/* ═══════════════════════════════════════════════
   LAB PAGE — V1
   Research archive and editorial notebook.
   Understated hero. Index-format entry list.
   Typography is the only design element.
   ═══════════════════════════════════════════════ */

/* ── IRAN Kharazmi — Persian display font ────── */
@font-face {
  font-family: 'IRAN Kharazmi';
  src: url('fonts/IRAN Kharazmi.eot');
  src: url('fonts/IRAN Kharazmi.eot?#iefix') format('embedded-opentype'),
       url('fonts/IRAN Kharazmi.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-fa-display: 'IRAN Kharazmi', 'Vazirmatn', Tahoma, sans-serif;
}

/* ── Scroll unlock ───────────────────────────── */
body.lab-page {
  overflow-y: auto;
  overflow-x: hidden;
}

body.lab-page .page-frame {
  height: auto;
  min-height: 100svh;
  display: block;
}

body.lab-page #main-content {
  display: block;
}

/* Pin chrome to viewport while content scrolls */
body.lab-page .corner,
body.lab-page .nav {
  position: fixed;
}

body.lab-page .nav {
  top: calc(var(--pad) + 28px);
  inset-inline-end: var(--pad);
  z-index: 20;
}

body.lab-page .corner--tl { top: var(--pad); inset-inline-start: var(--pad); }
body.lab-page .corner--tr { top: var(--pad); inset-inline-end: var(--pad); }
body.lab-page .corner--br { bottom: var(--pad); inset-inline-end: var(--pad); }

body.lab-page .footer {
  position: relative;
  z-index: 10;
}

/* ── Hero — intentionally restrained ─────────── */
/*
   No min-height: 100svh.
   The archive begins close — the lab is the point,
   not the entrance to it.
*/
.lab-hero {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-inline: var(--pad);
  padding-block: calc(var(--pad) * 5.5) calc(var(--pad) * 2.5);
  position: relative;
}

/* Orientation badge */
.lab-badge {
  position: absolute;
  top: calc(var(--pad) * 3.5);
  inset-inline-start: var(--pad);
  display: flex;
  align-items: center;
  gap: 12px;
  opacity: 0;
  animation: fade-up 0.55s ease 0.1s both;
}

.lab-badge__num {
  font-family: var(--font);
  font-size: 0.5rem;
  letter-spacing: 0.12em;
  color: var(--text-dim);
}

.lab-badge__label {
  font-family: var(--font);
  font-size: 0.5rem;
  letter-spacing: 0.18em;
  color: var(--text-dim);
  text-transform: uppercase;
}

/* ── EN headline ─────────────────────────────── */
/*
   Smaller than Work (10rem) — this is a notebook, not a declaration.
   "THE" opens the thought; "LAB." closes it in accent.
*/
.lab-hero__headline {
  margin: 0 0 clamp(14px, 2.2vh, 24px);
  line-height: 0.88;
}

.lab-hero__line {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(3rem, 7vw, 6.5rem);
  line-height: 0.88;
  letter-spacing: -0.01em;
  color: var(--text-bright);
  clip-path: inset(0 100% 0 0);
}

.lab-hero__line:nth-child(1) {
  animation: lab-line-reveal 0.9s cubic-bezier(0.77, 0, 0.175, 1) 0.2s both;
}

.lab-hero__line:nth-child(2) {
  animation: lab-line-reveal 0.9s cubic-bezier(0.77, 0, 0.175, 1) 0.36s both;
  color: var(--accent);
}

@keyframes lab-line-reveal {
  0%   { clip-path: inset(0 100% 0 0); }
  100% { clip-path: inset(0 0%   0 0); }
}

/* ── FA headline — independently composed ────── */
.lab-hero-fa {
  display: none;
}

[lang="fa"] .lab-hero-fa {
  display: block;
  font-family: var(--font-fa-display);
  font-size: clamp(2.8rem, 7vw, 6.5rem);
  line-height: 1.3;
  letter-spacing: 0;
  color: var(--accent);
  text-align: right;
  direction: rtl;
  margin: 0 0 clamp(14px, 2.2vh, 24px);
  clip-path: inset(0 0% 0 100%);
  animation: lab-line-reveal-rtl 0.9s cubic-bezier(0.77, 0, 0.175, 1) 0.2s both;
}

[lang="fa"] .lab-hero__headline {
  display: none;
}

@keyframes lab-line-reveal-rtl {
  0%   { clip-path: inset(0 0% 0 100%); }
  100% { clip-path: inset(0 0% 0 0%);   }
}

/* ── Hero subtitle ───────────────────────────── */
.lab-hero__sub {
  font-family: var(--font);
  font-size: clamp(0.6rem, 0.9vw, 0.7rem);
  letter-spacing: 0.05em;
  line-height: 2;
  color: var(--text-dim);
  max-width: 440px;
  margin: 0;
  opacity: 0;
  animation: fade-up 0.55s ease 0.55s both;
}

[lang="fa"] .lab-hero__sub {
  font-family: var(--font-fa);
  font-size: clamp(0.78rem, 1vw, 0.88rem);
  letter-spacing: 0;
  line-height: 2.2;
  text-align: right;
  max-width: 480px;
}

