:root {
  --paper: #f4edde;
  --paper-deep: #eadfca;
  --ink: #2d241b;
  --ink-soft: #6d6255;
  --line: rgba(58, 47, 35, 0.26);
  --olive: #5e6847;
  --olive-dark: #3e4531;
  --sand: #d9c7a8;
  --shadow: 0 24px 60px rgba(62, 45, 27, 0.12);
  --radius-lg: 32px;
  --radius-md: 24px;
  --radius-sm: 18px;
  --content-width: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.55), transparent 36%),
    linear-gradient(180deg, #f8f1e3 0%, #f0e7d6 45%, #efe4cf 100%);
}

.page-shell {
  width: min(calc(100% - 32px), var(--content-width));
  margin: 0 auto;
  padding: 24px 0 56px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 22px;
  position: sticky;
  top: 14px;
  z-index: 10;
  backdrop-filter: blur(18px);
  background: rgba(248, 241, 227, 0.78);
  border: 1px solid rgba(77, 60, 42, 0.12);
  border-radius: 999px;
  box-shadow: 0 14px 30px rgba(47, 35, 20, 0.08);
}

.brand,
.site-nav a,
.button,
.contact-card a {
  text-decoration: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: "Cormorant Garamond", serif;
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.02em;
}

.brand-icon {
  width: 32px;
  height: 32px;
  display: block;
  flex: 0 0 auto;
}

.site-nav {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
}

.nav-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.nav-group-pages {
  flex: 0 0 auto;
}

.nav-group-sections {
  flex: 1 1 auto;
  min-width: 0;
  justify-content: flex-end;
  padding-left: 16px;
  border-left: 1px solid rgba(77, 60, 42, 0.16);
}

.site-nav a {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  color: var(--ink-soft);
  font-size: 0.96rem;
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease;
}

.site-nav a.nav-page {
  background: rgba(255, 255, 255, 0.34);
  border-color: rgba(77, 60, 42, 0.08);
  color: var(--ink);
}

.site-nav a.nav-section {
  padding-inline: 10px;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  background: rgba(93, 104, 71, 0.1);
  border-color: rgba(93, 104, 71, 0.12);
  color: var(--ink);
}

.site-nav a.is-current {
  background: rgba(93, 104, 71, 0.14);
  border-color: rgba(93, 104, 71, 0.18);
  color: var(--ink);
  font-weight: 700;
}

main {
  display: grid;
  gap: 24px;
  margin-top: 28px;
}

.hero[id],
.panel[id],
.library-category[id] {
  scroll-margin-top: 110px;
}

.hero,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.46), rgba(244, 236, 221, 0.9)),
    var(--paper);
  box-shadow: var(--shadow);
}

.hero {
  display: grid;
  grid-template-columns: 1fr;
  padding: clamp(28px, 4vw, 48px);
  overflow: hidden;
  animation: rise-in 700ms ease both;
}

.hero-copy {
  align-self: center;
  max-width: 960px;
  margin: 0 auto;
  display: grid;
  justify-items: center;
  row-gap: 18px;
  text-align: center;
}

.hero-home .hero-copy {
  row-gap: 24px;
}

.hero-copy > .hero-logo,
.hero-copy > .status-pill,
.hero-copy > .arabic-line,
.hero-copy > h1,
.hero-copy > .subhead,
.hero-copy > .hero-quote-arabic,
.hero-copy > .hero-quote,
.hero-copy > .quote-source,
.hero-copy > .hero-text,
.hero-copy > .hero-actions {
  margin: 0;
}

.hero-logo {
  width: clamp(160px, 26vw, 280px);
  height: auto;
  display: block;
}

.status-pill,
.eyebrow,
.card-label,
.note-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--olive-dark);
}

.arabic-line {
  margin: 0 0 18px;
  font-family: "Noto Naskh Arabic", serif;
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1.15;
  color: #1e1710;
}

.hero-quote-arabic {
  margin: 0 0 14px;
  font-family: "Noto Naskh Arabic", serif;
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  line-height: 1.5;
  color: #1e1710;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  line-height: 0.96;
  letter-spacing: -0.03em;
}

