/* ==========================================================================
   saminazari.me — site styles
   Breakpoints: mobile < 810px, tablet 810–1199px, desktop >= 1200px
   ========================================================================== */

@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin-opsz-normal.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin-opsz-italic.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

:root {
  --blue: #0022ff;
  --black: #000;
  --ink: #171717;
  --muted: #666;
  --body: #484848;
  --lead: #3d3d3d;
  --line: #d1d1d1;
  --line-soft: #f5f5f5;
  --card: #f6f6f6;
  --tile: #fbfbfb;

  --pad: 64px;                 /* page side padding */
  --side: 240px;               /* desktop: space kept clear for the fixed sidebar */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);   /* strong ease-out for entrances and UI */
  --font: "Inter", "Inter Placeholder", system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: #fff;
  color: var(--black);
  font-family: var(--font);
  font-variation-settings: "opsz" 14;   /* "Inter" (text cut) */
  font-size: 15px;
  line-height: 22px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, p, ul, figure { margin: 0; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
hr { border: 0; height: 1px; margin: 0; background: var(--line-soft); }

/* "Inter Display" cut */
.display { font-variation-settings: "opsz" 32; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Type styles ---------- */
.t-heading {                 /* section headings, project titles */
  font-size: 16px; line-height: 20.8px; font-weight: 500;
  font-variation-settings: "opsz" 32;
}
.t-body  { font-size: 15px; line-height: 22px; letter-spacing: -0.02em; color: var(--body); }
.t-lead  { font-size: 15px; line-height: 25px; letter-spacing: -0.02em; font-weight: 500; color: var(--lead); }
.t-small { font-size: 14px; line-height: 22px; letter-spacing: -0.02em; color: var(--muted); }
.t-label { font-size: 14px; line-height: 16.8px; }
.capitalize { text-transform: capitalize; }

/* ---------- Header: name + nav (fixed sidebar on desktop) + signature ----------
   The header is shared by every page and stays put while the router in site.js
   swaps only <main>. On desktop the name and nav are fixed on the left; tablet
   and mobile turn the same markup into a sticky top bar. */
.site-header { position: absolute; top: 0; left: 0; right: 0; height: 0; z-index: 5; }
.site-name { position: fixed; top: 76px; left: var(--pad); font-size: 15px; line-height: 18px; color: var(--black); }
.site-nav { position: fixed; top: 279px; left: var(--pad); }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 18px; }
.site-nav a { font-size: 15px; line-height: 22px; letter-spacing: -0.02em; color: var(--muted); transition: color 200ms ease; }
.site-nav a:hover, .site-nav a[aria-current] { color: var(--blue); }
.signature { position: absolute; top: 65px; right: var(--pad); display: block; width: 88px; height: 39px; color: var(--blue); }
.signature svg { width: 100%; height: 100%; overflow: visible; }

/* Bounce dot: marks the current section and hops between items (see site.js).
   The outer span carries the position, the inner one the sideways hop. */
.bounce-dot { position: absolute; top: 0; left: 0; pointer-events: none; opacity: 0; transition: opacity 150ms ease; }
.bounce-dot.is-placed { opacity: 1; }
.bounce-dot > span { display: block; width: 6px; height: 6px; border-radius: 50%; background: var(--blue); }

/* Page columns: centred in the window, but never under the desktop sidebar. */
.home-layout, .about-main, .case-main {
  --col: min(var(--w), 100% - var(--side) - var(--pad));
  width: var(--col);
  margin-left: max(var(--side), (100% - var(--col)) / 2);
}

/* ---------- Footer ---------- */
.site-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--pad) 64px;
  margin-top: 170px;
}
.site-footer .email { font-size: 14px; line-height: 16.8px; }
.socials { display: flex; align-items: center; gap: 28px; color: var(--ink); }
.socials a { display: block; }
.socials svg { display: block; }

.t-heading, .site-footer .email, .socials a { transition: opacity 200ms ease; }
a:hover .t-heading, .site-footer .email:hover, .socials a:hover { opacity: .7; }

/* ==========================================================================
   Home
   ========================================================================== */
.home-layout { --w: 834px; margin-top: 275px; }

.intro h1 {
  font-size: 24px; line-height: 31.2px; font-weight: 400; color: var(--blue);
  font-variation-settings: "opsz" 32;
}
.intro .t-small { margin-top: 32px; }
.intro .previously a:hover { color: var(--black); }

.projects { list-style: none; padding: 0; margin: 100px 0 0; }
.project { border-top: 1px solid var(--line); padding-top: 100px; padding-bottom: 100px; }
.project:last-child { padding-bottom: 0; }
.project a { display: block; transition: transform 160ms var(--ease-out); }
.project a:active { transform: scale(0.99); }
.project-head { display: grid; grid-template-columns: 334px 1fr; column-gap: 41px; }
.project-head .meta { margin-top: 3px; font-size: 15px; line-height: 22px; letter-spacing: -0.02em; color: var(--body); }
.project-head .summary { font-size: 14px; line-height: 16.8px; color: var(--muted); }
.project img { width: 100%; height: auto; margin-top: 48px; object-fit: contain; }
.project img.r6 { border-radius: 6px; }
.project img.r4 { border-radius: 4px; }

