/* ============================================================
   okonlife.css  —  Omar Khayyam / Rubaiyat · Shahriar Shahriari
   ============================================================ */

/* ── TOKENS ─────────────────────────────────────────────────*/
:root {
  --page-bg:   #f0ead8;
  --panel-bg:  #e6ddc8;
  --card-bg:   #faf6ee;
  --dark-bg:   #2e2618;
  --dark-fg:   #f0ead8;

  --ink:    #1a1710;
  --ink2:   #2c2a22;
  --ink3:   #5e5a4e;

  --gold:   #8c6b2f;
  --gold2:  #b8904a;
  --gold3:  #d4aa6a;

  --border:    rgba(26,23,16,.18);
  --border-lt: rgba(26,23,16,.10);

  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans:  'Jost', system-ui, sans-serif;
}

/* ── RESET ──────────────────────────────────────────────────*/
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--page-bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.75;
}

/* ── NAV ────────────────────────────────────────────────────*/
nav {
  position: sticky; top: 0; z-index: 200;
  background: rgba(26,23,16,.96);
  backdrop-filter: blur(10px);
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 0 2.5rem; height: 54px;
}
.nav-brand {
  font-family: var(--serif);
  font-size: 1.1rem; font-weight: 500;
  letter-spacing: .03em; color: var(--gold3);
  text-decoration: none;
}
.nav-links { display: flex; align-items: center; gap: 2rem; list-style: none; }
.nav-links a {
  font-size: 12px; font-weight: 500;
  letter-spacing: .12em; text-transform: uppercase;
  color: #d4c9a8; text-decoration: none;
  padding: 4px 0; border-bottom: 1px solid transparent;
  transition: color .2s, border-color .2s;
}
.nav-links a:hover { color: var(--gold3); border-bottom-color: var(--gold3); }

/* ── HERO ───────────────────────────────────────────────────*/
.hero {
  display: grid;
  grid-template-columns: 1fr 260px;
  align-items: center;
  gap: 3rem;
  padding: 4rem 3rem;
  background: var(--panel-bg);
  border-bottom: 2px solid var(--border);
  position: relative; overflow: hidden;
}
.hero::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, transparent 55%, rgba(140,107,47,.06) 100%);
  pointer-events: none;
}
.hero-text { position: relative; z-index: 1; }
.hero h1 {
  font-family: var(--serif);
  font-size: clamp(3.2rem, 5vw, 5rem);
  font-weight: 600; letter-spacing: .02em;
  line-height: 1.0; color: var(--ink);
  margin-bottom: .3rem;
}
.hero-sub {
  font-family: var(--serif);
  font-size: 1.15rem; font-style: italic;
  color: var(--ink2); margin-bottom: 2.25rem;
}
.hero-epigraph {
  font-family: var(--serif);
  font-size: 1.05rem; font-style: italic;
  line-height: 1.95; color: var(--ink2);
  border-left: 3px solid var(--gold2);
  padding: .5rem 1.5rem;
}
.hero-image { position: relative; z-index: 1; }
.hero-image img {
  width: 260px; height: auto; display: block;
  border-radius: 4px; opacity: .88;
  mix-blend-mode: multiply;
}

/* ── SHARED LAYOUT ──────────────────────────────────────────*/
.container { max-width: 1100px; margin: 0 auto; padding: 0 3rem; }
section { padding: 4.5rem 0; border-bottom: 2px solid var(--border); }

.section-kicker {
  font-size: 10px; font-weight: 500;
  letter-spacing: .2em; text-transform: uppercase;
  color: var(--gold); margin-bottom: .6rem;
}
h2 {
  font-family: var(--serif);
  font-size: 2.1rem; font-weight: 600;
  color: var(--ink); margin-bottom: 1.75rem; line-height: 1.15;
}
p { color: var(--ink2); margin-bottom: 1rem; font-size: .95rem; }
em { font-style: italic; }

/* ── FACT CARDS ─────────────────────────────────────────────*/
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 1px; background: var(--border);
  border: 1px solid var(--border); border-radius: 8px;
  overflow: hidden; margin-bottom: 2rem;
}
.fact { background: var(--card-bg); padding: 1rem 1.25rem; }
.fact-lbl {
  font-size: 9px; font-weight: 500;
  letter-spacing: .15em; text-transform: uppercase;
  color: var(--ink3); margin-bottom: 5px;
}
.fact-val { font-family: var(--serif); font-size: 1rem; font-weight: 600; color: var(--ink); }

.contribs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px,1fr));
  gap: .45rem; margin-bottom: 1.75rem;
}
.ci { display: flex; align-items: flex-start; gap: .55rem; font-size: .88rem; color: var(--ink2); }
.ci::before { content: '—'; color: var(--gold2); flex-shrink: 0; margin-top: 1px; }