h1 {
  font-size: clamp(3.75rem, 10vw, 6.5rem);
}

.subhead {
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(1.3rem, 2.4vw, 2rem);
  font-style: italic;
  color: var(--ink-soft);
}

.hero-quote {
  margin: 0;
  max-width: 38rem;
  margin-left: auto;
  margin-right: auto;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(1.55rem, 2.8vw, 2.2rem);
  line-height: 1.15;
}

.quote-source {
  color: var(--ink-soft);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-text,
.story-grid p,
.support-copy p,
.contact-card p,
.site-footer p,
.note-card p {
  line-height: 1.75;
  font-size: 1rem;
}

.hero-text {
  max-width: 40rem;
  color: #352c24;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 22px;
  border-radius: 999px;
  font-weight: 700;
  transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.button:hover,
.button:focus-visible {
  transform: translateY(-1px);
}

.button-primary {
  background: linear-gradient(135deg, var(--olive) 0%, #49553a 100%);
  color: #f7f1e8;
  box-shadow: 0 10px 24px rgba(65, 76, 48, 0.22);
}

.button-secondary {
  color: var(--ink);
  border: 1px solid rgba(58, 47, 35, 0.18);
  background: rgba(255, 255, 255, 0.36);
}

.panel {
  padding: clamp(26px, 3.5vw, 40px);
  animation: rise-in 800ms ease both;
}

.section-heading {
  display: grid;
  gap: 10px;
  margin-bottom: 28px;
}

.panel-story .section-heading,
.panel-gallery .section-heading {
  justify-items: center;
  text-align: center;
}

h2 {
  font-size: clamp(2.8rem, 6vw, 4.6rem);
  max-width: 14ch;
}

.story-grid,
.support-grid,
.contact-grid {
  display: grid;
  gap: 24px;
}

.story-grid {
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
}

.note-card,
.contact-card,
.gallery-card,
.qr-frame {
  border: 1px solid rgba(58, 47, 35, 0.18);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.42);
}

.note-card {
  padding: 24px;
  align-self: start;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 18px;
}

.gallery-card {
  grid-column: span 4;
  margin: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.gallery-card-wide {
  grid-column: span 12;
}

.gallery-card img {
  width: 100%;
  height: 100%;
  max-height: 430px;
  object-fit: cover;
  display: block;
}

.gallery-card figcaption {
  padding: 14px 18px 18px;
  font-family: "Cormorant Garamond", serif;
  font-size: 1.35rem;
  font-style: italic;
  text-align: center;
  color: var(--ink-soft);
}

.gallery-card:not(.gallery-card-wide) figcaption {
  display: none;
}

.support-grid {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  align-items: center;
}

.support-copy ul {
  margin: 18px 0 0;
  padding-left: 20px;
  line-height: 1.8;
}

.qr-placeholder {
  display: grid;
}

.qr-frame {
  padding: 28px;
  display: grid;
  place-items: center;
  text-align: center;
  min-height: 100%;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.54), rgba(234, 223, 202, 0.62)),
    var(--paper-deep);
}

.qr-pattern {
  width: min(100%, 220px);
  aspect-ratio: 1;
  border-radius: 18px;
  border: 10px solid rgba(45, 36, 27, 0.94);
  background:
    linear-gradient(90deg, rgba(45, 36, 27, 0.94) 10%, transparent 10% 20%, rgba(45, 36, 27, 0.94) 20% 30%, transparent 30% 40%, rgba(45, 36, 27, 0.94) 40% 50%, transparent 50% 60%, rgba(45, 36, 27, 0.94) 60% 70%, transparent 70% 80%, rgba(45, 36, 27, 0.94) 80% 90%, transparent 90%),
    linear-gradient(rgba(45, 36, 27, 0.94) 10%, transparent 10% 20%, rgba(45, 36, 27, 0.94) 20% 30%, transparent 30% 40%, rgba(45, 36, 27, 0.94) 40% 50%, transparent 50% 60%, rgba(45, 36, 27, 0.94) 60% 70%, transparent 70% 80%, rgba(45, 36, 27, 0.94) 80% 90%, transparent 90%),
    radial-gradient(circle at 20% 20%, transparent 0 13%, rgba(45, 36, 27, 0.94) 13% 22%, transparent 22%),
    radial-gradient(circle at 80% 20%, transparent 0 13%, rgba(45, 36, 27, 0.94) 13% 22%, transparent 22%),
    radial-gradient(circle at 20% 80%, transparent 0 13%, rgba(45, 36, 27, 0.94) 13% 22%, transparent 22%),
    #f7f1e8;
  box-shadow: inset 0 0 0 8px #f7f1e8;
}

.qr-frame p {
  margin: 18px 0 6px;
  font-family: "Cormorant Garamond", serif;
  font-size: 2rem;
}

.qr-frame span,
.muted-link {
  color: var(--ink-soft);
}

.contact-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.contact-card {
  padding: 24px;
  display: grid;
  gap: 12px;
}

.card-label {
  margin-bottom: 0;
}

.contact-card h3 {
  font-size: 2rem;
}

.contact-card a {
  color: var(--olive-dark);
  font-weight: 700;
}

.library-hero .hero-copy {
  max-width: 860px;
}

.panel-library-intro .section-heading {
  justify-items: center;
  text-align: center;
}

.library-category-grid {
  display: grid;
  gap: 24px;
}

.library-category-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.library-category {
  border: 1px solid rgba(58, 47, 35, 0.18);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.42);
}

