/* ============================================================
   DINO Mail — static pages (about / privacy / terms / 404)
   Reuses every token in style.css; this file only adds the
   long-form document layout and the 404 composition.
   视觉语言与落地页一致：暖色邮政——点阵纸纹、色块眉标、
   盖章式提示卡、相纸图框、航空信封条纹。
   ============================================================ */

/* ---------- bilingual switch ----------
   page.js runs synchronously in <head> and sets <html lang>,
   so the correct language is painted on the very first frame —
   no English flash for Chinese readers. CSS does the rest. */
html[lang="zh-CN"] [data-l="en"] { display: none; }
html:not([lang="zh-CN"]) [data-l="zh"] { display: none; }

/* ---------- shell ---------- */
.doc-main { padding-top: 74px; }
/* 航空信封条纹压在页首 —— 全站统一的「信」符号 */
.doc-main::before {
  content: ""; display: block; height: 8px;
  background: repeating-linear-gradient(-45deg,
    #C8102E 0 16px, #F6F3EA 16px 32px, #012169 32px 48px, #F6F3EA 48px 64px);
}

.doc-hero { padding: clamp(38px, 5.5vw, 68px) 0 clamp(22px, 3vw, 34px); }

/* 眉标：与落地页 .eyebrow 同款（等宽字 + 方形色块） */
.doc-eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--mono); font-size: .72rem; font-weight: 600;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--ink-soft); margin-bottom: 14px;
}
.doc-eyebrow::before {
  content: ""; width: 9px; height: 9px;
  background: var(--accent); border-radius: 2px; flex: none;
}

.doc-title {
  font-size: clamp(2.05rem, 4.4vw, 3.15rem);
  line-height: 1.1; font-weight: 750; letter-spacing: -.015em;
  margin-bottom: 14px;
}
.doc-lede {
  font-size: clamp(1rem, 1.5vw, 1.12rem);
  color: var(--ink-soft); max-width: 42em;
}
.doc-meta {
  display: flex; flex-wrap: wrap; margin-top: 18px;
  font-family: var(--mono); font-size: .78rem; color: var(--ink-soft);
}
.doc-meta > * + *::before { content: "·"; margin: 0 .55em; opacity: .45; }

/* ---------- two-column layout ---------- */
.doc-grid {
  display: grid; grid-template-columns: 15rem minmax(0, 1fr);
  gap: clamp(28px, 4vw, 60px);
  align-items: start;
  padding: clamp(30px, 4.5vw, 52px) 0 clamp(56px, 8vw, 92px);
  border-top: 1px solid var(--line);
}

/* ---------- table of contents — 邮政卡片 ---------- */
.doc-toc {
  position: sticky; top: 88px;
  background: var(--card);
  border: 1.5px solid rgba(34, 52, 59, .16);
  border-radius: var(--radius); padding: 18px 14px;
  box-shadow: var(--shadow-card);
}
.doc-toc h2 {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--mono);
  font-size: .7rem; font-weight: 600; letter-spacing: .18em; text-transform: uppercase;
  color: var(--ink-soft); padding: 0 8px; margin-bottom: 10px;
}
.doc-toc h2::before {
  content: ""; width: 8px; height: 8px;
  background: var(--accent); border-radius: 2px; flex: none;
}
.doc-toc ol { list-style: none; counter-reset: toc; }
.doc-toc li { counter-increment: toc; }
.doc-toc a {
  display: flex; gap: 8px; padding: 6px 8px; border-radius: 8px;
  font-size: .875rem; line-height: 1.4; color: var(--ink-soft);
  border-left: 2px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.doc-toc a::before {
  content: counter(toc);
  flex: 0 0 auto; font-variant-numeric: tabular-nums;
  font-family: var(--mono); font-size: .78em; opacity: .5; padding-top: .18em;
}
.doc-toc a:hover { background: rgba(78, 148, 85, .08); color: var(--ink); }
.doc-toc a.active {
  background: rgba(78, 148, 85, .12); color: var(--accent-deep);
  font-weight: 650; border-left-color: var(--accent);
}

/* ---------- prose ---------- */
.doc-body { max-width: 46rem; }
.doc-body > * + * { margin-top: 1em; }

.doc-body h2 {
  font-size: clamp(1.2rem, 2vw, 1.42rem); font-weight: 720; letter-spacing: -.005em;
  margin-top: 2.4em; scroll-margin-top: 92px;
  /* 章节分隔：细线 + 色块记号，眉标系统的延伸 */
  border-top: 1px solid var(--line);
  padding-top: 1.6em; margin-left: -18px; padding-left: 18px;
  position: relative;
}
.doc-body > h2:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
.doc-body h2::before {
  content: ""; position: absolute; left: 0; top: calc(1.6em + .32em);
  width: 9px; height: 9px; background: var(--accent);
  border-radius: 2px; opacity: .85;
}
.doc-body > h2:first-child::before { top: .32em; }
.doc-body h3 { font-size: 1.02rem; font-weight: 700; margin-top: 1.7em; color: var(--ink); }

.doc-body p, .doc-body li { color: var(--ink-soft); font-size: 1rem; line-height: 1.75; }
.doc-body strong { color: var(--ink); font-weight: 650; }
.doc-body a {
  color: var(--accent-deep); text-decoration: underline;
  text-underline-offset: 2px; text-decoration-thickness: 1px;
}
.doc-body a:hover { color: var(--accent); }

.doc-body ul, .doc-body ol { padding-left: 1.3em; }
.doc-body ul { list-style: none; padding-left: 1.15em; }
.doc-body ul li { position: relative; }
.doc-body ul li::before {
  content: ""; position: absolute; left: -1.05em; top: .72em;
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent); opacity: .55;
}
.doc-body li + li { margin-top: .45em; }

