:root {
  color-scheme: dark;
  --night: #110f20;
  --indigo: #19172d;
  --plum: #3b223e;
  --wine: #682c3d;
  --wine-dark: #3f1d2a;
  --paper: #f1e2c4;
  --paper-deep: #e4cfa6;
  --paper-ink: #2e241d;
  --gold: #d3ad62;
  --gold-dark: #9c7134;
  --cream: #f8edcf;
  --muted: #c9bda6;
  --line-dark: rgba(56, 38, 26, 0.24);
  --line-light: rgba(241, 226, 196, 0.2);
  --focus: #ffd98d;
  --shadow: 0 24px 70px rgba(4, 3, 10, 0.48);
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--night);
  color: var(--cream);
  font-family: Inter, system-ui, sans-serif;
}

body, button, textarea { font: inherit; }
button, a, textarea { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

button:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

[hidden] { display: none !important; }

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  background: var(--paper);
  color: var(--paper-ink);
  transform: translateY(-160%);
}

.skip-link:focus { transform: translateY(0); }

.site-header {
  position: absolute;
  z-index: 10;
  top: 0;
  left: 50%;
  width: min(1320px, calc(100% - 48px));
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  border-bottom: 1px solid rgba(211, 173, 98, 0.42);
  transform: translateX(-50%);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--cream);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 30px;
  font-weight: 700;
  text-decoration: none;
}

.brand-symbol {
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  border: 1px solid var(--gold);
  color: var(--gold);
  font-size: 30px;
  line-height: 1;
  transform: rotate(-8deg);
}

.brand-symbol span { transform: rotate(8deg); }

.main-nav {
  display: flex;
  align-items: center;
  gap: 28px;
}

.main-nav a {
  color: var(--cream);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 18px;
  font-weight: 600;
  text-decoration: none;
}

.main-nav a:hover { color: var(--gold); }

.main-nav .workshop-link {
  padding: 9px 12px;
  border: 1px solid rgba(211, 173, 98, 0.55);
}

.hero {
  position: relative;
  min-height: 940px;
  overflow: hidden;
  background-color: #171225;
  background-image: url("./assets/night-library-background.png");
  background-position: center;
  background-size: cover;
}

.hero-shade {
  position: absolute;
  inset: 0;
  background: rgba(10, 8, 19, 0.54);
}

.hero-layout {
  position: relative;
  z-index: 1;
  width: min(1320px, calc(100% - 48px));
  min-height: 940px;
  margin: 0 auto;
  padding: 128px 0 68px;
  display: grid;
  grid-template-columns: minmax(280px, 0.72fr) minmax(620px, 1.28fr);
  gap: 48px;
  align-items: center;
}

.hero-copy {
  max-width: 540px;
  padding: 24px 0;
  text-shadow: 0 3px 18px rgba(0, 0, 0, 0.8);
}

.eyebrow,
.section-label {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.eyebrow.dark { color: var(--wine); }

h1, h2, h3, p { overflow-wrap: anywhere; }

h1, h2, h3 {
  font-family: "Cormorant Garamond", Georgia, serif;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  color: var(--cream);
  font-size: clamp(64px, 7vw, 108px);
  line-height: 0.85;
}

h2 {
  margin: 0;
  font-size: 42px;
  line-height: 1;
}

.tagline {
  max-width: 460px;
  margin: 26px 0 0;
  color: var(--cream);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 34px;
  line-height: 1.14;
}

.hero-note {
  max-width: 480px;
  margin: 18px 0 28px;
  color: #e0d6c0;
  font-size: 16px;
  line-height: 1.65;
}

.primary-button,
.send-button,
.text-button,
.choice-grid button,
.surprise-row button,
.choice-button {
  min-height: 46px;
  border-radius: 6px;
  cursor: pointer;
}

.primary-button,
.send-button {
  border: 1px solid #e1be72;
  background: var(--wine);
  box-shadow: inset 0 0 0 2px rgba(255, 223, 150, 0.12);
  color: var(--cream);
  font-weight: 700;
}

.primary-button { padding: 11px 22px; }
.primary-button:hover, .send-button:hover { background: #7c3549; }

.reader-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 2px solid var(--gold-dark);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow), inset 0 0 0 4px rgba(255, 247, 224, 0.36);
  color: var(--paper-ink);
}

