/* ============================================================================
   Home — an editorial opening, not a marketing page.

   The hierarchy is carried entirely by type and space: one display line, one
   subtitle, one paragraph of plain description, two buttons. The only image is
   the book's own scanned cover, so nothing decorative is invented.
   ========================================================================== */

/* ------------------------------------------------------------------- hero */
.hero {
  position: relative;
  padding-block: clamp(var(--s-12), 8vw, var(--s-24)) clamp(var(--s-10), 6vw, var(--s-20));
  overflow: hidden;
}
/* a single hairline grid, barely there: the suggestion of ruled paper */
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(to left, var(--line-soft) 1px, transparent 1px);
  background-size: 96px 100%;
  mask-image: radial-gradient(90% 70% at 70% 0%, #000 0%, transparent 72%);
  -webkit-mask-image: radial-gradient(90% 70% at 70% 0%, #000 0%, transparent 72%);
  opacity: .7;
}

.hero-grid {
  position: relative;
  display: grid; align-items: center;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr);
  gap: clamp(var(--s-8), 5vw, var(--s-20));
}

.hero-title {
  font-size: var(--fs-display);
  line-height: 1.05; letter-spacing: -.02em;
  color: var(--ink);
  margin-block-end: var(--s-3);
}
.hero-sub {
  font-family: var(--font-read);
  font-size: clamp(1.05rem, .85rem + .8vw, 1.4rem);
  color: var(--accent); line-height: 1.6;
  margin-block-end: var(--s-6);
}
.hero-lede {
  font-family: var(--font-read);
  font-size: clamp(1.02rem, .95rem + .3vw, 1.15rem);
  line-height: 2.05; color: var(--ink-2);
  max-width: 56ch; text-align: justify;
  margin-block-end: var(--s-6);
}
.hero-by {
  font-size: var(--fs-sm); color: var(--ink-3); line-height: 1.9;
  padding-inline-start: var(--s-4);
  border-inline-start: 2px solid var(--accent-line);
  margin-block-end: var(--s-8);
}
.hero-by b { color: var(--ink-2); font-weight: 600; }
.hero-ed { display: block; font-size: var(--fs-xs); }

.hero-cta { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-block-end: var(--s-6); }

/* a search affordance that reads as a field but is honestly a button */
.hero-search {
  display: flex; align-items: center; gap: var(--s-2);
  width: min(100%, 420px); min-height: 44px;
  padding-inline: var(--s-4);
  background: var(--surface); border: 1px dashed var(--line);
  border-radius: var(--r-sm); color: var(--ink-3);
  font-size: var(--fs-sm); text-align: start;
  transition: border-color var(--dur-2) var(--ease), color var(--dur-2) var(--ease);
}
.hero-search:hover { border-color: var(--accent-line); color: var(--ink-2); }
.hero-search-in { flex: 1 1 auto; }

/* ---- the cover ---------------------------------------------------------- */
.hero-book { display: flex; justify-content: center; }
.hero-book-inner {
  position: relative; width: min(100%, 340px);
  border-radius: 2px 6px 6px 2px;
  box-shadow: var(--sh-4);
  /* the gutter shadow of a bound book, drawn rather than photographed */
  background:
    linear-gradient(to left, rgba(0,0,0,.16) 0 6px, transparent 6px 14px,
                    rgba(255,255,255,.35) 14px 16px, transparent 16px);
  overflow: hidden;
  transform: rotate(-1.1deg);
  transition: transform var(--dur-4) var(--ease-soft);
}
.hero-book-inner:hover { transform: rotate(0deg) translateY(-3px); }
.hero-book img { width: 100%; height: auto; mix-blend-mode: multiply; }
:root[data-theme="dark"] .hero-book img,
:root:not([data-theme="light"]) .hero-book img { mix-blend-mode: normal; opacity: .92; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .hero-book img { mix-blend-mode: multiply; opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-book-inner, .hero-book-inner:hover { transform: none; transition: none; }
}

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-book { order: -1; }
  .hero-book-inner { width: min(56vw, 210px); transform: none; }
  .hero-lede { text-align: start; }
}

/* --------------------------------------------------------------- sections */
.section { padding-block: clamp(var(--s-10), 5vw, var(--s-16)); }
.sec-title {
  font-size: var(--fs-h1); color: var(--ink);
  letter-spacing: -.01em; margin-block-end: var(--s-6);
}

/* -------------------------------------------------------------- resume row */
.resume-wrap { padding-block-end: var(--s-4); }
.resume {
  display: grid; gap: var(--s-3);
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  padding: var(--s-5);
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
}
.resume-card {
  display: flex; flex-direction: column; gap: var(--s-1);
  padding: var(--s-4); text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  transition: border-color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease);
}
a.resume-card:hover { border-color: var(--accent-line); box-shadow: var(--sh-2); }
.resume-k {
  display: flex; align-items: center; gap: var(--s-2);
  font-size: var(--fs-2xs); font-weight: 600; color: var(--accent);
}
.resume-t { font-size: var(--fs-md); font-weight: 600; color: var(--ink); line-height: 1.5; }
.resume-d {
  font-size: var(--fs-xs); color: var(--ink-3);
  overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
}
.resume-bar {
  display: block; height: 4px; margin-block-start: var(--s-2);
  background: var(--surface-3); border-radius: var(--r-pill); overflow: hidden;
}
.resume-bar i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }

/* ------------------------------------------------------------------ doors */
.doors {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: var(--s-4);
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}
.door-wide { grid-column: span 1; }
@media (min-width: 900px) { .door-wide { grid-column: span 3; } .doors { grid-template-columns: repeat(6, 1fr); } }
@media (min-width: 900px) { .doors > li:not(.door-wide) { grid-column: span 2; } }

