/* =========================================================================
   Masha Denisova — portfolio
   Desktop reference: 1440 px. Shell: fixed nav + fixed About; galleries are
   larger-than-viewport fields scrolled natively; reading pages scroll the
   document while About and nav stay put.
   ========================================================================= */

/* Fonts are self-hosted (no Google Fonts request), so they load the same in every browser.
   FAT Rene is the display face; Special Elite (Apache 2.0) remains as its fallback. */
@font-face {
  font-family: "FAT Rene";
  src: url("assets/fonts/FATRene-Regular.woff2") format("woff2"),
       url("assets/fonts/FATRene-Regular.woff") format("woff");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Special Elite";
  src: url("assets/fonts/special-elite-latin-400-normal.woff2") format("woff2"),
       url("assets/fonts/special-elite-latin-400-normal.woff") format("woff");
  font-weight: 400; font-style: normal; font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #000;
  --text: #fff;
  --muted: #808080;                 /* design #787878, lifted slightly so it stays above 4.5:1 on the panels */
  --panel: linear-gradient(to bottom, rgba(232, 235, 242, .08), rgba(190, 195, 205, .08));
  --rim: inset 0 0 0 1px rgba(255, 255, 255, .07),
         inset 1.5px 1.5px 1px -1px rgba(255, 255, 255, .45),
         inset -1.5px -1.5px 1px -1px rgba(255, 255, 255, .22);
  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --display: "FAT Rene", "Special Elite", "Courier New", monospace;
  --focus: 0 0 0 2px #000, 0 0 0 4px #fff;
  --ref-w: 1440px;                  /* reference composition */
  --overflow: 200px;                /* extra field space beyond the composition */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh; background: var(--bg); color: var(--text);
  font: 400 16px/20px var(--sans); -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }
ul, ol { list-style: none; }
[hidden] { display: none !important; }
.display { font-family: var(--display); font-weight: 400; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }
h1:focus, h1:focus-visible { box-shadow: none; }

.skip { position: fixed; left: 16px; top: -60px; z-index: 50; padding: 8px 12px; border-radius: 16px; background: #fff; color: #111; }
.skip:focus { top: 16px; }

/* dot pattern: fixed to the viewport so the shell stays visually still */
.dots { position: fixed; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; z-index: 0; }

/* ---------------- glass surfaces (nav, About, reading panel) ---------------- */
.glass {
  background: var(--panel);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);   /* Figma glass blur 8 = CSS 4px */
  box-shadow: var(--rim);
  border-radius: 32px;
}

