/* The Temple of Records — visual system, built from Mina's Figma export */
:root {
  --bg: #0B1414;
  --stone: #162322;
  --stone-2: #1C2C2A;
  --paper: #E7D6AF;
  --paper-ink: #251F15;
  --gold: #D7B776;
  --gold-dim: #A8874A;
  --muted: #B4BEB4;
  --teal: #89CFC3;
  --line: #65583B;
  --text: #E8E2D2;
  --text-dim: #B9B29E;
  --hairline: rgba(215, 183, 118, .28);
  --display-en: 'Cinzel', serif;
  --body-en: 'Inter', system-ui, sans-serif;
  --display-ar: 'Aref Ruqaa', serif;
  --body-ar: 'IBM Plex Sans Arabic', 'Tajawal', system-ui, sans-serif;
  --mono: 'JetBrains Mono', monospace;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body-en);
  font-size: 16px;
  line-height: 1.65;
}
[lang-ar] body, body.ar { font-family: var(--body-ar); }

.container { max-width: 1200px; margin-inline: auto; padding-inline: 24px; }

/* Header */
header.site {
  border-bottom: 1px solid var(--hairline);
  background: rgba(11, 20, 20, .92);
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(6px);
}
header.site .bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding-block: 14px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand svg { width: 26px; height: 26px; color: var(--gold); flex: none; }
.brand .name {
  font-family: var(--display-en); font-size: 17px; letter-spacing: 3px; color: var(--text);
  white-space: nowrap;
}
body.ar .brand .name { font-family: var(--display-ar); letter-spacing: 0; font-size: 19px; }
.brand .tag {
  display: block; font-family: var(--body-en); font-size: 9px; letter-spacing: 2.4px;
  color: var(--muted); text-transform: uppercase;
}
body.ar .brand .tag { font-family: var(--body-ar); letter-spacing: .5px; font-size: 10px; text-transform: none; }
nav.main { display: flex; align-items: center; gap: 26px; }
nav.main a {
  color: var(--text-dim); text-decoration: none; font-size: 14px;
  transition: color .15s;
}
nav.main a:hover { color: var(--gold); }
nav.main a:focus-visible, .cta:focus-visible, .pill-lang:focus-visible {
  outline: 2px solid var(--gold); outline-offset: 3px;
}
.pill-lang {
  border: 1px solid var(--gold-dim); color: var(--gold);
  border-radius: 999px; padding: 5px 14px; font-size: 12.5px;
  text-decoration: none; letter-spacing: 1px; white-space: nowrap;
}

/* Hero */
.hero {
  position: relative; min-height: min(78vh, 780px);
  display: flex; align-items: center; justify-content: center;
  text-align: center; overflow: hidden;
  border-bottom: 1px solid var(--hairline);
}
.hero img.bg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center 22%;
}
.hero .scrim {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(11,20,20,.5) 0%, rgba(11,20,20,.28) 42%, rgba(11,20,20,.93) 100%);
}
.hero .content { position: relative; padding: 90px 24px 70px; max-width: 900px; }
.kicker {
  font-size: 11px; letter-spacing: 3px; color: var(--muted); text-transform: uppercase;
}
body.ar .kicker { font-size: 13px; letter-spacing: 1px; }
.hero h1 {
  font-family: var(--display-en); font-weight: 500;
  font-size: clamp(34px, 5vw, 60px); line-height: 1.25;
  color: var(--paper); margin: 18px 0 14px;
}
body.ar .hero h1 { font-family: var(--display-ar); font-weight: 700; line-height: 1.7; }
.hero .sub { color: var(--text-dim); font-size: 15px; }
.cta {
  display: inline-block; margin-top: 34px;
  background: var(--paper); color: var(--paper-ink);
  font-size: 13.5px; font-weight: 600;
  padding: 13px 34px; border-radius: 999px; text-decoration: none;
  border: 1px solid var(--gold-dim);
  transition: transform .15s, box-shadow .15s;
}
.cta:hover { transform: translateY(-1px); box-shadow: 0 6px 22px rgba(215,183,118,.25); }

/* Register sections */
section.register { padding: 72px 0 30px; }
.reg-head { border-bottom: 1px solid var(--hairline); padding-bottom: 14px; margin-bottom: 30px; }
.reg-head h2 {
  font-family: var(--display-en); font-weight: 500;
  font-size: clamp(24px, 3vw, 36px); color: var(--paper); letter-spacing: 2px; margin-top: 8px;
}
body.ar .reg-head h2 { font-family: var(--display-ar); letter-spacing: 0; }

