:root {
  color-scheme: light dark;
  --paper: #f4f0e8;
  --paper-deep: #e8e0d2;
  --ink: #20231f;
  --muted: #696b63;
  --accent: #8c4f35;
  --accent-soft: #ead7ca;
  --olive: #66705a;
  --line: rgba(32, 35, 31, 0.16);
  --white: #fffdf8;
  --shadow: 0 24px 70px rgba(62, 49, 35, 0.11);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 0%, rgba(255,255,255,.9), transparent 36rem),
    var(--paper);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

.eyebrow {
  margin: 0 0 18px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: .19em;
}

.home-shell {
  width: min(1120px, calc(100% - 40px));
  min-height: 100svh;
  margin: 0 auto;
  padding: clamp(56px, 8vw, 112px) 0 32px;
  display: flex;
  flex-direction: column;
}

.home-hero { max-width: 810px; }

.brand-mark {
  position: relative;
  width: 68px;
  height: 60px;
  margin-bottom: 38px;
}

.hanger-line {
  position: absolute;
  top: 0;
  left: 29px;
  width: 18px;
  height: 24px;
  border: 3px solid var(--accent);
  border-bottom: 0;
  border-radius: 50% 50% 0 0;
  transform: rotate(38deg);
}

.hanger-body {
  position: absolute;
  left: 4px;
  bottom: 5px;
  width: 58px;
  height: 29px;
  border: 3px solid var(--ink);
  border-top: 0;
  transform: skewX(-12deg) rotate(-1deg);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.home-hero h1,
.article-header h1 {
  margin: 0;
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  font-weight: 640;
  letter-spacing: -.045em;
}

.home-hero h1 {
  max-width: 780px;
  font-size: clamp(42px, 7.2vw, 82px);
  line-height: 1.08;
}

.home-lead {
  max-width: 650px;
  margin: 28px 0 0;
  color: var(--muted);
  font-size: clamp(16px, 2vw, 19px);
  line-height: 1.9;
}

.document-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: clamp(58px, 9vw, 110px);
}

.document-card {
  min-height: 250px;
  padding: 26px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 24px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 2px 26px 2px 2px;
  background: rgba(255, 253, 248, .72);
  box-shadow: 0 0 0 rgba(0,0,0,0);
  text-decoration: none;
  transition: transform .28s ease, box-shadow .28s ease, background .28s ease;
}

.document-card:hover,
.document-card:focus-visible {
  transform: translateY(-5px);
  background: var(--white);
  box-shadow: var(--shadow);
  outline: none;
}