/* ---------------- navigation ---------------- */
.topbar { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 30; }
.nav { display: flex; gap: 8px; padding: 4px; overflow: hidden; }
.nav-item {
  height: 36px; padding: 8px 12px; border-radius: 32px; white-space: nowrap;
  color: #fff; transition: background-color .15s;
}
.nav-item:hover { background: rgba(255, 255, 255, .1); }
.nav-item[aria-current="page"] { background: #fff; color: #111; }
.nav-item:focus-visible { border-radius: 32px; }

/* ---------------- About ---------------- */
.about {
  position: fixed; left: 16px; top: 100px; width: 338px; z-index: 20;
  padding: 24px; display: flex; flex-direction: column; gap: 48px;
}
.about-name { font-size: 20px; line-height: 24px; white-space: nowrap; }
.about-bio { max-width: 290px; }
.about-links { display: flex; gap: 20px; flex-wrap: wrap; }
.ext { display: inline-flex; align-items: center; gap: 4px; border-radius: 6px; }
.ext .arrow { width: 16px; height: 16px; flex: none; transition: transform .15s; }
.ext:hover .arrow { transform: translate(1px, -1px); }
.ext:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
[aria-disabled="true"] { cursor: default; }
[aria-disabled="true"]:hover { text-decoration: none; }
[aria-disabled="true"]:hover .arrow { transform: none; }

/* ---------------- explorable fields ---------------- */
main { position: relative; z-index: 1; }
.field-canvas {
  position: relative;
  /* the composition is anchored like the 1440 reference, centred when the viewport is wider */
  margin-left: max(0px, (100vw - var(--ref-w)) / 2);
  width: calc(var(--ref-w) + var(--overflow));
  height: calc(900px + var(--overflow));
}
body[data-mode="field"] { cursor: default; }
body.panning, body.panning * { cursor: grabbing !important; user-select: none; }

.tile {
  position: absolute; left: var(--x); top: var(--y); width: 360px;
  display: flex; flex-direction: column; gap: 16px; border-radius: 16px;
}
.tile-art { position: relative; display: block; width: 360px; height: calc(var(--fy, 104.58px) + 204.6px); }
.tile-back { position: absolute; left: 0; top: calc(var(--fy, 104.58px) - 31.4px); width: 360px; height: 236px; display: block; }
.tile-preview {
  position: absolute; max-width: none;   /* left/top/size per image, taken from the Figma render bounds */
  user-select: none; -webkit-user-drag: none;
  transition: transform .35s cubic-bezier(.2, .8, .25, 1);
}
.tile-front {
  position: absolute; left: 0; top: var(--fy, 104.58px); width: 360px; height: 204.6px; border-radius: 16px;
  background: linear-gradient(to bottom, rgba(64, 67, 74, .02), rgba(46, 48, 53, .02));
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);                 /* Figma glass blur 6 */
  box-shadow: inset 1.5px 1.5px 1px -1px rgba(255, 255, 255, .55), inset -1.5px -1.5px 1px -1px rgba(255, 255, 255, .25);
}
/* 1px inside stroke: white 60% → #191919 6%, layer opacity 20% */
.tile-front::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(to bottom, rgba(255, 255, 255, .12), rgba(25, 25, 25, .012));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.tile-title { font-size: 20px; line-height: normal; color: #fff; overflow-wrap: break-word; }
.tile:hover .tile-preview, .tile:focus-visible .tile-preview { transform: translateY(-8px); }
.tile:focus-visible { box-shadow: none; }
.tile:focus-visible .tile-front { box-shadow: var(--focus); }
.tile:focus-visible .tile-title { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }

/* ---------------- reading pages ---------------- */
.reading { padding: 100px 16px 16px 370px; }
.panel { position: relative; padding: 24px 24px 48px; }
.block + .block { margin-top: 48px; }
.head { display: flex; flex-direction: column; gap: 4px; padding-right: 120px; }
.h-page, .h-sec { font-size: 20px; line-height: 24px; }
.h-sub { font: 500 16px/20px var(--sans); }
.prose { max-width: 764px; }
.prose > * + *, .wide > * + * { margin-top: 4px; }
.h-sec + .h-sub { margin-top: 4px; }
.bullets { list-style: disc; padding-left: 24px; }
.bullets li::marker { color: #fff; }

.close {
  position: absolute; top: 16px; right: 16px; width: 32px; height: 32px; border-radius: 16px;
  display: grid; place-items: center; color: #fff; z-index: 2; transition: background-color .15s;
}
.close svg { width: 16px; height: 16px; }
.close:hover { background: rgba(255, 255, 255, .1); }
.head-row { flex-direction: row; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px 24px; padding-right: 0; }
.corner-link { border-radius: 6px; }
.corner-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* results */
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.metrics > div { display: flex; flex-direction: column; gap: 4px; }
.metric { font-size: 32px; line-height: 40px; }
.metrics dd { margin: 0; }

/* media panels: a 1006 x 610 composition that scales with the reading width */
.media-wrap { container-type: inline-size; }
.media {
  --u: calc(100cqw / 1006);
  position: relative; width: 100%; aspect-ratio: 1006 / 610;
  background: rgba(255, 255, 255, .06); border-radius: 24px; overflow: hidden;
}
.media-cap { position: absolute; left: 0; right: 0; top: 16px; text-align: center; }
.media-phones img { position: absolute; left: calc(var(--u) * 86); top: calc(var(--u) * 32); width: calc(var(--u) * 835); }
.wip { position: absolute; border-radius: 16px; }
.w1 { left: calc(var(--u) * 73);  top: calc(var(--u) * 70);  width: calc(var(--u) * 463); }
.w2 { left: calc(var(--u) * 546); top: calc(var(--u) * 70);  width: calc(var(--u) * 393); }
.w3 { left: calc(var(--u) * 546); top: calc(var(--u) * 304); width: calc(var(--u) * 393); }

.bubble {
  position: absolute; width: calc(var(--u) * 301.992);
  padding: calc(var(--u) * 18.632) calc(var(--u) * 21.737) calc(var(--u) * 21.737);
  border-radius: calc(var(--u) * 18.632); background: #fff; color: #000;
  font: 500 calc(var(--u) * 17.079) / calc(var(--u) * 21.737) var(--sans);
  filter: drop-shadow(0 12.8px 17px rgba(80, 82, 104, .09)) drop-shadow(0 3.9px 5.4px rgba(80, 82, 104, .06))
          drop-shadow(0 1.6px 2.2px rgba(80, 82, 104, .05)) drop-shadow(0 .6px .8px rgba(80, 82, 104, .03));
}
.bubble blockquote { margin: 0; }
.tail { position: absolute; left: calc(var(--u) * 240.36); bottom: calc(var(--u) * -11.4); width: calc(var(--u) * 22.3); height: calc(var(--u) * 15.7); transform: rotate(180deg); }
.b1 { left: calc(var(--u) * 99);     top: calc(var(--u) * 75); }
.b2 { left: calc(var(--u) * 584);    top: calc(var(--u) * 96); }
.b3 { left: calc(var(--u) * 351.88); top: calc(var(--u) * 240.37); }
.b4 { left: calc(var(--u) * 584);    top: calc(var(--u) * 395); }
.b5 { left: calc(var(--u) * 99);     top: calc(var(--u) * 378); }

/* small reading widths: quotes and boards as a readable column instead of the loose composition */
@container (max-width: 700px) {
  .media-voice, .media-wip { aspect-ratio: auto; display: flex; flex-direction: column; gap: 16px; padding: 16px 16px 24px; }
  .media-cap { position: static; }
  .bubbles { display: flex; flex-direction: column; gap: 20px; padding-bottom: 8px; }
  .bubble { position: relative; left: auto; top: auto; width: auto; max-width: 420px; padding: 14px 18px 16px; border-radius: 16px; font-size: 15px; line-height: 20px; }
  .bubble:nth-child(even) { align-self: flex-end; }
  .tail { left: auto; right: 28px; bottom: -11px; width: 22px; height: 15.5px; }
  .wip { position: static; width: 100%; }
}

/* experience */
.jobs { max-width: 764px; display: flex; flex-direction: column; gap: 48px; }
.job { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 40px; }
.job-meta { display: flex; flex-direction: column; gap: 2px; }

/* ---------------- motion ---------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .tile:hover .tile-preview, .tile:focus-visible .tile-preview { transform: none; }
  html { scroll-behavior: auto; }
}

/* ---------------- narrow screens: About reflows above the content ---------------- */
@media (max-width: 860px) {
  .topbar { position: sticky; top: 0; left: auto; transform: none; display: flex; justify-content: center; padding: 12px 16px 0; }
  .nav { flex-wrap: wrap; justify-content: center; border-radius: 24px; }
  .about { position: relative; left: auto; top: auto; width: auto; margin: 24px 16px 16px; gap: 24px; z-index: 1; }
  .about-bio { max-width: 36em; }

  .field-canvas {
    margin: 0; width: auto; height: auto; padding: 16px 16px 64px;
    display: flex; flex-direction: column; gap: 40px;
  }
  .tile { position: relative; left: auto; top: auto; zoom: var(--tile-zoom, 1); }
  /* keep a loose, staggered arrangement instead of a card grid */
  .tile:nth-child(3n+1) { align-self: flex-start; }
  .tile:nth-child(3n+2) { align-self: flex-end; }
  .tile:nth-child(3n)   { align-self: center; }
  .tile-title { max-width: 360px; }

  .reading { padding: 0 16px 16px; }
  .panel { padding: 20px 20px 40px; border-radius: 24px; }
  .head { padding-right: 40px; }
  .metrics { grid-template-columns: 1fr; gap: 24px; }
  .job { grid-template-columns: 1fr; gap: 8px; }
}