.reader-card::after {
  content: "";
  position: absolute;
  inset: 9px;
  z-index: 0;
  border: 1px solid rgba(156, 113, 52, 0.32);
  pointer-events: none;
}

.catalog-heading,
.reader-workspace {
  position: relative;
  z-index: 1;
}

.catalog-heading {
  min-height: 275px;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  align-items: center;
  border-bottom: 7px solid #5b3522;
  background-color: #ead7b4;
}

.catalog-heading::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -29px;
  left: 0;
  height: 22px;
  border-top: 1px solid #9a6d3e;
  border-bottom: 1px solid #4a281b;
  background-color: #6a4128;
  box-shadow: inset 0 4px 0 rgba(255, 220, 159, 0.09);
}

.lainessa {
  align-self: end;
  width: 238px;
  height: auto;
  margin: 12px 0 -2px 18px;
  filter: drop-shadow(0 12px 12px rgba(66, 31, 38, 0.24));
}

.speech-area {
  min-width: 0;
  padding: 34px 34px 38px 8px;
}

.assistant-name {
  margin: 0 0 9px;
  color: var(--wine);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.assistant-name span {
  margin-left: 6px;
  color: #7d6b56;
  font-weight: 600;
}

.speech {
  position: relative;
  min-height: 118px;
  display: flex;
  align-items: center;
  padding: 24px 28px;
  border: 1px solid #b48a50;
  border-radius: 8px;
  background: #f7e9ca;
  color: #30231b;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 29px;
  font-weight: 600;
  line-height: 1.1;
}

.speech::before {
  content: "";
  position: absolute;
  top: 52px;
  left: -13px;
  width: 22px;
  height: 22px;
  border-bottom: 1px solid #b48a50;
  border-left: 1px solid #b48a50;
  background: #f7e9ca;
  transform: rotate(45deg);
}

.reader-workspace {
  min-height: 410px;
  padding: 42px 34px 30px;
}

.instant-request label,
.quick-pick .section-label,
.genre-pick .section-label,
.language-control .section-label {
  display: block;
  color: #66523d;
  font-size: 13px;
  font-weight: 700;
}

.request-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 9px;
}

textarea {
  width: 100%;
  min-height: 76px;
  resize: vertical;
  padding: 13px 14px;
  border: 1px solid #a98250;
  border-radius: 6px;
  background: #fff3d8;
  color: var(--paper-ink);
  line-height: 1.45;
}

textarea::placeholder { color: #85715a; }

.send-button {
  align-self: stretch;
  min-width: 106px;
  padding: 0 16px;
}

.field-error {
  min-height: 18px;
  margin: 6px 0 0;
  color: #8e293a;
  font-size: 12px;
  font-weight: 700;
}

.quick-pick,
.genre-pick { margin-top: 15px; }

.language-control { margin-bottom: 17px; }

.choice-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.choice-grid button,
.choice-button {
  border: 1px solid #ad8958;
  background: #f8ebcf;
  color: #443325;
  font-weight: 700;
}

.choice-grid button { padding: 9px 8px; }

.choice-grid button:hover,
.choice-button:hover,
.choice-button[aria-pressed="true"] {
  border-color: var(--wine);
  background: #ead0bd;
  color: #5f2435;
}

.surprise-row { margin-top: 13px; }

.surprise-row button {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--line-dark);
  background: #6f3043;
  color: #fffaf0;
  text-align: left;
}

.surprise-row button:hover { background: #7c3549; }
.surprise-row strong, .surprise-row span { display: block; }

.surprise-row span {
  margin-top: 2px;
  color: #ead7b4;
  font-size: 12px;
}

.language-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 7px;
  border: 1px solid var(--line-dark);
  border-radius: 6px;
  overflow: hidden;
}

.language-row button {
  min-width: 0;
  min-height: 40px;
  padding: 8px 10px;
  border: 0;
  border-right: 1px solid var(--line-dark);
  background: transparent;
  color: #493728;
  font-weight: 700;
}

.language-row button:last-child { border-right: 0; }

.language-row button:hover,
.language-row button[aria-pressed="true"] {
  background: #6f3043;
  color: #fffaf0;
}

.progress-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #796650;
  font-size: 12px;
  font-weight: 600;
}

