/* ---------- Fonts ---------- */
@font-face { font-family: "Thmanyah Sans"; src: url("assets/fonts/thmanyahsans-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Thmanyah Sans"; src: url("assets/fonts/thmanyahsans-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Thmanyah Sans"; src: url("assets/fonts/thmanyahsans-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Thmanyah Sans"; src: url("assets/fonts/thmanyahsans-Black.woff2") format("woff2"); font-weight: 800 900; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("assets/fonts/dm-sans-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("assets/fonts/dm-sans-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("assets/fonts/dm-sans-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("assets/fonts/dm-sans-latin-800-normal.woff2") format("woff2"); font-weight: 800 900; font-display: swap; }

/* ---------- Tokens (mirror bannai-marketing/src/styles/global.css) ---------- */
:root {
  --brand: #1e3a2a;
  --brand-dark: #14271c;
  --brand-hover: #2a5a3c;
  --accent-orange: #d98b3f;
  --accent-orange-bright: #f3b55f;
  --accent-orange-soft: #f4e4d1;
  --cream: #fbf7f0;
  --sand: #f3ecdf;
  --ink: #223229;
  --muted-ink: #5b6b5e;
  --line: rgb(30 58 42 / 0.12);
  --radius: 10px;
  --font-en: "DM Sans", "Thmanyah Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-ar: "Thmanyah Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 5rem; -webkit-font-smoothing: antialiased; }
body { margin: 0; font-family: var(--font-en); color: var(--ink); background: var(--cream); line-height: 1.6; }
[lang="ar"], .thmanyah { font-family: var(--font-ar); }
.dmsans { font-family: var(--font-en); }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.15; margin: 0; letter-spacing: -0.02em; }
a { color: inherit; }
.wrap { width: min(1160px, 100% - 3rem); margin-inline: auto; }

/* ---------- Top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: rgb(251 247 240 / 0.85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.topbar-logo img { height: 40px; width: auto; }
.topnav { display: flex; gap: 1.75rem; font-size: 15px; font-weight: 500; }
.topnav a { text-decoration: none; color: var(--muted-ink); transition: color .2s; }
.topnav a:hover, .topnav a.active { color: var(--brand); }
.topbar-inner { gap: 1.5rem; }
.topnav { margin-inline-start: auto; }
.lang-toggle { font: 700 14px var(--font-ar); color: var(--brand); background: transparent; border: 1.5px solid rgb(30 58 42 / .25); border-radius: 10px; padding: .4rem .85rem; cursor: pointer; transition: background-color .2s, border-color .2s; }
.lang-toggle:hover { background: rgb(30 58 42 / .06); border-color: var(--brand); }
.lang-toggle:focus-visible { outline: 3px solid var(--accent-orange); outline-offset: 2px; }
.lang-toggle[lang="en"] { font-family: var(--font-en); }

/* Arabic page */
html[lang="ar"] body { font-family: var(--font-ar); }
html[lang="ar"] h1, html[lang="ar"] h2, html[lang="ar"] h3,
html[lang="ar"] .eyebrow, html[lang="ar"] .panel-label { letter-spacing: 0; }
html[lang="ar"] .lede { line-height: 1.9; }
html[lang="ar"] .hero-tagline { display: none; }
html[lang="ar"] .font-meta span:first-child { font-family: var(--font-ar); }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; background: var(--brand); color: var(--cream); padding: 6rem 0 5.5rem; }
.hero-grid { position: absolute; inset: 0; background-image: linear-gradient(rgb(251 247 240 / .06) 1px, transparent 1px), linear-gradient(90deg, rgb(251 247 240 / .06) 1px, transparent 1px); background-size: 48px 48px; mask-image: radial-gradient(ellipse at 70% 40%, #000 20%, transparent 75%); animation: grid-pan 30s linear infinite; }
.hero-aurora { position: absolute; width: 60vw; height: 60vw; inset-inline-end: -15vw; top: -25vw; border-radius: 50%; background: radial-gradient(circle, rgb(217 139 63 / .28), transparent 60%); filter: blur(40px); animation: aurora 16s ease-in-out infinite; }
.hero-inner { position: relative; display: grid; grid-template-columns: 300px 1fr; gap: 4rem; align-items: center; }
.hero-logo { width: 100%; height: auto; }
.eyebrow { font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-orange-bright); margin: 0 0 1rem; }
.eyebrow.dark { color: var(--accent-orange); }
.hero h1 { font-size: clamp(2.4rem, 5vw, 4rem); font-weight: 800; }
.accent { color: var(--accent-orange-bright); }
.lede { font-size: 1.15rem; max-width: 40rem; color: rgb(251 247 240 / .82); margin: 1.25rem 0 0; }
.lede.ar { font-size: 1.35rem; font-weight: 500; color: var(--cream); }

@keyframes grid-pan { to { background-position: 48px 48px; } }
@keyframes aurora { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(-6%, 8%) scale(1.1); } }

/* ---------- Sections ---------- */
.section { padding: 6rem 0; }
.section.alt { background: var(--sand); }
.section.dark { background: var(--brand-dark); color: var(--cream); }
.section-head { max-width: 44rem; margin-bottom: 3rem; }
.section-head h2 { font-size: clamp(2rem, 4vw, 2.75rem); font-weight: 800; color: var(--brand); }
.section.dark .section-head h2 { color: var(--cream); }
.section-head p:last-child { color: var(--muted-ink); font-size: 1.08rem; margin: 1rem 0 0; }
.section.dark .section-head p:last-child { color: rgb(251 247 240 / .75); }
.sub { font-size: 1.15rem; font-weight: 700; color: var(--brand); margin: 3.5rem 0 1.25rem; }
.note { color: var(--muted-ink); margin: -.75rem 0 1.25rem; font-size: .95rem; }

.on-cream { background: var(--cream); }
.on-green { background: var(--brand); color: var(--cream); }
.on-sand { background: var(--sand); }

/* ---------- Logo ---------- */
.logo-grid { display: grid; grid-template-columns: 1.2fr 1.2fr 1fr; gap: 1.25rem; }
.logo-card { margin: 0; border-radius: 18px; border: 1px solid var(--line); overflow: hidden; display: flex; flex-direction: column; }
.logo-card img { height: 260px; width: auto; margin: 2.5rem auto; padding: 0 1.5rem; object-fit: contain; }
.icon-card img { height: 140px; margin: calc(2.5rem + 60px) auto; border-radius: 30px; box-shadow: 0 12px 30px -12px rgb(20 39 28 / .4); padding: 0; }
.logo-card figcaption { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .9rem 1.1rem; font-size: 14px; border-top: 1px solid var(--line); background: rgb(255 255 255 / .35); }
.on-green figcaption { background: rgb(0 0 0 / .12); border-top-color: rgb(251 247 240 / .12); }
.dl-group { display: flex; gap: .4rem; }
.dl { font-weight: 700; font-size: 13px; text-decoration: none; padding: .3rem .65rem; border-radius: 8px; border: 1px solid currentColor; opacity: .85; white-space: nowrap; }
.dl:hover { opacity: 1; background: rgb(217 139 63 / .15); }

.anatomy { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; }
.anatomy-item { display: flex; gap: .9rem; padding: 1.25rem; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.anatomy-item p { margin: .3rem 0 0; color: var(--muted-ink); font-size: .93rem; }
.num { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-orange-soft); color: var(--brand); font-weight: 800; font-size: 14px; }

.rules { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; }
.rule p { margin: .75rem 0 0; font-size: .93rem; color: var(--muted-ink); }
.rule b { color: var(--ink); }
.rule-preview { position: relative; height: 170px; border-radius: 14px; border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; }
.rule-preview img { height: 110px; width: auto; }
.rule.do .rule-preview { border-bottom: 4px solid #3f8f5a; }
.rule.dont .rule-preview { border-bottom: 4px solid #c0492f; }
.rule-preview .stretch { transform: scaleX(1.6); }
.rule-preview .recolor { filter: hue-rotate(180deg) saturate(3); }
.rule-preview.busy { background: repeating-linear-gradient(45deg, #d98b3f 0 14px, #5b6b5e 14px 28px); }

/* ---------- Colors ---------- */
.swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; }
.swatches.small { grid-template-columns: repeat(4, 1fr); }
.swatch { all: unset; cursor: pointer; border-radius: 16px; overflow: hidden; background: #fff; border: 1px solid var(--line); display: flex; flex-direction: column; transition: transform .2s, box-shadow .2s; }
.swatch:hover { transform: translateY(-3px); box-shadow: 0 14px 30px -16px rgb(20 39 28 / .35); }
.swatch:focus-visible { outline: 3px solid var(--accent-orange); outline-offset: 2px; }
.swatch-color { height: 130px; display: flex; align-items: flex-end; padding: .75rem; font-size: 12px; font-weight: 700; }
.swatches.small .swatch-color { height: 90px; }
.swatch-info { padding: .9rem 1rem 1rem; }
.swatch-name { font-weight: 700; display: block; }
.swatch-role { font-size: .85rem; color: var(--muted-ink); display: block; margin-top: .15rem; }
.swatch-codes { display: flex; flex-wrap: wrap; gap: .35rem .75rem; margin-top: .6rem; font: 500 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted-ink); }
.swatch-codes .hex { color: var(--ink); font-weight: 700; }

.proportion { display: flex; height: 84px; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); font-weight: 700; font-size: 14px; }
.proportion div { display: flex; align-items: flex-end; padding: .75rem; white-space: nowrap; overflow: hidden; }

.pairs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.pair { border-radius: 14px; padding: 1.25rem; border: 1px solid var(--line); }
.pair-sample { font-size: 1.6rem; font-weight: 700; }
.pair-meta { display: flex; justify-content: space-between; align-items: center; margin-top: .75rem; font-size: 13px; opacity: .9; }
.badge { font-size: 11px; font-weight: 800; padding: .2rem .5rem; border-radius: 6px; background: rgb(255 255 255 / .85); color: var(--brand-dark); }
.badge.fail { background: #f6d5cc; color: #8a2a17; }

/* ---------- Typography ---------- */
.fonts { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.font-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 1.75rem; }
.font-meta { display: flex; justify-content: space-between; font: 600 13px var(--font-en); color: var(--muted-ink); text-transform: uppercase; letter-spacing: .06em; }
.font-specimen { font-size: clamp(4rem, 9vw, 7rem); font-weight: 900; line-height: 1.1; color: var(--brand); margin: 1rem 0; }
.font-specimen.dmsans { font-weight: 800; letter-spacing: -0.04em; }
.font-glyphs { font-size: 1.15rem; color: var(--muted-ink); margin: 0 0 1.25rem; word-spacing: .2em; }
.weights { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; border-top: 1px solid var(--line); padding-top: 1rem; font-size: 1.05rem; color: var(--ink); }

.tester { background: #fff; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.tester-controls { display: flex; flex-wrap: wrap; gap: 1.5rem; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); background: var(--cream); font-size: 14px; font-weight: 500; }
.tester-controls label { display: flex; align-items: center; gap: .6rem; }
.tester-controls input[type="range"] { accent-color: var(--brand); width: 160px; }
.tester-controls output { font: 600 12px ui-monospace, monospace; min-width: 3.5em; color: var(--muted-ink); }
.tester-controls select { font: inherit; padding: .3rem .5rem; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); }
.seg { display: inline-flex; padding: 3px; background: var(--sand); border-radius: 10px; }
.seg button { font: inherit; border: 0; background: transparent; padding: .35rem .85rem; border-radius: 8px; cursor: pointer; color: var(--muted-ink); }
.seg button.active { background: #fff; color: var(--brand); box-shadow: 0 1px 2px rgb(20 39 28 / .12); font-weight: 700; }
.tester-text { padding: 2.25rem 1.5rem; font-size: 48px; font-weight: 700; line-height: 1.3; color: var(--brand); outline: none; min-height: 1.3em; }

.scale { background: #fff; border: 1px solid var(--line); border-radius: 18px; }
.scale-row { display: grid; grid-template-columns: 180px 1fr; align-items: center; gap: 1rem; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--line); }
.scale-row:last-child { border-bottom: 0; }
.scale-tag { font: 600 12px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted-ink); }
.scale-row [dir="rtl"] { text-align: right; color: var(--brand); }

/* ---------- UI ---------- */
.ui-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.ui-panel { position: relative; border-radius: 18px; padding: 2.25rem 1.75rem 1.75rem; border: 1px solid var(--line); display: flex; flex-direction: column; gap: 1rem; min-height: 200px; }
.panel-label { position: absolute; top: .9rem; inset-inline-start: 1.1rem; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; opacity: .6; }
.btn-row { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: .75rem; }
.btn { font: 700 15px/1 inherit; font-family: inherit; padding: .85rem 1.4rem; border-radius: 14px; border: 0; cursor: pointer; transition: background-color .2s, box-shadow .2s; }
.btn-brand { background: var(--brand); color: var(--cream); box-shadow: 0 1px 2px rgb(20 39 28 / .12); }
.btn-brand:hover { background: var(--brand-hover); box-shadow: 0 6px 16px -6px rgb(20 39 28 / .28); }
.btn-cream { background: var(--cream); color: var(--brand); box-shadow: 0 1px 2px rgb(20 39 28 / .12); }
.btn-cream:hover { background: #fff; box-shadow: 0 6px 16px -6px rgb(20 39 28 / .22); }
.btn-outline { background: transparent; color: var(--brand); box-shadow: inset 0 0 0 1.5px rgb(30 58 42 / .25); }
.btn-outline:hover { background: rgb(30 58 42 / .05); }
.btn-ghost { background: rgb(251 247 240 / .08); color: var(--cream); box-shadow: inset 0 0 0 1px rgb(251 247 240 / .2); }
.btn-ghost:hover { background: rgb(251 247 240 / .14); }
.ui-heading { font-size: 1.9rem; font-weight: 900; margin: .5rem 0 0; }
.ui-heading span { color: var(--accent-orange-bright); }
.small-copy { margin: .75rem 0 0; color: var(--muted-ink); max-width: 30rem; }

@property --beam-angle { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes beam-rotate { to { --beam-angle: 360deg; } }
.beam-host { overflow: hidden; }
.border-beam { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; }
.border-beam::after { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; background: conic-gradient(from var(--beam-angle), transparent 0 70%, var(--accent-orange) 80%, color-mix(in oklch, var(--accent-orange) 55%, white) 88%, transparent 96%); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; animation: beam-rotate 6s linear infinite; }

.radii { display: flex; gap: 1.25rem; flex-wrap: wrap; margin-top: .75rem; }
.radii div { display: flex; flex-direction: column; align-items: center; gap: .5rem; }
.radii i { width: 72px; height: 72px; background: var(--sand); border: 1.5px solid var(--brand); box-shadow: 0 6px 16px -6px rgb(20 39 28 / .28); }
.radii small { font: 600 11px ui-monospace, monospace; color: var(--muted-ink); }

/* ---------- Downloads ---------- */
.downloads { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.dl-card { all: unset; box-sizing: border-box; cursor: pointer; display: flex; flex-direction: column; gap: .3rem; padding: 1.25rem; border-radius: 14px; background: rgb(251 247 240 / .05); border: 1px solid rgb(251 247 240 / .12); transition: background .2s, border-color .2s; }
.dl-card:hover { background: rgb(251 247 240 / .1); border-color: var(--accent-orange); }
.dl-card:focus-visible { outline: 3px solid var(--accent-orange); }
.dl-card span { font-size: 13px; color: var(--accent-orange-bright); }
.tokens { margin: 2rem 0 0; padding: 1.5rem; border-radius: 14px; background: rgb(0 0 0 / .25); color: rgb(251 247 240 / .85); font: 13px/1.7 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-x: auto; }

/* ---------- Footer & toast ---------- */
.footer { background: var(--brand-dark); color: rgb(251 247 240 / .6); border-top: 1px solid rgb(251 247 240 / .08); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; padding: 1.75rem 0; font-size: 14px; }
.footer img { height: 48px; width: auto; }
.toast { position: fixed; bottom: 1.5rem; left: 50%; transform: translate(-50%, 1rem); background: var(--brand); color: var(--cream); padding: .7rem 1.1rem; border-radius: 12px; font-size: 14px; font-weight: 600; box-shadow: 0 12px 30px -10px rgb(20 39 28 / .5); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero-inner { grid-template-columns: 1fr; gap: 2rem; }
  .hero-logo { width: 200px; }
  .logo-grid, .fonts, .ui-grid { grid-template-columns: 1fr; }
  .anatomy, .rules, .swatches, .swatches.small, .downloads { grid-template-columns: repeat(2, 1fr); }
  .pairs { grid-template-columns: 1fr 1fr; }
  .topnav { display: none; }
  .lang-toggle { margin-inline-start: auto; }
}
@media (max-width: 560px) {
  .section { padding: 4rem 0; }
  .anatomy, .rules, .swatches, .swatches.small, .downloads, .pairs { grid-template-columns: 1fr; }
  .weights { grid-template-columns: 1fr 1fr; }
  .scale-row { grid-template-columns: 1fr; }
  .icon-card img { margin: 2.5rem auto; }
  .tester-text { font-size: 32px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-grid, .hero-aurora, .border-beam::after { animation: none; }
  .swatch, .toast { transition: none; }
}