.library-category {
  padding: 24px;
}

.category-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.category-head h3 {
  font-size: 2rem;
}

.shelf-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(94, 104, 71, 0.1);
  color: var(--olive-dark);
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.book-card {
  margin: 0;
  display: grid;
  gap: 12px;
}

.book-card img {
  width: 100%;
  aspect-ratio: 16 / 22;
  object-fit: cover;
  border-radius: 18px;
  border: 1px solid rgba(58, 47, 35, 0.18);
  box-shadow: 0 10px 24px rgba(47, 35, 20, 0.12);
  background: rgba(255, 255, 255, 0.35);
}

.book-card figcaption {
  display: grid;
  gap: 4px;
}

.book-card strong {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.45rem;
  line-height: 1.05;
}

.book-card span {
  color: var(--ink-soft);
  font-size: 0.94rem;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 12px 24px;
  padding: 22px 6px 0;
  color: var(--ink-soft);
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1024px) {
  .hero,
  .story-grid,
  .support-grid,
  .contact-grid,
  .library-category-grid {
    grid-template-columns: 1fr;
  }

  .gallery-card,
  .gallery-card-wide {
    grid-column: span 12;
  }

  .book-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(calc(100% - 20px), var(--content-width));
    padding-top: 12px;
  }

  .site-header {
    position: static;
    flex-direction: column;
    align-items: flex-start;
    border-radius: 30px;
    padding: 18px;
  }

  .site-nav {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .nav-group-sections {
    width: 100%;
    justify-content: flex-start;
    padding-left: 0;
    border-left: 0;
  }

  .site-nav a.nav-section {
    padding-left: 0;
    padding-right: 12px;
  }

  .hero,
  .panel {
    border-radius: 28px;
  }

  h1 {
    font-size: clamp(3.2rem, 16vw, 4.8rem);
  }

  h2 {
    max-width: none;
  }

  .category-head {
    flex-direction: column;
  }

  .book-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .book-grid {
    grid-template-columns: 1fr;
  }
}

.site-nav a.nav-cta {
  background: linear-gradient(135deg, var(--olive) 0%, #49553a 100%);
  border-color: transparent;
  color: #f7f1e8;
  font-weight: 700;
  margin-left: 8px;
}

.site-nav a.nav-cta:hover,
.site-nav a.nav-cta:focus-visible {
  background: linear-gradient(135deg, #49553a 0%, var(--olive-dark) 100%);
  border-color: transparent;
  color: #f7f1e8;
}