/* Challenge card (stone tablet) */
.tablet {
  background: var(--stone); border: 1px solid var(--hairline);
  border-radius: 6px; overflow: hidden;
}
.tablet .scene { width: 100%; aspect-ratio: 21 / 5.2; object-fit: cover; display: block; object-position: center 30%; }
.tablet .body { padding: 26px 30px 30px; }
.labels { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.chip {
  font-size: 10.5px; letter-spacing: 1.6px; text-transform: uppercase;
  color: var(--muted); border: 1px solid var(--hairline);
  padding: 4px 12px; border-radius: 999px;
}
.chip.gold { color: var(--gold); border-color: var(--gold-dim); }
body.ar .chip { letter-spacing: .4px; font-size: 11.5px; }
.tablet h3 {
  font-family: var(--display-en); font-weight: 500; font-size: clamp(19px, 2.2vw, 27px);
  line-height: 1.45; color: var(--paper); margin-bottom: 16px;
}
body.ar .tablet h3 { font-family: var(--display-ar); font-weight: 700; }
.meta { display: flex; align-items: center; gap: 8px; color: var(--text-dim); font-size: 13px; }
.meta svg { width: 18px; height: 18px; color: var(--gold-dim); flex: none; }

/* Papyrus cards */
.scrolls { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.papyrus {
  background: var(--paper); color: var(--paper-ink);
  border-radius: 4px; padding: 26px 28px 22px;
  border: 1px solid #C8B58C;
  box-shadow: inset 0 0 60px rgba(120, 90, 40, .18);
  display: flex; flex-direction: column; gap: 10px;
}
.papyrus .ph { display: flex; align-items: center; gap: 8px; font-size: 10.5px; letter-spacing: 1.6px; text-transform: uppercase; color: #8A744A; }
body.ar .papyrus .ph { letter-spacing: .4px; font-size: 11.5px; }
.papyrus .ph svg { width: 18px; height: 18px; }
.papyrus h3 { font-family: var(--display-en); font-weight: 600; font-size: 21px; letter-spacing: 1px; }
body.ar .papyrus h3 { font-family: var(--display-ar); font-weight: 700; letter-spacing: 0; }
.papyrus p { font-size: 14px; color: #5A4B32; }
.papyrus .foot { margin-top: auto; padding-top: 12px; border-top: 1px solid rgba(120, 90, 40, .3); font-size: 12px; color: #8A744A; }

/* About teaser */
.about-teaser { padding: 80px 0 90px; }
.about-teaser .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
.about-teaser img { width: 100%; border-radius: 6px; border: 1px solid var(--hairline); display: block; }
.about-teaser h2 {
  font-family: var(--display-en); font-weight: 500; color: var(--paper);
  font-size: clamp(22px, 2.6vw, 30px); letter-spacing: 2px; margin-bottom: 16px;
}
body.ar .about-teaser h2 { font-family: var(--display-ar); letter-spacing: 0; }
.about-teaser p { color: var(--text-dim); font-size: 15px; max-width: 46ch; }
.more { display: inline-block; margin-top: 18px; color: var(--gold); text-decoration: none; font-size: 14px; }
.more:hover { text-decoration: underline; }

/* Footer */
footer.site { border-top: 1px solid var(--hairline); padding: 40px 0 34px; text-align: center; }
footer.site .mark { color: var(--gold); }
footer.site .mark svg { width: 30px; height: 30px; }
footer.site .motto { font-family: var(--display-en); color: var(--paper); letter-spacing: 2px; margin: 10px 0 4px; font-size: 15px; }
body.ar footer.site .motto { font-family: var(--display-ar); letter-spacing: 0; font-size: 18px; }
footer.site .who { color: var(--text-dim); font-size: 12.5px; }
footer.site nav { margin-top: 14px; display: flex; gap: 22px; justify-content: center; }
footer.site nav a { color: var(--muted); font-size: 12.5px; text-decoration: none; }
footer.site nav a:hover { color: var(--gold); }
footer.site .note { margin-top: 16px; font-size: 11px; color: #6B705E; }

@media (max-width: 760px) {
  header.site .bar { flex-wrap: wrap; row-gap: 6px; }
  nav.main { gap: 16px; margin-inline-start: auto; }
  nav.main a { font-size: 12.5px; }
  .pill-lang { padding: 4px 10px; }
  .brand .tag { display: none; }
  .hero { min-height: min(64vh, 560px); }
  .scrolls { grid-template-columns: 1fr; }
  .about-teaser .grid { grid-template-columns: 1fr; gap: 26px; }
  .tablet .scene { aspect-ratio: 21 / 9; }
  section.register { padding: 52px 0 20px; }
}

/* Readable Arabic for card titles and small headings (display Ruqaa stays for hero/section/motto) */
body.ar .tablet h3, body.ar .papyrus h3, body.ar .toc, body.ar .papyrus-reader h2,
body.ar .papyrus-reader p, body.ar .callout, body.ar .gate h2, body.ar .about-cards h3 {
  font-family: var(--body-ar);
}
body.ar .tablet h3, body.ar .papyrus h3, body.ar .about-cards h3 { font-weight: 600; }

/* Inner pages */
.crumb { font-size: 12px; color: var(--text-dim); padding: 18px 0 0; }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--gold); }
.pagehead { padding: 22px 0 34px; }
.pagehead .banner {
  width: 100%; aspect-ratio: 21 / 4.6; object-fit: cover; display: block;
  border: 1px solid var(--hairline); border-radius: 6px; margin-bottom: 26px; object-position: center 35%;
}
.pagehead h1 {
  font-family: var(--display-en); font-weight: 500; color: var(--paper);
  font-size: clamp(26px, 3.4vw, 40px); letter-spacing: 1.5px; line-height: 1.4; margin: 10px 0 8px;
}
body.ar .pagehead h1 { font-family: var(--display-ar); letter-spacing: 0; }
.pagehead .meta-line { color: var(--text-dim); font-size: 13.5px; }

.detail-grid { display: grid; grid-template-columns: 300px 1fr; gap: 34px; padding-bottom: 60px; align-items: start; }
.toc {
  background: var(--stone); border: 1px solid var(--hairline); border-radius: 6px;
  padding: 20px 22px; position: sticky; top: 86px;
}
.toc .toc-title { font-size: 10.5px; letter-spacing: 2px; color: var(--muted); text-transform: uppercase; margin-bottom: 12px; }
body.ar .toc .toc-title { letter-spacing: .5px; font-size: 12px; }
.toc a { display: block; color: var(--text-dim); text-decoration: none; font-size: 13.5px; padding: 6px 0; }
.toc a:hover { color: var(--gold); }
.toc .toc-meta { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--hairline); display: flex; gap: 8px; align-items: center; color: var(--text-dim); font-size: 12.5px; }
.toc .toc-meta svg { width: 18px; height: 18px; color: var(--gold-dim); }

.prose h2 {
  font-family: var(--display-en); font-weight: 500; color: var(--paper);
  font-size: 21px; letter-spacing: 1.5px; margin: 34px 0 12px;
}
body.ar .prose h2 { font-family: var(--display-ar); letter-spacing: 0; font-size: 24px; }
.prose p { color: var(--text-dim); font-size: 15px; margin-bottom: 14px; max-width: 68ch; }
.prose ol { color: var(--text-dim); font-size: 15px; padding-inline-start: 22px; }
.prose ol li { margin-bottom: 6px; }

.stone-panel {
  background: var(--stone); border: 1px solid var(--hairline); border-radius: 6px;
  padding: 18px 20px; margin: 14px 0;
}
.codeblock { background: #0E1A19; border: 1px solid var(--hairline); border-radius: 6px; overflow: hidden; margin: 14px 0; }
.codeblock .cb-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 14px; border-bottom: 1px solid var(--hairline);
  font-size: 10.5px; letter-spacing: 1.6px; color: var(--muted); text-transform: uppercase;
}
.codeblock .copy-btn {
  background: none; border: 1px solid var(--gold-dim); color: var(--gold);
  font-size: 11px; padding: 3px 12px; border-radius: 999px; cursor: pointer; font-family: inherit;
}
.codeblock .copy-btn:hover { background: rgba(215,183,118,.12); }
.codeblock .copy-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.codeblock pre {
  direction: ltr; text-align: left; unicode-bidi: isolate;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.7;
  color: #C8D6C9; padding: 14px 16px; overflow-x: auto; margin: 0;
}
.codeblock pre .cm { color: #7C8A6F; }
.codeblock pre .pr { color: var(--gold); }

/* Spoiler gate */
.gate { margin: 44px 0 20px; border: 1px solid var(--hairline); border-radius: 6px; overflow: hidden; }
.gate .gate-visual { position: relative; }
.gate .gate-visual img { width: 100%; aspect-ratio: 21/7; object-fit: cover; display: block; object-position: center 40%; }
.gate .gate-visual .gate-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px;
  background: rgba(11,20,20,.45); text-align: center; padding: 20px;
}
.gate h2 { font-family: var(--display-en); font-weight: 500; color: var(--paper); font-size: clamp(20px, 2.6vw, 30px); letter-spacing: 2px; }
body.ar .gate h2 { font-family: var(--display-ar); letter-spacing: 0; }
.gate .seal-btn {
  background: var(--paper); color: var(--paper-ink); border: 1px solid var(--gold-dim);
  font-size: 13.5px; font-weight: 600; padding: 12px 30px; border-radius: 999px;
  cursor: pointer; font-family: inherit;
}
.gate .seal-btn:hover { box-shadow: 0 6px 22px rgba(215,183,118,.25); }
.gate .seal-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.walkthrough { padding: 26px 30px 30px; background: var(--stone); }
.callout {
  border-inline-start: 3px solid var(--muted);
  background: var(--stone-2); padding: 14px 18px; margin: 16px 0;
  font-size: 13.5px; color: var(--text-dim);
}
.callout .callout-title { font-size: 10.5px; letter-spacing: 2px; color: var(--muted); text-transform: uppercase; display: block; margin-bottom: 4px; }
body.ar .callout .callout-title { letter-spacing: .5px; font-size: 12px; }

/* Article reading panel */
.papyrus-reader {
  background: var(--paper); color: var(--paper-ink);
  border: 1px solid #C8B58C; border-radius: 6px;
  box-shadow: inset 0 0 80px rgba(120, 90, 40, .16);
  padding: 34px 40px 30px;
}
.papyrus-reader .notice { font-size: 13.5px; color: #6B5836; margin-bottom: 20px; }
.papyrus-reader h2 {
  font-family: var(--display-en); font-weight: 600; font-size: 20px; letter-spacing: 1.2px;
  color: var(--paper-ink); margin: 26px 0 10px;
}
.papyrus-reader p { font-size: 14.5px; color: #4A3D28; margin-bottom: 12px; }
.chips-inline {
  direction: ltr; unicode-bidi: isolate;
  display: inline-block; background: rgba(120, 90, 40, .16);
  font-family: var(--mono); font-size: 12px; color: #5A4B32;
  padding: 4px 12px; border-radius: 4px; margin: 4px 0;
}

/* About page */
.about-hero { display: grid; grid-template-columns: 340px 1fr; gap: 40px; align-items: center; padding: 26px 0 40px; }
.about-hero img { width: 100%; border-radius: 6px; border: 1px solid var(--hairline); }
.about-hero h1 { font-family: var(--display-en); font-weight: 500; color: var(--paper); font-size: clamp(26px, 3.2vw, 38px); letter-spacing: 1.5px; margin: 8px 0 12px; }
body.ar .about-hero h1 { font-family: var(--display-ar); letter-spacing: 0; }
.about-hero p { color: var(--text-dim); font-size: 15px; max-width: 56ch; }
.about-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; padding-bottom: 40px; }
.about-cards .card { background: var(--stone); border: 1px solid var(--hairline); border-radius: 6px; padding: 20px 22px; }
.about-cards h3 { font-family: var(--display-en); font-weight: 500; color: var(--gold); font-size: 13px; letter-spacing: 2px; margin-bottom: 10px; }
.about-cards p { color: var(--text-dim); font-size: 13.5px; }
.contact-row { display: flex; flex-wrap: wrap; gap: 12px; padding-bottom: 70px; }
.contact-chip {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--hairline); border-radius: 999px; padding: 9px 18px;
  color: var(--text-dim); font-size: 13px; background: var(--stone);
}
.contact-chip svg { width: 16px; height: 16px; color: var(--gold-dim); }
.contact-chip .soon { color: var(--muted); font-size: 11px; }

@media (max-width: 760px) {
  .detail-grid { grid-template-columns: 1fr; }
  .toc { position: static; }
  .about-hero { grid-template-columns: 1fr; gap: 20px; }
  .about-cards { grid-template-columns: 1fr; }
  .papyrus-reader { padding: 22px 20px; }
  .pagehead .banner { aspect-ratio: 21 / 8; }
}

body.ar .pagehead.detail h1 {
  font-family: "IBM Plex Sans Arabic", sans-serif; font-weight: 700;
  letter-spacing: 0;
}

.detail-grid > * { min-width: 0; }
.codeblock pre { overflow-x: auto; }
.papyrus-reader, .toc { min-width: 0; }

/* Content editor (admin.html) */
.admin-note {
  border-inline-start: 3px solid var(--gold-dim); background: rgba(231,214,175,.05);
  padding: 14px 18px; border-radius: 6px; color: var(--text-dim); font-size: 14px; line-height: 2; margin: 16px 0 20px;
}
.admin-note strong { color: var(--paper); }
.ed-group h2 { font-family: var(--display-ar); color: var(--gold); font-size: 22px; margin: 34px 0 14px; letter-spacing: 0; }
.ed-row { border: 1px solid var(--hairline); border-radius: 8px; padding: 14px 16px; margin-bottom: 12px; background: rgba(231,214,175,.03); }
.ed-label { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.ed-field label { display: block; font-size: 11px; color: var(--gold-dim); margin-bottom: 4px; }
.ed-field input, .ed-field textarea {
  width: 100%; background: #0E1A19; border: 1px solid var(--hairline); border-radius: 6px;
  color: var(--paper); font-family: inherit; font-size: 14px; padding: 9px 11px; line-height: 1.7;
}
.ed-field input:focus, .ed-field textarea:focus { outline: 2px solid var(--gold-dim); outline-offset: 1px; }
.ed-field + .ed-field { margin-top: 10px; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 4px; align-items: center; }
.admin-actions .btn {
  background: var(--paper); color: var(--paper-ink); border: 1px solid var(--gold-dim);
  font-size: 13.5px; font-weight: 600; padding: 11px 24px; border-radius: 999px; cursor: pointer;
  font-family: inherit; text-decoration: none; display: inline-block;
}
.admin-actions .btn.ghost { background: none; color: var(--gold); }
.admin-actions .btn.ghost:hover { background: rgba(215,183,118,.12); }
.admin-actions .btn.danger { background: none; color: #C96A5A; border-color: #6B3A33; }
#status { min-height: 22px; color: var(--gold); font-size: 13px; margin: 6px 0 10px; }
footer.site .note a { color: var(--gold-dim); }
a.contact-chip { text-decoration: none; color: inherit; }
a.contact-chip.linked { border-color: var(--gold); }
a.contact-chip.linked:hover { background: rgba(215,183,118,.1); }

/* Mobile: keep the vault gate button fully inside the scene */
@media (max-width: 760px) {
  .gate .gate-visual img { aspect-ratio: auto; min-height: 220px; }
  .admin-actions .btn { padding: 10px 18px; font-size: 13px; }
}

/* Timeline (investigation chronology) */
.timeline { border-inline-start: 2px solid var(--gold-dim); margin: 16px 0; padding-inline-start: 18px; }
.tl-row { display: grid; grid-template-columns: 92px 1fr; gap: 12px; padding: 6px 0; align-items: baseline; }
.tl-t { font-family: var(--mono); direction: ltr; unicode-bidi: isolate; color: var(--gold); font-size: 13px; }
.tl-x { color: var(--text-dim); font-size: 14.5px; }
@media (max-width: 760px) { .tl-row { grid-template-columns: 68px 1fr; gap: 8px; } }

/* Figure inside articles/challenges */
figure.fig { margin: 18px 0; }
figure.fig img { width: 100%; border-radius: 6px; border: 1px solid var(--hairline); display: block; }
figure.fig figcaption { font-size: 12.5px; color: var(--text-dim); margin-top: 8px; }

/* Admin — collections editor */
.ed-item { border: 1px solid var(--hairline); border-radius: 8px; padding: 16px; margin-bottom: 14px; background: rgba(231,214,175,.03); }
.ed-item-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.ed-item-head h3 { font-size: 16px; color: var(--paper); font-family: var(--body-ar); letter-spacing: 0; }
.ed-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.mini { font: inherit; font-size: 12px; padding: 4px 10px; border-radius: 5px; border: 1px solid var(--hairline); background: none; color: var(--gold); cursor: pointer; }
.mini:hover { background: rgba(215,183,118,.12); }
.mini.warn { color: #C96A5A; border-color: #6B3A33; }
.ed-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ed-grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.ed-grid2 .ed-field, .ed-grid3 .ed-field { margin-top: 0; }
.ed-sec { border: 1px dashed var(--hairline); border-radius: 8px; padding: 12px; margin: 10px 0; }
.ed-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.ed-sec-type { font-size: 11.5px; color: var(--muted); letter-spacing: 1px; }
.ed-field select, .ed-field input[type="file"] { width: 100%; background: #0E1A19; border: 1px solid var(--hairline); border-radius: 6px; color: var(--text); padding: 8px 10px; font: inherit; font-size: 13.5px; }
.ed-field textarea.mono { direction: ltr; unicode-bidi: isolate; font-family: var(--mono); font-size: 12.5px; }
.ed-hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.ed-check { display: flex; align-items: center; gap: 8px; color: var(--text-dim); font-size: 13px; margin: 8px 0; }
.ed-add { display: flex; gap: 8px; align-items: center; margin: 12px 0; flex-wrap: wrap; }
.ed-imgprev { max-width: 180px; border-radius: 6px; border: 1px solid var(--hairline); display: block; margin-top: 6px; }
@media (max-width: 760px) { .ed-grid2, .ed-grid3 { grid-template-columns: 1fr; } }

/* Collection-rendered content contexts */
.prose ul { color: var(--text-dim); font-size: 15px; padding-inline-start: 22px; margin-bottom: 14px; }
.prose ul li { margin-bottom: 6px; }
.papyrus-reader ol, .papyrus-reader ul { color: #4A3D28; font-size: 14.5px; padding-inline-start: 22px; margin-bottom: 12px; }
.papyrus-reader ol li, .papyrus-reader ul li { margin-bottom: 6px; }
.papyrus-reader .timeline { border-color: #C8B58C; }
.papyrus-reader .tl-t { color: #8A744A; }
.papyrus-reader .tl-x { color: #4A3D28; }
.papyrus-reader .callout { background: rgba(120,90,40,.10); border: 1px solid #C8B58C; border-radius: 6px; padding: 14px 16px; margin-bottom: 16px; color: #4A3D28; font-size: 13.5px; }
.papyrus-reader .callout .callout-title { color: #8A744A; }
.papyrus-reader figure.fig img { border-color: #C8B58C; }
.papyrus-reader figure.fig figcaption { color: #6B5836; }

/* CTF challenge cards + regions */
.papyrus.ctf h3 a { text-decoration: none; color: inherit; }
.papyrus.ctf h3 a:hover { color: #7A5F28; }
.papyrus .ph .cid { font-family: var(--mono); direction: ltr; unicode-bidi: isolate; }
.solve-badge { margin-inline-start: auto; font-size: 11px; color: #8A744A; border: 1px solid rgba(120,90,40,.4); border-radius: 999px; padding: 2px 10px; }
.solve-badge.yes { color: #3F6B3A; border-color: #3F6B3A; font-weight: 600; }
.ctf-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; margin: 12px 0; font-size: 12.5px; color: #5A4B32; }
.ctf-meta span { border-top: 1px dotted rgba(120,90,40,.35); padding-top: 4px; }

.ctf-region { margin-top: 34px; }
.ctf-region h2 { font-family: var(--display-en); font-weight: 500; color: var(--gold); font-size: 21px; letter-spacing: 1.5px; margin-bottom: 12px; }
body.ar .ctf-region h2 { font-family: var(--display-ar); letter-spacing: 0; }
.muted-note { color: var(--text-dim); font-size: 12.5px; margin-top: 8px; }
.repo-link { color: var(--gold); direction: ltr; unicode-bidi: isolate; display: inline-block; }

table.artifacts { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--stone); border: 1px solid var(--hairline); border-radius: 6px; overflow: hidden; display: table; }
table.artifacts th { text-align: start; color: var(--gold-dim); font-weight: 600; font-size: 11.5px; letter-spacing: 1px; padding: 10px 12px; border-bottom: 1px solid var(--hairline); }
table.artifacts td { padding: 10px 12px; border-bottom: 1px solid rgba(215,183,118,.12); color: var(--text-dim); vertical-align: top; }
table.artifacts tr:last-child td { border-bottom: none; }
table.artifacts td.mono { font-family: var(--mono); direction: ltr; unicode-bidi: isolate; font-size: 12px; text-align: start; }
table.artifacts td.sha { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-mini { display: inline-block; font-size: 12px; padding: 4px 12px; border-radius: 5px; border: 1px solid var(--gold-dim); background: var(--gold); color: #241A08; text-decoration: none; margin: 2px 4px 2px 0; }
.btn-mini.ghost { background: none; color: var(--gold); }
.artifacts-wrap { overflow-x: auto; }

details.hint { border: 1px solid var(--hairline); border-radius: 6px; padding: 10px 14px; margin-bottom: 8px; background: var(--stone); }
details.hint summary { cursor: pointer; color: var(--gold); font-size: 13.5px; }
details.hint p { color: var(--text-dim); font-size: 13.5px; margin-top: 8px; }

.flag-form { display: flex; gap: 10px; flex-wrap: wrap; }
.flag-form input {
  flex: 1; min-width: 180px; background: #0E1A19; border: 1px solid var(--hairline); border-radius: 6px;
  color: var(--text); padding: 10px 14px; font-family: var(--mono); font-size: 14px;
}
.flag-form input#flag-name {
  font-family: inherit;
  flex: 0 1 230px;
}
.flag-form input:focus { outline: 2px solid var(--gold-dim); outline-offset: 1px; }
.flag-form .btn {
  font: inherit; font-size: 13.5px; padding: 10px 22px; border-radius: 6px;
  border: 1px solid var(--gold-dim); background: var(--gold); color: #241A08; cursor: pointer;
}
.flag-form .btn:disabled { opacity: .55; cursor: wait; }
.flag-format { color: var(--muted); font-size: 12px; margin-top: 8px; direction: ltr; unicode-bidi: isolate; text-align: start; }
.flag-status { min-height: 24px; font-size: 14px; margin-top: 8px; }
.flag-status.ok { color: #7FA86B; }
.flag-status.err { color: #C96A5A; }
.flag-status.load { color: var(--gold); }

/* Spinner & Loading Skeleton */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(215,183,118,0.25);
  border-radius: 50%;
  border-top-color: var(--gold);
  animation: tor-spin 0.75s linear infinite;
  vertical-align: middle;
  margin-inline-end: 6px;
}
@keyframes tor-spin { to { transform: rotate(360deg); } }

.skeleton-pulse {
  background: linear-gradient(90deg, rgba(215,183,118,0.06) 25%, rgba(215,183,118,0.2) 50%, rgba(215,183,118,0.06) 75%);
  background-size: 200% 100%;
  animation: tor-shimmer 1.5s infinite;
  display: inline-block;
}
@keyframes tor-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.solvers-section { margin-top: 18px; padding: 14px 18px; background: var(--stone); border: 1px solid var(--hairline); border-radius: 8px; }
.solvers-title { font-size: 13.5px; color: var(--gold); margin-bottom: 10px; font-weight: 600; }
.solvers-list { display: flex; flex-wrap: wrap; gap: 8px; }
.solver-badge { display: inline-flex; align-items: center; gap: 6px; background: var(--stone-2); border: 1px solid var(--hairline); color: var(--paper); padding: 4px 12px; border-radius: 999px; font-size: 13px; }
.solver-badge .ts { color: var(--muted); font-size: 11px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 760px) {
  .ctf-meta { grid-template-columns: 1fr; }
  table.artifacts td.sha { max-width: 90px; }
}
.artifacts-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.artifacts-wrap table.artifacts { min-width: 660px; }


/* ===== v5 design-fidelity layer (Figma "The Temple of Records") ===== */
:root {
  --tex: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .62 0 0 0 0 .72 0 0 0 0 .64 0 0 0 .10 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --frieze: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='108' height='36' viewBox='0 0 108 36' fill='none' stroke='%23A8874A' stroke-width='1.3'%3E%3Cpath d='M6 18c3-4.5 6-6 9-6s6 1.5 9 6c-3 4.5-6 6-9 6s-6-1.5-9-6z'/%3E%3Ccircle cx='15' cy='18' r='2'/%3E%3Cpath d='M66 9h24M69 9v3h18V9M72 12v14M84 12v14M69 26h18v3H69z'/%3E%3C/svg%3E");
}
header.site {
  background: #12201F var(--tex);
  border-top: 3px solid var(--gold-dim);
  backdrop-filter: none;
}
nav.main { gap: 8px; }
nav.main a { padding: 7px 16px; border-radius: 999px; }
nav.main a.pill-lang { padding: 5px 14px; margin-inline-start: 18px; }
nav.main a[aria-current="page"] { background: var(--gold); color: #1B1409; font-weight: 600; }
nav.main a[aria-current="page"]:hover { color: #1B1409; }
footer.site { position: relative; background: #12201F var(--tex); border-top: 0; padding-top: 74px; margin-top: 48px; }
footer.site::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 36px; margin-top: 10px; background: var(--frieze) repeat-x center; opacity: .85; }
footer.site::after { content: ""; position: absolute; inset: 56px 0 auto 0; height: 1px; max-width: 1152px; margin-inline: auto; background: var(--hairline); }
.papyrus h3 a { color: inherit; text-decoration: none; }
.papyrus h3 a:hover, .papyrus h3 a:focus-visible { text-decoration: underline; text-decoration-color: var(--gold-dim); }
.papyrus {
  background-color: var(--paper);
  background-image: var(--tex), linear-gradient(#A8874A, #A8874A), linear-gradient(#A8874A, #A8874A);
  background-size: 220px 220px, calc(100% - 20px) 5px, calc(100% - 20px) 5px;
  background-position: 0 0, 10px 8px, 10px calc(100% - 8px);
  background-repeat: repeat, no-repeat, no-repeat;
  padding-block: 34px;
}
.tablet { background-color: var(--stone); background-image: var(--tex); }
.about-cards .card, .tablet, .pagehead .head-panel { background-image: var(--tex); }
/* list-page headings: full-bleed banner with a centered title panel */
.pagehead:not(.detail) { padding-top: 0; }
.pagehead:not(.detail) .banner { width: 100vw; max-width: none; margin-inline: calc(50% - 50vw); height: clamp(200px, 24vw, 340px); aspect-ratio: auto; object-fit: cover; border-radius: 0; border: 0; display: block; }
.pagehead:not(.detail) .head-panel { position: relative; max-width: 1000px; margin: -64px auto 26px; padding: 26px 24px 22px; text-align: center; background-color: #14231F; border: 1px solid var(--hairline); border-radius: 28px; }
.pagehead:not(.detail) .head-panel .kicker { display: none; }
.pagehead:not(.detail) .head-panel h1 { color: var(--gold); margin: 0 0 8px; }
.crumb + .pagehead:not(.detail) { padding-top: 14px; }
/* home: scribe teaser */
.scribe { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 44px; align-items: center; padding: 20px 0 50px; }
.scribe img { width: 100%; display: block; border: 1px solid var(--hairline); }
.scribe h2 { font-family: var(--display-en); font-weight: 500; color: var(--gold); font-size: clamp(24px, 3vw, 34px); letter-spacing: 1.5px; margin-bottom: 14px; }
body.ar .scribe h2 { font-family: var(--display-ar); letter-spacing: 0; }
.scribe p { color: var(--text); font-size: 15px; max-width: 54ch; margin-bottom: 14px; }
.scribe a.more { color: #7FD0C4; font-size: 14px; text-decoration: none; }
.scribe a.more:hover { text-decoration: underline; }
.hero { min-height: 520px; display: flex; align-items: center; justify-content: center; text-align: center; }
.hero .content { margin-inline: auto; }
.hero h1 { font-size: clamp(34px, 5vw, 56px); }
/* about: large portrait */
.about-hero { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 56px; }
.about-hero img { border-radius: 0; }
@media (max-width: 760px) {
  .scribe, .about-hero { grid-template-columns: 1fr; gap: 22px; }
  .pagehead:not(.detail) .head-panel { margin-top: -40px; border-radius: 22px; }
  nav.main a { padding: 6px 10px; }
  nav.main a.pill-lang { margin-inline-start: 4px; }
}
body { overflow-x: clip; }
nav.main a.pill-lang[aria-current] { background: transparent; color: var(--gold); font-weight: 400; }

/* v5 list pages */
.rec-list { display: grid; gap: 22px; grid-template-columns: 1fr; }
.rec-row .scene { aspect-ratio: 21 / 5; }
.rec-row h3 a { color: inherit; text-decoration: none; }
.rec-row .rec-ex { color: var(--muted, #b9b19c); font-size: 14.5px; margin: 8px 0 0; max-width: 70ch; }
.rec-row .rec-meta { margin-top: 14px; font-size: 13px; color: var(--gold-dim, #b89b55); }
.rec-row[hidden] { display: none; }
.list-intro { margin: 8px 0 18px; font-size: 15px; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; padding: 12px 18px; margin-bottom: 22px; border: 1px solid rgba(201,162,75,.35); border-radius: 4px; background-image: var(--tex); font-size: 13px; }
.f-btn { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 4px 2px; border-bottom: 1px solid transparent; }
.f-btn.on, .f-btn:hover { color: var(--gold, #c9a24b); border-bottom-color: currentColor; }
.f-note { margin-inline-start: auto; opacity: .8; }
.list-end { text-align: center; margin: 46px 0 10px; opacity: .85; font-size: 13px; }
.list-end svg { width: 34px; height: 34px; color: var(--gold, #c9a24b); display: block; margin: 0 auto 8px; }
#listing.scrolls .papyrus h3 { font-size: 26px; }
#listing.scrolls .papyrus { padding: 30px 32px 24px; min-height: 230px; }
/* v5 challenge detail panel (design: content sits in a stone card) */
.detail-grid > .prose { background-color: var(--stone); background-image: var(--tex); border: 1px solid var(--hairline); border-radius: 6px; padding: 28px 32px; min-width: 0; }
@media (max-width: 640px) { .detail-grid > .prose { padding: 20px 16px; } }

/* v5 about */
.about-hero { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 56px; padding: 0 0 56px; align-items: stretch; }
.about-hero img { height: 100%; min-height: 380px; max-height: 560px; object-fit: cover; object-position: center 25%; }
.about-hero > div { align-self: center; }
.sec-kick { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--teal, #5fb3a8); margin: 10px 0 6px; }
body.ar .sec-kick { letter-spacing: 0; font-size: 12px; }
.sec-h { font-family: var(--display-en); font-weight: 500; color: var(--gold); font-size: clamp(22px, 2.6vw, 30px); letter-spacing: 1px; padding-bottom: 12px; margin-bottom: 22px; border-bottom: 1px solid var(--hairline); }
body.ar .sec-h { font-family: 'IBM Plex Sans Arabic', var(--display-ar); font-weight: 700; letter-spacing: 0; }
.about-cards .card .ci { width: 24px; height: 24px; color: var(--gold); display: block; margin-bottom: 10px; }
.cred-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 40px; }
.pill-ph { border: 1px solid var(--hairline); border-radius: 40px; padding: 22px 26px; text-align: center; color: var(--text-dim); font-size: 14px; }
.pill-ph.wide { grid-column: 1 / -1; }

/* Honors & Achievements Grid */
.honor-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; margin-bottom: 44px; }
.honor-card { background: var(--stone); background-image: var(--tex); border: 1px solid var(--hairline); border-radius: 8px; padding: 20px 22px; position: relative; transition: border-color .25s, transform .2s; }
.honor-card:hover { border-color: var(--gold); transform: translateY(-2px); }
.honor-card .rank-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; letter-spacing: 1px; color: var(--gold); background: rgba(215,183,118,.12); border: 1px solid rgba(215,183,118,.3); padding: 4px 10px; border-radius: 20px; margin-bottom: 12px; }
body.ar .honor-card .rank-badge { letter-spacing: 0; font-size: 12px; }
.honor-card h3 { font-family: var(--display-en); font-size: 16px; color: var(--paper); margin: 0 0 6px; font-weight: 600; }
body.ar .honor-card h3 { font-family: 'IBM Plex Sans Arabic', var(--display-ar); font-size: 16px; font-weight: 700; }
.honor-card p { font-size: 13px; color: var(--text-dim); margin: 0; line-height: 1.55; }

/* Certifications Grid */
.cert-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin-bottom: 44px; }
.cert-item { background: var(--stone); background-image: var(--tex); border: 1px solid var(--hairline); border-radius: 6px; padding: 14px 18px; display: flex; align-items: center; gap: 14px; transition: border-color .2s; }
.cert-item:hover { border-color: var(--gold-dim); }
.cert-code { font-family: 'JetBrains Mono', monospace; font-size: 12px; font-weight: 700; color: var(--gold); background: rgba(215,183,118,.15); padding: 4px 8px; border-radius: 4px; white-space: nowrap; }
.cert-info { min-width: 0; }
.cert-name { font-size: 13.5px; color: var(--paper); font-weight: 500; margin-bottom: 2px; }
.cert-issuer { font-size: 11.5px; color: var(--text-dim); }

/* Mobile Navigation Drawer */
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--hairline);
  color: var(--gold);
  border-radius: 6px;
  padding: 6px 9px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: border-color .2s, background .2s;
}
.nav-toggle:hover, .nav-toggle:focus-visible {
  background: rgba(215,183,118,0.12);
  border-color: var(--gold);
}
.nav-toggle .icon-close { display: none; }
.nav-toggle.active .icon-burger { display: none; }
.nav-toggle.active .icon-close { display: block; }

@media (max-width: 760px) {
  header.site .bar { position: relative; }
  .nav-toggle { display: inline-flex; margin-inline-start: auto; }
  nav.main {
    display: none;
    position: absolute;
    top: calc(100% + 1px);
    left: 0;
    right: 0;
    background: #12201F var(--tex);
    border-bottom: 2px solid var(--gold-dim);
    border-top: 1px solid var(--hairline);
    flex-direction: column;
    padding: 16px 20px 20px;
    gap: 10px;
    align-items: stretch;
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.6);
    z-index: 100;
  }
  nav.main.open { display: flex; animation: nav-slide-down 0.22s ease-out; }
  @keyframes nav-slide-down {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
  }
  nav.main a {
    padding: 10px 18px;
    font-size: 15px;
    text-align: center;
    border-radius: 6px;
  }
  nav.main a.pill-lang {
    margin-inline-start: 0;
    margin-top: 6px;
    text-align: center;
  }
  .about-hero { grid-template-columns: 1fr; gap: 20px; }
  .about-hero img { min-height: 0; max-height: 360px; }
  .cred-grid { grid-template-columns: 1fr; }
  .honor-grid { grid-template-columns: 1fr; }
  .cert-grid { grid-template-columns: 1fr; }
}

/* v5 hero: tall hero, kicker on top, CTA below the hero (as in the design) */
.hero { min-height: clamp(520px, 52vw, 760px); flex-direction: column; justify-content: flex-end; padding-bottom: 8%; }
.hero .content { padding: 0 24px; }
.hero .kicker { position: absolute; top: 28px; left: 0; right: 0; text-align: center; }

.hero-cta-row { text-align: center; padding: 44px 24px 4px; }
@media (max-width: 760px) {
  .hero {
    min-height: clamp(580px, 82vh, 740px) !important;
    padding-top: 40px;
    padding-bottom: 40px;
  }
  .hero img.bg {
    object-position: center 30%;
    transform: scale(1.08);
  }
  .hero .content {
    padding: 30px 16px;
  }
  .hero h1 {
    font-size: clamp(34px, 8.5vw, 48px);
    margin: 12px 0 16px;
  }
  .hero .sub {
    font-size: 15.5px;
    line-height: 1.65;
    max-width: 95%;
    margin-inline: auto;
  }
}
.hero .content { position: static; }
.hero .content > * { position: relative; z-index: 2; }
.hero .content > .kicker { position: absolute; top: 30px; left: 0; right: 0; }
/* v5 palette fidelity: kickers teal, CTA gold (Figma palette sheet) */
.kicker, .sec-kick { color: var(--teal); }
.hero .kicker { color: var(--paper); }
.cta, a.cta { background: var(--gold); color: #251F15; }
.hero h1 { font-size: clamp(38px, 5.4vw, 68px); }
.hero { justify-content: center; padding-bottom: 0; padding-top: 6%; }
html.light-mode{--bg:#f0e8d6;--stone:#e2d8c3;--stone-2:#d5cab3;--text:#251F15;--text-dim:#4b4539;--muted:#595c52;--hairline:rgba(101,88,59,.5)}
html.light-mode .rec-row .rec-ex{color:#4b4539}
html.light-mode header.site,html.light-mode footer.site{color:#251F15}