.door {
  display: flex; align-items: flex-start; gap: var(--s-4);
  width: 100%; height: 100%; text-align: start;
  padding: var(--s-5);
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--r-lg); text-decoration: none; color: inherit;
  transition: border-color var(--dur-2) var(--ease),
              box-shadow var(--dur-2) var(--ease),
              transform var(--dur-2) var(--ease);
}
.door:hover {
  border-color: var(--accent-line); box-shadow: var(--sh-2);
  transform: translateY(-2px);
}
@media (prefers-reduced-motion: reduce) { .door:hover { transform: none; } }

.door-ico {
  display: grid; place-items: center; flex: none;
  width: 42px; height: 42px; border-radius: var(--r-md);
  background: var(--accent-weak); color: var(--accent);
}
.door-body { flex: 1 1 auto; min-width: 0; }
.door-title {
  display: block; font-family: var(--font-read); font-weight: 700;
  font-size: 1.15rem; color: var(--ink); margin-block-end: var(--s-1);
}
.door-desc { display: block; font-size: var(--fs-sm); color: var(--ink-3); line-height: 1.75; }
.door-meta {
  flex: none; align-self: flex-start;
  font-size: var(--fs-2xs); font-weight: 600; color: var(--ink-3);
  padding: var(--s-1) var(--s-2);
  background: var(--surface-3); border-radius: var(--r-sm);
  white-space: nowrap;
}

/* ------------------------------------------------------------- provenance */
.provenance {
  background: var(--navy); color: var(--on-navy);
  padding-block: clamp(var(--s-12), 6vw, var(--s-20));
  margin-block-start: var(--s-8);
}
.prov-grid {
  display: grid; gap: clamp(var(--s-8), 5vw, var(--s-16));
  grid-template-columns: minmax(0, 1fr) minmax(0, .8fr);
  align-items: center;
}
@media (max-width: 860px) { .prov-grid { grid-template-columns: 1fr; } }

.provenance .eyebrow { color: var(--accent-strong); }
.provenance .eyebrow::after { background: linear-gradient(to left, var(--navy-2), transparent); }
.provenance .sec-title { color: var(--on-navy); }
.prov-lede {
  font-family: var(--font-read); font-size: 1.08rem; line-height: 2.05;
  color: var(--on-navy-2); max-width: 54ch; text-align: justify;
}
.prov-stats {
  display: grid; gap: var(--s-3);
  grid-template-columns: repeat(2, 1fr);
  margin: 0;
}
.prov-stat {
  padding: var(--s-5);
  background: var(--navy-2); border: 1px solid rgba(255,255,255,.06);
  border-radius: var(--r-md);
}
.prov-stat dt {
  font-family: var(--font-read); font-size: 1.9rem; font-weight: 700;
  color: var(--accent-strong); line-height: 1.1; margin-block-end: var(--s-1);
}
.prov-stat dd { margin: 0; font-size: var(--fs-xs); color: var(--on-navy-2); line-height: 1.6; }

/* ----------------------------------------------------------------- footer */
.site-foot {
  border-block-start: 1px solid var(--line-soft);
  background: var(--surface-2);
  padding-block: var(--s-10);
}
.foot-grid {
  display: flex; flex-wrap: wrap; gap: var(--s-8);
  align-items: flex-start; justify-content: space-between;
}
.foot-name { font-family: var(--font-read); font-weight: 700; font-size: 1.1rem; color: var(--ink); }
.foot-sub { font-size: var(--fs-xs); color: var(--ink-3); margin-block-start: var(--s-1); }
.foot-nav {
  display: grid; gap: var(--s-2) var(--s-8);
  grid-template-columns: repeat(auto-fit, minmax(140px, auto));
}
.foot-nav a {
  font-size: var(--fs-sm); color: var(--ink-2); text-decoration: none;
  transition: color var(--dur-1) var(--ease);
}
.foot-nav a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* ------------------------------------------------------------------- 404 */
.nf { max-width: 60ch; }
.nf-title { font-size: var(--fs-title); letter-spacing: -.015em; margin-block-end: var(--s-4); }
.nf-lede { font-family: var(--font-read); font-size: 1.1rem; line-height: 2; color: var(--ink-2); margin-block-end: var(--s-8); }
.nf-cta { display: flex; flex-wrap: wrap; gap: var(--s-3); }

/* ------------------------------------------------- the five divisions ---- */
/* The hero's right-hand side is not decoration: it is the course's own
   division into five أبواب, and each one is a link into the register. */
.hero-parts {
  display: grid; gap: var(--s-2);
  /* not a book cover: no spine gradient, no tilt */
  transform: none; width: min(100%, 420px);
  padding: var(--s-5); background: var(--surface);
  border: 1px solid var(--line-soft); border-radius: var(--r-lg);
  box-shadow: var(--sh-2);
  aspect-ratio: auto;
}
.hero-part {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: baseline; gap: var(--s-3);
  padding: var(--s-3);
  border-radius: var(--r-sm); text-decoration: none;
  border-inline-start: 2px solid transparent;
  transition: background var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease);
}
.hero-part:hover { background: var(--surface-2); border-inline-start-color: var(--accent); }
.hero-part-k { font-size: var(--fs-2xs); color: var(--accent); font-weight: 600; }
.hero-part-t { font-family: var(--font-read); font-size: 1.02rem; color: var(--ink); line-height: 1.5; }
.hero-part-n {
  font-size: var(--fs-2xs); color: var(--ink-3);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
@media (max-width: 900px) { .hero-parts { padding: var(--s-4); } }
