/* =========================================================================
   SPECTREX Library — shared styles for the library hub and author pages.
   Palette and type deliberately mirror yousefomar/peramouth/css/style.css so
   the tiers feel like one site; that file is NOT imported or modified.
   ========================================================================= */

:root {
  --ink:         #050506;
  --surface:     #141416;
  --surface-2:   #1a1a1c;
  --brown-2:     #3a2e22;

  --gold:        #c4a484;
  --gold-2:      #d9b98c;
  --gold-bright: #f2e9ca;
  --amber:       #c08a4e;

  --text:        #e8e2d8;
  --text-muted:  #9c9086;

  --font-display-ar: "Aref Ruqaa", "Amiri", "Times New Roman", serif;
  --font-body-ar:    "Tajawal", system-ui, "Segoe UI", sans-serif;
  --font-display-en: "Cinzel", Georgia, "Times New Roman", serif;
  --font-body-en:    "Inter", system-ui, "Segoe UI", sans-serif;

  --radius:      14px;
  --shell:       960px;
}

html[lang="ar"] { --font-display: var(--font-display-ar); --font-body: var(--font-body-ar); --lh: 1.9; }
html[lang="en"] { --font-display: var(--font-display-en); --font-body: var(--font-body-en); --lh: 1.65; }

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

html { color-scheme: dark; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background-color: var(--ink);
  background-image:
    radial-gradient(120% 55% at 50% -10%, rgba(192, 138, 78, 0.11), transparent 62%),
    radial-gradient(90% 45% at 50% 108%, rgba(42, 33, 24, 0.5), transparent 72%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.06rem);
  line-height: var(--lh);
  overflow-x: clip;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 700; line-height: 1.25; margin: 0; }
p { margin: 0; }
img { max-width: 100%; height: auto; display: block; }

::selection { background: rgba(217, 185, 140, 0.28); color: var(--gold-bright); }

:where(a, button):focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 3px;
  border-radius: 6px;
}

.skip-link {
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 12px;
  z-index: 20;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  background: var(--surface);
  color: var(--gold-bright);
  border: 1px solid var(--gold);
  padding: 10px 18px;
  border-radius: 0 0 10px 10px;
  text-decoration: none;
}
.skip-link:focus { width: auto; height: auto; overflow: visible; clip-path: none; }

.page {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: clamp(16px, 4vw, 40px);
  flex: 1 0 auto;
}

/* ---------------------------------------------------------------- topbar */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-block: clamp(16px, 3vw, 26px);
  border-block-end: 1px solid rgba(58, 46, 34, 0.6);
}

.brand {
  font-family: var(--font-display-en);
  font-size: 0.86rem;
  letter-spacing: 0.28em;
  color: var(--gold);
  white-space: nowrap;
  text-decoration: none;
}
.brand-thin { color: var(--text-muted); }
a.brand:hover .brand-thin { color: var(--gold-2); }

.langtoggle {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--brown-2);
  border-radius: 999px;
  background: rgba(20, 20, 22, 0.7);
}
.langtoggle button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.85rem;
  line-height: 1;
  padding: 9px 16px;
  min-height: 36px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease;
}
.langtoggle button:hover { color: var(--gold-2); }
.langtoggle button[aria-pressed="true"] {
  background: linear-gradient(180deg, rgba(217, 185, 140, 0.18), rgba(217, 185, 140, 0.07));
  color: var(--gold-bright);
  box-shadow: inset 0 0 0 1px rgba(217, 185, 140, 0.35);
}

/* ------------------------------------------------------------------ hero */

.hero {
  padding-block: clamp(40px, 9vw, 88px) clamp(28px, 5vw, 46px);
  text-align: start;
  max-width: 46rem;
}

.chip {
  display: inline-block;
  font-size: 0.75rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid var(--brown-2);
  border-radius: 999px;
  padding: 6px 16px;
  margin-block-end: 20px;
  background: rgba(20, 20, 22, 0.6);
}
html[lang="ar"] .chip { letter-spacing: normal; text-transform: none; font-size: 0.85rem; padding-block: 4px; }

.hero h1 {
  font-size: clamp(2.3rem, 1.5rem + 3.6vw, 3.8rem);
  color: var(--gold-bright);
  text-shadow: 0 0 34px rgba(192, 138, 78, 0.32);
  margin-block-end: 16px;
}
html[lang="en"] .hero h1 { letter-spacing: 0.05em; }
html[lang="ar"] .hero h1 { line-height: 1.5; }

