/* ==========================================================================
   Qur'anic Signs — design system
   Palette: ink #1c1917 · paper #f8f5ee · teal #0e5a55 · gold #a2833f
   ========================================================================== */

@font-face {
  font-family: "Amiri";
  src: url("../fonts/amiri-arabic-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: "Amiri";
  src: url("../fonts/amiri-arabic-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF;
}

:root {
  --ink: #1c1917;
  --ink-soft: #44403a;
  --ink-faint: #6f6a61;
  --paper: #f8f5ee;
  --paper-raised: #fffdf8;
  --paper-dim: #efeadf;
  --line: #ddd6c8;
  --teal: #0e5a55;
  --teal-dark: #0a423e;
  --teal-wash: #e5eeec;
  --gold: #a2833f;         /* decorative only (borders, rules) */
  --gold-text: #7d6228;    /* WCAG AA-compliant gold for text */
  --gold-wash: #f3ecdd;
  --tier1: #0e5a55;
  --tier2: #8a6d2f;
  --tier3: #8c4a3c;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --arabic: "Amiri", "Scheherazade New", "Traditional Arabic", "Geeza Pro", serif;
  --measure: 44rem;
  --wide: 72rem;
}

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

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
}

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

a { color: var(--teal); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:focus-visible, button:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
  border-radius: 2px;
}
a:hover { color: var(--teal-dark); }

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.25;
  color: var(--ink);
  margin: 2.2em 0 0.5em;
}
h1 { font-size: clamp(1.7rem, 4.5vw, 2.6rem); margin-top: 0; letter-spacing: -0.01em; }
h2 { font-size: clamp(1.3rem, 3vw, 1.7rem); }
h3 { font-size: 1.15rem; }

p, ul, ol { margin: 0 0 1.1em; }

/* Skip link */
.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--teal); color: #fff; padding: 0.6em 1em; z-index: 100;
}
.skip-link:focus { left: 0; }

/* ------------------------------------------------------------------ header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  background: var(--paper-raised);
  box-shadow: 0 1px 8px rgba(28, 25, 23, 0.06);
}
.site-header .inner {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0.9rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 1.6rem;
}
.brand {
  font-size: 1.28rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-decoration: none;
}
.brand .brand-mark { color: var(--teal); }
.brand:hover { color: var(--teal-dark); }
.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 1.15rem;
  font-family: var(--sans);
  font-size: 0.86rem;
  letter-spacing: 0.02em;
}
.site-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  padding: 0.2rem 0;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--teal-dark); }
.site-nav a[aria-current="page"], .site-nav a.active {
  color: var(--teal-dark);
  border-bottom-color: var(--gold);
}

/* ------------------------------------------------------------------ layout */
main { display: block; }
.container { max-width: var(--wide); margin: 0 auto; padding: 0 1.25rem; }
.prose { max-width: var(--measure); }
.section { padding: 2.75rem 0; }
.section + .section { padding-top: 0; }

.page-head { padding: 2.75rem 0 1rem; }
.kicker {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-text);
  margin: 0 0 0.6rem;
}
.lede { font-size: 1.16rem; color: var(--ink-soft); max-width: var(--measure); }

