/* Home-specific styles */

/* ---------- Hero strip ---------- */
.hero-strip {
  padding: 56px 0 64px;
}
.hero-strip__inner {
  display: grid;
  grid-template-columns: minmax(0,1fr) 360px;
  column-gap: 80px;
  row-gap: 44px;
  align-items: start;
}
.hero-strip__masthead {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--rule);
}
.hero-strip__masthead .label { white-space: nowrap; }
.hero-strip__left {
  display: flex;
  flex-direction: column;
  gap: 22px;
  align-self: stretch;
}
.hero-strip__note {
  margin-top: auto;
  padding-top: 22px;
  border-top: 1px solid var(--rule-soft);
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-width: 46ch;
}
.hero-strip__note p {
  margin: 0;
  font-family: var(--t-serif);
  font-size: 18px;
  line-height: 1.5;
  color: var(--muted);
}
.hero-strip__note em { font-style: italic; color: var(--ink-soft); }
.hero-strip__left .display {
  max-width: 22ch;
  font-size: clamp(44px, 4.7vw, 74px);
  line-height: 1.02;
}
.hero-strip__left .lede {
  max-width: 60ch;
}
.hero-strip__cta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.hero-strip__right {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.hero-pick {
  display: flex;
  flex-direction: column;
  gap: 14px;
  color: inherit;
}
.hero-pick__cover {
  max-width: 360px;
  aspect-ratio: 5 / 7;
}
.hero-pick__meta {
  max-width: 360px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.hero-pick__title {
  font-family: var(--t-serif);
  font-size: 22px;
  font-weight: 500;
}

/* ---------- Layout switching ---------- */
.home-layout { display: none; padding: 80px 0; }
body[data-home-layout="shelf"]     .home-layout--shelf,
body[data-home-layout="letter"]    .home-layout--letter,
body[data-home-layout="inventory"] .home-layout--inventory { display: block; }
body:not([data-home-layout])       .home-layout--shelf { display: block; }

/* ---------- Shelf layout ---------- */
.shelf-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 40px 36px;
}

/* Grouped shelves (children's / grown readers) */
.shelf-group + .shelf-group { margin-top: 64px; }
.shelf-group__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 14px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--rule-soft);
}
.shelf-group__label {
  font-family: var(--t-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
  font-weight: 500;
  white-space: nowrap;
}
.shelf-group__sub {
  font-family: var(--t-serif);
  font-style: italic;
  font-size: 15px;
  color: var(--muted);
}
.shelf-group__sub em { color: var(--ink); font-style: italic; }
.shelf-grid--2up .shelf-aside {
  grid-column: span 2;
  align-self: end;
  padding: 0 8px 28px 16px;
  border-left: 1px solid var(--rule-soft);
  max-width: 42ch;
  display: flex;
  flex-direction: column;
  gap: 14px;
  color: var(--ink-soft);
}
.shelf-grid--2up .shelf-aside p {
  font-family: var(--t-serif);
  font-size: 17px;
  line-height: 1.55;
  margin: 0;
  text-wrap: pretty;
}
.shelf-grid--2up .shelf-aside .nav-link {
  font-family: var(--t-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  align-self: flex-start;
}

/* Flex shelf, covers share a fixed height; widths derived from aspect ratio.
   Use this when a row mixes 5:7 covers with non-rectangle covers (e.g. 1:1)
   and we want every cover to top-and-bottom align. */
.shelf-grid--flex {
  --cover-h: clamp(320px, 28vw, 440px);
  display: flex;
  flex-wrap: wrap;
  gap: 44px 40px;
  align-items: flex-start;
  justify-content: flex-start;
}
.shelf-grid--flex > .book {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  /* 5:7 covers, width derived from cover height */
  width: calc(var(--cover-h) * 5 / 7);
}
.shelf-grid--flex > .book:has(.cv-miantiao) {
  /* 1:1 square cover, width equals cover height */
  width: var(--cover-h);
}
.shelf-grid--flex > .book:has(.book__cover--image) {
  /* 2:3 jacket cover, width derived from cover height */
  width: calc(var(--cover-h) * 2 / 3);
}
.shelf-grid--flex > .book > .book__cover {
  height: var(--cover-h);
  width: 100%;
  aspect-ratio: auto;
  padding: 22px 18px;
}
.shelf-grid--flex > .book > .book__cover.cv-miantiao {
  aspect-ratio: auto !important;
}
.shelf-grid--flex .shelf-group__link {
  align-self: flex-end;
  margin-left: auto;
  font-family: var(--t-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding-bottom: 28px;
}
/* Home shelf, uniform 4-up rows; every cover shares one aspect so the row reads even */
.shelf-row {
  --shelf-gap: 40px;
  display: flex;
  flex-wrap: wrap;
  gap: 46px var(--shelf-gap);
  align-items: flex-start;
}
.shelf-row > .book {
  width: calc((100% - 3 * var(--shelf-gap)) / 4);
}
.shelf-row--center { justify-content: center; }
.shelf-row > .book > .book__cover {
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 3 !important;
  padding: 0;
}
.shelf-row > .book > .book__cover.cv-miantiao { aspect-ratio: 1 / 1 !important; }
/* 面条 is a square cover, widen its card so the square matches the height of the 2:3 covers beside it */
.shelf-row--center > .book:has(.cv-miantiao) { width: calc(1.5 * (100% - 3 * var(--shelf-gap)) / 4); }
.shelf-row .book__cover--image > img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 900px) {
  .shelf-row > .book { width: calc((100% - var(--shelf-gap)) / 2); }
}
@media (max-width: 560px) {
  .shelf-row > .book { width: 100%; }
}
.shelf-bottom {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 16px;
  margin-top: 64px;
  padding-top: 18px;
  border-top: 1px solid var(--rule-soft);
}

/* ---------- Letter layout ---------- */
.letter__head { margin-bottom: 36px; }
.letter__body {
  font-size: 19px;
  line-height: 1.62;
  color: var(--ink-soft);
  text-wrap: pretty;
}
.letter__body p { margin-bottom: 1.2em; }
.letter__featured {
  margin-top: 56px;
  padding-top: 40px;
  border-top: 1px solid var(--rule);
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 40px;
  align-items: end;
}
.letter__featured-side {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-bottom: 18px;
}
.letter__featured .book__cover { max-width: 280px; }

/* ---------- Inventory layout ---------- */
.inventory-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 36px 28px;
}
.book--sm .book__cover { aspect-ratio: 5 / 7; padding: 16px 14px; }
.book--sm .book__cover .ttl { font-size: 18px; }
.book--sm .book__cover .imp { font-size: 8.5px; }

/* ---------- Imprints strip ---------- */
.imprints-strip {
  padding: 96px 0 48px;
  border-top: 2px solid var(--rule);
}
.imprints-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border: 1px solid var(--rule);
}
.imp-card {
  padding: 36px 28px 32px;
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 150px;
  position: relative;
  transition: background .2s;
}
.imp-card:last-child { border-right: 0; }