/* ── COLLAPSIBLE — biography & philosophy ───────────────────*/
details { margin-top: 1.25rem; }
details > summary {
  font-size: 11px; font-weight: 500; letter-spacing: .12em;
  text-transform: uppercase; color: var(--gold);
  cursor: pointer; user-select: none; list-style: none;
  display: flex; align-items: center; gap: .55rem;
  padding: .75rem 0; border-top: 1px solid var(--border);
}
details > summary::-webkit-details-marker { display: none; }
.tog {
  font-size: 1.1rem; color: var(--gold2);
  display: inline-block; transition: transform .25s; line-height: 1;
}
details[open] > summary .tog { transform: rotate(45deg); }

.collapsible-body {
  font-family: var(--serif);
  font-size: 1.02rem; line-height: 1.9;
  color: var(--ink2); padding: 1.5rem 0 .5rem;
  max-width: 78ch;
}
.collapsible-body p {
  font-family: var(--serif); color: var(--ink2);
  margin-bottom: 1.15rem; font-size: 1.02rem;
}
.collapsible-body blockquote {
  font-style: italic; margin: 1rem 0 1rem 1.5rem;
  border-left: 2px solid var(--gold2); padding-left: 1.25rem;
  color: var(--ink); line-height: 1.9;
}
.bio-verse {
  font-family: var(--serif); font-style: italic;
  margin: .75rem 0 .75rem 2.5rem;
  color: var(--ink); line-height: 1.9;
}
.footnotes {
  margin-top: 2rem; padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.footnotes h4 {
  font-family: var(--sans); font-size: .8rem; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink3); margin-bottom: .75rem;
}
.footnotes ol { padding-left: 1.35rem; }
.footnotes li {
  font-family: var(--serif); font-size: .9rem;
  color: var(--ink3); line-height: 1.7; margin-bottom: .6rem;
}
.source-note { font-size: .82rem; color: var(--ink3); margin-top: 1rem; font-style: italic; }
sup { font-size: .7em; vertical-align: super; color: var(--gold); }

/* ── RUBAIYAT KEY — collapsible pill ────────────────────────*/
.key-wrap { margin-bottom: 2.5rem; }
.key-wrap > summary {
  display: inline-flex; align-items: center; gap: .6rem;
  font-size: 11px; font-weight: 500; letter-spacing: .12em;
  text-transform: uppercase;
  cursor: pointer; user-select: none; list-style: none;
  padding: .55rem 1.2rem .55rem .9rem;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--card-bg);
  color: var(--ink);
  transition: background .2s, border-color .2s, color .2s;
}
.key-wrap > summary::-webkit-details-marker { display: none; }
.key-wrap > summary:hover { background: var(--panel-bg); border-color: var(--gold2); color: var(--gold); }
.key-wrap[open] > summary {
  background: var(--dark-bg); color: var(--gold3);
  border-color: var(--dark-bg);
}
.key-wrap[open] > summary .tog { color: var(--gold3); transform: rotate(45deg); }

.dark-panel {
  background: var(--dark-bg); color: var(--dark-fg);
  padding: 2.5rem 3rem; border-radius: 10px;
  margin-top: 1rem;
}
.dark-panel p { color: #c0b898; font-size: .95rem; margin-bottom: .85rem; }
.dark-panel h3 {
  font-family: var(--serif); font-size: 1.35rem; font-weight: 500;
  color: var(--gold3); margin-bottom: 1rem;
}

.legend {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 1px; background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12); border-radius: 8px;
  overflow: hidden; margin-top: 1.5rem;
}
.legend-col { background: rgba(255,255,255,.04); padding: 1rem 1.25rem; }
.legend-col-title {
  font-size: 9px; font-weight: 500; letter-spacing: .15em;
  text-transform: uppercase; color: var(--gold3); margin-bottom: .65rem;
}
.legend-row {
  font-size: .82rem; color: #b0a888;
  padding: .28rem 0; border-top: 1px solid rgba(255,255,255,.08); line-height: 1.55;
}
.legend-row:first-of-type { border-top: none; }
.legend-row strong { color: #ddd0a8; font-weight: 500; }

/* ── QUATRAIN HEADER ────────────────────────────────────────*/
.q-header { display: flex; align-items: center; gap: .85rem; margin-bottom: .85rem; }
.q-num {
  font-size: 10px; font-weight: 500;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--ink3); white-space: nowrap;
}
.q-rule { flex: 1; height: 1px; background: var(--border); }

/* ── QUATRAIN 2×3 GRID ──────────────────────────────────────*/
.q-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 1px; background: var(--border);
  border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; margin-bottom: 1rem; min-width: 0;
}
.qc { background: var(--card-bg); padding: 1.35rem 1.5rem 1.5rem; min-width: 0; }
.qc.rtl { direction: rtl; text-align: right; }

.qc-lbl {
  display: block; font-size: 9px; font-weight: 500;
  letter-spacing: .15em; text-transform: uppercase;
  color: var(--gold); margin-bottom: .75rem;
}

/* English + German verse — dark for readability */
.verse {
  font-family: var(--serif);
  font-size: 1rem; font-style: italic;
  line-height: 1.95; color: var(--ink);
  white-space: normal; word-break: normal;
}
.verse-or {
  display: block; font-family: var(--sans);
  font-size: .75rem; font-weight: 500; font-style: normal;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--gold2); margin: .75rem 0;
}