.lede { color: var(--text-muted); max-width: 42ch; }

/* an obviously-unfinished slot, not real copy */
.placeholder {
  margin-block-start: 18px;
  padding: 14px 18px;
  border: 1px dashed var(--brown-2);
  border-radius: 10px;
  color: #6b635b;
  font-size: 0.92rem;
  max-width: 42ch;
}

/* --------------------------------------------------------------- section */

.section { padding-block-end: clamp(36px, 7vw, 64px); }

.section-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-block-end: 22px;
}
.section-head h2 {
  font-size: clamp(1.15rem, 1rem + 0.6vw, 1.45rem);
  color: var(--gold);
  white-space: nowrap;
}
html[lang="ar"] .section-head h2 { font-family: var(--font-body-ar); font-weight: 700; }
/* the rule sits after the heading, so it must fade AWAY from it in each direction */
.section-head::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(to left, rgba(58, 46, 34, 0.9), transparent);
}
[dir="ltr"] .section-head::after { background: linear-gradient(to right, rgba(58, 46, 34, 0.9), transparent); }

/* ------------------------------------------------------------- tile grid
   One repeatable component for both tiers: an author tile on the hub page,
   a book tile on the author page. Add more <a class="tile"> and the grid
   handles the rest — no layout changes needed. */

.tiles {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr;
  list-style: none;
  margin: 0;
  padding: 0;
}
@media (min-width: 720px) {
  .tiles { grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); }
}

.tile {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px;
  text-decoration: none;
  color: inherit;
  background: linear-gradient(180deg, rgba(20, 20, 22, 0.96), rgba(11, 11, 13, 0.96));
  border: 1px solid var(--brown-2);
  border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  transition: border-color 0.22s ease, box-shadow 0.28s ease, transform 0.18s ease;
}
.tile:hover {
  border-color: var(--gold-2);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55), 0 0 28px rgba(192, 138, 78, 0.16);
  transform: translateY(-2px);
}

/* optional cover art; tiles without it (the author tile) simply omit the node */
.tile-art {
  flex: 0 0 auto;
  width: 84px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}
.tile-art img { width: 100%; aspect-ratio: 400 / 709; object-fit: cover; }

/* the monogram stands in for cover art on tiles that have none */
.tile-mark {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid var(--brown-2);
  background: radial-gradient(60% 60% at 50% 45%, rgba(192, 138, 78, 0.24), transparent 70%);
  color: var(--gold-2);
  font-family: var(--font-display);
  font-size: 1.15rem;
  line-height: 1;
}

.tile-body { flex: 1 1 auto; min-width: 0; }
.tile-kicker, .tile-title, .tile-meta { display: block; }

.tile-kicker {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-block-end: 6px;
}
html[lang="ar"] .tile-kicker { letter-spacing: normal; font-size: 0.8rem; }

.tile-title {
  font-size: 1.25rem;
  color: var(--gold-bright);
  margin-block-end: 4px;
}
html[lang="ar"] .tile-title { line-height: 1.6; }

.tile-meta { font-size: 0.9rem; color: var(--text-muted); }

.tile-arrow {
  flex: 0 0 auto;
  color: var(--gold);
  transition: transform 0.22s ease, color 0.22s ease;
}
/* the flip lives on `scale`, not `transform`, so switching language does not
   animate it; `scale` applies after `transform`, so the hover nudge below
   still travels the right way in both directions */
[dir="rtl"] .tile-arrow { scale: -1 1; }
.tile:hover .tile-arrow { color: var(--gold-bright); transform: translateX(3px); }

/* ---------------------------------------------------------------- footer */

.foot {
  flex: 0 0 auto;
  border-block-start: 1px solid rgba(58, 46, 34, 0.6);
  padding-block: 22px 30px;
  text-align: center;
  color: #6b635b;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
}

/* ---------------------------------------------------------------- motion */

.reveal { opacity: 1; }

@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.7s ease, transform 0.7s ease;
  }
  body.is-ready .reveal { opacity: 1; transform: none; }
  body.is-ready .hero    { transition-delay: 0.08s; }
  body.is-ready .section { transition-delay: 0.2s; }
}
