/* DailyHSK web: the cover of a thread-bound Chinese book (秘籍) in the app's green. Thin
   stitching on the left edge, the owner's white title label (assets/label.png) on the right,
   the content in the middle. Shared by every page. */

:root {
  --cover: #246448;          /* DhTokens.primary */
  --cover-light: #329666;    /* DhTokens.taskActive */
  --cover-deep: #1b4d37;
  --on-cover: #f3efe2;
  --on-cover-soft: #cfe3d6;
  --accent: #f2a54a;         /* the app's orange, lightened to read on green */
  --label: #fbfaf5;
  --ink: #1f1a14;
  --ink-soft: #4d463c;
  --seal: #b3261e;
  --thread: rgba(235, 240, 232, 0.55);
  --page-bg: #f1efe9;
  --paper: #f7f2e4;
  --body-font: "Noto Serif", "Times New Roman", serif;
  --title-font: "Playfair Display", "Noto Serif", serif;
  --brush-font: "Ma Shan Zheng", "STKaiti", "KaiTi", serif;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  padding: 40px 16px;
  background: var(--page-bg);
  color: var(--on-cover);
  font-family: var(--body-font);
  font-size: 18px;
  line-height: 1.75;
}

/* The cover: cloth-like grain over the app green, a soft shadow, square corners. */
.book {
  position: relative;
  max-width: 1000px;
  margin: 0 auto;
  padding: 56px 48px 32px 96px;
  background-color: var(--cover);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(160deg, var(--cover-light) 0%, var(--cover) 45%, var(--cover-deep) 100%);
  box-shadow: 0 20px 45px rgba(20, 45, 32, 0.28), 0 3px 8px rgba(20, 45, 32, 0.25);
}

/* The binding: one thread along the spine, stitches from it over the edge. */
.spine {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 30px;
  border-right: 2px solid var(--thread);
  background: repeating-linear-gradient(180deg,
    transparent 0 150px,
    var(--thread) 150px 152px,
    transparent 152px 300px);
  background-position: 0 -40px;
  box-shadow: 1px 0 0 rgba(0, 0, 0, 0.12);
}

.spine::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 8px;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.18), transparent);
}

/* Middle content on the left, the label on the right. */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "head side" "main side";
  column-gap: 48px;
  align-items: start;
}

.masthead { grid-area: head; }
.labels { grid-area: side; grid-row: 1 / span 2; }
.content { grid-area: main; min-width: 0; }

.labels {
  position: sticky;
  top: 32px;
  display: flex;
}

/* The owner's white title label: both lines in brush script, the 学 logo at the foot. */
.label-img {
  display: block;
  width: 125px;
  height: auto;
  box-shadow: 0 3px 10px rgba(10, 30, 20, 0.3);
}

/* Header, as the owner's banner: the icon in a cream frame, the name in heavy serif and
   the tagline in italic under it, about as wide as the name. */
.masthead { margin-bottom: 36px; }

.masthead-center { display: flex; justify-content: center; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 22px;
  color: var(--on-cover);
  text-decoration: none;
}

.brand img {
  flex: none;
  width: 104px;
  height: 104px;
  border: 4px solid #ece6cf;
  border-radius: 24px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-family: var(--title-font);
  font-weight: 900;
  font-size: 72px;
  line-height: 0.95;
  letter-spacing: 0.005em;
  color: #f6eed5;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.tagline {
  margin-top: 6px;
  font-family: var(--title-font);
  font-style: italic;
  font-weight: 500;
  font-size: 25px;
  line-height: 1.2;
  color: #f6eed5;
  white-space: nowrap;
}

/* Body text. */
.scroll { max-width: 600px; }

.scroll p { margin: 0 0 0.9em; }

.lead { font-size: 20px; }

.turn {
  margin: 1.3em 0 1.1em;
  font-family: var(--title-font);
  font-weight: 700;
  font-size: 27px;
  color: var(--accent);
}

.cases {
  list-style: none;
  margin: 0 0 1.4em;
  padding: 0;
}

.cases li {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 14px;
  align-items: start;
  margin-bottom: 1em;
}

.num {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-top: 2px;
  border: 1.5px solid var(--on-cover);
  border-radius: 50%;
  color: var(--on-cover);
  font-family: var(--brush-font);
  font-size: 23px;
  line-height: 1;
}

.found {
  margin: 1.6em 0 0;
  padding: 18px 0;
  border-top: 1px solid rgba(243, 239, 226, 0.4);
  border-bottom: 1px solid rgba(243, 239, 226, 0.4);
}

.found strong {
  display: block;
  margin-top: 6px;
  font-family: var(--title-font);
  font-size: 36px;
  line-height: 1.25;
  color: var(--accent);
}

/* Links: the YouTube guide, then one door for each of the four groups. */
.paths {
  max-width: 600px;
  margin-top: 36px;
}

.button {
  display: inline-block;
  padding: 6px;
  background: var(--label);
  color: var(--ink);
  font-family: var(--title-font);
  font-weight: 700;
  font-size: 20px;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(10, 30, 20, 0.25);
}

.button span {
  display: block;
  padding: 10px 22px;
  border: 1px solid var(--ink);
  outline: 1px solid var(--ink);
  outline-offset: -4px;
}

.button:hover, .button:focus-visible { color: var(--seal); }

.doors-title {
  margin: 36px 0 14px;
  font-family: var(--title-font);
  font-size: 23px;
}