/* callout — 盖章式提示卡：外实线内虚线（邮票齿孔） */
.doc-note {
  position: relative;
  border: 1.5px solid rgba(34, 52, 59, .18);
  background: rgba(78, 148, 85, .06);
  border-radius: 14px;
  padding: 15px 19px;
}
.doc-note::after {
  content: ""; position: absolute; inset: 4px;
  border: 1.5px dashed rgba(78, 148, 85, .3);
  border-radius: 10px; pointer-events: none;
}
.doc-note p { margin: 0; font-size: .95rem; position: relative; z-index: 1; }
.doc-note p + p { margin-top: .6em; }

/* definition-ish rows for the "what we store" table */
.doc-rows {
  border: 1.5px solid rgba(34, 52, 59, .16); border-radius: 14px;
  overflow: hidden; background: var(--card);
  box-shadow: var(--shadow-card);
}
.doc-rows > div { display: flex; gap: 16px; padding: 12px 18px; border-top: 1px solid var(--line); }
.doc-rows > div:first-child { border-top: 0; }
.doc-rows dt { flex: 0 0 9rem; font-weight: 650; color: var(--ink); font-size: .93rem; }
.doc-rows dd { color: var(--ink-soft); font-size: .93rem; line-height: 1.6; }

/* ---------- prev / next ---------- */
.doc-next {
  margin-top: 3em; padding-top: 1.5em; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 12px;
}
.doc-next a {
  display: flex; flex-direction: column; gap: 2px;
  border: 1.5px solid rgba(34, 52, 59, .16); border-radius: 12px;
  padding: 10px 18px; background: var(--card);
  font-size: .95rem; font-weight: 650; color: var(--ink);
  box-shadow: var(--shadow-card);
  transition: border-color .2s, transform .2s, box-shadow .2s;
}
.doc-next a:hover { border-color: rgba(78, 148, 85, .4); transform: translateY(-2px); box-shadow: var(--shadow-card-hover); }
.doc-next .dn-k {
  font-family: var(--mono);
  font-size: .7rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft);
}
.doc-next .dn-t { font-size: .95rem; font-weight: 650; color: var(--ink); }

/* inline code — the cookie and key names */
.doc-body code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: .88em; color: var(--ink);
  background: rgba(34, 52, 59, .07);
  border-radius: 5px; padding: .12em .4em;
}

/* ---------- about ---------- */
.about-hero {
  display: grid; grid-template-columns: 1.08fr .92fr;
  gap: clamp(28px, 4vw, 56px); align-items: center;
  padding: clamp(24px, 4vw, 44px) 0 clamp(30px, 5vw, 56px);
}
/* 相纸白框 + 微歪斜 —— 与落地页 spirit-fig 同款 */
.about-fig { padding: 4px 12px 16px 4px; }
.about-fig img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  background: #fff; padding: 9px;
  border: 1px solid var(--line);
  box-shadow: 0 28px 56px -24px rgba(34, 52, 59, .45);
  transform: rotate(1.4deg);
  transition: transform .3s;
}
.about-fig img:hover { transform: rotate(0deg); }

