/* Blue Yolk — design tokens, layout and motion.
   Logical properties (inline-start/end) are used throughout so Arabic (RTL) mirrors correctly. */

:root {
  --cobalt: #1f41e0;
  --paper: #f2f3f7;
  --ink: #0b0d14;
  --yolk: #f2b632;
  --muted: color-mix(in srgb, var(--ink) 62%, var(--paper));
  --line: color-mix(in srgb, var(--ink) 14%, var(--paper));
  --gutter: clamp(20px, 4vw, 56px);
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.7, 0, 0.2, 1);
  color-scheme: light;
}

html[lang="ar"] {
  --serif: "IBM Plex Sans Arabic", "Noto Naskh Arabic", system-ui, sans-serif;
  --sans: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
html[lang="ar"] body { line-height: 1.85; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { color: var(--cobalt); }
::selection { background: var(--cobalt); color: var(--paper); }

:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 3px; border-radius: 2px; }

.skip {
  position: absolute; inset-inline-start: var(--gutter); top: -100px; z-index: 200;
  background: var(--ink); color: var(--paper); padding: 0.6rem 1rem; text-decoration: none;
}
.skip:focus { top: 12px; color: var(--paper); }

.mono { font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.05em; line-height: 1.5; }
html[lang="ar"] .mono { font-family: var(--sans); letter-spacing: 0; font-size: 0.8125rem; }
html[lang="en"] .caps { text-transform: uppercase; }
.muted { color: var(--muted); }

/* ---------- header ---------- */
.site-header {
  position: fixed; inset-block-start: 0; inset-inline: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px var(--gutter);
  pointer-events: none;
}
.site-header > * { pointer-events: auto; }
.wordmark { display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none; font-family: var(--serif); font-size: 1.5rem; line-height: 1; }
.wordmark svg { width: 22px; height: 22px; }
html[lang="ar"] .wordmark { font-weight: 600; font-size: 1.25rem; }
.nav { display: flex; align-items: center; gap: clamp(14px, 2.4vw, 34px); }
.nav a { text-decoration: none; font-size: 0.9375rem; position: relative; padding-block: 4px; }
.nav a[aria-current="page"]::after, .nav a:hover::after {
  content: ""; position: absolute; inset-inline: 0; bottom: -2px; height: 1px; background: currentColor;
}
.lang-switch { font-family: var(--sans); font-weight: 600; border: 1px solid var(--ink); border-radius: 999px; padding: 2px 12px !important; }
.lang-switch::after { display: none; }
.lang-switch:hover { background: var(--ink); color: var(--paper) !important; }
.menu-btn { display: none; background: none; border: 0; font: inherit; color: inherit; cursor: pointer; padding: 6px 0; }

@media (max-width: 760px) {
  .menu-btn { display: block; font-family: var(--mono); font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.05em; }
  html[lang="ar"] .menu-btn { font-family: var(--sans); text-transform: none; letter-spacing: 0; }
  .nav {
    position: fixed; inset: 0; background: var(--paper); flex-direction: column; justify-content: center;
    align-items: flex-start; gap: 18px; padding: var(--gutter);
    opacity: 0; visibility: hidden; transition: opacity 0.3s;
  }
  .nav a { font-family: var(--serif); font-size: 2.6rem; line-height: 1.1; }
  .lang-switch { font-size: 1rem !important; margin-top: 12px; }
  body.menu-open .nav { opacity: 1; visibility: visible; }
  body.menu-open .menu-btn { position: relative; z-index: 60; }
}

/* ---------- layout ---------- */
main { min-height: 70vh; }
.wrap { padding-inline: var(--gutter); max-width: 1500px; margin-inline: auto; }
.section { padding-block: clamp(56px, 9vw, 130px); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-block-end: clamp(20px, 3vw, 40px); border-block-end: 1px solid var(--line); padding-block-end: 14px; }
.section-head h2 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: clamp(1.5rem, 2.4vw, 2.2rem); line-height: 1.1; }
.arrow-link { text-decoration: none; white-space: nowrap; }
.arrow-link .arr { display: inline-block; transition: transform 0.3s var(--ease); }
.arrow-link:hover .arr { transform: translateX(4px); }
html[dir="rtl"] .arr { transform: scaleX(-1); }
html[dir="rtl"] .arrow-link:hover .arr { transform: scaleX(-1) translateX(4px); }

