/* ===========================================================================
   actual. — Brand Book styles
   Arabic-first / RTL. Everything is driven by the design-system tokens
   (var(--*) from _ds/.../tokens). No invented colors, type, or spacing.
   =========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg-void);
  color: var(--text-primary);
  font: var(--type-body);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

::selection { background: var(--accent-soft); color: var(--warm-white); }

a { color: inherit; text-decoration: none; }

/* warm scrollbar */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--ink-950); }
::-webkit-scrollbar-thumb { background: var(--ink-600); border-radius: 999px; border: 3px solid var(--ink-950); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-500); }

/* ===========================================================================
   LAYOUT — fixed side index (RTL: sits on the right) + content column
   =========================================================================== */
.shell { display: flex; min-height: 100vh; }

.sidenav {
  position: sticky; top: 0; align-self: flex-start;
  width: 248px; flex: none; height: 100vh;
  padding: var(--space-7) var(--space-5);
  border-inline-start: 1px solid var(--line);
  background: linear-gradient(180deg, var(--ink-900), var(--ink-950));
  display: flex; flex-direction: column; gap: var(--space-6);
  z-index: 40;
}
.sidenav .brandrow { display: flex; align-items: center; gap: 10px; }
.sidenav .brandrow img { width: 34px; height: 34px; border-radius: 8px; }
.sidenav .brandrow .wm {
  font-family: var(--font-latin); font-weight: 700; font-size: 20px;
  letter-spacing: -0.03em; color: var(--warm-white);
}
.sidenav .brandrow .wm .dot { color: var(--accent); }

.toc { display: flex; flex-direction: column; gap: 2px; }
.toc .eyebrow { font: var(--type-caption); letter-spacing: var(--ls-caps); text-transform: uppercase;
  color: var(--text-faint); margin: 0 0 var(--space-2); font-family: var(--font-latin); }
.toc a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: var(--text-md); font-weight: var(--fw-medium);
  transition: all var(--dur-fast) var(--ease-out);
}
.toc a .num { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); width: 18px; }
.toc a:hover { background: var(--ink-800); color: var(--text-primary); }
.toc a.active { background: var(--accent-soft); color: var(--accent); }
.toc a.active .num { color: var(--accent); }

.sidenav .foot { margin-top: auto; font: var(--type-caption); color: var(--text-faint); line-height: 1.7; }

.content { flex: 1 1 auto; min-width: 0; }

/* ===========================================================================
   SECTION SCAFFOLD
   =========================================================================== */
section { padding: var(--space-11) var(--space-9); border-bottom: 1px solid var(--line-soft); position: relative; }
section:last-child { border-bottom: 0; }
.wrap { max-width: 1080px; margin: 0 auto; }

.sec-head { display: flex; align-items: baseline; gap: 16px; margin-bottom: var(--space-8); flex-wrap: wrap; }
.sec-head .idx { font-family: var(--font-mono); font-size: var(--text-md); color: var(--accent); }
.sec-head h2 { margin: 0; font: var(--type-display); color: var(--text-primary); }
.sec-head .en { font-family: var(--font-latin); font-size: var(--text-lg); color: var(--text-faint);
  font-weight: 500; letter-spacing: -0.01em; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font: var(--type-label); font-family: var(--font-latin); letter-spacing: var(--ls-caps);
  text-transform: uppercase; color: var(--accent);
}
.eyebrow .spk { color: var(--accent); }

.lead { font-size: var(--text-xl); line-height: var(--lh-relaxed); color: var(--text-secondary);
  max-width: 64ch; }
.muted { color: var(--text-muted); }
.mono { font-family: var(--font-mono); }

.grid { display: grid; gap: var(--space-5); }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }

/* generic card */
.card {
  background: var(--bg-card); border: 1px solid var(--border-card);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
  padding: var(--space-6);
}
.card.flush { padding: 0; overflow: hidden; }
.card .label { font: var(--type-caption); letter-spacing: var(--ls-caps); text-transform: uppercase;
  color: var(--text-faint); font-family: var(--font-latin); }

/* ===========================================================================
   1 — COVER
   =========================================================================== */