/* ==========================================================================
   About
   ========================================================================== */
.about-main { --w: 936px; margin-top: 301px; }
.about-intro { display: flex; align-items: flex-start; gap: 48px; }
.about-intro img { width: 125px; height: 125px; border-radius: 50%; object-fit: cover; flex: none; }
.about-intro h1 { font-size: 32px; line-height: 41.6px; font-weight: 400; letter-spacing: -0.02em; }

.about-section { border-top: 1px solid var(--line); margin-top: 60px; padding-top: 63px; }
.about-section + .about-section { margin-top: 68px; padding-top: 69px; }
.about-section-head { display: grid; grid-template-columns: 1fr 1fr; align-items: center; }
.ext-links { display: flex; align-items: center; gap: 24px; font-size: 15px; line-height: 25px; font-weight: 500; letter-spacing: -0.02em; color: var(--lead); }
.ext-links a { display: inline-flex; align-items: center; gap: 8px; }
.ext-links a:hover { color: var(--black); }
.ext-links .sep { width: 4px; height: 4px; border-radius: 50%; background: var(--black); }

.timeline { list-style: none; padding: 0; margin-top: 70px; display: flex; flex-direction: column; gap: 48px; }
.timeline > li { display: grid; grid-template-columns: 1fr 1fr; }
.entry { display: flex; gap: 24px; align-items: flex-start; }
.entry-logo { width: 72px; height: 72px; flex: none; border-radius: 8px; border: 1px solid #e6e6e6; background: var(--tile); display: grid; place-items: center; }
.entry-meta { padding-top: 4px; }
.entry-meta .name { font-size: 14px; line-height: 16.8px; color: var(--black); }
.entry-meta .name a:hover { text-decoration: underline; }
.entry-meta .role { font-size: 14px; line-height: 22px; font-weight: 600; letter-spacing: -0.02em; color: var(--muted); }
.entry-meta .dates { display: flex; align-items: center; gap: 8px; }
.entry-meta .t-body { margin-top: 4px; }
.entry-meta .name + .t-body { margin-top: 4px; }
.entry-meta .t-body + .t-body { margin-top: 4px; }
.entry-desc { margin: 0; }

/* ==========================================================================
   Case studies
   ========================================================================== */
.case { --media: 959px; --text: 671px; --top: 223px; --hero-gap: 48px; }
.case-main { --w: var(--media); padding-top: var(--top-d, var(--top)); }
.case-main > :not(figure):not(hr):not(.stats-wrap) { width: min(var(--text), 100%); margin-left: auto; margin-right: auto; }

.case-meta { display: flex; justify-content: space-between; align-items: baseline; }
.case-meta .kind { font-size: 14px; line-height: 15.4px; letter-spacing: -0.04em; color: var(--muted); }
.case-meta time { font-size: 14px; line-height: 22px; letter-spacing: -0.02em; color: var(--muted); }
.flow > .case-title { margin-top: 100px; font-size: 24px; line-height: 31.2px; font-weight: 600; letter-spacing: -0.04em; }
.flow > .case-credits { margin-top: 28px; }
.flow > .case-hero { margin-top: var(--hero-gap-d, var(--hero-gap)); }

/* vertical rhythm inside the article */
.flow > * + * { margin-top: 24px; }
.flow > hr { margin-top: 48px; }
.flow > hr + * { margin-top: 48px; }
.flow > h2 + *, .flow > h3 + * { margin-top: 12px; }
.flow > h2 + h3 { margin-top: 24px; }
.flow > p + p { margin-top: 20px; }
.flow > figure + figure { margin-top: 16px; }
.flow > .caption + figure { margin-top: 8px; }
.flow > figure.space-lg { margin-top: 48px; }
.flow > figure + h3 { margin-top: 40px; }
.flow > * + .stats-wrap, .flow > .callout + * { margin-top: 24px; }
.flow > .cta + * { margin-top: 32px; }
.flow > .cta { margin-top: 32px; }

.flow figure img { width: 100%; height: auto; border-radius: 6px; object-fit: cover; }
.flow figure.contain img { object-fit: contain; }
.flow figure.square img { border-radius: 0; }
img[style*="--ar"] { aspect-ratio: var(--ar); object-fit: cover; }
img.framed { outline: 1px solid #e5e5e5; outline-offset: -1px; }

.flow ul { padding-left: 21px; font-size: 14px; line-height: 22px; letter-spacing: -0.02em; color: var(--muted); }
.flow > p + ul { margin-top: 0; }

.callout { background: var(--card); border-radius: 16px; padding: 24px; }
.callout > * + * { margin-top: 12px; }
.callout .t-lead { color: var(--black); }
.callout .t-lead + .t-lead { margin-top: 20px; }
.callout.note { padding: 16px; }
.callout.note > .t-small { margin: 0; }

.stats-wrap { width: min(var(--text), 100%); margin-left: auto; margin-right: auto; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--card); border-radius: 16px; padding: 32px; text-align: center; }
.stat:nth-child(3) { grid-column: 1 / -1; }
.stat:nth-child(3) .stat-desc { max-width: 440px; margin-left: auto; margin-right: auto; }
.stat-num { font-size: 32px; line-height: 38.4px; font-weight: 400; font-variation-settings: "opsz" 32; }
.stat-num strong { font-weight: 700; }
.stat-label { font-size: 15px; line-height: 25px; font-weight: 500; letter-spacing: -0.02em; }
.stat-title { font-size: 16px; line-height: 20.8px; font-weight: 500; font-variation-settings: "opsz" 32; }
.stat-desc { margin-top: 24px; }
.stat-title + .stat-desc { margin-top: 24px; }

.cta { display: flex; justify-content: center; width: auto !important; }
.cta a {
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--black); color: #fff; border-radius: 100px;
  padding: 8px 16px; font-size: 15px; line-height: 22px; letter-spacing: -0.02em;
  transition: opacity 200ms ease, transform 160ms var(--ease-out);
}
.cta a:hover { opacity: .8; }
.cta a:active { transform: scale(0.97); }

