/* KAHN HAUS — public site. Tokens mirror apps/gate/src/ui.jsx 1:1. */
:root {
  --g: #C9A961;            /* gold */
  --gh: #E8C87A;           /* gold high */
  --gd: #8A7443;           /* gold dim */
  --bone: #EDE6D6;
  --mut: #9A9080;
  --dim: #5E574A;
  --bg: #0B0A08;
  --bg2: #0F0D0A;
  --panel: #141109;
  --line: rgba(201, 169, 97, 0.16);
  --lsoft: rgba(201, 169, 97, 0.08);
  --green: #5CB57F;
  --amber: #D9A441;
  --red: #C4574A;
  --head: 'Cinzel', 'Times New Roman', serif;
  --ui: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --max: 1120px;
  --gutter: clamp(20px, 5vw, 56px);
  color-scheme: dark;
}
html[lang="ar"] {
  --head: 'Amiri', 'Noto Naskh Arabic', 'Times New Roman', serif;
  --ui: 'Noto Sans Arabic', 'Inter', system-ui, sans-serif;
}
html[lang="ru"] { --head: 'Cormorant Garamond', 'Times New Roman', serif; }
html[lang="ru"] .h1, html[lang="ru"] .h2 { letter-spacing: 0.01em; }
html[lang="ru"] .mark { letter-spacing: 0.2em; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
body {
  margin: 0;
  background: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(201, 169, 97, 0.06), transparent), var(--bg);
  color: var(--bone);
  font-family: var(--ui);
  font-weight: 300;
  font-size: 16px;
  line-height: 1.7;
  letter-spacing: 0.02em;
  min-height: 100vh;
}
html[lang="ar"] body { letter-spacing: 0; font-weight: 400; line-height: 1.9; }
::selection { background: rgba(201, 169, 97, 0.28); color: var(--bone); }
:focus-visible { outline: 1px solid var(--g); outline-offset: 3px; }
a { color: var(--g); text-decoration: none; }
a:hover { color: var(--gh); }
img, svg { max-width: 100%; }
h1, h2, h3 { font-family: var(--head); font-weight: 500; color: var(--bone); margin: 0; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

.skip {
  position: absolute; inset-inline-start: 12px; top: -48px; z-index: 100;
  background: var(--panel); color: var(--g); border: 1px solid var(--line);
  padding: 8px 14px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
}
.skip:focus { top: 12px; }

.wrap { width: min(100% - 2 * var(--gutter), var(--max)); margin-inline: auto; }

/* Type roles */
.micro {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--g);
}
html[lang="ar"] .micro { font-family: var(--ui); letter-spacing: 0.04em; font-size: 12px; }
.h1 { font-size: clamp(30px, 4.6vw, 54px); line-height: 1.12; letter-spacing: 0.02em; }
.h2 { font-size: clamp(22px, 2.6vw, 32px); line-height: 1.2; letter-spacing: 0.03em; }
.h3 { font-size: 17px; letter-spacing: 0.04em; line-height: 1.35; }
.lede { font-size: clamp(16px, 1.6vw, 19px); color: var(--mut); max-width: 62ch; }
.body { color: var(--mut); max-width: 68ch; }
.gold { color: var(--g); }