.doors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.doors a {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 12px;
  align-items: center;
  height: 100%;
  padding: 14px 16px;
  background: var(--label);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
  text-decoration: none;
  box-shadow: inset 0 0 0 4px var(--label), inset 0 0 0 5px var(--ink), 0 2px 6px rgba(10, 30, 20, 0.25);
}

.doors a:hover, .doors a:focus-visible { color: var(--seal); }

.doors .num {
  width: 36px;
  height: 36px;
  margin: 0;
  border-color: var(--seal);
  color: var(--seal);
  font-size: 20px;
}

/* Download the app. */
.download {
  clear: both;
  margin-top: 48px;
  text-align: center;
}

.download h2 {
  margin: 0 0 14px;
  font-family: var(--title-font);
  font-size: 23px;
}

.stores {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}

.store {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 210px;
  padding: 10px 20px;
  background: #111;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 10px;
  text-align: left;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(10, 30, 20, 0.3);
}

.store svg { flex: none; width: 26px; height: 26px; fill: currentColor; }

.store small { display: block; font-size: 12px; line-height: 1.2; opacity: 0.85; }

.store b { display: block; font-family: var(--title-font); font-size: 20px; line-height: 1.2; }

.store:hover, .store:focus-visible { background: #000; border-color: var(--accent); }

/* Footer. */
.colophon {
  margin-top: 56px;
  padding-top: 18px;
  border-top: 1px solid rgba(243, 239, 226, 0.35);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 24px;
  font-size: 15px;
  color: var(--on-cover-soft);
}

.colophon a { color: inherit; }

a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* The privacy page: an inner page of paper laid on the cover. */
.doc {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 44px;
  background: var(--paper);
  color: var(--ink);
  font-size: 17px;
  box-shadow: 0 2px 8px rgba(10, 30, 20, 0.3);
}

.doc h1 {
  margin: 0 0 4px;
  text-align: center;
  font-family: var(--title-font);
  font-size: 36px;
  line-height: 1.2;
}

.doc .updated {
  margin: 0 0 28px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 15px;
}

.doc h2 {
  margin: 32px 0 8px;
  font-family: var(--title-font);
  font-size: 22px;
  color: var(--cover);
}

.doc a { color: var(--cover); }

.doc ul { padding-left: 22px; }

.doc li { margin-bottom: 6px; }

.back { text-align: center; margin-top: 36px; }

/* The four group pages: the group's numeral, then the two rules in a framed box. */
.doc-num {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 10px;
  border: 2px solid var(--seal);
  border-radius: 50%;
  color: var(--seal);
  font-family: var(--brush-font);
  font-size: 30px;
  line-height: 1;
}

.mantra {
  margin: 4px 0 24px;
  padding: 18px 22px 6px;
  background: #fffdf6;
  box-shadow: inset 0 0 0 1px var(--ink), inset 0 0 0 4px #fffdf6, inset 0 0 0 5px var(--ink);
}

.mantra-title {
  margin: 0 0 6px;
  font-family: var(--title-font);
  font-weight: 700;
  font-size: 20px;
  color: var(--seal);
}

.mantra-title span { font-family: var(--brush-font); font-weight: 400; margin-right: 6px; }

.mantra ol { margin: 0 0 12px; padding-left: 22px; }

/* Tablets and phones: the label moves above the content, at the right. */
@media (max-width: 820px) {
  /* The text flows past the label on its left, then under it. */
  .layout { display: block; }
  .masthead { margin-bottom: 24px; }
  .labels { position: static; float: right; margin: 0 0 12px 16px; }
  .content::after { content: ""; display: block; clear: both; }
}

@media (max-width: 720px) {
  body { padding: 0; font-size: 17px; }
  .book { padding: 28px 20px 24px 52px; box-shadow: none; }
  .spine { width: 20px; }
  .brand { gap: 12px; }
  .brand img { width: 62px; height: 62px; border-width: 3px; border-radius: 15px; }
  .brand-name { font-size: 42px; }
  .tagline { font-size: 14.5px; margin-top: 4px; }
  .masthead { margin-bottom: 20px; }
  .label-img { width: 86px; }
  .lead { font-size: 18px; }
  .turn { font-size: 23px; }
  .found strong { font-size: 29px; }
  .doors { grid-template-columns: 1fr; }
  .doc { padding: 28px 20px; }
  .doc h1 { font-size: 28px; }
}

/* The daily workflow on the four group pages: numbered steps in the seal colour. */
.steps { padding-left: 0; list-style: none; counter-reset: step; }

.steps li {
  position: relative;
  margin-bottom: 10px;
  padding-left: 40px;
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  top: 2px;
  left: 0;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--cover);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

/* The folded workflow on the group pages: a link-like line that opens in place. */
.expand {
  margin: 24px 0 8px;
  border-top: 1px solid rgba(31, 26, 20, 0.2);
  border-bottom: 1px solid rgba(31, 26, 20, 0.2);
}

.expand summary {
  padding: 12px 0;
  cursor: pointer;
  list-style: none;
  font-family: var(--title-font);
  font-weight: 700;
  font-size: 20px;
  color: var(--cover);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}

.expand summary::-webkit-details-marker { display: none; }

.expand summary::after {
  content: "▾";
  display: inline-block;
  margin-left: 8px;
  text-decoration: none;
  transition: transform 0.2s;
}

.expand[open] summary::after { transform: rotate(180deg); }

.expand summary:focus-visible { outline: 2px solid var(--cover); outline-offset: 3px; }

.expand-body { padding: 4px 0 8px; }
