/* qiblah.us 2026, v2 "the book and its compass". One stylesheet, no framework.
   The one bold element is the home page compass (needle swings to the southeast). Everything else is a quiet book:
   Amiri for reading and headings in both scripts, IBM Plex Sans for the interface, deep green and gold on sage paper. */
@font-face { font-family: "Amiri"; font-weight: 400; font-display: swap; src: url(fonts/amiri-latin-400.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: "Amiri"; font-weight: 400; font-style: italic; font-display: swap; src: url(fonts/amiri-latin-400i.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: "Amiri"; font-weight: 700; font-display: swap; src: url(fonts/amiri-latin-700.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: "Amiri"; font-weight: 400; font-display: swap; src: url(fonts/amiri-arabic-400.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Amiri"; font-weight: 700; font-display: swap; src: url(fonts/amiri-arabic-700.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Plex"; font-weight: 400; font-display: swap; src: url(fonts/plex-latin-400.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: "Plex"; font-weight: 600; font-display: swap; src: url(fonts/plex-latin-600.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: "Plex"; font-weight: 400; font-display: swap; src: url(fonts/plex-arabic-400.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Plex"; font-weight: 600; font-display: swap; src: url(fonts/plex-arabic-600.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }

/* ---------- tokens ---------- */
:root {
  --green: #003529;        /* mihrab green: hero, header, headings */
  --green-2: #0b4a3b;
  --gold: #c58a3c;         /* the needle, the spine, chapter numerals */
  --gold-ink: #8b5a1d;     /* gold for small text on paper */
  --paper: #eef1ec;        /* sage paper */
  --leaf: #fbfcf9;         /* a book page */
  --ink: #15261f;
  --muted: #5b6b64;
  --rule: #d3dbd2;
  --hl: #7d4c12;           /* verses and quotes in the texts */
  --on-green: #eef4f0;
  --on-green-muted: #a9c3b9;
  --serif: "Amiri", "Iowan Old Style", Georgia, serif;
  --sans: "Plex", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --measure: 36rem;
  --wrap: 1180px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0b1512;
    --leaf: #101d19;
    --ink: #e2eae6;
    --muted: #9cb0a8;
    --rule: #22362f;
    --gold-ink: #dda962;
    --hl: #e8b46e;
    --green-2: #0f3b30;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1rem/1.6 var(--sans); }
img { max-width: 100%; height: auto; }
a { color: var(--green); text-decoration-thickness: 1px; text-underline-offset: .22em; }
@media (prefers-color-scheme: dark) { a { color: #8fd0b8; } }
a:hover { color: var(--gold-ink); }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.2; margin: 0 0 .4em; }
p { margin: 0 0 1em; }
.wrap { width: min(100% - 32px, var(--wrap)); margin-inline: auto; }
.muted { color: var(--muted); }
.skip { position: absolute; inset-inline-start: -999px; }
.skip:focus { inset-inline-start: 16px; top: 12px; z-index: 10; background: var(--leaf); padding: 8px 14px; border-radius: 6px; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 3px; }

/* ---------- header and footer ---------- */
.site-head { background: var(--green); color: var(--on-green); }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; min-height: 64px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--on-green); text-decoration: none; }
.brand:hover { color: #fff; }
.brand .mark, .foot-brand .mark { display: grid; color: currentColor; }
.brand-name { font-family: var(--serif); font-size: 1.45rem; font-weight: 700; letter-spacing: .01em; }
.brand-name span { color: var(--gold); }
.site-nav { display: flex; gap: 2px; }
.site-nav a { color: var(--on-green-muted); text-decoration: none; padding: 8px 14px; font-size: .95rem; border-bottom: 2px solid transparent; }
.site-nav a[lang="ar"] { font-size: 1.05rem; }
.site-nav a:hover { color: #fff; }
.site-nav a[aria-current] { color: #fff; border-bottom-color: var(--gold); }

.site-foot { background: var(--green); color: var(--on-green-muted); margin-top: 72px; }
.foot-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 28px; padding-block: 26px; font-size: .92rem; }
.foot-row [lang="ar"] { font-family: var(--serif); font-size: 1.1rem; color: var(--on-green); }
.foot-row .muted { color: var(--on-green-muted); margin-inline-start: auto; }
.foot-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--on-green); text-decoration: none; font-family: var(--serif); font-size: 1.1rem; }
.foot-brand:hover { color: #fff; }

/* ---------- buttons ---------- */
.btn { display: inline-block; padding: 12px 22px; border-radius: 4px; background: var(--gold); color: #1b1408; font-weight: 600; text-decoration: none; border: 1px solid var(--gold); line-height: 1.2; }
.btn[lang="ar"] { font-size: 1.05rem; }
.btn:hover { background: #d89c4c; border-color: #d89c4c; color: #1b1408; }
.btn.line { background: transparent; color: inherit; border-color: currentColor; }
.btn.line:hover { background: rgb(197 138 60 / .14); color: inherit; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- home: hero with the compass ---------- */
.hero {
  background-color: var(--green);
  /* a faint map graticule */
  background-image:
    linear-gradient(rgb(255 255 255 / .045) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / .045) 1px, transparent 1px);
  background-size: 56px 56px;
  background-position: center -1px;
  color: var(--on-green);
  padding-block: clamp(36px, 6vw, 80px) clamp(40px, 7vw, 96px);
  overflow: hidden;
}
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); align-items: center; gap: clamp(24px, 4vw, 64px); }
.hero h1 { color: #fff; font-size: clamp(2.6rem, 1.6rem + 4vw, 4.6rem); line-height: 1.02; letter-spacing: -.01em; max-width: 11ch; margin-bottom: .2em; }
.hero-ar { font-family: var(--serif); font-weight: 700; font-size: clamp(1.9rem, 1.3rem + 2.4vw, 3rem); color: var(--gold); margin: 0 0 .9em; line-height: 1.4; }
.claim { font-family: var(--serif); font-size: clamp(1.2rem, 1.05rem + .5vw, 1.45rem); line-height: 1.5; max-width: 30em; color: var(--on-green); margin-bottom: .6em; }
.claim-ar { font-family: var(--serif); font-size: clamp(1.25rem, 1.1rem + .5vw, 1.5rem); line-height: 1.9; max-width: 30em; color: var(--on-green-muted); margin-bottom: 1.8em; }
.hero .btn.line { color: var(--on-green); }
.hero-compass { justify-self: center; width: min(100%, 470px); }

.compass { display: block; width: 100%; height: auto; overflow: visible; }
.compass .ring { fill: none; stroke: rgb(238 244 240 / .55); stroke-width: 1.5; }
.compass .ring.thin { stroke: rgb(238 244 240 / .18); stroke-width: 1; }
.compass .ticks line { stroke: rgb(238 244 240 / .35); stroke-width: 1; }
.compass .ticks .t-long { stroke: rgb(238 244 240 / .75); stroke-width: 2; }
.compass .labels text { fill: var(--on-green); font: 600 20px var(--sans); text-anchor: middle; }
.compass .sweep { fill: none; stroke: var(--gold); stroke-width: 2; stroke-dasharray: 3 7; opacity: .7; }
.compass .needle { transform-origin: 200px 200px; transform: rotate(135deg); }
.compass .tip { fill: var(--gold); }
.compass .tail { fill: rgb(238 244 240 / .28); }
.compass .hub { fill: var(--green); stroke: var(--gold); stroke-width: 2; }
.compass .hub-dot { fill: var(--gold); }
.compass .kaaba rect { fill: #0b0f0d; stroke: rgb(238 244 240 / .7); stroke-width: 1; }
.compass .kaaba .band { fill: var(--gold); stroke: none; }
.compass .makkah { fill: var(--gold); font: 400 22px var(--serif); text-anchor: middle; }
/* the one animation: on load the needle turns from north to the southeast */
@media (prefers-reduced-motion: no-preference) {
  .compass .needle { animation: to-qiblah 2.4s cubic-bezier(.3, .1, .2, 1) .3s both; }
  .compass .sweep { stroke-dashoffset: 0; animation: sweep 2.4s cubic-bezier(.3, .1, .2, 1) .3s both; }
  @keyframes to-qiblah { 0% { transform: rotate(0deg); } 62% { transform: rotate(146deg); } 82% { transform: rotate(131deg); } 100% { transform: rotate(135deg); } }
  @keyframes sweep { from { opacity: 0; } to { opacity: .7; } }
}

/* ---------- home: the open book with both editions ---------- */
.spread { margin-top: clamp(-56px, -5vw, -32px); position: relative; }
.spread-inner { display: grid; grid-template-columns: 1fr 1px 1fr; background: var(--leaf); border: 1px solid var(--rule); border-radius: 4px; box-shadow: 0 30px 60px -40px rgb(0 40 30 / .45); }
.spine { background: linear-gradient(var(--rule), var(--gold) 20%, var(--gold) 80%, var(--rule)); }
.page-en, .page-ar { padding: clamp(24px, 4vw, 52px) clamp(20px, 4vw, 56px); }
.spread h2 { font-size: clamp(1.6rem, 1.3rem + 1vw, 2.1rem); margin-bottom: .15em; }
.spread h2 a { color: var(--green); text-decoration: none; }
@media (prefers-color-scheme: dark) { .spread h2 a { color: var(--ink); } }
.spread h2 a:hover { color: var(--gold-ink); }
.count { color: var(--muted); font-size: .92rem; margin-bottom: 1.6em; }

/* contents lists (home pages of the spread and the contents pages) */
.toc { list-style: none; margin: 0 0 1.4em; padding: 0; border-top: 1px solid var(--rule); }
.toc li { border-bottom: 1px solid var(--rule); }
.toc a { display: grid; grid-template-columns: 2.4rem 1fr; gap: 8px; align-items: baseline; padding: 11px 2px; color: var(--ink); text-decoration: none; font-family: var(--serif); font-size: 1.12rem; line-height: 1.35; }
[dir="rtl"] .toc a { font-size: 1.25rem; }
.toc a:hover { color: var(--gold-ink); }
.toc .n { font-family: var(--serif); font-weight: 700; color: var(--gold-ink); font-size: 1.2rem; font-variant-numeric: oldstyle-nums; }
.toc-head { font-size: 1.2rem; margin: 1.6em 0 .5em; }
.toc-head a { color: var(--ink); text-decoration: none; }
.toc-head a:hover { color: var(--gold-ink); }
.answers { list-style: none; margin: 0; padding: 0; }
.answers a { display: block; padding: 6px 0; padding-inline-start: 18px; position: relative; color: var(--muted); text-decoration: none; line-height: 1.4; }
[dir="rtl"] .answers a { font-size: 1.08rem; }
.answers a::before { content: ""; position: absolute; inset-inline-start: 2px; top: 1em; width: 7px; height: 7px; background: var(--gold); transform: rotate(45deg); }
.answers a:hover { color: var(--ink); }

/* ---------- home: the documents strip ---------- */
.strip { margin-top: 72px; }
.strip-head { display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; gap: 8px 28px; margin-bottom: 20px; }
.strip-head h2 { font-size: clamp(1.5rem, 1.3rem + .8vw, 2rem); margin: 0; }
.strip-head p { margin: 0; color: var(--muted); }
.strip-docs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(130px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; }
.doc { display: block; background: #fff; padding: 6px; border: 1px solid var(--rule); box-shadow: 0 10px 24px -18px rgb(0 40 30 / .6); scroll-snap-align: start; transition: transform .2s; }
.doc:hover { transform: translateY(-3px); border-color: var(--gold); }
.doc img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; object-position: top; }

/* ---------- reading pages ---------- */
.leaf { width: min(100% - 32px, calc(var(--measure) + 120px)); margin: 0 auto; background: var(--leaf); border-inline: 1px solid var(--rule); padding: 8px clamp(18px, 5vw, 60px) 40px; min-height: 60vh; }
.crumbs { display: flex; flex-wrap: wrap; gap: 4px 0; font-size: .85rem; color: var(--muted); padding-block: 22px 0; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--gold-ink); text-decoration: underline; }
.crumbs .sep { margin-inline: 8px; color: var(--rule); }
.chapter-head { padding: 36px 0 28px; margin-bottom: 32px; border-bottom: 1px solid var(--rule); position: relative; }
.chapter-head.wide { max-width: 46rem; }
.big-num { display: block; font-family: var(--serif); font-weight: 700; font-size: clamp(4.5rem, 3rem + 6vw, 7.5rem); line-height: .9; color: var(--gold); font-variant-numeric: oldstyle-nums; margin-bottom: 8px; }
.label { color: var(--gold-ink); font-size: .92rem; margin-bottom: .5em; }
[lang="ar"] .label { font-size: 1rem; }
.chapter-head h1 { font-size: clamp(1.9rem, 1.4rem + 2.2vw, 2.9rem); color: var(--green); }
@media (prefers-color-scheme: dark) { .chapter-head h1 { color: var(--ink); } }
.intro { color: var(--muted); font-size: 1.1rem; max-width: 40rem; }

.prose { font-family: var(--serif); font-size: 1.25rem; line-height: 1.75; max-width: var(--measure); }
[lang="ar"] .prose { font-size: 1.42rem; line-height: 2.1; }
.prose p { margin-bottom: 1em; }
.prose h2 { font-size: 1.6rem; color: var(--green); margin-top: 1.6em; }
.prose section + section { margin-top: 2.6em; padding-top: 1.6em; border-top: 1px solid var(--rule); }
.prose .hl { color: var(--hl); }
[lang="ar"] .prose .hl { font-weight: 700; }
.prose .center { text-align: center; }
.prose table { width: 100%; border-collapse: collapse; margin: 1em 0; display: block; overflow-x: auto; font-size: .9em; }
.prose td, .prose th { border: 1px solid var(--rule); padding: 8px 12px; vertical-align: top; }
.prose ul, .prose ol { padding-inline-start: 1.3em; }
.prose a { overflow-wrap: anywhere; }

.pager { display: grid; grid-template-columns: 1fr 1fr; margin-top: 56px; border-block: 1px solid var(--rule); }
.pager a { display: grid; gap: 4px; padding: 20px 4px; text-decoration: none; color: var(--ink); }
.pager a + a, .pager span + a { border-inline-start: 1px solid var(--rule); padding-inline-start: 20px; }
.pager .next { text-align: end; padding-inline-end: 4px; }
.pager small { color: var(--gold-ink); font-size: .85rem; }
.pager a span { font-family: var(--serif); font-size: 1.15rem; line-height: 1.3; }
[lang="ar"] .pager a span { font-size: 1.25rem; }
.pager a:hover span { color: var(--gold-ink); }
.back { margin: 22px 0 0; font-size: .95rem; }
.start { margin-top: 28px; }

/* ---------- proofs page ---------- */
.proofs .wrap > .chapter-head { border-bottom: 0; margin-bottom: 8px; }
.docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 22px; padding-bottom: 24px; }

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-compass { order: -1; width: min(72vw, 320px); margin-bottom: 4px; }
  .spread-inner { grid-template-columns: 1fr; }
  .spine { height: 1px; background: linear-gradient(90deg, var(--rule), var(--gold) 20%, var(--gold) 80%, var(--rule)); }
  .strip-head { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .head-row { min-height: 0; padding-block: 10px; }
  .site-nav { width: 100%; justify-content: space-between; }
  .site-nav a { padding: 6px 4px; }
  .leaf { width: 100%; border-inline: 0; }
  .prose { font-size: 1.15rem; }
  [lang="ar"] .prose { font-size: 1.3rem; }
  .pager { grid-template-columns: 1fr; }
  .pager a + a, .pager span + a { border-inline-start: 0; border-top: 1px solid var(--rule); padding-inline-start: 4px; }
  .pager .next { text-align: start; }
  .foot-row .muted { margin-inline-start: 0; }
}
@media print {
  .site-head, .site-foot, .pager, .crumbs, .back { display: none; }
  body, .leaf { background: #fff; color: #000; border: 0; }
}