.progress-track {
  height: 5px;
  margin: 8px 0 24px;
  overflow: hidden;
  background: #d9c29a;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--wine);
  transition: width 180ms ease;
}

.question-view h2,
.result-heading h2 {
  color: #39281e;
  font-size: 34px;
}

.question-help,
.result-heading p {
  margin: 8px 0 0;
  color: #6e5b46;
  font-size: 14px;
  line-height: 1.55;
}

.answer-area {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
}

.answer-area textarea {
  grid-column: 1 / -1;
  min-height: 118px;
}

.choice-button {
  width: 100%;
  padding: 10px 12px;
  text-align: left;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 14px;
}

.text-button {
  padding: 9px 14px;
  border: 1px solid #a98b62;
  background: transparent;
  color: #533d2b;
  font-weight: 700;
}

.text-button:hover { background: #ead7b4; }

.recommendation-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.recommendation-grid article {
  min-width: 0;
  min-height: 176px;
  padding: 15px;
  border: 1px solid #a98250;
  background: #f7e9ca;
}

.book-cover {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  margin-bottom: 12px;
  border: 1px solid rgba(77, 50, 32, 0.2);
  background: #ead7b4;
  object-fit: contain;
}

.recommendation-grid .result-status {
  grid-column: 1 / -1;
  min-height: 120px;
}

.book-role {
  display: block;
  margin-top: 2px;
  color: var(--wine);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.recommendation-grid .book-author {
  margin-bottom: 10px;
  color: #4c382b;
  font-weight: 700;
}

.recommendation-grid .book-reason {
  font-size: 13px;
}

.recommendation-grid .book-details {
  margin-top: 9px;
  font-style: italic;
}

.book-source {
  display: inline-block;
  margin-top: 11px;
  color: #7d2e40;
  font-size: 11px;
  font-weight: 800;
}

.book-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 12px;
}

.book-actions a {
  min-width: 0;
  padding: 7px 6px;
  border: 1px solid #a98250;
  border-radius: 5px;
  color: #5f2435;
  font-size: 10px;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

.book-actions a:hover {
  border-color: var(--wine);
  background: #ead0bd;
}

button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.book-mark {
  display: block;
  color: var(--wine);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 25px;
  font-weight: 700;
}

.recommendation-grid h3 {
  margin: 7px 0 5px;
  color: #3d2b20;
  font-size: 21px;
  line-height: 1;
}

.recommendation-grid p {
  margin: 0;
  color: #6e5b46;
  font-size: 12px;
  line-height: 1.45;
}

.verification {
  display: block;
  margin-top: 12px;
  color: #7d2e40;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.request-summary {
  display: grid;
  gap: 6px;
  margin: 17px 0;
}

.request-summary div {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 9px;
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(78, 54, 34, 0.16);
  font-size: 12px;
}

.request-summary dt { color: var(--wine); font-weight: 800; }
.request-summary dd { margin: 0; color: #66523d; }

.paper-band,
.about-band {
  background: var(--paper);
  color: var(--paper-ink);
}

.section-inner {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 72px 0;
}

.shelf-layout,
.coffee-layout,
.about-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(420px, 1.2fr);
  gap: 70px;
  align-items: center;
}

.section-copy p,
.coffee-layout > div > p,
.about-layout p {
  margin: 14px 0 0;
  line-height: 1.65;
}

.book-spines {
  min-height: 260px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 18px;
  border-bottom: 12px solid #70452c;
}

.spine {
  position: relative;
  width: 142px;
  height: 225px;
  display: grid;
  place-items: center;
  border: 2px solid #b88b44;
  box-shadow: 8px 8px 0 rgba(79, 44, 28, 0.2), inset 7px 0 0 rgba(255, 233, 175, 0.08);
}

.spine::before,
.spine::after {
  content: "";
  position: absolute;
  right: 10px;
  left: 10px;
  height: 1px;
  background: #cba55f;
}

.spine::before { top: 15px; }
.spine::after { bottom: 15px; }
.spine.plum { height: 215px; background: #3d254b; }
.spine.wine { height: 238px; background: #6b2e39; }
.spine.indigo { height: 205px; background: #222b46; }

.spine i {
  color: var(--gold);
  font-family: Georgia, serif;
  font-size: 48px;
  font-style: normal;
}

.coffee-band {
  background: var(--wine-dark);
  color: var(--cream);
  border-top: 1px solid rgba(211, 173, 98, 0.35);
  border-bottom: 1px solid rgba(211, 173, 98, 0.35);
}

.drink-list { border-top: 1px solid var(--line-light); }

.drink-list div {
  display: grid;
  grid-template-columns: 46px minmax(150px, 0.7fr) minmax(180px, 1fr);
  gap: 16px;
  align-items: center;
  min-height: 70px;
  border-bottom: 1px solid var(--line-light);
}

.drink-list span {
  color: var(--gold);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 24px;
}

.drink-list small { color: var(--muted); }
.about-layout h2 { max-width: 440px; }

.site-footer {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  color: var(--muted);
  font-size: 13px;
}

.site-footer a { color: var(--gold); }

@media (pointer: fine) {
  body, a, button, textarea {
    cursor: url("./assets/dragon-claw-cursor.png") 2 2, auto;
  }
}

@media (max-width: 1060px) {
  .hero { min-height: auto; }

  .hero-layout {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 30px;
    padding-top: 116px;
  }

  .hero-copy { max-width: 680px; }
  .reader-card { width: min(780px, 100%); }
}

@media (max-width: 760px) {
  .site-header { width: calc(100% - 28px); min-height: 66px; }
  .brand { font-size: 24px; }
  .brand-symbol { width: 36px; height: 36px; font-size: 25px; }
  .main-nav a:not(.workshop-link) { display: none; }
  .main-nav .workshop-link { padding: 8px 9px; font-size: 14px; }
  .hero { background-position: 52% center; }
  .hero-layout { width: calc(100% - 28px); padding: 92px 0 40px; }
  .hero-copy { padding: 18px 0 0; }
  h1 { font-size: 58px; }
  .tagline { max-width: 330px; margin-top: 15px; font-size: 28px; }
  .hero-note, .hero-copy > .primary-button { display: none; }

  .catalog-heading {
    min-height: 220px;
    grid-template-columns: 160px minmax(0, 1fr);
  }

  .lainessa { width: 166px; margin-left: 3px; }
  .speech-area { padding: 24px 16px 30px 2px; }
  .assistant-name span { display: block; margin: 2px 0 0; }
  .speech { min-height: 110px; padding: 17px; font-size: 23px; }
  .reader-workspace { padding: 38px 18px 22px; }

  .choice-grid,
  .answer-area,
  .recommendation-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .recommendation-grid article:last-child { grid-column: 1 / -1; }

  .shelf-layout,
  .coffee-layout,
  .about-layout {
    grid-template-columns: 1fr;
    gap: 35px;
  }

  .section-inner { width: calc(100% - 28px); padding: 54px 0; }
  .book-spines { min-height: 205px; gap: 10px; }
  .spine { width: min(30vw, 120px); height: 185px; }
  .spine.plum { height: 178px; }
  .spine.wine { height: 198px; }
  .spine.indigo { height: 170px; }

  .drink-list div {
    grid-template-columns: 36px 1fr;
    gap: 10px;
    padding: 12px 0;
  }

  .drink-list small { grid-column: 2; }
  .site-footer { width: calc(100% - 28px); }
}

@media (max-width: 470px) {
  .site-header { gap: 12px; }
  .main-nav .workshop-link { display: none; }
  .catalog-heading { min-height: 196px; grid-template-columns: 126px minmax(0, 1fr); }
  .lainessa { width: 136px; }
  .speech-area { padding-right: 12px; }
  .assistant-name { font-size: 10px; }
  .speech { min-height: 98px; padding: 13px; font-size: 20px; }
  .speech::before { top: 40px; left: -10px; width: 17px; height: 17px; }
  .request-row, .recommendation-grid { grid-template-columns: 1fr; }
  .mood-grid { grid-template-columns: 1fr 1fr; }
  .send-button { min-height: 46px; }
  .recommendation-grid article:last-child { grid-column: auto; }

  .form-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .form-actions .primary-button { grid-column: 1 / -1; }
  .request-summary div { grid-template-columns: 1fr; }

  .site-footer {
    min-height: 110px;
    flex-direction: column;
    justify-content: center;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