/* ------------------------------------------------------------------- hero */
.hero {
  position: relative;
  isolation: isolate;
  color: #f4f1e8;
  background: var(--teal-dark);
}
.hero .hero-img {
  position: absolute; inset: 0; z-index: -1;
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0.85;
}
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(12,26,24,0.25) 0%, rgba(12,26,24,0.72) 100%);
}
.hero .inner {
  max-width: var(--wide);
  margin: 0 auto;
  padding: clamp(4rem, 12vw, 8.5rem) 1.25rem clamp(2.5rem, 7vw, 5rem);
}
.hero h1 { color: #fdfcf7; max-width: 24ch; text-wrap: balance; }
.hero .lede { color: #e8e3d5; }

/* ------------------------------------------------------------------ cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 1.4rem;
  padding: 0; margin: 1.6rem 0;
  list-style: none;
}
.card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 120ms ease, transform 120ms ease;
}
.card:hover { box-shadow: 0 6px 22px rgba(28,25,23,0.09); transform: translateY(-2px); }
.card img { aspect-ratio: 16/9; object-fit: cover; width: 100%; }
.card .card-body { padding: 1.05rem 1.15rem 1.2rem; display: flex; flex-direction: column; gap: 0.45rem; flex: 1; }
.card h3 { margin: 0; font-size: 1.06rem; line-height: 1.35; }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a:hover { color: var(--teal-dark); }
.card h3 a::after { content: ""; position: absolute; inset: 0; }
.card { position: relative; }
.card .card-meta {
  font-family: var(--sans); font-size: 0.76rem; color: var(--ink-faint);
  display: flex; gap: 0.6rem; align-items: center; margin-top: auto;
}
.card p { font-size: 0.92rem; color: var(--ink-soft); margin: 0; }

/* ------------------------------------------------------------- tier badge */
.tier {
  display: inline-flex; align-items: center; gap: 0.35em;
  font-family: var(--sans); font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 0.18em 0.6em; border-radius: 999px;
  border: 1px solid currentColor;
  background: var(--paper-raised);
}
.tier-1 { color: var(--tier1); }
.tier-2 { color: var(--tier2); }
.tier-3 { color: var(--tier3); }
.tier .dot { width: 0.5em; height: 0.5em; border-radius: 50%; background: currentColor; }

/* -------------------------------------------------------------- quotation */
.scripture {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-inline-start: 3px solid var(--gold);
  border-radius: 4px;
  padding: 1.5rem 1.6rem 1.25rem;
  margin: 1.8rem 0;
}
.scripture .ar {
  font-family: var(--arabic);
  font-size: 1.65rem;
  line-height: 2.1;
  direction: rtl;
  text-align: right;
  color: var(--ink);
  margin: 0 0 0.9rem;
}
.scripture .en { font-size: 1.02rem; color: var(--ink-soft); margin: 0 0 0.65rem; }
.scripture .ref {
  font-family: var(--sans); font-size: 0.8rem; color: var(--ink-faint); margin: 0;
}
.scripture .ref a { color: inherit; }
.grading { font-family: var(--sans); font-size: 0.8rem; color: var(--ink-faint); }

/* --------------------------------------------------------------- item page */
.item-hero { margin: 0 0 1.8rem; }
.item-hero img { border-radius: 6px; border: 1px solid var(--line); aspect-ratio: 21/9; object-fit: cover; width: 100%; }
.item-meta {
  display: flex; flex-wrap: wrap; gap: 0.7rem 1rem; align-items: center;
  font-family: var(--sans); font-size: 0.82rem; color: var(--ink-faint);
  margin: 0.9rem 0 0;
}
.considerations {
  background: var(--gold-wash);
  border: 1px solid #e4d9bd;
  border-radius: 6px;
  padding: 1.3rem 1.5rem;
  margin: 2rem 0;
}
.considerations h2 { margin-top: 0; font-size: 1.15rem; }
.considerations p:last-child { margin-bottom: 0; }

.footnotes { font-size: 0.9rem; color: var(--ink-soft); border-top: 1px solid var(--line); margin-top: 2.6rem; padding-top: 1.2rem; }
.footnotes h2 { font-size: 1rem; margin-top: 0; }
.footnotes ol { padding-left: 1.2rem; }
.footnotes li { margin-bottom: 0.4em; overflow-wrap: anywhere; }

.related { margin-top: 2.5rem; }
.related h2 { font-size: 1.1rem; }
.related ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.6rem; }
.related li a {
  display: inline-block; font-family: var(--sans); font-size: 0.84rem;
  background: var(--teal-wash); color: var(--teal-dark);
  padding: 0.35em 0.85em; border-radius: 999px; text-decoration: none;
  border: 1px solid #cfe0dd;
}
.related li a:hover { background: #d8e7e4; }

/* --------------------------------------------------------------- buckets */
.bucket-banner img { border-radius: 6px; border: 1px solid var(--line); aspect-ratio: 3/1; object-fit: cover; width: 100%; }

/* ---------------------------------------------------------------- search */
.search-box {
  display: flex; gap: 0.6rem; margin: 1.2rem 0 0.4rem; max-width: 34rem;
}
.search-box input {
  flex: 1; font: inherit; font-family: var(--sans); font-size: 0.95rem;
  padding: 0.55em 0.9em; border: 1px solid var(--line); border-radius: 6px;
  background: var(--paper-raised); color: var(--ink);
}
.search-box input:focus { outline: 2px solid var(--teal); outline-offset: 1px; border-color: var(--teal); }
#search-results { margin-top: 0.6rem; }
#search-count { font-family: var(--sans); font-size: 0.82rem; color: #5d584f; min-height: 1.2em; }

/* tier filter toggle */
.tier-filter {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem;
  margin: 0.7rem 0 0.2rem;
}
.tier-filter-label {
  font-family: var(--sans); font-size: 0.78rem; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint);
  margin-right: 0.2rem;
}
.tier-btn {
  font-family: var(--sans); font-size: 0.8rem; font-weight: 600;
  color: var(--ink-soft); background: var(--paper-raised);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 0.3em 0.85em; cursor: pointer; transition: background 100ms ease, border-color 100ms ease;
}
.tier-btn:hover { border-color: var(--teal); }
.tier-btn.is-active {
  color: #fff; background: var(--teal); border-color: var(--teal-dark);
}
.tier-btn:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* ----------------------------------------------------------- feedback form */
.feedback-form { max-width: var(--measure); }
.feedback-form fieldset {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper-raised);
  padding: 1rem 1.3rem 1.2rem;
  margin: 0 0 1.4rem;
}
.feedback-form legend {
  font-family: var(--sans); font-size: 0.82rem; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint);
  padding: 0 0.5em;
}
.feedback-form .radio {
  display: block; margin: 0.45em 0; font-size: 0.98rem; color: var(--ink-soft);
  cursor: pointer; font-family: var(--serif); font-weight: 400;
}
.feedback-form .radio input { margin-right: 0.55em; accent-color: var(--teal); }
.feedback-form label { display: block; font-family: var(--sans); font-size: 0.88rem; font-weight: 600; margin-bottom: 0.3em; color: var(--ink-soft); }
.feedback-form label .note { font-weight: 400; }
.feedback-form input[type="text"],
.feedback-form input[type="email"],
.feedback-form textarea {
  width: 100%; font: inherit; font-family: var(--sans); font-size: 0.95rem;
  padding: 0.55em 0.9em; border: 1px solid var(--line); border-radius: 6px;
  background: var(--paper-raised); color: var(--ink);
}
.feedback-form input:focus, .feedback-form textarea:focus {
  outline: 2px solid var(--teal); outline-offset: 1px; border-color: var(--teal);
}
.feedback-form textarea { resize: vertical; line-height: 1.55; }
.feedback-form .hp-field { position: absolute; left: -9999px; top: -9999px; }
.form-ok, .form-err {
  font-family: var(--sans); font-size: 0.95rem; border-radius: 6px;
  padding: 0.8em 1.1em; max-width: var(--measure);
}
.form-ok { background: var(--teal-wash); color: var(--teal-dark); border: 1px solid #cfe0dd; }
.form-err { background: #f6e7e3; color: #8c4a3c; border: 1px solid #e6cfc7; }

/* --------------------------------------------------------------- footer */
.site-footer {
  margin-top: 4rem;
  border-top: 1px solid var(--line);
  background: var(--paper-dim);
  color: var(--ink-soft);
  font-size: 0.9rem;
}
.site-footer .inner {
  max-width: var(--wide); margin: 0 auto; padding: 2.2rem 1.25rem 2.6rem;
  display: grid; gap: 1.6rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
}
.site-footer h2 { font-size: 0.85rem; font-family: var(--sans); letter-spacing: 0.1em; text-transform: uppercase; color: #5d584f; margin: 0 0 0.6rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 0.35em; }
.site-footer a { color: var(--ink-soft); }
.site-footer .colophon { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 1.1rem; font-size: 0.82rem; color: #5d584f; font-family: var(--sans); }

/* ----------------------------------------------------------- consent bar */
.consent-bar {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 60;
  background: var(--paper-raised);
  border-top: 2px solid var(--teal);
  box-shadow: 0 -4px 18px rgba(28, 25, 23, 0.12);
  padding: 0.9rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.4rem;
  align-items: center;
  justify-content: center;
}
.consent-bar p {
  margin: 0;
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--ink-soft);
  max-width: 46rem;
}
.consent-actions { display: flex; gap: 0.6rem; flex-shrink: 0; }
.consent-bar .btn { font-size: 0.85rem; padding: 0.5em 1.1em; }

/* ------------------------------------------------------------ utilities */
.divider {
  border: none; height: 22px; margin: 2.4rem auto;
  max-width: var(--measure);
  background-image: repeating-linear-gradient(135deg, var(--line) 0 1px, transparent 1px 9px),
                    repeating-linear-gradient(45deg, var(--line) 0 1px, transparent 1px 9px);
  opacity: 0.7;
}
.note {
  font-family: var(--sans); font-size: 0.86rem; color: var(--ink-faint);
}
.btn {
  display: inline-block; font-family: var(--sans); font-size: 0.92rem; font-weight: 600;
  background: var(--teal); color: #fff; text-decoration: none;
  padding: 0.6em 1.3em; border-radius: 6px; border: 1px solid var(--teal-dark);
}
.btn:hover { background: var(--teal-dark); color: #fff; }
.btn.ghost { background: transparent; color: var(--teal-dark); border-color: var(--teal); }
.btn.ghost:hover { background: var(--teal-wash); }

.two-col { display: grid; gap: 2rem; grid-template-columns: 1fr; }
@media (min-width: 54rem) { .two-col { grid-template-columns: 1fr 1fr; } }

dl.glossary dt { font-weight: 700; margin-top: 1.1em; }
dl.glossary dd { margin: 0.15em 0 0; color: var(--ink-soft); }

table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; padding: 0.5em 0.8em; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-family: var(--sans); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card, .card:hover { transition: none; transform: none; }
}

@media print {
  .site-header, .site-footer, .search-box { display: none; }
  body { background: #fff; }
}
