/* khutwa.css — the shared stylesheet for Khutwa 101 pages (EN, فصحى, مصري).
   Palette from theme.css (CLAUDE.md Part 1). Light by default; dark follows the system setting
   unless the visitor picks one with the theme button (stored in localStorage "khutwa-theme").
   RTL rules are scoped under html[dir="rtl"], so one file serves all three languages. */
/* COMING SOON — warm editorial; palette from theme.css (CLAUDE.md Part 1) */
:root {
  --ink: #0f1b2d; --amber: #e8a838; --amber-text: #926311; --focus-ring: #a86f10;
  --cream: #faf8f4; --paper: #f4f1eb; --rule: #d9d2c4; --muted: #4a5568; --band: #0f1b2d; --grain: .06;
  color-scheme: light;
  --serif: 'Instrument Serif', Georgia, serif;
  --body: 'Libre Franklin', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--cream); color: var(--ink); font-family: var(--body); font-size: 17px; line-height: 1.6; }
body::before { /* grain */
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: var(--grain);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
a { color: inherit; text-decoration: none; }
a:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 4px; border-radius: 2px; }
.wrap { position: relative; z-index: 1; max-width: 1180px; margin-inline: auto; padding-inline: clamp(20px, 4vw, 48px); }
.label { font-family: var(--mono); font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

/* top bar */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 22px; border-bottom: 1px solid var(--ink); }
.brand { display: flex; align-items: center; gap: 10px; white-space: nowrap; font-family: var(--serif); font-size: 1.6rem; line-height: 1; }
.brand svg { width: 26px; height: 26px; }
.bar .status { display: flex; align-items: center; gap: 8px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); animation: pulse-beacon 2.5s infinite var(--ease); }
.language-switch { font-family: var(--mono); font-size: .8rem; letter-spacing: .08em; text-decoration: underline; text-underline-offset: 5px; display: inline-flex; align-items: center; min-height: 44px; padding-inline: 8px; }
.language-switch:hover { color: var(--amber-text); }
.langs { display: flex; gap: 4px; }
.language-switch[aria-current] { text-decoration: none; color: var(--amber-text); }

/* hero */
.hero { display: grid; grid-template-columns: 1fr 340px; gap: clamp(24px, 5vw, 72px); align-items: end; padding-block: clamp(48px, 9vw, 120px) clamp(40px, 6vw, 80px); }
h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(3.2rem, 8.4vw, 7.6rem); line-height: .95; letter-spacing: -.025em; margin-top: 22px; }
h1 em { color: var(--amber-text); }
.sub { display: grid; grid-template-columns: 1fr auto; gap: 32px; align-items: end; padding-block: 28px; border-top: 1px solid var(--rule); }
.lede { max-width: 36em; color: var(--muted); }
.lede strong { color: var(--ink); font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; padding: 14px 22px; border-radius: 999px; border: 1px solid var(--ink); transition: background .3s var(--ease), color .3s var(--ease); }
.btn-primary { background: var(--ink); color: var(--cream); }
.btn-primary:hover { background: var(--amber); color: var(--ink); border-color: var(--amber); }
.btn-ghost:hover { background: var(--ink); color: var(--cream); }
.arrow { transition: transform .3s var(--ease); }
.btn:hover .arrow { transform: translateX(4px); }

/* the staircase: hairline steps, an amber dot climbing them */
.stair { width: 100%; height: auto; overflow: visible; }
.stair path { fill: none; stroke: var(--ink); stroke-width: 1.25; }
.stair .climber { fill: var(--amber); animation: climb 6s infinite var(--ease); }
.stair .top { fill: var(--amber); }

