/* Twin Myths — Persian lapis & gold meets Greek black-glaze & terracotta */
:root {
  --ink: #0e0c0b;
  --ink-2: #16120f;
  --ink-3: #211a15;
  --parch: #f2e6cf;
  --parch-dim: #bfae90;
  --gold: #d6ad55;
  --gold-2: #f3d98f;
  --lapis: #1d3488;
  --lapis-deep: #0d1847;
  --turq: #4cc0b4;
  --clay: #cf6a3c;
  --clay-2: #eb9a6d;
  --line: rgba(214, 173, 85, 0.22);
  --serif: "EB Garamond", Georgia, "Times New Roman", serif;
  --display: "Cinzel", "EB Garamond", Georgia, serif;
  --fa: "Vazirmatn", Tahoma, sans-serif;
  --radius: 18px;
  --girih: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cg fill='none' stroke='%23d6ad55' stroke-opacity='.2'%3E%3Crect x='22' y='22' width='28' height='28'/%3E%3Crect x='22' y='22' width='28' height='28' transform='rotate(45 36 36)'/%3E%3Cpath d='M0 0L22 22M72 0L50 22M0 72L22 50M72 72L50 50'/%3E%3Ccircle cx='36' cy='36' r='5'/%3E%3C/g%3E%3C/svg%3E");
  --meander: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M0 21H24M19 21V3H3V17H15V7H7V13H11' fill='none' stroke='%23cf6a3c' stroke-width='2'/%3E%3C/svg%3E");
}
html[lang="el"] { --display: "EB Garamond", Georgia, serif; }
html[lang="fa"] { --serif: var(--fa); --display: var(--fa); }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--parch);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
html[lang="fa"] body { font-size: 1.05rem; line-height: 1.95; }
a { color: var(--gold-2); }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 3px; border-radius: 6px; }