/* ---------- Page-load reveal ----------
   Content resolves from a soft blur as each page loads. Elements opt in with
   class="reveal" and set their order with style="--i: N" (60ms apart). */
@media (prefers-reduced-motion: no-preference) {
  .reveal { animation: reveal 650ms var(--ease-out) both; animation-delay: calc(var(--i, 0) * 60ms); }
  @keyframes reveal { from { opacity: 0; filter: blur(8px); transform: translateY(16px); } }
}
@media (prefers-reduced-motion: reduce) {
  .reveal { animation: reveal-fade 300ms ease both; }
  @keyframes reveal-fade { from { opacity: 0; } }
}

/* Blocks hidden just before leaving a page, so that coming back with the
   back/forward buttons starts hidden and replays the reveal (see site.js). */
.replay-pending { opacity: 0; }

/* ---------- Lazy images fade in instead of popping ---------- */
.js img[loading="lazy"] { transition: opacity 300ms var(--ease-out); }
.js img[loading="lazy"]:not(.is-loaded) { opacity: 0; }

/* ==========================================================================
   Tablet (810–1199px)
   ========================================================================== */
@media (max-width: 1199.98px) {
  :root { --pad: 48px; --side: var(--pad); }
  .site-header {
    position: sticky; height: auto; display: grid; grid-template-columns: 1fr auto; align-items: center;
    padding: 28px var(--pad); background: #fff;
  }
  .site-name { display: none; }
  .site-nav { position: relative; top: auto; left: auto; }
  .site-nav ul { flex-direction: row; gap: 24px; }
  .signature { position: static; width: 77px; height: 34px; }
  .site-footer { margin-top: 140px; }

  .home-layout { --w: 100%; margin-top: 48px; }
  .intro .t-small { margin-top: 48px; }
  .intro h1 br { display: none; }
  .projects { margin-top: 100px; }
  .project-head { grid-template-columns: 362px 1fr; column-gap: 45px; }

  .about-main { --w: 100%; --pad: 50px; margin-top: 63px; }
  .about-intro { flex-direction: column; gap: 48px; }

  .case { --media: 800px; --text: 600px; --top: 45px; --hero-gap: 48px; }
  .case-main { padding-top: var(--top); }
  .flow > .case-hero { margin-top: var(--hero-gap); }
  img[style*="--ar-t"] { aspect-ratio: var(--ar-t); }
}

/* ==========================================================================
   Mobile (< 810px)
   ========================================================================== */
@media (max-width: 809.98px) {
  :root { --pad: 20px; }
  .site-header { padding: 22px var(--pad) 21px; }
  .signature { width: 64px; height: 28px; }
  .site-nav ul { gap: 20px; }
  .home-layout { margin-top: 76px; }
  .intro .t-small { margin-top: 32px; }
  .project { padding-top: 80px; padding-bottom: 80px; }
  .project-head { display: block; }
  .project-head .summary { margin-top: 16px; }

  .about-main { --pad: 20px; margin-top: 58px; }
  .about-intro { gap: 24px; }
  .about-section-head { display: block; }
  .ext-links { margin-top: 32px; }
  .about-section + .about-section { margin-top: 72px; padding-top: 73px; }
  .timeline { margin-top: 72px; }
  .timeline > li { display: block; }
  .entry-desc { margin-top: 24px; }

  .case { --media: 100%; --text: 100%; --top: 64px; }
  .stats { grid-template-columns: 1fr; }
  img[style*="--ar-m"] { aspect-ratio: var(--ar-m); }
  .stat:nth-child(3) { grid-column: auto; }

  .site-footer { flex-direction: column; gap: 24px; margin-top: 120px; }
}