.cover {
  min-height: 100vh; display: flex; flex-direction: column; justify-content: center;
  padding: var(--space-9);
  background:
    radial-gradient(60% 50% at 50% 30%, rgba(255,158,87,0.10), transparent 70%),
    var(--grad-night);
  border-bottom: 1px solid var(--line);
  overflow: hidden; position: relative;
}
.cover .bloom {
  position: absolute; inset-inline-start: 50%; top: 16%;
  width: 540px; height: 540px; transform: translateX(50%);
  background: radial-gradient(circle, rgba(255,122,89,0.22), transparent 62%);
  filter: blur(36px); pointer-events: none; z-index: 0;
}
.cover .inner { position: relative; z-index: 1; max-width: 1080px; margin: 0 auto; width: 100%; }
.cover .mark-xl { width: 124px; height: 124px; border-radius: 26px; box-shadow: var(--glow-spark); margin-bottom: var(--space-7); }
.cover h1 {
  margin: 0 0 var(--space-4);
  font-family: var(--font-display); font-weight: var(--fw-black);
  font-size: clamp(3rem, 8vw, var(--text-6xl)); line-height: var(--lh-tight);
  letter-spacing: -0.01em;
}
.cover h1 .two { background: var(--grad-twotone); -webkit-background-clip: text; background-clip: text; color: transparent; }
.cover .sub { font-size: var(--text-2xl); color: var(--text-secondary); line-height: var(--lh-snug); max-width: 30ch; }
.cover .meta {
  margin-top: var(--space-9); display: flex; gap: var(--space-8); flex-wrap: wrap;
  border-top: 1px solid var(--line); padding-top: var(--space-6);
}
.cover .meta .k { font: var(--type-caption); letter-spacing: var(--ls-caps); text-transform: uppercase;
  color: var(--text-faint); font-family: var(--font-latin); margin-bottom: 4px; }
.cover .meta .v { font-size: var(--text-lg); color: var(--text-primary); font-weight: var(--fw-medium); }
.cover .scrollcue {
  position: absolute; inset-inline: 0; bottom: 26px; text-align: center;
  font: var(--type-caption); color: var(--text-faint); font-family: var(--font-latin);
  letter-spacing: var(--ls-wide);
}

/* ===========================================================================
   2 — ESSENCE
   =========================================================================== */
.principle { display: flex; flex-direction: column; gap: 10px; }
.principle .n { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--accent); }
.principle h3 { margin: 0; font: var(--type-title); }
.principle p { margin: 0; color: var(--text-secondary); line-height: var(--lh-relaxed); }

.quote {
  margin: var(--space-8) 0 0; padding: var(--space-7);
  background: var(--accent-soft); border: 1px solid var(--accent-line);
  border-radius: var(--radius-xl); text-align: center;
}
.quote .ar { font: var(--type-title); font-size: var(--text-3xl); color: var(--warm-white); margin-bottom: 8px; }
.quote .en { font-family: var(--font-latin); color: var(--text-muted); font-size: var(--text-lg); font-style: italic; }

/* ===========================================================================
   3 — LOGO
   =========================================================================== */
.logo-stage {
  display: grid; place-items: center; min-height: 280px;
  background: var(--grad-night); border: 1px solid var(--line); border-radius: var(--radius-xl);
  position: relative; overflow: hidden;
}
.logo-stage.light { background: var(--paper); }
.logo-stage img.mark { width: 96px; height: 96px; border-radius: 21px; }
.logo-stage .lock { display: flex; align-items: center; gap: 16px; }
.logo-stage .lock .wm { font-family: var(--font-latin); font-weight: 700; font-size: 46px; letter-spacing: -0.04em; color: var(--warm-white); }
.logo-stage.light .lock .wm { color: var(--ink-900); }
.logo-stage .lock .wm .dot { color: var(--accent); }

.clearspace { position: relative; }
.clearspace .pad { position: absolute; inset: 0; outline: 1px dashed var(--accent-line); outline-offset: -28px; pointer-events: none; }

.misuse .ex { display: flex; flex-direction: column; gap: 10px; }
.misuse .frame { aspect-ratio: 16/10; display: grid; place-items: center; border-radius: var(--radius-lg);
  border: 1px solid var(--line); background: var(--ink-800); position: relative; overflow: hidden; }
.misuse .tag { display: inline-flex; align-items: center; gap: 6px; font: var(--type-label); }
.misuse .tag.no { color: var(--danger-400); }
.misuse .tag.no::before { content: "✕"; }

/* ===========================================================================
   4 — COLOR
   =========================================================================== */
.swatch-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 2px;
  border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--line); }
.swatch { aspect-ratio: 3/4; padding: 12px; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; }
.swatch .nm { font: var(--type-caption); font-family: var(--font-latin); font-weight: 600; }
.swatch .hx { font-family: var(--font-mono); font-size: 10px; opacity: 0.7; }