h1, .display { font-family: var(--serif); font-weight: 400; margin: 0; line-height: 1; letter-spacing: -0.01em; }
html[lang="ar"] h1, html[lang="ar"] .display { font-weight: 500; line-height: 1.25; letter-spacing: 0; }
.page-title { font-size: clamp(3.4rem, 11vw, 9.5rem); padding-block: clamp(110px, 16vw, 200px) clamp(18px, 3vw, 36px); }
html[lang="ar"] .page-title { font-size: clamp(3rem, 9vw, 7.5rem); }
.page-intro { max-width: 40ch; font-size: clamp(1.15rem, 1.8vw, 1.5rem); line-height: 1.4; color: var(--muted); margin: 0 0 clamp(36px, 6vw, 80px); }
html[lang="ar"] .page-intro { line-height: 1.7; }

/* ---------- home hero ---------- */
.hero { position: relative; min-height: 100svh; display: grid; place-items: center; padding: 110px var(--gutter) 90px; overflow: hidden; }
.hero-eyebrow { position: absolute; inset-block-start: 84px; inset-inline-start: var(--gutter); }
.hero-stage { position: relative; width: min(82vmin, 780px); aspect-ratio: 1; display: grid; place-items: center; }
.hero-stage svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.hero-stage .blob-path { fill: var(--cobalt); }
.hero-statement {
  position: relative; z-index: 1; max-width: 62%; text-align: center; color: var(--paper);
  font-size: clamp(1.75rem, 4.4vmin, 3.4rem); line-height: 1.06;
}
.hero-cta { position: absolute; inset-block-end: 36px; inset-inline: 0; text-align: center; }
.hero-cta a { text-decoration: none; display: inline-flex; gap: 10px; align-items: center; padding: 10px 4px; border-block-end: 1px solid var(--ink); }
.hero-cta a:hover { color: var(--cobalt); border-color: var(--cobalt); }

/* ---------- rows (home exhibits, journal) ---------- */
.rows { list-style: none; margin: 0; padding: 0; }
.row { position: relative; border-block-end: 1px solid var(--line); }
.row > a {
  display: grid; grid-template-columns: 3.2rem minmax(0, 1fr) 11rem 5rem 1.5rem; gap: 1rem; align-items: baseline;
  padding-block: clamp(18px, 2.4vw, 30px); text-decoration: none;
}
.row:hover > a { color: var(--cobalt); }
.row .title { font-family: var(--serif); font-size: clamp(1.6rem, 3.6vw, 3.2rem); line-height: 1.05; }
html[lang="ar"] .row .title { font-weight: 500; line-height: 1.3; }
.row .arr { transition: transform 0.3s var(--ease); }
.row:hover .arr { transform: translateX(6px); }
html[dir="rtl"] .row:hover .arr { transform: scaleX(-1) translateX(6px); }
.row .thumb {
  position: absolute; inset-inline-end: 8rem; top: 50%; width: 240px; aspect-ratio: 4 / 3; translate: 0 -50%;
  opacity: 0; transform: scale(0.92) rotate(-2deg); transition: opacity 0.3s, transform 0.4s var(--ease);
  pointer-events: none; z-index: 2; overflow: hidden;
}
.row:hover .thumb { opacity: 1; transform: scale(1) rotate(0); }
.row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.journal-row > a { grid-template-columns: 8rem 7rem minmax(0, 1fr) 1.5rem; }
.journal-row .summary { grid-column: 3; margin: 0; color: var(--muted); font-size: 0.9375rem; max-width: 56ch; }
.journal-row > a .title { font-size: clamp(1.4rem, 2.6vw, 2.2rem); }

@media (max-width: 760px) {
  .row > a { grid-template-columns: 2.4rem minmax(0, 1fr) 1.2rem; }
  .row .disc, .row .yr { display: none; }
  .row .thumb { display: none; }
  .journal-row > a { grid-template-columns: minmax(0, 1fr) 1.2rem; }
  .journal-row .date, .journal-row .cat { grid-column: 1; }
  .journal-row .summary { grid-column: 1; }
}