/* Hairline + diamond */
.hair { height: 1px; background: var(--line); border: 0; margin: 0; }
.dia { display: inline-block; width: 6px; height: 6px; background: var(--g); transform: rotate(45deg); flex: none; }
.rule { display: flex; align-items: center; gap: 10px; }
.rule .hair { width: 56px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase;
  padding: 13px 24px; border: 1px solid var(--line); background: transparent; color: var(--g);
  cursor: pointer; border-radius: 0; transition: filter 160ms ease, border-color 160ms ease; min-height: 44px;
}
html[lang="ar"] .btn { font-family: var(--ui); letter-spacing: 0.04em; font-size: 13px; font-weight: 500; }
.btn:hover:not(:disabled) { filter: brightness(1.12); border-color: rgba(201, 169, 97, 0.45); color: var(--gh); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { background: linear-gradient(135deg, #E8C87A, #C9A961); color: var(--bg); border-color: var(--g); }
.btn.primary:hover:not(:disabled) { color: var(--bg); }
.btn.small { padding: 8px 14px; font-size: 10px; min-height: 36px; }

/* Header */
.hdr { position: sticky; top: 0; z-index: 50; background: rgba(11, 10, 8, 0.86); backdrop-filter: blur(10px); border-bottom: 1px solid var(--lsoft); }
.hdr .wrap { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 68px; flex-wrap: wrap; padding-block: 10px; width: min(100% - 2 * var(--gutter), 1280px); }
.mark { font-family: var(--head); font-weight: 500; letter-spacing: 0.26em; text-indent: 0.26em; color: var(--bone); font-size: 18px; white-space: nowrap; }
html[lang="ar"] .mark { letter-spacing: 0.02em; text-indent: 0; font-size: 22px; }
.mark b { font-weight: 500; color: var(--g); }
.nav { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.nav a { font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--mut); padding: 6px 0; }
html[lang="ar"] .nav a { font-family: var(--ui); letter-spacing: 0.03em; font-size: 13.5px; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--bone); }
.nav a[aria-current="page"] { border-bottom: 1px solid var(--g); }
.hdr-cta { display: flex; align-items: center; gap: 10px; }
/* Journal pages rendered by kahn-api still emit their EN/AR switch as <a class="lang">. */
.lang { font-family: var(--ui) !important; letter-spacing: 0 !important; text-transform: none !important; font-size: 14px !important; color: var(--g) !important; }
.langs { display: flex; align-items: center; gap: 2px; border: 1px solid var(--line); padding: 2px; }
.langs a { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em; color: var(--mut); padding: 6px 8px; min-width: 34px; text-align: center; }
.langs a:hover { color: var(--bone); }
.langs a.on { color: var(--bg); background: var(--g); }
html[lang="ar"] .langs a { font-family: var(--mono); }

/* Sections */
.hero { padding-block: clamp(64px, 12vw, 140px) clamp(48px, 8vw, 96px); }
.hero .h1 { margin-top: 18px; max-width: 18ch; }
.hero .lede { margin-top: 22px; }
.hero-full { min-height: calc(100svh - 68px); display: flex; align-items: center; background: var(--bg); }
.hero-full .h1 { max-width: 20ch; }
.hero-full .lede { max-width: 66ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.sec { padding-block: clamp(40px, 7vw, 88px); border-top: 1px solid var(--lsoft); }
.sec-head { display: flex; flex-direction: column; gap: 12px; margin-bottom: clamp(24px, 4vw, 44px); }
.grid { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.grid > * { background: var(--bg); padding: clamp(22px, 3vw, 34px); }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.grid.c3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.grid.c4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.cell .h3 { margin-top: 12px; }
.cell .body { margin-top: 10px; font-size: 15px; }
.cell .micro { color: var(--g); }

/* Doors */
.doors { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.door { background: var(--panel); padding: clamp(26px, 3.4vw, 40px); display: flex; flex-direction: column; gap: 16px; min-height: 260px; color: inherit; transition: background 180ms ease; }
.door:hover { background: #181410; color: inherit; }
.door .h2 { margin-top: 6px; }
.door .body { flex: 1; font-size: 15px; }
.door .enter { font-family: var(--mono); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--g); display: inline-flex; align-items: center; gap: 10px; }
.door { border-radius: 0; }
html[lang="ar"] .door .enter { font-family: var(--ui); letter-spacing: 0.03em; font-size: 13px; }

/* Steps */
.steps { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); counter-reset: step; }
.step { background: var(--bg); padding: 24px; }
.step .n { font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em; color: var(--g); }
.step .h3 { margin-top: 10px; }
.step .body { margin-top: 8px; font-size: 14.5px; }

/* Terms list (Capital) */
.terms { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.terms > li { background: var(--panel); padding: 26px; }
.terms .h3 { display: flex; align-items: center; gap: 12px; }
.terms .body { margin-top: 10px; font-size: 15px; }

/* Notice */
.notice { border: 1px solid var(--line); border-inline-start: 2px solid var(--g); padding: 20px 24px; color: var(--mut); font-size: 14px; max-width: 78ch; }

/* FAQ */
.faq { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.faq details { background: var(--bg); }
.faq summary { cursor: pointer; padding: 20px 24px; font-family: var(--head); font-size: 17px; letter-spacing: 0.02em; list-style: none; display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--mono); color: var(--g); font-size: 18px; }
.faq details[open] summary::after { content: "–"; }
.faq .body { padding: 0 24px 22px; font-size: 15px; }

/* CTA band */
.cta { padding-block: clamp(48px, 8vw, 96px); border-top: 1px solid var(--lsoft); background: var(--bg2); }
.cta .wrap { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 28px; }
.cta .lede { margin-top: 10px; }

/* Form */
.form { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); max-width: 760px; }
.form .full { grid-column: 1 / -1; }
.field label { display: block; margin-bottom: 7px; }
.field input, .field select, .field textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--line); color: var(--bone); padding: 12px 14px;
  font-family: var(--ui); font-size: 15px; letter-spacing: 0.02em; border-radius: 0; outline: none; min-height: 46px;
}
.field textarea { min-height: 120px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: var(--dim); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: rgba(201, 169, 97, 0.55); }
.field select {
  appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--g) 50%), linear-gradient(135deg, var(--g) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px, 6px 6px; background-repeat: no-repeat;
  padding-inline-end: 40px;
}
html[dir="rtl"] .field select { background-position: 20px 50%, 14px 50%; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); padding: 8px 12px; cursor: pointer; font-size: 13.5px; color: var(--mut); min-height: 36px; }
.chip input { accent-color: var(--g); margin: 0; }
.chip:has(input:checked) { color: var(--bone); border-color: rgba(201, 169, 97, 0.5); }
.consent { display: flex; gap: 12px; align-items: flex-start; color: var(--mut); font-size: 14px; }
.consent input { accent-color: var(--g); margin-top: 5px; flex: none; }
.err { color: var(--red); font-size: 13px; margin-top: 6px; }
.ok { border: 1px solid rgba(92, 181, 127, 0.4); padding: 18px 22px; color: var(--bone); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Legal */
.legal { max-width: 74ch; }
.legal h2 { font-size: 20px; margin-top: 36px; letter-spacing: 0.03em; }
.legal p { color: var(--mut); margin-top: 12px; font-size: 15.5px; }
.legal .effective { margin-top: 14px; }

/* Journal teaser */
.jlist { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.jlist a { background: var(--bg); padding: 22px 24px; color: inherit; display: block; }
.jlist a:hover { background: var(--panel); }
.jlist .h3 { margin-top: 10px; }
.jlist time { display: block; margin-top: 12px; }

/* Footer */
.ftr { border-top: 1px solid var(--line); padding-block: 40px 56px; margin-top: 40px; }
.ftr .wrap { display: grid; gap: 22px; }
.ftr .row { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center; justify-content: space-between; }
.ftr .links { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.ftr .links a { color: var(--mut); font-size: 13.5px; }
.ftr .links a:hover { color: var(--bone); }
.ftr .fine { color: var(--mut); font-size: 12.5px; max-width: 80ch; }

@media (max-width: 720px) {
  /* Compact header: wordmark + language switcher on one row, the nav as a
     single scrollable row beneath; the primary action lives in the hero and
     the CTA bands, not in a header that would otherwise cover a third of the
     screen. */
  .hdr .wrap { min-height: 56px; padding-block: 8px; row-gap: 6px; }
  .nav { gap: 18px; order: 3; width: 100%; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 4px; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; }
  .langs { order: 2; margin-inline-start: auto; }
  /* The primary action stays in the header (journal pages rendered by kahn-api share this
     stylesheet and carry their only request link here); the secondary sign-in is hidden. */
  .hdr-cta { order: 4; width: 100%; }
  .hdr-cta .btn:not(.primary) { display: none; }
  .hdr-cta .btn.primary { width: 100%; }
}
@media (max-width: 420px) {
  /* 320px phones: the wordmark and the five-language switcher share one 280px row */
  .hdr .wrap { gap: 10px; }
  .mark { font-size: 15px; letter-spacing: 0.16em; text-indent: 0.16em; }
  .langs { gap: 0; padding: 1px; }
  .langs a { min-width: 26px; padding: 6px 4px; font-size: 10px; letter-spacing: 0.06em; }
}
