@font-face {
  font-family: "Hanken Grotesk";
  src: url("../fonts/hanken-grotesk-latin-wght.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/vazirmatn-arabic-wght.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+200C-200F, U+FB50-FDFF, U+FE70-FEFF;
}

/* The brand mark is white and gold on black, so the site is locked to dark.
   Shape rule: media corners 6px, text buttons are pills, icon buttons are circles. */
:root {
  color-scheme: dark;
  --bg: #0c0c0d;
  --bg-lift: #19191b;
  --text: #f3f2ef;
  --muted: #a5a4a0;
  --line: rgb(243 242 239 / .14);
  --gold: #fec93f;
  --radius: 6px;
  --pad: clamp(1.25rem, 4vw, 3.5rem);
  --pad-l: max(var(--pad), env(safe-area-inset-left));
  --pad-r: max(var(--pad), env(safe-area-inset-right));
  --gap: clamp(1rem, 2vw, 1.75rem);
  --top-h: 3.75rem;
  --ease: cubic-bezier(.16, 1, .3, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-color: #3a3a3d var(--bg);
  scroll-padding-top: calc(var(--top-h) + 1rem);
}
html:has(dialog[open]) { overflow: hidden; }

::selection { background: var(--gold); color: var(--bg); }

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

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(60vmax 60vmax at 78% 40vh, var(--bg-lift), transparent 70%) no-repeat,
    var(--bg);
  color: var(--text);
  font-family: "Hanken Grotesk", ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Film grain on a fixed layer behind the content, never over photos or video. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .6 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
body > * { position: relative; z-index: 1; }

a { color: inherit; }
a, button { touch-action: manipulation; }
img, video { max-width: 100%; }
button { font: inherit; color: inherit; }

.skip {
  position: absolute;
  left: var(--pad-l);
  top: -4rem;
  z-index: 30;
  padding: .6rem 1rem;
  border-radius: 999px;
  background: var(--gold);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
}
.skip:focus { top: .6rem; }

/* Text for screen readers only. */
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Top bar ---------- */

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgb(12 12 13 / .86);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.top-in {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  min-height: var(--top-h);
  max-width: 1400px;
  margin-inline: auto;
  padding: 0 var(--pad-r) 0 var(--pad-l);
  font-size: .9375rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  color: var(--text);
  font-weight: 500;
  letter-spacing: .01em;
  text-decoration: none;
  white-space: nowrap;
}
.brand span { margin-left: .3em; color: var(--muted); font-weight: 400; }

.top nav { display: flex; gap: clamp(.25rem, 2vw, 1.5rem); margin-right: -.6rem; }
.top nav a {
  display: inline-flex;
  align-items: center;
  gap: .35em;
  min-height: 2.75rem;
  padding: 0 .6rem;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color .2s ease;
}
.top nav a:hover, .top nav a[aria-current] { color: var(--text); }
.top nav a[aria-current] { box-shadow: inset 0 -1px 0 var(--gold); }
.out { width: .7em; height: .7em; flex: none; }

/* ---------- Hero ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  align-items: end;
  gap: clamp(2rem, 6vw, 6rem);
  min-height: min(calc(100dvh - var(--top-h) - 5rem), 50rem);
  max-width: 1400px;
  margin-inline: auto;
  padding: clamp(1.5rem, 4vh, 3rem) var(--pad-r) 0 var(--pad-l);
}

.copy { padding-bottom: clamp(1rem, 5vh, 4rem); }

h1, h2, h3 { margin: 0; font-weight: 300; text-wrap: balance; }

h1 {
  margin-left: -.045em;
  max-width: 16ch;
  font-size: clamp(2.5rem, 5.6vw, 5rem);
  line-height: 1.04;
  letter-spacing: -.035em;
}
h1 em { display: block; font-style: normal; color: var(--gold); }

.copy p {
  margin: clamp(1.25rem, 2.5vw, 2rem) 0 0;
  max-width: 40ch;
  font-size: clamp(1rem, 1.25vw, 1.125rem);
  color: var(--muted);
  text-wrap: pretty;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem 1.75rem;
  margin-top: clamp(1.5rem, 3vw, 2.25rem);
}
.btn {
  display: inline-flex;
  align-items: center;
  min-height: 3rem;
  padding: 0 1.5rem;
  border-radius: 999px;
  background: var(--gold);
  color: #17130a;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: transform .2s var(--ease), background-color .2s ease;
}
.btn:hover { background: #ffd666; }
.btn:active { transform: scale(.98); }
.link {
  display: inline-flex;
  align-items: center;
  min-height: 3rem;
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-decoration-thickness: 1px;
  text-underline-offset: .35em;
  white-space: nowrap;
  transition: text-decoration-color .2s ease;
}
.link:hover { text-decoration-color: var(--gold); }

.mark { align-self: center; justify-self: center; margin: 0; }
/* 3D monogram. The flat logo is its poster: it shows first, and stays
   if the model or WebGL is unavailable. */
.mark model-viewer, .mark .flat {
  display: block;
  --mark-h: min(64dvh, 42rem);
  height: var(--mark-h);
  width: calc(var(--mark-h) * 5 / 9);
  max-width: 100%;
  background: transparent;
  --poster-color: transparent;
  --progress-bar-color: transparent;
  touch-action: pan-y;
}
.mark model-viewer::part(default-progress-bar) { display: none; }
.mark img {
  display: block;
  height: 100%;
  width: auto;
  margin-inline: auto;
  aspect-ratio: 655 / 1903;
}

/* ---------- Sections ---------- */

.part {
  max-width: 1400px;
  /* Margin, not padding, so nav links land on the section rule. */
  margin: clamp(4.5rem, 10vw, 8rem) auto 0;
  padding: 0 var(--pad-r) 0 var(--pad-l);
}
.part-head {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  align-items: end;
  gap: 1rem clamp(2rem, 6vw, 6rem);
  padding-top: clamp(1.25rem, 2.5vw, 2rem);
  margin-bottom: clamp(2rem, 4vw, 3.5rem);
  border-top: 1px solid var(--line);
}
h2 {
  margin-left: -.04em;
  font-size: clamp(2.25rem, 4.6vw, 4rem);
  line-height: 1.05;
  letter-spacing: -.035em;
}
.part-head p {
  margin: 0 0 .45em;
  max-width: 40ch;
  color: var(--muted);
  text-wrap: pretty;
}

/* ---------- Videos ---------- */

.reel { columns: 3; column-gap: var(--gap); }
.clip {
  break-inside: avoid;
  margin: 0 0 clamp(1.75rem, 3vw, 2.5rem);
}
.frame {
  position: relative;
  aspect-ratio: var(--ar);
  overflow: hidden;
  border-radius: var(--radius);
  background: #000;
}
.frame video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}
.play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  width: 100%;
  padding: clamp(.75rem, 1.4vw, 1.1rem);
  border: 0;
  border-radius: var(--radius);
  background: linear-gradient(to top, rgb(0 0 0 / .5), transparent 45%);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.play:focus-visible { outline-offset: -4px; border-radius: var(--radius); }
.play .disc {
  display: grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: var(--gold);
  color: #17130a;
  box-shadow: 0 6px 24px rgb(0 0 0 / .45);
  transition: transform .35s var(--ease);
}
.play svg { width: 1.1rem; height: 1.1rem; margin-left: .15rem; }
.play:hover .disc { transform: scale(1.08); }
.play:active .disc { transform: scale(.96); }
.play[hidden] { display: none; }

.clip figcaption {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-top: .75rem;
}
.clip h3 { font-size: 1.0625rem; font-weight: 500; line-height: 1.35; }
.clip .len {
  flex: none;
  color: var(--muted);
  font-size: .875rem;
  font-variant-numeric: tabular-nums;
}

/* ---------- Blog ---------- */

.post-head {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  align-items: end;
  gap: .75rem clamp(2rem, 6vw, 6rem);
  margin-bottom: clamp(1.25rem, 2.5vw, 2rem);
}
.post-head h3 {
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -.02em;
}
.post-head p { margin: 0; max-width: 44ch; color: var(--muted); text-wrap: pretty; }

.slides {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--gap);
  margin: 0;
  padding: 0;
  list-style: none;
}
.slides a {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--bg-lift);
  cursor: zoom-in;
}
.slides a:focus-visible { border-radius: var(--radius); }
.slides img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1179 / 2085;
  object-fit: cover;
  transition: transform .6s var(--ease);
}
.slides a:hover img { transform: scale(1.03); }
.slides .no {
  position: absolute;
  left: .6rem;
  bottom: .6rem;
  padding: .1rem .55rem;
  border-radius: 999px;
  background: rgb(12 12 13 / .82);
  color: var(--text);
  font-size: .8125rem;
  font-variant-numeric: tabular-nums;
}