/* ── Archive section ─────────────────────────── */
.lab-archive {
  padding-inline: var(--pad);
  padding-block: 0 clamp(60px, 8vh, 100px);
}

/* Rule between hero and archive */
.lab-rule {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-bottom: 0;
}

.lab-rule__line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--text-mid), transparent);
  opacity: 0.22;
}

.lab-rule__diamond {
  font-size: 0.3rem;
  color: var(--text-dim);
  opacity: 0.5;
}

/* ── Entry list ──────────────────────────────── */
.lab-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* ── Individual entry ────────────────────────── */
/*
   Three-column grid:
   [number]  [title]  [status]

   The entry IS the design — nothing else.
*/
.lab-entry {
  display: grid;
  grid-template-columns: 2.5rem 1fr auto;
  align-items: center;
  gap: clamp(16px, 2.5vw, 32px);
  padding-block: clamp(20px, 3.2vh, 32px);
  position: relative;
  cursor: default;
  transition: opacity 0.25s ease;
}

/* Hover accent: left border flash */
.lab-entry::before {
  content: '';
  position: absolute;
  inset-block: 0;
  inset-inline-start: -1px;
  width: 1px;
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.3s cubic-bezier(0.77, 0, 0.175, 1);
}

.lab-entry:hover::before {
  transform: scaleY(1);
}

/* Entry number */
.lab-entry__index {
  font-family: var(--font);
  font-size: 0.48rem;
  letter-spacing: 0.1em;
  color: var(--accent);
  opacity: 0.7;
  transition: opacity 0.25s ease;
  flex-shrink: 0;
  line-height: 1;
}

.lab-entry:hover .lab-entry__index {
  opacity: 1;
}

/* Topic title — the anchor of each entry */
.lab-entry__title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3.2vw, 3rem);
  line-height: 1;
  letter-spacing: -0.005em;
  color: var(--text-bright);
  margin: 0;
  transition: color 0.25s ease;
}

.lab-entry:hover .lab-entry__title {
  color: var(--accent);
}

/* Status — right-aligned annotation */
.lab-entry__status {
  font-family: var(--font);
  font-size: 0.48rem;
  letter-spacing: 0.06em;
  line-height: 1;
  color: var(--text-dim);
  font-style: italic;
  text-align: end;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.25s ease;
}

.lab-entry:hover .lab-entry__status {
  color: var(--text-mid);
}

/* Hairline divider between entries */
.lab-entry__rule {
  position: absolute;
  inset-block-end: 0;
  inset-inline: 0;
  height: 1px;
  background: var(--text-mid);
  opacity: 0.1;
}

/* No bottom rule on last entry */
.lab-entry:last-child .lab-entry__rule {
  display: none;
}

/* ── Persian entry typography ─────────────────── */
[lang="fa"] .lab-entry__title {
  font-family: var(--font-fa-display);
  font-size: clamp(1.4rem, 3vw, 2.8rem);
  line-height: 1.3;
  letter-spacing: 0;
}

[lang="fa"] .lab-entry__index,
[lang="fa"] .lab-entry__status {
  font-family: var(--font-fa);
  font-size: clamp(0.65rem, 0.8vw, 0.72rem);
  letter-spacing: 0;
  font-style: normal;
}

/* In RTL, index stays on the leading edge (right), status on the trailing (left) */
[lang="fa"] .lab-entry__status {
  text-align: start;
}

/* ── Scroll reveal ───────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* Stagger: each entry slightly offset */
.lab-entry:nth-child(1) { transition-delay: 0s;    }
.lab-entry:nth-child(2) { transition-delay: 0.05s; }
.lab-entry:nth-child(3) { transition-delay: 0.10s; }
.lab-entry:nth-child(4) { transition-delay: 0.15s; }
.lab-entry:nth-child(5) { transition-delay: 0.20s; }
.lab-entry:nth-child(6) { transition-delay: 0.25s; }

/* ── Responsive ──────────────────────────────── */
@media (max-width: 900px) {
  .lab-hero__line {
    font-size: clamp(2.6rem, 7vw, 5rem);
  }

  [lang="fa"] .lab-hero-fa {
    font-size: clamp(2.4rem, 7vw, 5rem);
  }

  .lab-entry__title {
    font-size: clamp(1.3rem, 3.5vw, 2.4rem);
  }
}

@media (max-width: 600px) {
  .lab-hero {
    padding-block: calc(var(--pad) * 5) calc(var(--pad) * 2);
  }

  .lab-hero__line {
    font-size: clamp(2.2rem, 9vw, 3.5rem);
  }

  [lang="fa"] .lab-hero-fa {
    font-size: clamp(2rem, 8vw, 3rem);
  }

  /* Stack on mobile: number + title in block, status below title */
  .lab-entry {
    grid-template-columns: 2rem 1fr;
    grid-template-rows: auto auto;
    row-gap: 6px;
  }

  .lab-entry__status {
    grid-column: 2;
    grid-row: 2;
    text-align: start;
    white-space: normal;
  }
}