/* ---------- cards (work index) ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-block-end: clamp(24px, 4vw, 48px); }
.filters button {
  font: inherit; font-size: 0.875rem; background: none; border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 16px; cursor: pointer; color: var(--ink);
}
.filters button:hover { border-color: var(--ink); }
.filters button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(28px, 5vw, 80px) clamp(20px, 3vw, 48px); }
.card { display: block; text-decoration: none; }
.card:hover { color: inherit; }
@media (min-width: 761px) { .card:nth-child(even) { margin-block-start: clamp(40px, 8vw, 120px); } }
.card .frame { overflow: hidden; aspect-ratio: 4 / 3; background: var(--line); }
.card .frame img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.8s var(--ease); }
.card:hover .frame img { transform: scale(1.04); }
.card .meta { display: flex; justify-content: space-between; gap: 1rem; margin-block-start: 14px; }
.card h3 { margin: 6px 0 4px; font-family: var(--serif); font-weight: 400; font-size: clamp(1.6rem, 2.6vw, 2.4rem); line-height: 1.05; }
html[lang="ar"] .card h3 { font-weight: 500; line-height: 1.3; }
.card p { margin: 0; color: var(--muted); max-width: 46ch; font-size: 0.9375rem; }
@media (max-width: 760px) { .grid { grid-template-columns: 1fr; } }
.is-hidden { display: none !important; }

.tag {
  display: inline-block; font-family: var(--mono); font-size: 0.6875rem; letter-spacing: 0.06em; text-transform: uppercase;
  background: var(--yolk); color: var(--ink); padding: 1px 8px; border-radius: 999px; vertical-align: middle;
}
html[lang="ar"] .tag { font-family: var(--sans); text-transform: none; letter-spacing: 0; font-size: 0.75rem; }

/* ---------- exhibit + post pages ---------- */
.exhibit-hero { margin-block-start: 0; aspect-ratio: 21 / 9; min-height: 280px; overflow: hidden; background: var(--line); }
.exhibit-hero img { width: 100%; height: 100%; object-fit: cover; }
.exhibit-top { padding-block-start: clamp(110px, 14vw, 170px); }
.exhibit-title { font-size: clamp(2.8rem, 8vw, 7rem); max-width: 14ch; margin-block-end: 28px; }
html[lang="ar"] .exhibit-title { max-width: none; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; border-block: 1px solid var(--line); padding-block: 16px; margin-block-end: clamp(32px, 5vw, 64px); }
.facts dt { color: var(--muted); }
.facts dd { margin: 2px 0 0; font-size: 1.0625rem; }
.exhibit-body { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); gap: clamp(32px, 6vw, 96px); }
.credits { list-style: none; margin: 0; padding: 0; }
.credits li { padding-block: 10px; border-block-end: 1px solid var(--line); display: flex; justify-content: space-between; gap: 1rem; }
.credits li span:first-child { color: var(--muted); }
@media (max-width: 760px) { .exhibit-body { grid-template-columns: 1fr; } .facts { grid-template-columns: 1fr 1fr; } }

.prose { max-width: 62ch; }
.prose p { margin: 0 0 1.2em; }
.prose h2, .prose h3 { font-family: var(--serif); font-weight: 400; line-height: 1.15; margin: 1.8em 0 0.6em; }
.prose ul { padding-inline-start: 1.2em; }
.prose blockquote { margin: 1.5em 0; padding-inline-start: 1.2em; border-inline-start: 2px solid var(--cobalt); font-family: var(--serif); font-size: 1.4em; line-height: 1.3; }
.prose.lead-first > p:first-child { font-family: var(--serif); font-size: clamp(1.5rem, 2.6vw, 2.2rem); line-height: 1.25; margin-block-end: 1.1em; }
html[lang="ar"] .prose.lead-first > p:first-child { font-weight: 500; line-height: 1.6; }

.next-exhibit { display: block; text-decoration: none; padding-block: clamp(48px, 8vw, 110px); border-block-start: 1px solid var(--line); margin-block-start: clamp(48px, 8vw, 110px); }
.next-exhibit .big { display: block; font-family: var(--serif); font-size: clamp(2.4rem, 7vw, 6rem); line-height: 1.05; margin-block-start: 8px; }
html[lang="ar"] .next-exhibit .big { font-weight: 500; line-height: 1.3; }

