/*
Theme Name: Yara162 Dark Index
Description: A dark editorial portfolio and AV project index for Yara Zabihi.
Version: 2.1.1
Requires at least: 6.6
Text Domain: yara162-index
*/
@font-face {
  font-family: "Bebas Neue";
  src: url("assets/fonts/bebasneue.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Fredoka";
  src: url("assets/fonts/fredoka.ttf") format("truetype");
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: "Lalezar";
  src: url("assets/fonts/lalezar.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Parastoo";
  src: url("assets/fonts/parastoo.ttf") format("truetype");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}
:root {
  --page: #141820;
  --navy: #111a30;
  --ink: #edf0fa;
  --muted: #b8c1d3;
  --label: #97a3bd;
  --line: #364156;
  --accent: #a9b8ff;
  --display-font: "Bebas Neue", sans-serif;
  --body-font: "Fredoka", sans-serif;
  --mono-font: "Courier New", Courier, monospace;
  --label-columns: minmax(145px, 1fr) minmax(0, 3fr);
  --column-gap: clamp(22px, 5vw, 64px);
}
:root:lang(fa) {
  --display-font: "Lalezar", sans-serif;
  --body-font: "Parastoo", serif;
  /* Courier New has no Persian glyphs, which breaks letter joining. */
  --mono-font: "Parastoo", serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
.wp-site-blocks, .editor-styles-wrapper {
  background: var(--page); color: var(--ink);
  font: 1rem/1.6 var(--body-font);
}
/* `clip` (unlike `hidden`) keeps the sticky header and footer working. */
.wp-site-blocks { min-height: 100vh; overflow-x: clip; }
.wrap { width: min(1080px, calc(100% - 64px)); margin-inline: auto; }
.wrap :where(h1, h2, h3, h4, p) { margin: 0; }
.wrap a { color: var(--accent); text-underline-offset: .24em; text-decoration-thickness: 1px; }
.wrap a:hover { color: var(--ink); }
.wrap a:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

/* ---------- Header and footer ---------- */
.site-head, .site-foot {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 12px 26px; padding-block: 20px; border-bottom: 1px solid var(--line);
  font: .875rem/1.55 var(--body-font);
}
.site-head nav { display: flex; flex-wrap: wrap; gap: 10px clamp(12px, 3vw, 29px); }
.site-head a, .site-foot a { color: var(--ink); text-decoration: none; }
.site-head a:hover, .site-foot a:hover { color: var(--accent); text-decoration: underline; }
.brand span { color: var(--muted); }
.wrap :is(h1, h2, h3, h4, h5, h6), .brand a, .field-label {
  font-family: var(--display-font);
  font-weight: 400;
}
.brand a { font-size: 1.16rem; }
.site-foot { border-top: 1px solid var(--line); border-bottom: 0; color: var(--muted); }
.site-foot .signoff { color: var(--accent); font: 1rem/1.4 var(--mono-font); }
.languages { display: inline-flex; align-items: center; gap: 8px; }
.languages [aria-current="true"] { text-decoration: underline; color: var(--accent); }
.languages a { padding-block: 5px; }
.languages a[lang="fa"] { font-family: "Parastoo", serif; }
.languages a[lang="en"] { font-family: "Fredoka", sans-serif; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  isolation: isolate;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: clamp(14px, 2.2vw, 24px);
  padding-block: clamp(44px, 7vw, 88px);
  background-color: var(--navy);
  border-image: linear-gradient(var(--navy), var(--navy)) fill 0 // 0 100vmax;
}
/* Alignment grid. A faint base layer plus a spotlight that follows the cursor
   (assets/scenes.js sets --mx/--my; on touch screens the spotlight drifts on its own). */
.hero { --mx: 32%; --my: 50%; --grid-base: 32% 50%; }
:root:lang(fa) .hero { --mx: 68%; --grid-base: 68% 50%; }
.hero::before {
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline: calc(50% - 50vw);
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(circle 300px at var(--mx) var(--my), rgb(169 184 255 / .10), transparent 70%),
    linear-gradient(rgb(169 184 255 / .16) 1px, transparent 1px),
    linear-gradient(90deg, rgb(169 184 255 / .16) 1px, transparent 1px);
  background-size: auto, 48px 48px, 48px 48px;
  background-position: center;
  -webkit-mask-image:
    radial-gradient(circle 260px at var(--mx) var(--my), #000, rgb(0 0 0 / .45) 45%, transparent),
    radial-gradient(ellipse 60% 70% at var(--grid-base), rgb(0 0 0 / .38) 15%, transparent 75%);
  mask-image:
    radial-gradient(circle 260px at var(--mx) var(--my), #000, rgb(0 0 0 / .45) 45%, transparent),
    radial-gradient(ellipse 60% 70% at var(--grid-base), rgb(0 0 0 / .38) 15%, transparent 75%);
}
/* A thin colour-bar strip, borrowed from the test pattern. */
.hero::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  inset-block-end: 0;
  height: 4px;
  opacity: .75;
  background: linear-gradient(90deg,
    #c0c0c0 0 14.28%, #c0c000 0 28.57%, #00c0c0 0 42.85%, #00c000 0 57.14%,
    #c000c0 0 71.42%, #c00000 0 85.71%, #3a3aff 0);
}
.hero h1 {
  font-size: clamp(3.65rem, 10vw, 8.4rem);
  line-height: .88; letter-spacing: normal;
}
.hero-tagline {
  max-width: 56ch;
  text-wrap: balance;
  color: var(--muted);
  font-size: clamp(1.05rem, 1.8vw, 1.35rem);
  line-height: 1.45;
}
.wrap .hero-cta a {
  display: inline-flex; align-items: center; gap: .5em;
  margin-top: 6px; padding: 10px 20px;
  border: 1px solid var(--accent); border-radius: 999px;
  color: var(--accent); text-decoration: none;
  transition: background-color .2s, color .2s;
}
.wrap .hero-cta a:is(:hover, :focus-visible) { background: var(--accent); color: var(--page); }

/* ---------- Section grid ---------- */
.landing > :is(.section, .contact-card) {
  display: grid; grid-template-columns: var(--label-columns);
  gap: 16px var(--column-gap); padding-block: clamp(36px, 6vw, 72px);
  border-top: 1px solid var(--line); scroll-margin-top: 0;
}
/* Column labels: muted, with a short accent rule so they don't read as links. */
.section > h2, .contact-card h2, .interests h3, .field-label {
  color: var(--label);
  font: 400 1.25rem/1.45 var(--display-font);
  letter-spacing: .04em;
}
.section > h2::before, .contact-card h2::before, .interests h3::before, .field-label::before {
  content: "";
  display: inline-block;
  width: 18px; height: 2px;
  margin-inline-end: 10px;
  vertical-align: middle;
  translate: 0 -.12em;
  background: var(--accent);
}
.eyebrow {
  color: var(--label);
  font: 500 .8rem/1.45 var(--body-font);
  letter-spacing: .08em; text-transform: uppercase;
}

/* ---------- Work ---------- */
.work-card { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 18px 32px; }
.work-copy h3 { margin-block: 6px 12px; font-size: clamp(1.6rem, 4vw, 2.75rem); line-height: 1.08; letter-spacing: .01em; }
.work-copy p:not(.eyebrow), .about-copy, .contact-card p,
.tools-section > p, .tool-card p { color: var(--muted); }
.work-note, .about-copy > p + p { margin-top: 12px; }
.platforms { border-inline-start: 1px solid var(--line); padding-inline-start: 18px; font: .875rem/1.65 var(--body-font); }
.platforms h4 { font-size: 1.12rem; margin-bottom: 8px; letter-spacing: .04em; }
.platform-list { list-style: none; margin: 0; padding: 0; }
.platform-list a {
  display: inline-flex; align-items: center; gap: 10px; min-height: 30px;
  color: var(--muted); text-decoration: none;
}
/* Logos stay hidden until their link is hovered or focused, then fade in. */
.platform-mark {
  width: auto; height: 20px; max-width: 72px; object-fit: contain;
  opacity: 0; scale: .85;
  transition: opacity .25s ease, scale .25s ease;
}
.mark-extron, .mark-shure { height: 14px; }
.mark-crestron, .mark-extron { background: #edf0fa; border-radius: 3px; padding: 2px 3px; box-sizing: content-box; }
.platform-list a:is(:hover, :focus-visible) { color: var(--ink); text-decoration: underline; }
:is(.platform-list, .social-links) a:is(:hover, :focus-visible) .platform-mark { opacity: 1; scale: 1; }

/* ---------- Field gallery ---------- */
.landing .field-story {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: var(--label-columns);
  gap: 16px var(--column-gap);
  border-top: 1px solid var(--line); padding-block: clamp(30px, 5vw, 56px) 0;
  scroll-margin-top: 0;
}
.field-label { align-self: start; }
.field-teaser {
  grid-column: 2;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  align-items: center; gap: 24px clamp(22px, 4vw, 48px);
}
.field-story h2 {
  font-size: clamp(1.8rem, 3vw, 2.6rem); line-height: 1.04; letter-spacing: .01em;
  text-wrap: balance;
}
.field-intro > p { margin-top: 16px; max-width: 38ch; color: var(--muted); }
.field-intro .gallery-link, .roll-header p { font: .93rem/1.5 var(--body-font); }
.field-story figure, .interest-photos figure { margin: 0; }
.field-story img, .interest-photos img { display: block; width: 100%; }
.field-cover a { display: block; overflow: hidden; border-radius: 2px; }
.field-cover img {
  aspect-ratio: 16/10; object-fit: cover; object-position: center 48%;
  transition: scale .45s ease, filter .45s ease;
}
.field-cover a:is(:hover, :focus-visible) img { scale: 1.03; filter: brightness(1.08); }
.field-story figcaption, .interest-photos figcaption {
  margin: 8px 0 0; color: var(--muted); font: .875rem/1.45 var(--body-font); text-align: start;
}
.photo-roll { display: none; grid-column: 1 / -1; scroll-margin-top: 24px; }
.photo-roll:target, .editor-styles-wrapper .photo-roll { display: block; }
/* The roll is focused programmatically so arrow keys work; it is not itself a control. */
.photo-roll:focus { outline: none; }
.field-story:has(.photo-roll:target) :is(.field-teaser, .field-label) { display: none; }
.roll-header {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 12px 24px; margin-bottom: 22px;
}
.gallery-controls {
  display: flex; align-items: center; justify-content: center; gap: clamp(12px, 4vw, 48px);
  padding-block: 9px; border-block: 1px solid var(--line); font: .9rem/1.4 var(--body-font);
}
.gallery-controls button {
  appearance: none; background: transparent; color: var(--accent); border: 0;
  padding: 10px 4px; font: inherit; text-decoration: underline; text-underline-offset: .24em;
  cursor: pointer;
}
.gallery-controls button:hover { color: var(--ink); }
.gallery-controls button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.field-frames { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.field-frames img { height: auto; }
.has-viewer .field-frames { display: block; margin-top: 16px; }
.has-viewer .field-frame[hidden] { display: none; }
.has-viewer .field-frame img {
  height: clamp(230px, 62vh, 650px); object-fit: contain; background: var(--navy);
}

/* ---------- AV tools ---------- */
.tools-section { row-gap: 18px; }
.tools-section > :not(h2) { grid-column: 2; }
.tools-section > p, .about-copy { max-width: 65ch; }
.tool-card + .tool-card { margin-top: 23px; }
.tool-card h3 { margin-bottom: 8px; font: 400 1.15rem/1.45 var(--display-font); letter-spacing: .04em; }
.tool-card p {
  display: grid; grid-template-columns: minmax(0,.85fr) minmax(0,1.2fr);
  gap: 4px 20px; border-top: 1px solid var(--line); padding-block: 9px;
  font-size: .95rem; overflow-wrap: anywhere;
}
.tool-card p:last-child { border-bottom: 1px solid var(--line); }
.tool-card br { display: none; }
.tool-card p:is(:hover, :focus-within) { background-color: var(--navy); }
.tool-card p a { justify-self: start; }
/* Marks the repo links as leaving the site. Hidden from screen readers. */
.tool-card p a::after {
  content: "\2197";
  content: "\2197" / "";
  display: inline-block;
  margin-inline-start: .3em;
  font-size: .8em;
  opacity: .7;
}
:root:lang(fa) .tool-card p a::after { content: "\2196"; content: "\2196" / ""; }
.tools-all { font: .875rem/1.5 var(--body-font); }

/* ---------- About ---------- */
.interests {
  grid-column: 1 / -1; display: grid; grid-template-columns: var(--label-columns);
  gap: 20px var(--column-gap); margin-top: 18px;
}
.interests > p { max-width: 65ch; color: var(--muted); }
.interest-photos {
  grid-column: 2; display: grid; grid-template-columns: repeat(3, minmax(0,1fr));
  gap: clamp(12px, 2vw, 20px);
}
.interest-photos img { aspect-ratio: 4/3; object-fit: cover; }

/* ---------- Contact ---------- */
.contact-card .contact-copy { display: contents; }
.contact-card .contact-copy > p, .contact-links { grid-column: 2; }
.contact-card .contact-copy > p { max-width: 50ch; }
.contact-links { display: grid; gap: 22px; margin-top: 6px; overflow-wrap: anywhere; }
.wrap .contact-email a {
  color: var(--ink);
  font: 500 clamp(1.5rem, 4.2vw, 2.7rem)/1.2 "Fredoka", sans-serif;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: .2em;
}
.wrap .contact-email a:hover { color: var(--accent); }
.social-links { display: flex; flex-wrap: wrap; gap: 12px; }
.wrap .social-links a {
  display: inline-flex; align-items: center;
  padding: 9px 18px;
  border: 1px solid var(--line); border-radius: 999px;
  color: var(--ink); text-decoration: none;
  transition: border-color .2s, background-color .2s;
}
/* The icon slot takes no space until hover, so the pill hugs its label and grows to fit the icon. */
.social-links a .platform-mark {
  width: 0; height: 20px; margin-inline-start: 0;
  transition: width .3s cubic-bezier(.2, .7, .2, 1), margin .3s cubic-bezier(.2, .7, .2, 1), opacity .25s ease, scale .3s ease;
}
.social-links a:is(:hover, :focus-visible) .platform-mark { width: 20px; margin-inline-start: 10px; }
.wrap .social-links a:is(:hover, :focus-visible) { border-color: var(--accent); background: var(--navy); }

/* ---------- Blog and single posts ---------- */
.blog-list .wp-block-post-template { padding: 0; list-style: none; }
.blog-list .wp-block-post { border-top: 1px solid var(--line); padding-block: 20px; }
.blog-list .wp-block-post-date { color: var(--muted); font: .9rem/1.6 var(--body-font); }
.blog-list .wp-block-post-title, .reading .wp-block-post-content p, .wp-block-post-excerpt__excerpt {
  unicode-bidi: plaintext;
}
.reading { max-width: 740px; padding-block: 54px; }
.reading :where(p,h1,h2,h3) { margin-bottom: 1em; }
.preview-skip { position: absolute; left: 1rem; top: -8rem; z-index: 3; padding: 8px 14px; background: var(--page); color: var(--ink); }
.preview-skip:focus { top: 0; }

/* ---------- Persian ---------- */
/* Letter-spacing breaks Persian letter joining, so it is reset everywhere. */
html[lang="fa"] .wrap :is(h1,h2,h3,h4,.field-label,.eyebrow) { letter-spacing: normal; line-height: 1.45; }
html[lang="fa"] .eyebrow { text-transform: none; font-size: .9rem; }
html[lang="fa"] .hero h1 { max-width: none; font-size: clamp(3rem, 8vw, 6.5rem); }
html[lang="fa"] .wrap p { line-height: 1.85; }
html[lang="fa"] .site-foot .signoff { font-size: 1.05rem; }

/* ---------- Home: sticky bars and full-screen scenes ---------- */
@media screen {
  html:has(.wp-site-blocks > .landing) {
    --home-header: 72px;
    --home-footer: 72px;
    --admin-offset: 0px;
    --hero-top: calc(var(--home-header) + var(--admin-offset));
    --panel-height: calc(100dvh - var(--home-header) - var(--home-footer) - var(--admin-offset));
    scroll-padding-block: calc(var(--home-header) + var(--admin-offset)) var(--home-footer);
  }
  html:has(body.admin-bar .landing) { --admin-offset: var(--wp-admin--admin-bar--height, 32px); }
  .wp-site-blocks:has(> .landing) > :is(header, footer) {
    position: sticky;
    z-index: 3;
    background: var(--page);
  }
  .wp-site-blocks:has(> .landing) > header { inset-block-start: var(--admin-offset); }
  .wp-site-blocks:has(> .landing) > footer { inset-block-end: 0; }

  /* Every section is a full screen "scene", with its content centred. */
  .landing > section {
    min-block-size: var(--panel-height);
    align-content: center;
  }
  /* The hero stays pinned while the first scene slides up over it. */
  .landing > .hero { position: sticky; inset-block-start: var(--hero-top); }
  .landing > section:not(.hero) {
    position: relative;
    z-index: 1;
    isolation: isolate;
    background: var(--page);
    /* Paint the page colour edge to edge so the pinned hero is fully covered. */
    box-shadow: 0 0 0 100vmax var(--page);
    clip-path: inset(0 -100vmax);
  }
  /* Each scene has its own faint ambient tint, which crossfades as you scroll. */
  .landing > section:not(.hero)::before {
    content: "";
    position: absolute;
    inset-block: 0;
    inset-inline: calc(50% - 50vw);
    z-index: -1;
    pointer-events: none;
    background: radial-gradient(ellipse 55% 60% at var(--glow-at, 78% 40%), rgb(var(--glow, 120 140 255) / .13), transparent 70%);
    opacity: .5;
    /* Fade the tint out at the scene's top and bottom so there's no hard edge. */
    -webkit-mask-image: linear-gradient(transparent, #000 18%, #000 82%, transparent);
    mask-image: linear-gradient(transparent, #000 18%, #000 82%, transparent);
  }
  #work { --glow: 120 140 255; }
  #av-tools { --glow: 70 200 190; --glow-at: 18% 30%; }
  #about { --glow: 255 170 90; --glow-at: 82% 65%; }
  #contact { --glow: 190 120 255; --glow-at: 50% 55%; }
}

/* Scroll-linked motion. Everything here is skipped for people who prefer reduced motion. */
@media screen and (prefers-reduced-motion: no-preference) {
  html:has(.wp-site-blocks > .landing) { scroll-behavior: smooth; }

  /* scenes.js sets --hero-out from 0 to 1 as the first scene covers the hero. */
  .landing > .hero > * {
    opacity: clamp(0, 1 - var(--hero-out, 0) * 1.5, 1);
    translate: 0 calc(var(--hero-out, 0) * -64px);
    scale: calc(1 - var(--hero-out, 0) * .06);
    transform-origin: 0 50%;
  }
  :root:lang(fa) .landing > .hero > * { transform-origin: 100% 50%; }
  .landing > .hero h1 { filter: blur(calc(var(--hero-out, 0) * 8px)); }

  /* Blocks rise in as they enter the screen and drift out as they leave it.
     The selector list matches SCENE_BLOCKS in assets/scenes.js. */
  @supports (animation-timeline: view()) {
    :is(.landing > section:not(.hero) > h2, .work-card, .field-label, .field-intro, .field-cover,
        .tools-section > p, .tool-card, .tools-all, .about-copy, .interests > *,
        .contact-copy > *, .contact-links) {
      animation: scene-in linear both, scene-out linear both;
      animation-timeline: view(), view();
      animation-range: entry 0% cover 35%, exit 15% exit 100%;
    }
    :is(.landing > section:not(.hero) > h2, .field-label, .field-intro, .contact-links) {
      animation-name: scene-in-soft, scene-out;
    }
    .landing > section:not(.hero)::before {
      animation: scene-glow linear both;
      animation-timeline: view();
      animation-range: cover 0% cover 100%;
    }
  }

  /* Fallback for browsers without scroll timelines: scenes.js adds .js-scenes and .is-in. */
  .js-scenes :is(.landing > section:not(.hero) > h2, .work-card, .field-label, .field-intro, .field-cover,
      .tools-section > p, .tool-card, .tools-all, .about-copy, .interests > *,
      .contact-copy > *, .contact-links) {
    opacity: 0;
    translate: 0 48px;
    transition: opacity .8s ease, translate .9s cubic-bezier(.2, .7, .2, 1);
  }
  .js-scenes :is(.landing > section:not(.hero) > h2, .work-card, .field-label, .field-intro, .field-cover,
      .tools-section > p, .tool-card, .tools-all, .about-copy, .interests > *,
      .contact-copy > *, .contact-links).is-in { opacity: 1; translate: 0 0; }
  .js-scenes .landing > section:not(.hero)::before { opacity: 0; transition: opacity 1.2s ease; }
  .js-scenes .landing > section.is-in:not(.hero)::before { opacity: 1; }
}
@keyframes scene-in { from { opacity: 0; translate: 0 72px; scale: .94; } }
@keyframes scene-in-soft { from { opacity: 0; translate: 0 72px; scale: .94; filter: blur(10px); } }
@keyframes scene-out { to { opacity: 0; translate: 0 -56px; scale: .97; } }
@keyframes scene-glow { 0%, 100% { opacity: 0; } 35%, 65% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .field-cover img, .platform-mark, .social-links a .platform-mark, .wrap .hero-cta a, .wrap .social-links a { transition: none; }
}
@media screen and (max-height: 539px) {
  .wp-site-blocks:has(> .landing) > header { position: relative; inset-block-start: auto; }
  html:has(.wp-site-blocks > .landing) { scroll-padding-block-start: var(--admin-offset); --hero-top: var(--admin-offset); }
}

/* ---------- Small screens ---------- */
@media (max-width: 680px) {
  .wrap { width: calc(100% - 36px); }
  .landing > :is(.section, .contact-card), .landing .field-story, .interests { grid-template-columns: minmax(0,1fr); }
  .tools-section > :not(h2), .field-teaser, .contact-card .contact-copy > p, .contact-links, .interest-photos { grid-column: 1; }
  .field-teaser, .field-frames { grid-template-columns: minmax(0,1fr); }
  .field-intro > p { max-width: 52ch; }
  .interest-photos { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .interest-print:first-child { grid-column: 1/-1; }
  .interest-print:first-child img { aspect-ratio: 2/1; }

  /* Sticky bars would take about a quarter of a phone screen, so they scroll away. */
  .wp-site-blocks:has(> .landing) > :is(header, footer) { position: static; }
  html:has(.wp-site-blocks > .landing) { scroll-padding-block: 0; --panel-height: 100svh; --hero-top: 0px; }
  html:has(body.admin-bar .landing) { --admin-offset: 0px; }
  .landing > .hero { min-block-size: calc(100svh - var(--home-header)); }
}
@media (max-width: 540px) {
  .site-foot .signoff { flex-basis: 100%; order: 1; }
}
@media (max-width: 440px) {
  .work-card, .tool-card p { grid-template-columns: minmax(0,1fr); }
  .platforms { border-inline-start: 0; border-top: 1px solid var(--line); padding: 10px 0 0; }
}
