/*
 * molio.app — styles. Colour values are Molio's design tokens
 * (DESIGN_BUNDLE/tokens/tokens.css, dark-first; the light block mirrors its
 * [data-theme="light"] scheme). Fonts are self-hosted subsets of the families
 * the app ships (Instrument Serif, Inter Tight, Amiri, Readex Pro; SIL OFL,
 * see fonts/LICENSES.txt), so no page calls a third-party font service.
 */

@font-face {
  font-family: "Instrument Serif";
  src: url("fonts/instrument-serif-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Inter Tight";
  src: url("fonts/inter-tight-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Inter Tight";
  src: url("fonts/inter-tight-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Amiri";
  src: url("fonts/amiri-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
  unicode-range:
    U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: "Readex Pro";
  src: url("fonts/readex-pro-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
  unicode-range:
    U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: "Readex Pro";
  src: url("fonts/readex-pro-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
  unicode-range:
    U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
}

:root {
  color-scheme: dark;
  --bg-canvas: #0b181b;
  --bg-surface: #0f2024;
  --bg-raised: #13272c;
  --text-primary: #f1e9d6;
  --text-dim: rgba(241, 233, 214, 0.62);
  --text-disclosure: rgba(241, 233, 214, 0.62);
  --accent: #c8a55b;
  --accent-text: #c8a55b;
  --accent-graphic: #c8a55b;
  --accent-badge: rgba(200, 165, 91, 0.14);
  --accent-outline: rgba(200, 165, 91, 0.32);
  --border-low: rgba(241, 233, 214, 0.08);
  --border-high: rgba(241, 233, 214, 0.16);
  /* The header band stays dark in both schemes (design-tokens.json). */
  --band: linear-gradient(168deg, #16333a 0%, #112831 46%, #0e1f24 100%);
  --band-text: #f1e9d6;
  --band-dim: rgba(241, 233, 214, 0.62);
  --band-hairline: rgba(241, 233, 214, 0.06);

  --font-display: "Instrument Serif", "EB Garamond", Georgia, serif;
  --font-body: "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 16px;
  --wrap: 1080px;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg-canvas: #f5f3ee;
    --bg-surface: #fbf8f1;
    --bg-raised: #fffdf8;
    --text-primary: #0b181b;
    --text-dim: rgba(11, 24, 27, 0.62);
    --text-disclosure: rgba(11, 24, 27, 0.62);
    --accent-text: #82611f;
    --accent-graphic: #a6813c;
    --border-low: rgba(11, 24, 27, 0.1);
    --border-high: rgba(11, 24, 27, 0.18);
  }
}

[lang="ar"] {
  --font-display: "Amiri", "Noto Naskh Arabic", serif;
  /* The Arabic faces carry Arabic glyphs only; Latin runs fall to Inter Tight. */
  --font-body:
    "Readex Pro", "Inter Tight", "Noto Naskh Arabic", system-ui, sans-serif;
}

[lang="en"] {
  --font-display: "Instrument Serif", "EB Garamond", Georgia, serif;
  --font-body: "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* A run in the other language (the language pill, the English disclaimer on
   the Arabic page, the Arabic line on the 404) takes its own body face. */
[lang="ar"],
[lang="en"] {
  font-family: var(--font-body);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

main {
  flex: 1;
}

/* Links use accent-text, not accent-link: the dark accent-link (brass-700) is
   3.66:1 on ink-900, below AA for body text; on light both are brass-800. */
a {
  color: var(--accent-text);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:focus-visible {
  outline: 2px solid var(--accent-graphic);
  outline-offset: 3px;
  border-radius: 4px;
}

img {
  display: block;
  max-width: 100%;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 20px;
}

.nowrap {
  white-space: nowrap;
}

.skip {
  position: absolute;
  inset-inline-start: 12px;
  top: -48px;
  padding: 8px 12px;
  background: var(--accent);
  color: #0b181b;
  border-radius: 8px;
  z-index: 10;
}

.skip:focus {
  top: 12px;
}

/* ---------------------------------------------------------- header band */

.band {
  background: var(--band);
  color: var(--band-text);
}

header.band {
  border-bottom: 1px solid var(--band-hairline);
}

.band a:focus-visible {
  outline-color: #c8a55b;
}

/* On the home page the header runs straight into the hero: one gradient. */
.page-home header.band {
  border-bottom: 0;
  background: #16333a;
}

.hero {
  /* Vertical, unlike the 168deg band, so its top edge matches the flat
     home header exactly (same stops). */
  background: linear-gradient(180deg, #16333a 0%, #112831 46%, #0e1f24 100%);
  color: var(--band-text);
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  flex-wrap: wrap;
  padding-block: 10px;
}

.lockup {
  display: inline-flex;
  align-items: center;
  padding: 6px;
  margin-inline-start: -6px;
}

.lockup-word {
  height: 22px;
  width: auto;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  font-size: 0.92rem;
}

nav a {
  color: var(--band-dim);
  text-decoration: none;
  padding: 6px 0;
}

nav a:hover {
  color: var(--band-text);
}

nav a.lang {
  color: #c8a55b;
  border: 1px solid var(--accent-outline);
  border-radius: 999px;
  padding: 4px 12px;
}

/* -------------------------------------------------------------- hero */

.hero {
  padding-block: 56px 72px;
  border-bottom: 1px solid var(--band-hairline);
}

.hero-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.hero-mark {
  height: 84px;
  width: auto;
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 18px;
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--accent-badge);
  border: 1px solid var(--accent-outline);
  color: #c8a55b;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

[lang="ar"] .eyebrow {
  letter-spacing: 0;
  font-size: 0.9rem;
}

.hero h1 {
  margin: 0;
  text-wrap: balance;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.6rem, 7vw, 4.6rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--band-text);
}

[lang="ar"] .hero h1 {
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0;
}

.flourish {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 26px 0 22px;
}

.flourish span {
  width: 44px;
  height: 1px;
  background: rgba(241, 233, 214, 0.22);
}

.flourish i {
  width: 6px;
  height: 6px;
  background: #c8a55b;
  opacity: 0.9;
  transform: rotate(45deg);
}

/* -------------------------------------------------------------- cards */

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 48px;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-low);
  border-radius: var(--radius);
  padding: 24px;
}

.card h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.45rem;
  line-height: 1.2;
}

[lang="ar"] .card h2 {
  font-weight: 700;
  font-size: 1.3rem;
  line-height: 1.5;
}

.card p {
  margin: 0;
  color: var(--text-dim);
}

/* --------------------------------------------------------- disclosure */

.disclosure {
  margin-block: 40px 56px;
}

.disclosure h2 {
  margin: 0 0 6px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.disclosure p {
  margin: 0 0 10px;
  max-width: 52rem;
  color: var(--text-disclosure);
  font-size: 0.92rem;
}

.legal-langs a {
  font-weight: 600;
}

.disclosure .lang-note {
  font-size: 0.85rem;
}

/* ------------------------------------------------------ prose & legal */

.prose,
.legal {
  max-width: 760px;
  padding-block: 48px 64px;
}

.prose h1,
.legal h1 {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.2rem, 5vw, 3rem);
  line-height: 1.1;
}

.prose h2,
.legal h2 {
  margin: 2.2em 0 0.5em;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.55rem;
  line-height: 1.25;
}

.legal h1 + p,
.legal h1 + p + p,
.legal h1 + p + p + p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.95rem;
}

.legal h1 + p + p + p {
  margin-bottom: 8px;
}

.prose p,
.legal p {
  margin: 0 0 1em;
}

.legal ul,
.prose ul {
  margin: 0 0 1em;
  padding-inline-start: 1.2em;
}

.legal li,
.prose li {
  margin-bottom: 0.5em;
}

.legal li::marker,
.prose li::marker {
  color: var(--accent-graphic);
}

.lead-sm {
  color: var(--text-dim);
  font-size: 1.05rem;
}

.table-wrap {
  overflow-x: auto;
  margin: 0 0 1.4em;
  border: 1px solid var(--border-low);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th,
td {
  text-align: start;
  vertical-align: top;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-low);
}

th {
  background: var(--bg-surface);
  font-weight: 600;
}

tr:last-child td {
  border-bottom: 0;
}

.notfound p {
  color: var(--text-dim);
}

/* ------------------------------------------------------------- footer */

.foot {
  border-top: 1px solid var(--border-low);
  padding-block: 28px 36px;
  font-size: 0.88rem;
  color: var(--text-dim);
}

.foot-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 24px;
}

.keploom {
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  /* Dark scheme (the default): a light badge behind the blue logo. */
  background: #f5f3ee;
  padding: 4px 10px;
}

/* The Keploom logo in its official colour, Keploom blue #1503A9, unmodified.
   On the dark canvas that blue is about 1.6:1, so in the dark scheme the logo
   sits on a light badge (set on .keploom) instead of being recoloured
   (founder, 2026-10-04). */
.keploom-logo {
  display: block;
  width: 94px;
  height: 30px;
}

@media (prefers-color-scheme: light) {
  .keploom {
    background: none;
    padding: 0;
  }
}

.copy {
  margin: 0;
}

.copy a {
  color: inherit;
}

.foot-links {
  display: flex;
  gap: 18px;
  margin: 0;
  margin-inline-start: auto;
}

.foot-links a {
  color: var(--text-dim);
}

/* --------------------------------------------------------- small screens */

@media (max-width: 760px) {
  .cards {
    grid-template-columns: 1fr;
    margin-top: 32px;
  }

  .hero {
    padding-block: 36px 52px;
  }

  .hero-mark {
    height: 64px;
    margin-bottom: 22px;
  }

  .foot-links {
    margin-inline-start: 0;
  }
}

@media (max-width: 420px) {
  nav {
    gap: 2px 14px;
    font-size: 0.86rem;
  }

  .lockup-word {
    height: 19px;
  }
}

@media (pointer: coarse) {
  .lockup,
  .keploom,
  nav a,
  .foot-links a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }
}