/* ---------- Slide viewer ---------- */

.viewer {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgb(8 8 9 / .97);
  color: var(--text);
  overflow: hidden;
  overscroll-behavior: contain;
}
.viewer::backdrop { background: rgb(8 8 9 / .97); }
.viewer[open] {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: auto minmax(0, 1fr);
  align-items: center;
  gap: .75rem;
  padding:
    max(.75rem, env(safe-area-inset-top)) max(.75rem, env(safe-area-inset-right))
    max(1rem, env(safe-area-inset-bottom)) max(.75rem, env(safe-area-inset-left));
}
.viewer-bar {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-left: .5rem;
  color: var(--muted);
  font-size: .9375rem;
  font-variant-numeric: tabular-nums;
}
.viewer img {
  grid-column: 2;
  justify-self: center;
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  min-height: 0;
  border-radius: var(--radius);
  touch-action: pan-y pinch-zoom;
  user-select: none;
  -webkit-user-drag: none;
}
.icon-btn {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: border-color .2s ease, background-color .2s ease, transform .2s var(--ease);
}
.icon-btn:hover { border-color: var(--gold); background: rgb(254 201 63 / .1); }
.icon-btn:active { transform: scale(.94); }
.icon-btn:focus-visible { border-radius: 50%; }
.icon-btn svg { width: 1.1rem; height: 1.1rem; }