/* Farsi text */
.verse-farsi {
  font-family: var(--serif);
  font-size: 1.1rem; font-style: normal;
  line-height: 2.2; color: var(--ink);
  direction: rtl; text-align: right;
}

/* GIF / calligraphy — right-justified, no label in quatrain context */
.gif-wrap {
  background: var(--page-bg);
  border: 1px solid var(--border-lt); border-radius: 5px;
  overflow: hidden;
  display: flex; align-items: center; justify-content: flex-end;
  min-height: 56px; direction: ltr;
}
.gif-wrap img { max-width: 100%; height: auto; display: block; }
.gif-miss {
  width: 100%; padding: .85rem 1rem;
  text-align: right; font-size: .78rem;
  color: var(--ink3); font-style: italic; direction: ltr;
}

.q-sep {
  text-align: center; color: var(--gold2);
  font-size: 1rem; letter-spacing: .55em;
  opacity: .55; margin: 2rem 0 3rem;
}

/* ── PHILOSOPHY ─────────────────────────────────────────────*/
.phil-ellipsis { color: var(--gold2); font-weight: 500; }
.phil-quote {
  font-family: var(--serif); font-size: 1.05rem; font-style: italic;
  line-height: 1.95; color: var(--ink);
  border-left: 3px solid var(--gold2);
  padding: .5rem 1.5rem; margin: 1.25rem 0 1.5rem;
}

/* ── GALLERY ────────────────────────────────────────────────*/
.gallery-row { display: flex; gap: 1rem; margin-bottom: 1rem; }
.gallery-row.centered { justify-content: center; }
.gitem {
  flex: 0 0 calc(25% - .75rem);
  aspect-ratio: 3/4; overflow: hidden;
  border-radius: 7px; border: 1px solid var(--border);
  background: var(--panel-bg); cursor: pointer;
  transition: transform .25s, box-shadow .25s;
}
.gitem:hover { transform: translateY(-4px); box-shadow: 0 10px 30px rgba(26,23,16,.18); }
.gitem img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gitem-miss {
  width: 100%; height: 100%; display: flex; align-items: center;
  justify-content: center; font-size: .78rem; color: var(--ink3);
  font-style: italic; padding: 1rem; text-align: center; line-height: 1.5;
}

/* ── LIGHTBOX ───────────────────────────────────────────────*/
#lb {
  display: none; position: fixed; inset: 0;
  background: rgba(15,12,8,.92); z-index: 999;
  align-items: center; justify-content: center;
  padding: 2rem; cursor: zoom-out;
}
#lb.on { display: flex; }
#lb img { max-width: 82vw; max-height: 82vh; border-radius: 6px; }
#lb-close {
  position: fixed; top: 1.25rem; right: 1.5rem;
  color: rgba(255,255,255,.7); font-size: 2.2rem;
  cursor: pointer; background: none; border: none; line-height: 1;
}
#lb-close:hover { color: #fff; }

/* ── SCROLL-TO-TOP ──────────────────────────────────────────*/
#back-top {
  position: fixed; bottom: 2rem; right: 2rem; z-index: 300;
  width: 46px; height: 46px;
  background: rgba(46,38,24,.88);
  border: 1px solid rgba(212,170,106,.4);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; text-decoration: none;
  opacity: 0; pointer-events: none;
  transition: opacity .35s, transform .25s;
  backdrop-filter: blur(6px);
  color: var(--gold3); font-size: 1.2rem;
}
#back-top.visible { opacity: 1; pointer-events: auto; }
#back-top:hover { transform: translateY(-3px); background: rgba(46,38,24,.98); }

/* ── FOOTER ─────────────────────────────────────────────────*/
footer {
  background: var(--dark-bg); color: var(--dark-fg);
  text-align: center; padding: 3.5rem 2rem 2.75rem;
}
.sister { display: flex; justify-content: center; gap: 2.5rem; flex-wrap: wrap; margin-bottom: 1.75rem; }
.sister a {
  font-family: var(--serif); font-size: 1.1rem; font-style: italic;
  color: var(--gold3); text-decoration: none; transition: color .2s;
}
.sister a:hover { color: #fff; }
.copyright { font-size: .74rem; letter-spacing: .05em; color: #7a7060; line-height: 1.8; }

/* ── RESPONSIVE ─────────────────────────────────────────────*/
@media (max-width: 820px) {
  nav { padding: 0 1rem; }
  .hero { grid-template-columns: 1fr; }
  .hero-image { display: none; }
  .container { padding: 0 1.25rem; }
  .dark-panel { padding: 1.75rem 1.25rem; }
  .legend { grid-template-columns: 1fr; }
  .q-grid { grid-template-columns: 1fr; }
  .qc.rtl { direction: ltr; text-align: left; }
  .verse-farsi { direction: rtl; text-align: right; }
  .gallery-row { flex-wrap: wrap; }
  .gitem { flex: 0 0 calc(50% - .5rem); }
}

@media print {
  nav, #back-top { display: none; }
  .q-grid { grid-template-columns: 1fr 1fr 1fr; }
}