.about-section { padding: clamp(40px, 6vw, 72px) 0; border-top: 1px solid var(--line); }
.about-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 26px; }
.about-cell {
  position: relative;
  background: var(--card);
  border: 1.5px solid rgba(34, 52, 59, .16);
  border-radius: 14px; padding: 20px 22px;
  box-shadow: var(--shadow-card);
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.about-cell:hover { transform: translateY(-3px); border-color: rgba(78, 148, 85, .4); box-shadow: var(--shadow-card-hover); }
.about-cell h3 { font-size: 1rem; font-weight: 700; margin-bottom: 6px; }
.about-cell p { font-size: .93rem; color: var(--ink-soft); }
.about-cell a { color: var(--accent-deep); text-decoration: underline; text-underline-offset: 2px; }

/* D.I. / F.S. — the letterforms are the visual */
.abbr {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.75rem; font-weight: 800; line-height: 1;
  letter-spacing: -.02em; color: var(--accent-deep); margin-bottom: 10px;
}

.about-stack {
  border: 1.5px solid rgba(34, 52, 59, .16); border-radius: var(--radius);
  overflow: hidden; background: var(--card); margin-top: 22px;
  box-shadow: var(--shadow-card);
}
.about-stack > div { display: flex; gap: 16px; padding: 12px 20px; border-top: 1px solid var(--line); font-size: .92rem; }
.about-stack > div:first-child { border-top: 0; }
.about-stack dt { flex: 0 0 9rem; font-weight: 650; color: var(--ink); }
.about-stack dd { color: var(--ink-soft); }

/* ---------- 404 ---------- */
.nf-main {
  min-height: 100svh; display: grid; place-items: center;
  padding: 108px 20px 64px; text-align: center;
}
.nf-inner { max-width: 36rem; }
.nf-code {
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(4.2rem, 13vw, 7.5rem); line-height: .88; font-weight: 800;
  letter-spacing: -.045em; color: var(--accent-deep);
}
.nf-title { font-size: clamp(1.35rem, 3vw, 1.95rem); font-weight: 750; margin: 20px 0 10px; }
.nf-sub { color: var(--ink-soft); max-width: 28em; margin: 0 auto; }
.nf-fig {
  width: min(280px, 62vw); margin: 32px auto 0;
  padding: 4px 12px 16px 4px;
}
/* 相纸白框 + 微歪斜，与 spirit-fig / about-fig 同款 */
.nf-fig img {
  width: 100%; aspect-ratio: 1 / 1; object-fit: cover;
  background: #fff; padding: 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 26px 52px -24px rgba(34, 52, 59, .45);
  transform: rotate(-2deg);
}
.nf-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 30px; }
.nf-links {
  display: flex; flex-wrap: wrap; gap: 18px; justify-content: center;
  margin-top: 26px; font-size: .88rem;
}
.nf-links a { color: var(--ink-soft); border-bottom: 1px solid transparent; padding-bottom: 1px; }
.nf-links a:hover { color: var(--accent-deep); border-bottom-color: var(--accent); }

/* on short screens the illustration would push the buttons off-screen */
@media (max-height: 720px) {
  .nf-fig { display: none; }
  .nf-main { padding-top: 84px; }
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .doc-grid { grid-template-columns: 1fr; gap: 22px; }
  .doc-toc { position: static; }
  .doc-toc ol { columns: 2; column-gap: 10px; }
  .doc-toc a { font-size: .83rem; padding: 5px 6px; }
  .about-hero { grid-template-columns: 1fr; }
  .about-fig { order: -1; }
  .about-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .doc-rows > div, .about-stack > div { flex-direction: column; gap: 2px; }
  .doc-rows dt, .about-stack dt { flex: none; }
  /* keep two columns — one column pushes the article a full screen down */
  .doc-toc { padding: 14px 12px; }
  .doc-toc a { font-size: .8rem; padding: 5px 5px; gap: 6px; }
  /* stacked meta lines would each start with a stray middot */
  .doc-meta { flex-direction: column; gap: 2px; }
  .doc-meta > * + *::before { content: none; }
  /* 色块记号在小屏上会顶到文字，留出的负外边距也一并收回 */
  .doc-body h2 { margin-left: 0; padding-left: 0; }
  .doc-body h2::before { position: static; display: block; margin-bottom: 8px; }
  .doc-body > h2:first-child::before { top: auto; }
}

/* ---------- print ---------- */
@media print {
  .topbar, .doc-toc, .doc-next, .footer, .nf-actions { display: none !important; }
  body { background: #fff; }
  .doc-main { padding-top: 0; }
  .doc-main::before { display: none; }
  .doc-grid { display: block; padding: 0; border-top: 0; }
  .doc-body { max-width: none; }
  .doc-body a { color: inherit; text-decoration: none; }
  .doc-body h2 { page-break-after: avoid; }
}
