/* ============================================================
   PoliteKey — Shared Design System
   Aesthetic: warm refined minimalism · espresso + paper-cream
   Display: Fraunces (serif, optical)  ·  Body: Hanken Grotesk
   ============================================================ */

/* ---------- Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Hanken+Grotesk:wght@400;500;600;700&display=swap');

/* ---------- Tokens ---------- */
:root {
  /* core palette */
  --espresso:   #2A2620;
  --espresso-2: #3D382F;
  --ink:        #211E18;
  --paper:      #F4EEE2;   /* warm cream page bg */
  --paper-2:    #ECE3D3;
  --card:       #FFFFFF;
  --card-soft:  #FBF7EF;
  --line:       rgba(42, 38, 32, 0.12);
  --line-soft:  rgba(42, 38, 32, 0.07);
  --muted:      #6E665A;
  --muted-2:    #938A7B;
  --amber:      #BE8636;   /* warm accent */
  --amber-soft: #E7CC93;
  --good:       #4F7A53;

  /* type */
  --font-display: 'Fraunces', 'Songti SC', Georgia, serif;
  --font-body: 'Hanken Grotesk', -apple-system, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;

  /* shape */
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-pill: 999px;

  /* shadow */
  --shadow-sm: 0 1px 2px rgba(42,38,32,.06), 0 2px 8px rgba(42,38,32,.05);
  --shadow-md: 0 8px 30px rgba(42,38,32,.10);
  --shadow-lg: 0 24px 70px rgba(42,38,32,.16);

  --maxw: 1120px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.65;
  font-size: 17px;
  letter-spacing: .005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  position: relative;
  overflow-x: hidden;
}

/* subtle paper grain over the whole page */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

/* ---------- Layout helpers ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.wrap-narrow { max-width: 780px; }
section { position: relative; z-index: 2; }

/* ---------- Type ---------- */
.display {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -0.015em;
  font-optical-sizing: auto;
}
.eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--amber);
}
.lede { color: var(--muted); font-size: 1.18rem; line-height: 1.6; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5em;
  font-family: var(--font-body);
  font-weight: 600; font-size: 16px;
  padding: 15px 28px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .25s cubic-bezier(.2,.8,.3,1), box-shadow .25s, background .25s, color .25s;
  white-space: nowrap;
}
.btn-primary {
  background: var(--espresso); color: #F6F1E7;
  box-shadow: var(--shadow-md);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); background: var(--espresso-2); }
.btn-ghost {
  background: transparent; color: var(--ink);
  border-color: var(--line);
}
.btn-ghost:hover { border-color: var(--ink); transform: translateY(-1px); }
.btn-sm { padding: 10px 20px; font-size: 14.5px; }

/* ---------- Brand mark ---------- */
.brand { display: inline-flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  background: var(--espresso); color: #F6F1E7;
  border-radius: 10px;
  font-family: var(--font-display);
  font-weight: 600; font-size: 20px;
  box-shadow: var(--shadow-sm);
}
.brand-name {
  font-family: var(--font-display);
  font-weight: 600; font-size: 21px; letter-spacing: -.01em;
  color: var(--ink);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(180%) blur(14px);
  background: color-mix(in srgb, var(--paper) 80%, transparent);
  border-bottom: 1px solid var(--line-soft);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 70px;
}
.site-nav { display: flex; align-items: center; gap: 30px; }
.site-nav a.nav-link {
  font-size: 15px; font-weight: 500; color: var(--muted);
  transition: color .2s;
}
.site-nav a.nav-link:hover { color: var(--ink); }
.header-cta { display: flex; align-items: center; gap: 14px; }
.nav-toggle { display: none; }

@media (max-width: 860px) {
  .site-nav { display: none; }
}

/* ---------- Footer ---------- */
.site-footer {
  position: relative; z-index: 2;
  background: var(--espresso);
  color: #D9D1C2;
  margin-top: 120px;
  padding: 70px 0 40px;
}
.site-footer .brand-name { color: #F6F1E7; }
.site-footer .brand-mark { background: #F6F1E7; color: var(--espresso); }
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 50px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.footer-col h4 {
  font-size: 12px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted-2); margin-bottom: 16px; font-weight: 600;
}
.footer-col a {
  display: block; color: #CFC6B6; font-size: 15px; padding: 6px 0;
  transition: color .2s;
}
.footer-col a:hover { color: #F6F1E7; }
.footer-tag { color: #B7AE9E; font-size: 15px; line-height: 1.7; margin-top: 16px; max-width: 32ch; }
.footer-bottom {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px;
  padding-top: 28px; color: var(--muted-2); font-size: 13.5px;
}
@media (max-width: 760px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; }
}

/* ---------- Legal / document pages ---------- */
.doc-hero {
  padding: 70px 0 36px;
  border-bottom: 1px solid var(--line);
}
.doc-hero h1 {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(2.2rem, 5vw, 3.2rem); letter-spacing: -.02em;
  line-height: 1.05;
}
.doc-meta { color: var(--muted); margin-top: 14px; font-size: 15px; }
.doc-body { padding: 46px 0 20px; }
.doc-body h2 {
  font-family: var(--font-display); font-weight: 600;
  font-size: 1.5rem; margin: 44px 0 14px; letter-spacing: -.01em;
  scroll-margin-top: 90px;
}
.doc-body h2:first-child { margin-top: 0; }
.doc-body h3 { font-size: 1.12rem; font-weight: 700; margin: 26px 0 10px; }
.doc-body p { margin: 0 0 16px; color: #3A352C; }
.doc-body ul, .doc-body ol { margin: 0 0 18px; padding-left: 1.3em; }
.doc-body li { margin: 0 0 9px; color: #3A352C; }
.doc-body strong { color: var(--ink); font-weight: 700; }
.doc-body a { color: var(--amber); text-decoration: underline; text-underline-offset: 3px; }
.callout {
  background: var(--card-soft);
  border: 1px solid var(--line);
  border-left: 3px solid var(--amber);
  border-radius: var(--radius-md);
  padding: 18px 22px; margin: 22px 0;
}
.callout p:last-child { margin-bottom: 0; }
.toc {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 22px 26px; margin: 0 0 8px;
  box-shadow: var(--shadow-sm);
}
.toc h4 { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.toc ol { columns: 2; column-gap: 36px; padding-left: 1.2em; }
.toc a { color: var(--ink); font-size: 14.5px; }
.toc a:hover { color: var(--amber); }
@media (max-width: 620px){ .toc ol { columns: 1; } }

/* ---------- i18n ---------- */
html.i18n-pending [data-lang] { display: none !important; }
[data-lang][hidden] { display: none !important; }
.lang-switcher { display: inline-flex; align-items: center; }
.lang-select {
  font-family: var(--font-body); font-size: 14px; font-weight: 600;
  color: var(--ink); background-color: transparent;
  border: 1px solid var(--line); border-radius: var(--radius-pill);
  padding: 8px 32px 8px 15px; cursor: pointer; line-height: 1.2;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236E665A' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  transition: border-color .2s, color .2s;
}
.lang-select:hover { border-color: var(--ink); }
.lang-select:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
/* footer switcher on dark espresso */
.site-footer .lang-select {
  color: #E7DECF; border-color: rgba(255,255,255,.18);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23B7AE9E' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}
.site-footer .lang-select option { color: #211E18; }

/* ---------- Utilities ---------- */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity .7s ease, transform .7s cubic-bezier(.2,.8,.3,1); }
.reveal.in { opacity: 1; transform: none; }
.center { text-align: center; }
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