.grad-tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-4); }
.grad-tile { height: 120px; border-radius: var(--radius-lg); border: 1px solid var(--line); position: relative;
  display: flex; align-items: flex-end; padding: 14px; }
.grad-tile .nm { font: var(--type-label); font-family: var(--font-mono); color: var(--text-on-spark);
  background: rgba(0,0,0,0.18); padding: 3px 8px; border-radius: 6px; }
.grad-tile.night .nm, .grad-tile.twotone .nm { color: var(--warm-white); }

.role-list { display: grid; gap: 10px; }
.role { display: flex; align-items: center; gap: 14px; padding: 12px 14px; background: var(--ink-800);
  border: 1px solid var(--line); border-radius: var(--radius-md); }
.role .chip { width: 38px; height: 38px; border-radius: 10px; flex: none; border: 1px solid var(--line-strong); }
.role .meta { display: flex; flex-direction: column; }
.role .meta .nm { font-weight: var(--fw-medium); }
.role .meta .vr { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-faint); }

/* ===========================================================================
   5 — TYPE
   =========================================================================== */
.type-spec { border: 1px solid var(--line); border-radius: var(--radius-xl); overflow: hidden; }
.type-spec .row { padding: var(--space-6); border-bottom: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 8px; }
.type-spec .row:last-child { border-bottom: 0; }
.type-spec .meta { display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap; }
.type-spec .meta .role { all: unset; font: var(--type-caption); letter-spacing: var(--ls-caps); text-transform: uppercase; color: var(--accent); font-family: var(--font-latin); }
.type-spec .meta .spec { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-faint); }
.type-spec .sample { color: var(--text-primary); }

.font-card { padding: var(--space-6); }
.font-card .big { font-size: 64px; line-height: 1; margin-bottom: 14px; }
.font-card .name { font-family: var(--font-latin); font-weight: 600; font-size: var(--text-lg); }
.font-card .use { color: var(--text-muted); font: var(--type-caption); }
.font-card .glyphs { margin-top: 14px; color: var(--text-secondary); font-size: var(--text-xl); letter-spacing: 0.02em; }

/* ===========================================================================
   6 — VOICE
   =========================================================================== */
.voice-pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5); }
.voice-col h4 { margin: 0 0 var(--space-4); display: flex; align-items: center; gap: 8px; font: var(--type-heading); }
.voice-col.do h4 { color: var(--success-400); }
.voice-col.dont h4 { color: var(--danger-400); }
.voice-col .item { padding: 14px 16px; border-radius: var(--radius-md); margin-bottom: 10px; line-height: var(--lh-normal); }
.voice-col.do .item { background: var(--success-bg); border: 1px solid rgba(78,201,138,0.25); }
.voice-col.dont .item { background: var(--danger-bg); border: 1px solid rgba(240,104,95,0.22); color: var(--text-secondary); }
.voice-col .item .tr { display: block; margin-top: 6px; font-size: var(--text-sm); color: var(--text-faint); font-family: var(--font-latin); }

.tone-bars { display: grid; gap: 14px; }
.tone-bar { display: grid; grid-template-columns: 130px 1fr 130px; align-items: center; gap: 14px; }
.tone-bar .end { font-size: var(--text-sm); }
.tone-bar .end.r { text-align: start; color: var(--text-faint); }
.tone-bar .end.l { text-align: end; color: var(--text-primary); font-weight: var(--fw-medium); }
.tone-bar .track { height: 6px; background: var(--ink-700); border-radius: 999px; position: relative; }
.tone-bar .track .fill { position: absolute; inset-inline-end: 0; top: 0; bottom: 0; border-radius: 999px; background: var(--grad-spark); }
.tone-bar .track .dot { position: absolute; top: 50%; width: 14px; height: 14px; border-radius: 50%;
  background: var(--warm-white); transform: translate(50%, -50%); box-shadow: var(--glow-spark); }

.lexicon { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--line); }
.lexicon .head { background: var(--ink-700); padding: 10px 16px; font: var(--type-caption); letter-spacing: var(--ls-caps);
  text-transform: uppercase; color: var(--text-faint); font-family: var(--font-latin); }
.lexicon .cell { background: var(--ink-850); padding: 12px 16px; font-size: var(--text-md); }
.lexicon .cell.bad { color: var(--text-muted); text-decoration: line-through; text-decoration-color: var(--danger-400); }
.lexicon .cell.good { color: var(--text-primary); font-weight: var(--fw-medium); }

/* ===========================================================================
   7 — SOUND
   =========================================================================== */