/* curriculum index */
.index { padding-block: 24px 96px; }
.index-head { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 14px; border-bottom: 1px solid var(--ink); }
.index-head h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(2rem, 4vw, 3rem); line-height: 1; }
.rows { list-style: none; }
.rows a { display: grid; grid-template-columns: 56px 1fr 110px 100px 28px; gap: 16px; align-items: baseline; padding-block: 20px; border-bottom: 1px solid var(--rule); transition: padding .35s var(--ease), background .35s var(--ease); }
.rows .n { font-family: var(--mono); font-size: .8rem; color: var(--muted); }
.rows .t { font-family: var(--serif); font-size: clamp(1.5rem, 2.8vw, 2.2rem); line-height: 1.1; }
.rows .m { font-size: .85rem; color: var(--muted); }
.rows .c { font-family: var(--mono); font-size: .8rem; color: var(--amber-text); }
.rows .go { justify-self: end; opacity: .35; transition: opacity .3s var(--ease), transform .3s var(--ease); }
.rows a:hover { padding-inline: 12px; background: var(--paper); }
.rows a:hover .go { opacity: 1; transform: translateX(4px); }

/* colophon */
footer { position: relative; z-index: 1; background: var(--band); color: #faf8f4; overflow: hidden; }
.big { display: flex; justify-content: space-between; align-items: baseline; gap: 24px; padding-block: 56px 8px; font-family: var(--serif); font-size: clamp(3.4rem, 11vw, 10rem); line-height: .85; letter-spacing: -.03em; }
.big .ar { color: var(--amber); }
.big b { font-weight: inherit; color: var(--amber); }
.big .ar b { color: #faf8f4; }
.fine { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding-block: 18px 26px; border-top: 1px solid rgba(250,248,244,.25); }
footer .label { color: rgba(250,248,244,.75); }

.fade-up { opacity: 0; transform: translateY(28px); animation: fade-up .8s var(--ease) forwards; }
.stagger-1 { animation-delay: .05s; } .stagger-2 { animation-delay: .15s; } .stagger-3 { animation-delay: .3s; } .stagger-4 { animation-delay: .45s; }
@keyframes fade-up { to { opacity: 1; transform: none; } }
@keyframes pulse-beacon { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
@keyframes climb {
  0%, 8%   { transform: translate(0, 0); }
  20%, 28% { transform: translate(64px, -48px); }
  40%, 48% { transform: translate(128px, -96px); }
  60%, 68% { transform: translate(192px, -144px); }
  80%, 92% { transform: translate(256px, -192px); opacity: 1; }
  100%     { transform: translate(256px, -192px); opacity: 0; }
}

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .stair { max-width: 180px; }
  .sub { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .bar .status { display: none; }
  .rows a { grid-template-columns: 36px 1fr 24px; }
  .rows .c, .rows .m { display: none; }
  .big { flex-direction: column; gap: 8px; }
}
/* ---------- dark mode ---------- */
:root[data-theme="dark"] { --ink: #f0ece4; --cream: #0d1626; --paper: #15213a; --rule: #2a3754; --muted: #a9b2c3;
  --amber-text: #f0c87c; --focus-ring: #e8a838; --band: #070c16; --grain: .04; color-scheme: dark; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --ink: #f0ece4; --cream: #0d1626; --paper: #15213a; --rule: #2a3754; --muted: #a9b2c3;
  --amber-text: #f0c87c; --focus-ring: #e8a838; --band: #070c16; --grain: .04; color-scheme: dark; }
}
.btn-primary:hover { color: #0f1b2d; }

/* ---------- theme button + icons ---------- */
.tools { display: flex; align-items: center; gap: 4px; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 44px; height: 44px; padding-inline: 10px; border: 1px solid var(--rule); border-radius: 999px; background: transparent; color: inherit; cursor: pointer; font: 500 .75rem/1 var(--mono); }
.theme-btn:hover { background: var(--paper); }
.theme-btn:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.theme-btn .icon { display: none; }
.theme-btn[data-mode="auto"] .i-auto, .theme-btn[data-mode="light"] .i-light, .theme-btn[data-mode="dark"] .i-dark { display: block; }
html[dir="rtl"] .theme-name { font-family: var(--body); font-size: .8rem; }
@media (max-width: 600px) { .theme-name { display: none; } .theme-btn { padding-inline: 0; width: 44px; } }
.brand .mark { width: 44px; height: 44px; color: var(--ink); }

/* ---------- Arabic (فصحى and مصري): same design, Arabic type ---------- */
html[dir="rtl"] { --body: 'IBM Plex Sans Arabic', 'Libre Franklin', system-ui, sans-serif; --kufi: 'Noto Kufi Arabic', 'Instrument Serif', serif; }
html[dir="rtl"] .label { font-family: var(--body); font-size: .85rem; font-weight: 500; letter-spacing: 0; text-transform: none; }
/* the top bar is identical in every language: logo left, languages + theme right, same sizes */
html[dir="rtl"] .bar { direction: ltr; }
html[dir="rtl"] .brand { font-family: var(--kufi); font-weight: 700; font-size: 1.3rem; }
html[dir="rtl"] h1 { font-family: var(--kufi); font-weight: 800; font-size: clamp(2.6rem, 6.6vw, 6rem); line-height: 1.3; letter-spacing: 0; }
html[dir="rtl"] .index-head h2 { font-family: var(--kufi); font-weight: 700; }
html[dir="rtl"] .rows .t { font-family: var(--kufi); font-weight: 500; font-size: clamp(1.25rem, 2.4vw, 1.8rem); line-height: 1.4; }
html[dir="rtl"] .rows .c, html[dir="rtl"] .rows .n { direction: ltr; }
html[dir="rtl"] .stair, html[dir="rtl"] .arrow, html[dir="rtl"] .rows .go { transform: scaleX(-1); }
html[dir="rtl"] .btn:hover .arrow, html[dir="rtl"] .rows a:hover .go { transform: scaleX(-1) translateX(4px); }
html[dir="rtl"] .big .ar { font-family: var(--serif); font-size: .7em; letter-spacing: -.02em; }
html[dir="rtl"] .big .main { font-family: var(--kufi); font-weight: 800; font-size: .8em; letter-spacing: 0; }
html:not([dir="rtl"]) .big .ar { font-family: 'Noto Kufi Arabic', var(--serif); font-size: .55em; letter-spacing: 0; }

/* ---------- A + B: Hairline hero figure and course cards ---------- */
:root { --hairline-plate: var(--cream); --hairline-hi: var(--ink); --hairline-edge: #8d8270; --hairline-mid: #c9bfae; --hairline-lo: #e6dfd1; --hairline-stroke: 1; }
:root[data-theme="dark"] { --hairline-edge: #8f98ab; --hairline-mid: #4a5670; --hairline-lo: #26324a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --hairline-edge: #8f98ab; --hairline-mid: #4a5670; --hairline-lo: #26324a; } }
.hero { grid-template-columns: 1fr minmax(0, 460px); }
.hero-fig { width: 100%; max-width: 460px; justify-self: end; }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--rule); border-inline-start: 1px solid var(--rule); margin-top: 18px; }
.card { display: flex; flex-direction: column; min-width: 0; border-inline-end: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 16px 18px 20px; transition: background .3s var(--ease); }
.card:hover, .card:focus-visible { background: var(--paper); }
.card .fig { width: 100%; }
.card .meta { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-top: 6px; }
.card .t { font-family: var(--serif); font-size: 1.65rem; line-height: 1.1; }
.card .c { font-family: var(--mono); font-size: .72rem; color: var(--amber-text); white-space: nowrap; direction: ltr; }
.card .d { font-size: .9rem; color: var(--muted); margin-top: 4px; }
.card .d .m { white-space: nowrap; }
.card .d .m::before { content: "· "; }
.card.more { justify-content: center; gap: 8px; background: var(--paper); grid-column: span 2; }
.card.more .t { font-size: 2.1rem; }
html[dir="rtl"] .card .t { font-family: var(--kufi); font-weight: 600; font-size: 1.3rem; line-height: 1.5; }
html[dir="rtl"] .card.more .t { font-size: 1.7rem; }
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .hero-fig { justify-self: center; max-width: 280px; margin-block: -24px; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .card.more { grid-column: auto; }
}
@media (max-width: 560px) { .cards { grid-template-columns: 1fr; } }
/* small phones: keep brand, three languages and the theme button on one line */
@media (max-width: 600px) {
  .bar { gap: 6px; }
  .theme-btn { border-color: transparent; }
  .brand { font-size: 1.3rem; gap: 6px; }
  .brand .mark { width: 28px; height: 28px; }
  .language-switch { padding-inline: 5px; font-size: .75rem; }
}
@media (max-width: 600px) { html[dir="rtl"] .brand { font-size: 1.05rem; } }
@media (max-width: 360px) { .brand { font-size: 1.1rem; } html[dir="rtl"] .brand { font-size: .95rem; } .brand .mark { width: 24px; height: 24px; } }

/* ---------- skip link, how it works, why it's different, closing CTA, footer columns ---------- */
.skip { position: absolute; inset-inline-start: 12px; top: -80px; z-index: 10; background: var(--ink); color: var(--cream); padding: 12px 18px; border-radius: 999px; font-weight: 600; }
.skip:focus { top: 12px; }
main:focus { outline: none; }
.how { padding-block: 48px 8px; }
.steps { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin-top: 18px; border-inline-start: 1px solid var(--rule); }
.steps li { padding: 4px 22px 8px; border-inline-end: 1px solid var(--rule); }
.steps .n { font-family: var(--mono); font-size: .8rem; color: var(--amber-text); }
.steps h3, .points h3 { font-family: var(--serif); font-weight: 400; font-size: 1.55rem; line-height: 1.15; margin-block: 6px 6px; }
.steps p, .points p { font-size: .92rem; color: var(--muted); }
.why { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: clamp(24px, 5vw, 72px); padding-block: 56px; border-top: 1px solid var(--ink); }
.why h2, .closing h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(2rem, 4vw, 3rem); line-height: 1.05; }
.points { list-style: none; display: grid; grid-template-columns: repeat(2, 1fr); gap: 28px 40px; }
.points li { padding-top: 14px; border-top: 1px solid var(--rule); }
.closing { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 20px 32px; padding-block: 56px 80px; border-top: 1px solid var(--rule); }
.closing h2 { font-size: clamp(2.2rem, 5.4vw, 4.4rem); }
.closing h2 em { color: var(--amber-text); }
.foot-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 20px 48px; padding-block: 36px 28px; border-top: 1px solid rgba(250,248,244,.25); margin-top: 32px; }
.about { font-family: var(--serif); font-size: 1.5rem; line-height: 1.25; max-width: 18em; }
.foot-links { list-style: none; display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 28px; margin-top: 10px; }
.foot-links a { display: inline-flex; align-items: center; min-height: 36px; color: rgba(250,248,244,.9); }
footer a:hover { color: var(--amber); }
footer .fine a { text-decoration: underline; text-underline-offset: 4px; }
footer a:focus-visible { outline-color: var(--amber); }
html[dir="rtl"] .steps h3, html[dir="rtl"] .points h3 { font-family: var(--kufi); font-weight: 600; font-size: 1.15rem; line-height: 1.6; }
html[dir="rtl"] .why h2, html[dir="rtl"] .closing h2 { font-family: var(--kufi); font-weight: 700; line-height: 1.4; }
html[dir="rtl"] .closing h2 { font-size: clamp(1.8rem, 4.4vw, 3.4rem); }
html[dir="rtl"] .about { font-family: var(--kufi); font-weight: 500; font-size: 1.15rem; line-height: 1.7; }
html:not([dir="rtl"]) .points h3 [lang^="ar"] { font-family: var(--kufi, 'Noto Kufi Arabic'), serif; font-weight: 600; font-size: .78em; }
@media (max-width: 900px) {
  .steps { grid-template-columns: repeat(2, 1fr); row-gap: 24px; }
  .why, .foot-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .steps, .points { grid-template-columns: 1fr; }
  .steps { border-inline-start: 0; }
  .steps li { border-inline-end: 0; border-top: 1px solid var(--rule); padding: 14px 0 0; }
  .closing .btn { flex: 1 1 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) { .card { transition: none; } }

@media (prefers-reduced-motion: reduce) {
  .fade-up, .dot, .stair .climber { animation: none; opacity: 1; transform: none; }
  .stair .climber { display: none; }
  .btn, .arrow, .rows a, .rows .go { transition: none; }
}
  