/* ---------- about / lab / contact ---------- */
.about-grid { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: clamp(32px, 6vw, 96px); align-items: start; }
.about-aside { position: sticky; top: 110px; }
.about-aside .blob-mini { width: min(220px, 50%); aspect-ratio: 1; margin-block-end: 24px; }
.about-aside .blob-mini .blob-path { fill: var(--cobalt); }
@media (max-width: 760px) { .about-grid { grid-template-columns: 1fr; } .about-aside { position: static; } }
.about-name { font-size: clamp(2.6rem, 6vw, 5rem); }
.lab-prose { max-width: 34ch; }
.lab-prose p { font-family: var(--serif); font-size: clamp(1.6rem, 3.2vw, 2.8rem); line-height: 1.15; margin: 0 0 0.8em; }
html[lang="ar"] .lab-prose p { font-weight: 500; line-height: 1.55; }
.lab-prose p:first-child { color: var(--cobalt); }
.dna { font-family: var(--mono); color: var(--cobalt); margin-block-start: 3rem; opacity: 0.85; direction: ltr; text-align: start; }
.contact-mail { display: inline-block; font-family: var(--serif); font-size: clamp(2.2rem, 7vw, 6rem); line-height: 1.05; text-decoration: none; border-block-end: 2px solid var(--cobalt); margin-block: 8px 40px; word-break: break-word; }
html[lang="ar"] .contact-mail { font-family: var(--sans); direction: ltr; }

/* ---------- footer ---------- */
.site-footer { border-block-start: 1px solid var(--line); padding: clamp(40px, 6vw, 80px) var(--gutter) 28px; }
.footer-grid { max-width: 1500px; margin-inline: auto; display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 28px; }
.footer-grid .big-mail { font-family: var(--serif); font-size: clamp(1.6rem, 3vw, 2.4rem); text-decoration: none; line-height: 1.1; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin-block-end: 4px; }
.footer-grid a { text-decoration: none; }
.footer-grid a:hover { text-decoration: underline; }
.footer-base { max-width: 1500px; margin: 40px auto 0; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; color: var(--muted); }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; } }

/* ---------- motion: page veil + cursor ---------- */
.veil {
  position: fixed; inset: 0; z-index: 100; background: var(--cobalt); pointer-events: none;
  clip-path: circle(0 at var(--x, 50%) var(--y, 50%));
}
.veil.cover { clip-path: circle(150vmax at var(--x, 50%) var(--y, 50%)); transition: clip-path 0.7s var(--ease); }
.veil.start-covered { clip-path: circle(150vmax at var(--x, 50%) var(--y, 50%)); }
.veil.reveal { clip-path: circle(0 at var(--x, 50%) var(--y, 50%)); transition: clip-path 0.8s var(--ease); }

.cursor {
  position: fixed; left: 0; top: 0; z-index: 90; width: 14px; height: 14px; margin: -7px 0 0 -7px;
  background: var(--yolk); border-radius: 46% 54% 50% 50% / 52% 48% 54% 46%; pointer-events: none;
  opacity: 0; transition: opacity 0.3s, width 0.25s var(--ease), height 0.25s var(--ease), margin 0.25s var(--ease);
  will-change: transform;
}
.cursor.on { opacity: 1; }
.cursor.big { width: 44px; height: 44px; margin: -22px 0 0 -22px; mix-blend-mode: multiply; }

.js .reveal-in { opacity: 0; transform: translateY(18px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); }
.js .reveal-in.seen { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  .reveal-in { opacity: 1; transform: none; }
  .veil, .cursor { display: none; }
}
@media (hover: none), (pointer: coarse) { .cursor { display: none; } }
@media print { .site-header, .veil, .cursor, .skip { display: none; } .reveal-in { opacity: 1; transform: none; } }

/* ---------- phone safety ---------- */
html, body { max-width: 100%; }
html, body { overflow-x: clip; }
@media (max-width: 760px) {
  .journal-row > a { grid-template-columns: 2.4rem minmax(0, 1fr) 1.2rem; }
  .journal-row .summary { grid-column: 2; }
  .row .title, .card h3, .page-title { overflow-wrap: anywhere; }
  .tag { white-space: nowrap; }
}