/* ---------- About ---------- */

.about {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  align-items: start;
  gap: clamp(2rem, 6vw, 6rem);
  max-width: 1400px;
  margin-inline: auto;
  padding: clamp(2rem, 6vh, 4.5rem) var(--pad-r) 0 var(--pad-l);
}
.portrait {
  position: sticky;
  top: calc(var(--top-h) + 2rem);
  margin: 0;
}
.portrait img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1100 / 1429;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--bg-lift);
}
.portrait figcaption { margin-top: .75rem; color: var(--muted); font-size: .875rem; }

/* Round portrait (about.html; about-square.html keeps the original): square crop centred on the face */
.portrait--round { max-width: 26rem; text-align: center; }
.portrait--round img {
  aspect-ratio: 1;
  object-position: 50% 15%;
  border-radius: 50%;
  outline: 1px solid rgb(255 255 255 / .14);
  outline-offset: .5rem;
}
.portrait--round figcaption { margin-top: 1.25rem; }

.bio h1 { max-width: none; font-size: clamp(2.25rem, 4.6vw, 4.25rem); }
.bio p {
  max-width: 64ch;
  margin: 0 0 1.25em;
  color: #d4d2cd;
  font-size: clamp(1rem, 1.1vw, 1.0625rem);
  line-height: 1.75;
  text-wrap: pretty;
}
.bio .lead {
  max-width: 44ch;
  margin-top: clamp(1.5rem, 3vw, 2.5rem);
  color: var(--text);
  font-size: clamp(1.125rem, 1.5vw, 1.3125rem);
  line-height: 1.6;
}
.bio .actions { margin-top: clamp(1.75rem, 3vw, 2.5rem); }