/* Uniform card background, tints removed */
.imp-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: currentColor;
  opacity: 0;
  transition: opacity .25s;
  pointer-events: none;
}
.imp-card--particle  { --imp-tone: var(--imp-particle); }
.imp-card--lake      { --imp-tone: var(--imp-lake); }
.imp-card--sapientia { --imp-tone: var(--imp-sapientia); }
.imp-card--velvet    { --imp-tone: var(--imp-velvet); }
.imp-card:hover::after { opacity: 0.06; color: var(--imp-tone); }
.imp-card:hover .imp-card__name { color: var(--imp-tone); }
.imp-card__arrow {
  position: absolute;
  bottom: 32px;
  right: 28px;
  font-size: 18px;
  color: var(--imp-tone);
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity .25s, transform .25s;
}
.imp-card:hover .imp-card__arrow { opacity: 1; transform: translateX(0); }
.imp-card > * { position: relative; z-index: 1; }
.imp-card__chip {
  font-family: var(--t-serif);
  font-size: 56px;
  font-weight: 700;
  line-height: 1;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 2px solid currentColor;
  padding-bottom: 6px;
  align-self: flex-start;
}
.imp-card__name {
  font-family: var(--t-serif);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.1;
  margin-top: auto;
  transition: color .2s;
}
.imp-card__sub {
  font-family: var(--t-serif);
  font-style: italic;
  font-size: 15px;
  color: var(--muted);
  padding-right: 28px;
}
.imp-card__count {
  font-family: var(--t-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  position: absolute;
  top: 28px;
  right: 28px;
}
.imp-card--particle .imp-card__chip { color: var(--imp-particle); }
.imp-card--lake .imp-card__chip { color: var(--imp-lake); font-size: 28px; font-weight: 600; }
.imp-card--sapientia .imp-card__chip { color: var(--imp-sapientia); }
.imp-card--velvet .imp-card__chip { color: var(--imp-velvet); }

/* ---------- Voice strip ---------- */
.voice-strip {
  padding: 96px 0 32px;
}
.voice-strip__inner {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 64px;
  padding: 56px;
  border: 1px solid var(--rule);
  background: var(--paper-deep);
  align-items: center;
}
.newsletter {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.newsletter input {
  font-family: var(--t-serif);
  font-size: 16px;
  padding: 14px 16px;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  outline: none;
  transition: border-color .15s;
}
.newsletter input:focus { border-color: var(--primary); }
.newsletter button { align-self: flex-start; }

.author-services {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.srv-card {
  border: 1px solid var(--rule-soft);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--paper);
  transition: background .15s, transform .15s;
}
.srv-card:hover { background: var(--paper); transform: translateY(-2px); border-color: var(--primary); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .hero-strip__inner { grid-template-columns: 1fr; gap: 56px; }
  .shelf-grid { grid-template-columns: repeat(3, 1fr); }
  .shelf-grid--2up .shelf-aside { grid-column: span 1; }
  .inventory-grid { grid-template-columns: repeat(4, 1fr); }
  .imprints-grid { grid-template-columns: 1fr 1fr; }
  .imp-card:nth-child(2) { border-right: 0; }
  .imp-card:nth-child(1), .imp-card:nth-child(2) { border-bottom: 1px solid var(--rule); }
  .voice-strip__inner { grid-template-columns: 1fr; padding: 36px; }
}
@media (max-width: 780px) {
  .shelf-grid { grid-template-columns: 1fr 1fr; }
  .shelf-grid--2up .shelf-aside { grid-column: span 2; border-left: 0; border-top: 1px solid var(--rule-soft); padding: 18px 0 0; max-width: none; }
  .inventory-grid { grid-template-columns: 1fr 1fr; }
  .letter__featured { grid-template-columns: 1fr; }
  .imprints-grid { grid-template-columns: 1fr; }
  .imp-card { border-right: 0; border-bottom: 1px solid var(--rule); }
  .imp-card:last-child { border-bottom: 0; }
  .author-services { grid-template-columns: 1fr; }
}