.sound-hero {
  background: radial-gradient(70% 90% at 50% 0%, rgba(255,122,89,0.12), transparent 70%), var(--ink-900);
  border: 1px solid var(--line); border-radius: var(--radius-2xl); padding: var(--space-9);
  text-align: center; position: relative; overflow: hidden;
}
.play-spark {
  width: 132px; height: 132px; border-radius: 32px; border: 0; cursor: pointer; margin: 0 auto var(--space-6);
  display: grid; place-items: center; background: var(--ink-850);
  box-shadow: var(--glow-spark); position: relative; transition: transform var(--dur-base) var(--ease-out);
}
.play-spark:hover { transform: translateY(-3px); }
.play-spark:active { transform: scale(0.97); }
.play-spark img { width: 76px; height: 76px; }
.play-spark .ring { position: absolute; inset: 0; border-radius: 32px; border: 2px solid var(--accent); opacity: 0; }
.play-spark.playing .ring { animation: sparkring 1.1s var(--ease-out) forwards; }
@keyframes sparkring {
  0% { opacity: 0.8; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.5); }
}
.sound-hero h3 { margin: 0 0 8px; font: var(--type-title); }
.sound-hero p { margin: 0 auto; max-width: 48ch; color: var(--text-secondary); line-height: var(--lh-relaxed); }
.sound-hint { margin-top: 14px; font: var(--type-caption); color: var(--text-faint); font-family: var(--font-latin); }

.sound-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-4); margin-top: var(--space-7); }
.sound-cue {
  display: flex; align-items: center; gap: 16px; padding: var(--space-5);
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  cursor: pointer; text-align: start; transition: all var(--dur-base) var(--ease-out); width: 100%;
}
.sound-cue:hover { border-color: var(--accent-line); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.sound-cue .play {
  width: 52px; height: 52px; flex: none; border-radius: var(--radius-md);
  display: grid; place-items: center; background: var(--bg-elevated); color: var(--accent);
  border: 1px solid var(--line); transition: all var(--dur-base) var(--ease-out);
}
.sound-cue:hover .play { background: var(--grad-spark); color: var(--text-on-spark); border-color: transparent; }
.sound-cue .play svg { width: 22px; height: 22px; }
.sound-cue .info .nm { font: var(--type-heading); margin-bottom: 2px; }
.sound-cue .info .ds { font: var(--type-caption); color: var(--text-muted); line-height: 1.5; }
.sound-cue .info .nm .en { font-family: var(--font-latin); color: var(--text-faint); font-size: var(--text-xs); font-weight: 500; margin-inline-start: 6px; }

/* live animated waveform shown while a cue plays */
.wave { display: flex; align-items: center; gap: 3px; height: 26px; margin-inline-start: auto; }
.wave i { width: 3px; height: 6px; background: var(--accent-line); border-radius: 2px; transition: height var(--dur-fast) ease; }
.sound-cue.playing .wave i { background: var(--accent); }

.sound-princ { display: grid; grid-template-columns: repeat(3,1fr); gap: var(--space-4); margin-top: var(--space-7); }
.sound-princ .p { padding: var(--space-5); background: var(--ink-800); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.sound-princ .p h4 { margin: 0 0 6px; font: var(--type-heading); }
.sound-princ .p p { margin: 0; font: var(--type-caption); color: var(--text-muted); line-height: 1.6; }

/* ===========================================================================
   8 — PRODUCT UI
   =========================================================================== */
.demo-stage {
  background: var(--grad-night); border: 1px solid var(--line); border-radius: var(--radius-xl);
  padding: var(--space-7); display: flex; flex-direction: column; gap: var(--space-5);
}
.demo-row { display: flex; gap: var(--space-4); align-items: center; flex-wrap: wrap; }
.demo-caption { font: var(--type-caption); color: var(--text-faint); font-family: var(--font-latin);
  letter-spacing: var(--ls-caps); text-transform: uppercase; }

.ui-princ { display: grid; gap: 12px; }
.ui-princ .p { display: flex; gap: 14px; padding: 16px; background: var(--ink-800); border: 1px solid var(--line); border-radius: var(--radius-md); }
.ui-princ .p .ic { width: 32px; height: 32px; flex: none; color: var(--accent); }
.ui-princ .p h4 { margin: 0 0 4px; font: var(--type-heading); }
.ui-princ .p p { margin: 0; color: var(--text-secondary); line-height: var(--lh-normal); }

/* ===========================================================================
   9 — IMAGERY / ICON
   =========================================================================== */
.spark-forms { display: grid; grid-template-columns: repeat(2,1fr); gap: var(--space-4); }
.spark-form { aspect-ratio: 4/3; display: grid; place-items: center; gap: 10px; background: var(--ink-850);
  border: 1px solid var(--line); border-radius: var(--radius-lg); position: relative; }
.spark-form .glow { filter: drop-shadow(var(--glow-spark-lg)); }
.spark-form .cap { position: absolute; inset-inline: 14px; bottom: 12px; text-align: center; font: var(--type-caption);
  color: var(--text-faint); font-family: var(--font-latin); }

.icon-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--space-3); }
.icon-cell { aspect-ratio: 1; display: grid; place-items: center; background: var(--ink-800);
  border: 1px solid var(--line); border-radius: var(--radius-md); color: var(--text-secondary); }
