/* IQRA 1447 — the landing page at iqra.muslimbynature.org.
   The palette and the geometry are the workbook cover's: green #14513A and gold
   #C1A054 on white, stars and crosses in line work, the mihrab arch as the window. */

:root {
  --green: #14513A;
  --green-2: #1E6B4C;
  --gold: #C1A054;
  --gold-dk: #8C6C2A;
  --ink: #1F2A24;
  --muted: #56615A;
  --line: #E7DFCB;
  --tint: #F7F4EC;
  --paper: #FFFFFF;
  --danger: #A33A2A;
  --serif: 'Cormorant Garamond', 'Perpetua', Georgia, 'Times New Roman', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--green); }
h1, h2, h3 { font-family: var(--serif); color: var(--green); line-height: 1.15; margin: 0; text-wrap: balance; }
/* Cormorant's default figures are old-style (1447 dips below the line); the cover's are lining */
h1, h2, h3, .top-brand span { font-variant-numeric: lining-nums; }
h2 { font-size: clamp(32px, 5vw, 42px); }
h3 { font-size: 26px; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 640px; }

/* ---------- the app, switched on and off at /admin ---------- */
/* hidden unless main.js finds config/site.appVisible === true: off is the default */
html:not(.app-on) .app-only { display: none !important; }

/* ---------- top bar ---------- */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.top-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.top-brand img { width: 30px; height: auto; }
.top-brand span { font-family: var(--serif); font-weight: 700; font-size: 22px; letter-spacing: 0.08em; color: var(--green); white-space: nowrap; }
.top-nav { display: flex; gap: 6px; }
.top-nav a {
  text-decoration: none; color: var(--green); font-weight: 600; font-size: 15px;
  padding: 7px 12px; border-radius: 999px;
}
.top-nav a:hover, .top-nav a:focus-visible { background: var(--tint); }

/* ---------- hero ---------- */
.hero { position: relative; padding: 36px 16px 0; overflow: hidden; }
.hero-pattern { position: absolute; inset: 0; width: 100%; height: 100%; }
.arch { position: relative; max-width: 620px; margin: 0 auto; }
.arch-shape { position: absolute; inset: 0; width: 100%; height: 100%; }
.arch-content { position: relative; text-align: center; padding: 96px 36px 48px; }
.lockup { width: min(300px, 70%); margin: 0 auto 22px; }
.hero h1 { font-size: clamp(30px, 5.4vw, 44px); margin: 0 auto 28px; max-width: 14em; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

/* ---------- buttons ---------- */
.btn {
  display: inline-block; text-decoration: none; text-align: center; cursor: pointer;
  font: 600 16px/1 var(--sans);
  padding: 14px 22px; border-radius: 999px; border: 2px solid var(--green);
  transition: background-color .15s, color .15s;
}
.btn-solid { background: var(--green); color: #fff; }
.btn-solid:hover, .btn-solid:focus-visible { background: var(--green-2); border-color: var(--green-2); }
.btn-line { background: #fff; color: var(--green); }
.btn-line:hover, .btn-line:focus-visible { background: var(--tint); }
.btn-big { padding: 17px 30px; font-size: 17px; }
.btn:focus-visible, .top-nav a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--gold); outline-offset: 2px;
}
.btn[disabled] { opacity: .6; cursor: progress; }

/* ---------- sections ---------- */
.band { padding: 64px 0; border-top: 1px solid var(--line); }
.band-tint { background: var(--tint); }
.section-lead { color: var(--muted); font-size: 18px; margin: 10px 0 30px; max-width: 42em; }

/* ---------- workbooks ---------- */
.books { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.book {
  display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: #fff;
}
.book img { width: 100%; aspect-ratio: 8.5 / 11; object-fit: cover; border-bottom: 1px solid var(--line); background: #fff; }
.book-body { display: flex; flex-direction: column; gap: 10px; padding: 18px 20px 22px; flex: 1; }
.topics { margin: 0; font-size: 15px; color: var(--ink); }
.meta { margin: auto 0 4px; font-size: 14px; color: var(--muted); }
.book .btn { align-self: flex-start; }

.note {
  margin-top: 30px; padding: 22px 24px;
  border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: 12px; background: var(--tint);
}
.note h3 { font-size: 24px; margin-bottom: 6px; }
.note p { margin: 0; }

/* ---------- app ---------- */
.app-row { display: flex; align-items: center; justify-content: space-between; gap: 28px; }
.app-row .section-lead { margin-bottom: 0; }
.app-row .btn { flex: none; }

/* ---------- contact ---------- */
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 600; font-size: 15px; }
.opt { font-weight: 400; color: var(--muted); }
.contact-heading { margin-bottom: 24px; }
input, select, textarea {
  width: 100%; font: 16px/1.4 var(--sans); color: var(--ink);
  padding: 11px 13px; border: 1px solid #CFC6B0; border-radius: 10px; background: #fff;
}
textarea { resize: vertical; min-height: 140px; }
.trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.form .btn { justify-self: start; }
.form-status { margin: 0; min-height: 1.6em; font-weight: 600; }
.form-status.ok { color: var(--green); }
.form-status.err { color: var(--danger); }
.fine { margin: 0; font-size: 14px; color: var(--muted); }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--line); padding: 34px 0 44px; color: var(--muted); font-size: 14px; }
.foot .wrap { display: grid; gap: 8px; justify-items: center; text-align: center; }
.foot p { margin: 0; max-width: 46em; }

/* ---------- narrow screens ---------- */
@media (max-width: 900px) {
  .books { grid-template-columns: 1fr; max-width: 520px; margin: 0 auto; }
  .book { flex-direction: row; }
  .book img { width: 38%; aspect-ratio: auto; height: auto; border-bottom: 0; border-right: 1px solid var(--line); object-fit: contain; }
  .app-row { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .top { padding: 8px 14px; }
  .top-brand span { font-size: 18px; letter-spacing: 0.04em; }
  .top-brand { gap: 7px; }
  .top-nav { gap: 0; }
  .top-nav a { padding: 6px 8px; font-size: 14px; }
  .hero { padding: 22px 10px 0; }
  .arch-content { padding: 76px 20px 40px; }
  .section-lead { font-size: 16px; }
  .band { padding: 48px 0; }
  .book { flex-direction: column; }
  .book img { width: 100%; border-right: 0; border-bottom: 1px solid var(--line); }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ---------- /admin ---------- */
[hidden] { display: none !important; }   /* .form's display: grid would otherwise beat the hidden attribute */
.admin { border-top: 0; }
.admin h2 { margin-bottom: 22px; }
.admin-card { border: 1px solid var(--line); border-radius: 16px; padding: 24px; background: #fff; }
.switch-row { display: flex; gap: 18px; align-items: flex-start; }
.switch-title { margin: 2px 0 4px; font-weight: 600; }
.switch { position: relative; flex: none; width: 56px; height: 32px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.slider { position: absolute; inset: 0; border-radius: 999px; background: #CFC6B0; transition: background-color .15s; }
.slider::after {
  content: ''; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s;
}
.switch input:checked + .slider { background: var(--green); }
.switch input:checked + .slider::after { transform: translateX(24px); }
.switch input:focus-visible + .slider { outline: 3px solid var(--gold); outline-offset: 2px; }
.switch input:disabled + .slider { opacity: .6; }
.admin-links { margin: 18px 0 8px; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--green); text-decoration: underline; cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