.skip { position: absolute; top: 0; inset-inline-start: 0; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.skip:focus { width: auto; height: auto; clip-path: none; top: 1rem; inset-inline-start: 1rem; z-index: 99; background: var(--gold); color: var(--ink); padding: .5rem 1rem; }

/* ---------- Top bar ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem clamp(1rem, 4vw, 2.5rem);
  background: rgba(14, 12, 11, .82);
  border-bottom: 1px solid rgba(214, 173, 85, .12);
  backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--parch); }
.brand-mark { width: 30px; height: 30px; display: inline-block; }
.brand-text { font-family: var(--display); font-weight: 700; letter-spacing: .08em; font-size: 1rem; }
html[lang="el"] .brand-text { text-transform: uppercase; letter-spacing: .12em; }
.langs { display: flex; gap: .25rem; padding: .25rem; border: 1px solid var(--line); border-radius: 999px; background: rgba(14, 12, 11, .6); }
.langs button {
  border: 0; background: transparent; cursor: pointer;
  padding: .3rem .8rem; border-radius: 999px; font-size: .85rem; letter-spacing: .06em; color: var(--parch-dim);
  font-family: var(--serif);
}
.langs button[lang="fa"] { font-family: var(--fa); }
.langs button[aria-pressed="true"] { background: var(--gold); color: var(--ink); font-weight: 600; }

/* ---------- Hero ---------- */
.hero {
  position: relative; min-height: 94vh; display: grid; place-items: center;
  overflow: hidden; isolation: isolate; padding: 6rem 1.25rem 4rem;
  background-size: cover; background-position: center;
}
.hero-half { position: absolute; top: 0; bottom: 0; width: 50%; z-index: -2; }
.hero-ir {
  inset-inline-start: 0;
  background:
    var(--girih),
    radial-gradient(circle at 35% 40%, #2b4bb3 0%, var(--lapis) 35%, var(--lapis-deep) 75%, #070c26 100%);
}
.hero-gr {
  inset-inline-end: 0;
  background:
    radial-gradient(circle at 65% 60%, rgba(207, 106, 60, .38), transparent 55%),
    var(--ink);
}
.hero-gr::before, .hero-gr::after {
  content: ""; position: absolute; inset-inline: 0; height: 24px; background: var(--meander) repeat-x; opacity: .75;
}
.hero-gr::before { top: 4.5rem; }
.hero-gr::after { bottom: 1.5rem; }
.hero.has-image .hero-half { opacity: .55; }
.hero-seam {
  position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; z-index: -1;
  background: linear-gradient(to bottom, transparent, var(--gold) 20%, var(--gold-2) 50%, var(--gold) 80%, transparent);
  box-shadow: 0 0 24px 4px rgba(214, 173, 85, .35);
}
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(ellipse at center, rgba(14, 12, 11, .55), rgba(14, 12, 11, 0) 60%);
}
.hero-content { max-width: 780px; text-align: center; }
.hero-emblems { display: flex; justify-content: center; margin-bottom: 1.25rem; }
.hero-emblems svg { width: clamp(90px, 14vw, 128px); height: auto; filter: drop-shadow(0 10px 30px rgba(0, 0, 0, .5)); }
.hero-emblems svg + svg { margin-inline-start: -22px; }
.eyebrow { font-size: .9rem; letter-spacing: .28em; text-transform: uppercase; color: var(--gold); margin: 0 0 .5rem; }
html[lang="fa"] .eyebrow { letter-spacing: .05em; }
h1 {
  margin: 0; font-family: var(--display); font-weight: 700; line-height: 1.02;
  font-size: clamp(3rem, 10vw, 7.2rem); letter-spacing: .03em;
  background: linear-gradient(180deg, var(--gold-2) 10%, var(--gold) 55%, #a47a2c 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 2px 40px rgba(214, 173, 85, .15);
}
html[lang="el"] h1 { text-transform: uppercase; font-weight: 600; letter-spacing: .05em; font-size: clamp(2.6rem, 8vw, 6rem); }
html[lang="fa"] h1 { font-weight: 800; line-height: 1.3; letter-spacing: 0; }
h1 small {
  display: block; margin-top: .6rem; font-size: .26em; letter-spacing: .4em; text-transform: uppercase;
  -webkit-text-fill-color: var(--parch); color: var(--parch); font-weight: 500;
}
html[lang="fa"] h1 small { letter-spacing: .1em; font-size: .3em; }
.lede { font-size: clamp(1.1rem, 2.2vw, 1.35rem); color: #e8dcc4; margin: 1.5rem auto 2rem; max-width: 620px; }
.btn {
  display: inline-block; padding: .8rem 1.8rem; border-radius: 999px; text-decoration: none;
  color: var(--ink); background: linear-gradient(180deg, var(--gold-2), var(--gold)); font-weight: 600; letter-spacing: .04em;
  box-shadow: 0 8px 30px rgba(214, 173, 85, .3); transition: transform .2s, box-shadow .2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 12px 40px rgba(214, 173, 85, .45); }

/* ---------- Intro ---------- */
.intro { max-width: 1120px; margin: 0 auto; padding: 5rem clamp(1.25rem, 4vw, 2.5rem) 2rem; }
h2 { font-family: var(--display); font-weight: 600; font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0 0 1.5rem; color: var(--gold-2); letter-spacing: .02em; }
html[lang="fa"] h2 { font-weight: 800; }
.intro-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.5rem; }
.intro-grid article { border-top: 1px solid var(--gold); padding-top: 1rem; }
.intro-grid .num { font-family: "Cinzel", serif; color: var(--clay-2); font-size: .9rem; letter-spacing: .2em; }
.intro-grid h3 { margin: .3rem 0 .5rem; font-size: 1.3rem; font-weight: 600; }
.intro-grid p { margin: 0; color: #dccfb6; }

/* ---------- Pairs ---------- */
.pairs { max-width: 1240px; margin: 0 auto; padding: 3rem clamp(1rem, 4vw, 2.5rem) 5rem; }
.pairs-head { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: end; justify-content: space-between; margin-bottom: 1.75rem; }
.pairs-head h2 { margin: 0; }
.count { margin: .2rem 0 0; color: var(--parch-dim); font-size: 1rem; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  border: 1px solid var(--line); background: var(--ink-2); border-radius: 999px; padding: .35rem .95rem;
  cursor: pointer; font-size: .95rem; color: var(--parch-dim); transition: all .15s;
}
.chip:hover { border-color: var(--gold); color: var(--parch); }
.chip[aria-pressed="true"] { background: var(--parch); color: var(--ink); border-color: var(--parch); }
.chip-sep { width: 1px; background: var(--line); margin: 0 .25rem; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 1.5rem; }
.empty { color: var(--parch-dim); grid-column: 1 / -1; text-align: center; padding: 3rem 0; }

.card {
  position: relative; display: flex; flex-direction: column; text-align: start;
  background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  cursor: pointer; padding: 0; transition: transform .25s, box-shadow .25s, border-color .25s;
}
.card:hover { transform: translateY(-4px); border-color: rgba(214, 173, 85, .55); box-shadow: 0 18px 50px rgba(0, 0, 0, .45), 0 0 0 1px rgba(214, 173, 85, .15); }
.duo { position: relative; display: grid; grid-template-columns: 1fr 1fr; }
.side { padding: 1.1rem .9rem 1rem; text-align: center; }
.side.ir { background: var(--girih), linear-gradient(160deg, #22399a, var(--lapis-deep)); }
.side.gr { background: radial-gradient(circle at 50% 30%, rgba(207, 106, 60, .28), transparent 65%), #0b0908; border-inline-start: 1px solid rgba(214, 173, 85, .35); }
.side .media { width: 78%; margin: 0 auto .7rem; }
.side .name { font-family: var(--display); font-weight: 600; font-size: 1.12rem; line-height: 1.25; display: block; }
html[lang="el"] .side .name { font-size: 1.15rem; }
.side.ir .name { color: var(--gold-2); }
.side.gr .name { color: var(--clay-2); }
.side .sub { display: block; font-size: .85rem; color: var(--parch-dim); margin-top: .2rem; line-height: 1.35; }
.mirror {
  position: absolute; top: 42%; left: 50%; transform: translate(-50%, -50%);
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ink); border: 1px solid var(--gold); color: var(--gold-2); font-size: 1.05rem;
  box-shadow: 0 0 18px rgba(214, 173, 85, .35);
}
.card-body { padding: 1rem 1.2rem 1.2rem; display: flex; flex-direction: column; gap: .6rem; flex: 1; }
.badge { align-self: flex-start; font-size: .78rem; letter-spacing: .06em; padding: .15rem .65rem; border-radius: 999px; }
.badge.historical { background: var(--gold); color: var(--ink); font-weight: 600; }
.badge.thematic { border: 1px solid var(--turq); color: var(--turq); }
.excerpt { margin: 0; color: #d9ccb2; font-size: 1rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.more { margin-top: auto; color: var(--gold-2); font-size: .95rem; }
.more::after { content: " →"; }
html[dir="rtl"] .more::after { content: " ←"; }

/* media: illustration or emblem */
.media { aspect-ratio: 4 / 5; display: grid; place-items: center; border-radius: 12px; overflow: hidden; }
.media img { width: 100%; height: 100%; object-fit: cover; }
.media svg { width: 92%; height: auto; }
.media.has-img { box-shadow: 0 0 0 1px rgba(214, 173, 85, .5), 0 10px 30px rgba(0, 0, 0, .4); }

/* ---------- Detail dialog ---------- */
dialog {
  width: min(1120px, 94vw); max-height: 92vh; padding: 0; border: 1px solid rgba(214, 173, 85, .45);
  border-radius: 22px; background: var(--ink-2); color: var(--parch); overflow: auto;
  box-shadow: 0 30px 120px rgba(0, 0, 0, .7);
}
dialog::backdrop { background: rgba(5, 4, 3, .78); backdrop-filter: blur(4px); }
.d-head {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 1rem; justify-content: space-between;
  padding: .9rem 1.4rem; background: rgba(22, 18, 15, .94); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line);
}
.d-head h2 { margin: 0; font-size: clamp(1.15rem, 2.6vw, 1.6rem); }
.d-head h2 .x { color: var(--gold); margin: 0 .5rem; }
.icon-btn {
  border: 1px solid var(--line); background: var(--ink-3); border-radius: 999px; padding: .35rem .9rem; cursor: pointer; font-size: .9rem; white-space: nowrap;
}
.icon-btn:hover { border-color: var(--gold); }
.d-cols { display: grid; grid-template-columns: 1fr 1fr; }
.d-side { padding: 1.6rem clamp(1.1rem, 3vw, 2.2rem) 1.8rem; }
.d-side.ir { background: var(--girih), linear-gradient(170deg, rgba(34, 57, 154, .55), rgba(13, 24, 71, .9)); }
.d-side.gr { background: radial-gradient(circle at 50% 10%, rgba(207, 106, 60, .2), transparent 60%), #0b0908; border-inline-start: 1px solid rgba(214, 173, 85, .3); }
.d-side .media { max-width: 300px; margin: 0 auto 1.2rem; }
.d-side .label { font-size: .78rem; letter-spacing: .25em; text-transform: uppercase; color: var(--parch-dim); }
html[lang="fa"] .d-side .label { letter-spacing: .05em; }
.d-side h3 { font-family: var(--display); font-size: 1.7rem; margin: .1rem 0 .1rem; line-height: 1.2; }
.d-side.ir h3 { color: var(--gold-2); }
.d-side.gr h3 { color: var(--clay-2); }
.d-side .epithet { font-style: italic; color: #e2d5bb; margin: 0 0 .9rem; }
html[lang="fa"] .d-side .epithet { font-style: normal; color: var(--parch-dim); }
.d-side p.story { margin: 0; }
.verse { margin: 1.2rem 0 0; padding: .9rem 1.1rem; border-inline-start: 3px solid var(--gold); background: rgba(0, 0, 0, .25); border-radius: 0 10px 10px 0; }
html[dir="rtl"] .verse { border-radius: 10px 0 0 10px; }
.verse .fa-verse { font-family: var(--fa); direction: rtl; text-align: right; font-size: 1.15rem; color: var(--gold-2); display: block; line-height: 2; }
.verse .tr { display: block; color: var(--parch-dim); font-size: .95rem; font-style: italic; margin-top: .3rem; }
.verse small { display: block; color: var(--parch-dim); font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; margin-bottom: .3rem; }
.d-bond {
  margin: 0; padding: 1.8rem clamp(1.1rem, 3vw, 2.2rem) 2rem; border-top: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(29, 52, 136, .25), rgba(207, 106, 60, .18));
}
.d-bond h4 { margin: 0 0 .5rem; font-family: var(--display); color: var(--gold-2); font-size: 1.3rem; display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.d-bond p { margin: 0; max-width: 78ch; font-size: 1.12rem; }
.d-sources { margin-top: 1rem !important; color: var(--parch-dim); font-size: .92rem !important; }
.d-nav { display: flex; justify-content: space-between; gap: 1rem; padding: 1rem 1.4rem 1.4rem; }

/* ---------- Footer ---------- */
.footer { text-align: center; padding: 0 1.25rem 3rem; color: var(--parch); }
.footer .meander { height: 24px; background: var(--meander) repeat-x; opacity: .6; margin-bottom: 2rem; }
.footer p { margin: .3rem 0; }
.muted { color: var(--parch-dim); font-size: .95rem; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .d-cols { grid-template-columns: 1fr; }
  .d-side.gr { border-inline-start: 0; border-top: 1px solid rgba(214, 173, 85, .3); }
  .grid { grid-template-columns: 1fr; }
  .hero-gr::before { top: 4rem; }
  .side .name { font-size: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card, .btn { transition: none; }
}