.icon-cell svg { width: 26px; height: 26px; }

.emoji-tiles { display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--space-3); }
.emoji-tile { aspect-ratio: 1; display: grid; place-items: center; font-size: 30px; background: var(--ink-800);
  border: 1px solid var(--line); border-radius: var(--radius-md); }

/* ===========================================================================
   10 — APPLICATIONS
   =========================================================================== */
.app-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-5); }
.app { border-radius: var(--radius-xl); border: 1px solid var(--line); overflow: hidden; box-shadow: var(--shadow-md); }
.app .cap { padding: 12px 16px; font: var(--type-caption); color: var(--text-faint); font-family: var(--font-latin);
  letter-spacing: var(--ls-caps); text-transform: uppercase; background: var(--ink-850); border-top: 1px solid var(--line); }

.avatar-app { aspect-ratio: 1; display: grid; place-items: center; }
.story { aspect-ratio: 9/16; max-height: 420px; }

/* social profile mock */
.profile { aspect-ratio: 16/9; background: var(--grad-night); display: flex; flex-direction: column; }
.profile .banner { flex: 1; background:
  radial-gradient(50% 80% at 30% 0%, rgba(255,122,89,0.22), transparent), var(--ink-900);
  position: relative; }
.profile .av { position: absolute; inset-inline-start: 24px; bottom: -26px; width: 72px; height: 72px;
  border-radius: 18px; background: var(--ink-850); display: grid; place-items: center; border: 3px solid var(--ink-850); box-shadow: var(--glow-spark); }
.profile .av img { width: 44px; height: 44px; }
.profile .meta { padding: 36px 24px 20px; }
.profile .meta .h { font-family: var(--font-latin); font-weight: 700; font-size: 22px; letter-spacing: -0.02em; }
.profile .meta .h .dot { color: var(--accent); }
.profile .meta .b { color: var(--text-muted); font-size: var(--text-md); margin-top: 4px; }

/* the "made on actual" badge */
.made-badge { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px;
  background: var(--ink-850); border: 1px solid var(--accent-line); color: var(--text-secondary); font: var(--type-label); }
.made-badge .spk { color: var(--accent); }
.made-badge .wm { font-family: var(--font-latin); color: var(--warm-white); font-weight: 600; }
.made-badge .wm .dot { color: var(--accent); }

/* closing */
.closing { text-align: center; background: var(--grad-night); }
.closing .spark-end { width: 64px; height: 64px; margin: 0 auto var(--space-5); filter: drop-shadow(var(--glow-spark-lg)); }
.closing h2 { font: var(--type-display); margin: 0 0 12px; }
.closing p { color: var(--text-muted); }

/* ===========================================================================
   RESPONSIVE
   =========================================================================== */
@media (max-width: 940px) {
  .sidenav { display: none; }
  section { padding: var(--space-9) var(--space-6); }
  .cols-2, .cols-3, .cols-4, .voice-pair, .grad-tiles, .sound-grid, .sound-princ,
  .spark-forms, .app-grid, .lexicon { grid-template-columns: 1fr; }
  .tone-bar { grid-template-columns: 90px 1fr 90px; }
  .icon-grid, .emoji-tiles { grid-template-columns: repeat(4,1fr); }
}

/* ===========================================================================
   PRINT — preserve the dark, brand-true look; clean page breaks
   =========================================================================== */
@media print {
  .sidenav, .cover .scrollcue, .sound-hint { display: none !important; }
  html, body { background: var(--ink-950) !important; }
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  section { page-break-inside: avoid; break-inside: avoid; padding: 40px 48px; border-bottom: 1px solid var(--line); }
  .cover { min-height: auto; padding: 60px 48px; }
  .sound-cue, .card, .app { break-inside: avoid; }
  h2, h3, h4 { break-after: avoid; }
}