/* Persian translation at the end of the bio */
.bio-fa {
  margin-top: clamp(3.5rem, 7vw, 5.5rem);
  padding-top: clamp(2rem, 4vw, 3rem);
  border-top: 1px solid var(--line);
  font-family: "Vazirmatn", "Segoe UI", Tahoma, sans-serif;
}
.bio-fa h2 {
  margin: 0;
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 600;
  line-height: 1.4;
}
.bio .bio-fa p { line-height: 2; }
.bio .bio-fa .lead { line-height: 1.9; }

/* ---------- Footer ---------- */

.end {
  max-width: 1400px;
  margin: clamp(5rem, 11vw, 9rem) auto 0;
  padding: 0 var(--pad-r) 0 var(--pad-l);
}
.end-in {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem 2rem;
  padding: clamp(1.25rem, 2.5vw, 2rem) 0 max(clamp(1.25rem, 2.5vw, 2rem), env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .875rem;
}
.end a {
  display: inline-flex;
  align-items: center;
  gap: .35em;
  min-height: 2.75rem;
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-decoration-thickness: 1px;
  text-underline-offset: .35em;
  transition: text-decoration-color .2s ease;
}
.end a:hover { text-decoration-color: var(--gold); }

/* ---------- Responsive ---------- */

@media (max-width: 1023px) {
  .reel { columns: 2; }
  /* The story becomes a swipeable strip, the way it was first published. */
  .slides {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: min(38vw, 17rem);
    margin-inline: calc(var(--pad-l) * -1) calc(var(--pad-r) * -1);
    padding: 0 var(--pad-r) .75rem var(--pad-l);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--pad-l);
    scrollbar-width: thin;
  }
  .slides li { scroll-snap-align: start; }
}

@media (max-width: 767px) {
  .about { grid-template-columns: 1fr; }
  .portrait { position: static; max-width: 28rem; }
  .hero {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 1.75rem;
    min-height: 0;
  }
  .mark { order: -1; justify-self: start; }
  .mark model-viewer, .mark .flat { --mark-h: min(36dvh, 19rem); }
  .copy { padding-bottom: 0; }
  .part-head, .post-head { grid-template-columns: 1fr; }
  .part-head p { margin-bottom: 0; }
}

@media (max-width: 599px) {
  .reel { columns: 1; }
  .slides { grid-auto-columns: 68vw; }
  .viewer[open] { grid-template-columns: 1fr 1fr; grid-template-rows: auto minmax(0, 1fr) auto; }
  .viewer img { grid-column: 1 / -1; grid-row: 2; }
  .viewer .prev { grid-row: 3; justify-self: end; }
  .viewer .next { grid-row: 3; justify-self: start; }
}

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }

  /* Load-in: the mark builds upward, then the message follows. */
  .mark img { animation: build 1.5s var(--ease) .15s both; }
  .rise { animation: rise .9s var(--ease) both; animation-delay: calc(.55s + var(--i, 0) * .12s); }

  .viewer[open] { animation: fade .3s ease both; }
  .viewer img.swap { animation: swap .35s var(--ease) both; }

  @keyframes build {
    from { clip-path: inset(100% 0 0 0); transform: translateY(18px); }
    to   { clip-path: inset(0 0 0 0);    transform: none; }
  }
  @keyframes rise {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
  }
  @keyframes fade { from { opacity: 0; } }
  @keyframes swap { from { opacity: 0; transform: scale(.985); } }
}

@media (prefers-reduced-motion: reduce) {
  .slides img, .play .disc, .btn, .icon-btn { transition: none; }
}

/* Instagram stays in the footer; the top bar keeps the three page links. */
@media (max-width: 519px) {
  .top nav .ig { display: none; }
}

@media (max-width: 359px) {
  .brand span { display: none; }
}