.terms-card { background: rgba(102, 112, 90, .09); }
.card-index { color: var(--accent); font: 700 13px/1 ui-monospace, monospace; }
.card-copy { align-self: end; display: flex; flex-direction: column; }
.card-kicker { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.card-copy strong { font-family: "Songti SC", "STSong", serif; font-size: clamp(27px, 4vw, 39px); }
.card-copy > span:last-child { max-width: 280px; margin-top: 14px; color: var(--muted); font-size: 14px; line-height: 1.7; }
.card-arrow { font-size: 24px; transition: transform .28s ease; }
.document-card:hover .card-arrow { transform: translate(4px, -4px); }

.home-footer {
  margin-top: auto;
  padding-top: 64px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .05em;
}

.reading-progress {
  position: fixed;
  z-index: 30;
  inset: 0 0 auto;
  height: 3px;
  background: transparent;
}

.reading-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width .08s linear;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  height: 68px;
  padding: 0 max(20px, calc((100vw - 1120px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 240, 232, .88);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.brand-link { display: inline-flex; align-items: center; gap: 10px; font-weight: 760; text-decoration: none; }
.mini-mark { width: 18px; height: 18px; border: 2px solid var(--accent); border-radius: 50% 50% 45% 45%; }
.topbar nav { display: flex; gap: 6px; }
.topbar nav a { padding: 9px 13px; border-radius: 999px; color: var(--muted); font-size: 13px; text-decoration: none; }
.topbar nav a.active { color: var(--ink); background: var(--white); box-shadow: 0 4px 18px rgba(62,49,35,.08); }

.document-layout {
  width: min(980px, calc(100% - 40px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 82px minmax(0, 720px);
  gap: clamp(26px, 6vw, 84px);
  justify-content: center;
  padding: clamp(52px, 8vw, 92px) 0 90px;
}

.document-rail {
  position: sticky;
  top: 110px;
  height: max-content;
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 20px;
}

.rail-number { color: var(--accent); font: 700 15px/1 ui-monospace, monospace; }
.rail-label { color: var(--muted); font: 700 10px/1 ui-monospace, monospace; letter-spacing: .24em; writing-mode: vertical-rl; }
.document-rail::after { content: ""; width: 1px; height: 110px; background: var(--line); }

.article-header { padding-bottom: 44px; border-bottom: 1px solid var(--line); }
.article-header h1 { font-size: clamp(40px, 7vw, 68px); line-height: 1.12; }
.article-summary { max-width: 640px; margin: 28px 0 32px; color: var(--muted); font-size: 18px; line-height: 1.9; }
.meta-list { margin: 0; display: flex; flex-wrap: wrap; gap: 16px 36px; }
.meta-list div { display: flex; gap: 12px; font-size: 13px; }
.meta-list dt { color: var(--muted); }
.meta-list dd { margin: 0; font-weight: 650; }

.notice-card {
  margin: 36px 0 56px;
  padding: 22px 24px;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 16px;
  background: var(--accent-soft);
  border-radius: 2px 18px 2px 2px;
}
.notice-card.warm { background: rgba(102, 112, 90, .15); }
.notice-card p { margin: 0; color: #4f4038; }
.notice-card.warm p { color: #434a3b; }
.notice-icon { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid currentColor; border-radius: 50%; font: 700 13px/1 ui-monospace, monospace; }

.policy-article section { padding: 15px 0 32px; scroll-margin-top: 90px; }
.policy-article h2 { margin: 0 0 22px; font-family: "Songti SC", "STSong", serif; font-size: 26px; line-height: 1.45; }
.policy-article h2 span { display: inline-block; width: 38px; color: var(--accent); font: 700 11px/1 ui-monospace, monospace; vertical-align: .45em; }
.policy-article h3 { margin: 27px 0 10px 38px; font-size: 16px; }
.policy-article p,
.policy-article li { color: #51534d; font-size: 16px; line-height: 2; }
.policy-article p { margin: 0 0 15px; }
.policy-article section > p,
.policy-article section > ul { margin-left: 38px; }
.policy-article ul { padding-left: 22px; }
.policy-article li { margin: 7px 0; padding-left: 4px; }
.policy-article strong { color: var(--ink); }
.policy-article a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 4px; }

.article-footer {
  margin-top: 36px;
  padding: 28px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
}
.article-footer p { margin: 0; color: var(--muted); font-size: 13px; }
.article-footer a { font-weight: 700; text-decoration: none; }
.article-footer a span { display: inline-block; transition: transform .2s ease; }
.article-footer a:hover span { transform: translateX(4px); }

.back-to-top {
  position: fixed;
  right: 22px;
  bottom: max(22px, env(safe-area-inset-bottom));
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  background: rgba(255,253,248,.9);
  box-shadow: 0 8px 28px rgba(62,49,35,.12);
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.back-to-top.visible { opacity: 1; transform: none; pointer-events: auto; }
.back-to-top:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; }

@media (max-width: 720px) {
  .home-shell { width: min(100% - 32px, 560px); padding-top: 42px; }
  .home-hero h1 { font-size: clamp(39px, 12vw, 58px); }
  .brand-mark { margin-bottom: 28px; transform: scale(.85); transform-origin: left center; }
  .document-grid { grid-template-columns: 1fr; margin-top: 52px; }
  .document-card { min-height: 205px; padding: 22px; gap: 16px; }
  .home-footer { padding-top: 44px; }
  .topbar { height: 62px; padding: 0 16px; }
  .topbar nav a { padding: 8px 10px; font-size: 12px; }
  .document-layout { width: min(100% - 32px, 640px); display: block; padding-top: 44px; }
  .document-rail { display: none; }
  .article-header h1 { font-size: 42px; }
  .article-summary { font-size: 16px; }
  .notice-card { grid-template-columns: 28px 1fr; padding: 19px 18px; }
  .notice-icon { width: 26px; height: 26px; }
  .policy-article h2 { font-size: 22px; }
  .policy-article h2 span { width: 31px; }
  .policy-article h3,
  .policy-article section > p,
  .policy-article section > ul { margin-left: 31px; }
  .policy-article p,
  .policy-article li { font-size: 15px; line-height: 1.9; }
  .article-footer { align-items: flex-start; flex-direction: column; gap: 16px; }
}

html.outfit-ios-container body.document-page .topbar { display: none !important; }
html.outfit-ios-container body.document-page .document-layout {
  padding-top: clamp(36px, 8vw, 72px);
}

@media (max-width: 720px) {
  html.outfit-ios-container body.document-page .document-layout { padding-top: 36px; }
}

/* Keep theme overrides after the base and responsive rules so light values
   cannot win the cascade inside WKWebView. */
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #11130f;
    --paper-deep: #20231d;
    --ink: #f1eee6;
    --muted: #b9bbb1;
    --accent: #d89573;
    --accent-soft: #432f26;
    --olive: #a9b39a;
    --line: rgba(241, 238, 230, .18);
    --white: #1b1e19;
    --shadow: 0 24px 70px rgba(0, 0, 0, .32);
  }

  body {
    background:
      radial-gradient(circle at 12% -10%, rgba(216, 149, 115, .08), transparent 42rem),
      var(--paper);
  }

  .document-card { background: rgba(27, 30, 25, .82); }
  .terms-card { background: rgba(169, 179, 154, .08); }
  .article-summary,
  .meta-list dt,
  .policy-article p,
  .policy-article li { color: var(--muted); }
  .notice-card p { color: #e6d2c6; }
  .notice-card.warm p { color: #dce4d3; }
  .topbar { background: rgba(17, 19, 15, .92); }
  .back-to-top { background: rgba(27, 30, 25, .94); }
}

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

@media print {
  body { background: #fff; }
  .topbar, .reading-progress, .back-to-top, .document-rail { display: none; }
  .document-layout { display: block; width: 100%; padding: 0; }
  .policy-article { max-width: none; }
  .policy-article section { break-inside: avoid; }
}
