/* ==========================================================================
   Anastasia Rovatsou — portfolio
   1. Tokens   2. Base   3. Type   4. Nav + cursor   5. Media
   6. Home     7. About  8. Project   9. Motion + transitions
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */

@font-face {
  font-family: "Unbounded";
  src: url("/assets/fonts/Unbounded-VariableFont_wght.ttf") format("truetype");
  font-weight: 200 900;
  font-display: swap;
}

:root {
  --bg: #f3f2ee;
  --ink: #111110;
  --muted: #86857f;
  --line: rgba(17, 17, 16, 0.16);
  --placeholder: #dbd9d3;

  /* Mouse cursor: a green circle everywhere. The two numbers are its centre (the click point). */
  --cursor: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><circle cx='12' cy='12' r='10' fill='%2389f07d'/></svg>") 12 12, auto;
  --cursor-link: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><circle cx='12' cy='12' r='10' fill='%2389f07d'/></svg>") 12 12, pointer;

  /* Swap the typeface here once the final choice is made. */
  --font: "Neue Haas Grotesk Display Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-display: "Unbounded", var(--font); /* big titles */

  --margin: clamp(1rem, 2.2vw, 2.75rem);
  --gutter: clamp(0.75rem, 1.4vw, 1.75rem);
  --nav-h: calc(var(--margin) * 2 + 1rem);
  --space-s: clamp(1.5rem, 3vw, 3rem);
  --space-m: clamp(3rem, 7vw, 8rem);
  --space-l: clamp(5rem, 12vw, 14rem);

  --fs-label: clamp(0.6875rem, 0.62rem + 0.22vw, 0.875rem);
  --fs-body: clamp(1rem, 0.92rem + 0.3vw, 1.25rem);
  --fs-lead: clamp(1.25rem, 0.9rem + 1.5vw, 2.5rem);
  --fs-tile: clamp(1.25rem, 0.6rem + 1.7vw, 2.6rem);
  --fs-m: clamp(1.4rem, 0.7rem + 2.3vw, 3.4rem);
  --fs-l: clamp(1.9rem, 0.6rem + 5.6vw, 7.75rem);
  --fs-xl: calc((100vw - 2 * var(--margin)) * 0.143); /* name fills the content width */

  --ease: cubic-bezier(0.22, 0.8, 0.2, 1);
  --ease-in-out: cubic-bezier(0.7, 0, 0.2, 1);
}

/* 2. Base ------------------------------------------------------------------ */

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

html {
  cursor: var(--cursor);
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 100%;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
}

body { margin: 0; font-size: var(--fs-body); overflow-x: clip; }
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
a, button { cursor: var(--cursor-link); }
img, video { display: block; max-width: 100%; }
main { display: block; min-height: 100svh; outline: none; }
/* Selected (highlighted) text: blue letters on a green box. */
::selection { background: #89f07d; color: #2c18b1; }
:focus-visible { outline: 1px solid currentColor; outline-offset: 4px; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

.skip {
  position: fixed; top: 0; left: 0; z-index: 30;
  padding: 0.75rem 1rem; background: var(--ink); color: var(--bg);
  transform: translateY(-100%);
}
.skip:focus { transform: none; }

.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
}

/* 3. Type ------------------------------------------------------------------ */

.label {
  font-size: var(--fs-label);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.display-xl, .display-l, .display-m {
  font-family: var(--font-display);
  font-weight: 500;
  text-transform: uppercase;
  line-height: 0.96;
}
.display-xl { font-size: var(--fs-xl); letter-spacing: -0.03em; }
.display-l { font-size: var(--fs-l); letter-spacing: -0.03em; }
.display-m { font-size: var(--fs-m); letter-spacing: -0.025em; line-height: 1; }

.lead { font-size: var(--fs-lead); line-height: 1.16; letter-spacing: -0.02em; }
.lead p + p, .block__body p + p { margin-top: 1em; }

/* Arrow icon (see arrow() in js/lib/dom.js). */
.arrow {
  display: inline-block;
  width: 1em; height: 1em;
  vertical-align: -0.16em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
}
.arrow--ne { transform: rotate(-45deg); }
.arrow--s { transform: rotate(90deg); }
.arrow--w { transform: rotate(180deg); }
.label .arrow, .nav .arrow { width: 1.25em; height: 1.25em; vertical-align: -0.28em; }

/* Underline that draws in on hover. */
.link {
  background: linear-gradient(currentColor, currentColor) no-repeat 0 100% / 0 1px;
  transition: background-size 0.5s var(--ease);
}
.link:focus-visible { background-size: 100% 1px; }
@media (hover: hover) {
  .link:hover { background-size: 100% 1px; }
}

/* 4. Nav + cursor ---------------------------------------------------------- */

/* White + difference blending keeps the nav legible over any image. */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: baseline;
  gap: var(--gutter);
  padding: var(--margin);
  color: #fff;
  mix-blend-mode: difference;

  pointer-events: none;
  font-size: var(--fs-label);
  font-weight: 500;
  line-height: 1rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.nav a { pointer-events: auto; }
/* The nav's blending inverts colours, so its selection uses the inverses of the green and blue. */
.nav ::selection { background: #6a0271; color: #c7da3d; }
.nav__links { display: flex; gap: clamp(1rem, 2.5vw, 2.5rem); }

.cursor {
  position: fixed; top: 0; left: 0; z-index: 40;
  pointer-events: none;
  will-change: transform;
}
.cursor span {
  display: block;
  margin: 1rem 0 0 1rem;
  padding: 0.5em 0.8em;
  background: var(--ink);
  color: var(--bg);
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  transform: scale(0.6);
  transform-origin: 0 0;
  transition: opacity 0.25s var(--ease), transform 0.35s var(--ease);
}
.cursor.is-active span { opacity: 1; transform: none; }

/* Opening screen (js/lib/preloader.js). The base black layer is inline in index.html. */
.preloader.is-built { background: none; }
.preloader__black { position: absolute; inset: 0; background: #000; }
.preloader__defs { position: absolute; }
/* A box around the screen centre: characters and the circle are placed from its middle. */
.preloader__mass {
  position: absolute; top: 50%; left: 50%;
  width: 30rem; height: 30rem;
  margin: -15rem 0 0 -15rem;
}
.preloader__char {
  position: absolute; top: 50%; left: 50%;
  color: #fff;
  line-height: 1;
  white-space: pre;
  will-change: transform;
}
.preloader__char--name { font-family: var(--font-display); font-weight: 500; }
.preloader__char--label { font-family: var(--font); font-weight: 400; }
.preloader__disc {
  position: absolute; top: 50%; left: 50%;
  box-sizing: border-box;
  width: clamp(72px, 7vw, 116px); aspect-ratio: 1;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%) scale(0);
}
.preloader__dot {
  position: absolute; top: 50%; left: 50%;
  border-radius: 50%;
  background: #000;
  transform: translate(-50%, -50%) scale(0);
}
/* Once hollow, the circle is drawn as a white ring around a real hole in the black layer. */
.preloader__disc.is-ring { aspect-ratio: auto; background: none; border: 0 solid #fff; }
.preloader.is-open { pointer-events: none; }
.preloader.is-fading { opacity: 0; transition: opacity 0.35s ease; }

/* 5. Media ----------------------------------------------------------------- */

.media { position: relative; }
.media__asset { width: 100%; height: auto; background: var(--placeholder); }
.media__asset--placeholder { position: relative; }
.media__tag { position: absolute; left: 0.9rem; bottom: 0.8rem; color: var(--muted); }
.media__caption { margin-top: 0.75rem; color: var(--muted); }

.media--fill, .media--fill .media__asset {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  aspect-ratio: auto !important;
}

/* Device frames with auto-scrolling screens (js/lib/autoscroll.js). */
.stage {
  display: flex; justify-content: center; align-items: flex-start;
  gap: clamp(1.25rem, 6vw, 6rem);
  padding: clamp(1.5rem, 6vw, 6.5rem) clamp(1rem, 6vw, 6.5rem);
  background: var(--placeholder);
}
.device { min-width: 0; }
.device__screen { position: relative; overflow: hidden; background: #fff; }
.device__page { display: block; width: 100%; height: auto; will-change: transform; }
.device .media__caption { text-align: center; color: var(--ink); }

.device--browser { width: 100%; max-width: 78rem; }
.device--browser .device__screen { border-radius: 0 0 0.5rem 0.5rem; }
.device__bar {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.65rem 0.85rem;
  border-radius: 0.5rem 0.5rem 0 0;
  background: var(--bg);
}
.device__bar i { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--placeholder); }
.device__bar span {
  margin: 0 auto;
  padding-right: 2.5rem;
  color: var(--muted);
  font-size: var(--fs-label);
  letter-spacing: 0.02em;
}

.device--phone { width: min(44%, 19rem); }
.device--phone .device__screen {
  border: clamp(5px, 0.9vw, 10px) solid var(--ink);
  border-radius: clamp(1.4rem, 3.6vw, 2.8rem);
}
/* Camera cut-out */
.device--phone .device__screen::after {
  content: "";
  position: absolute; top: 1.3%; left: 50%;
  width: 29%; aspect-ratio: 3.5 / 1;
  border-radius: 99px;
  background: var(--ink);
  transform: translateX(-50%);
}
.stage--row .device:nth-child(even) { margin-top: clamp(1.5rem, 7vw, 7rem); }

/* Photo mockups with a live, scrolling screen laid over the phone in the photo. */
.mock { position: relative; overflow: hidden; }
.mock__photo { display: block; width: 100%; height: auto; }
.mock__plane { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.mock__screen {
  position: absolute; top: 0; left: 0;
  overflow: hidden;
  border-radius: 55px;
  background: #fff;
  transform-origin: 0 0;
}
.mock__island { position: absolute; border-radius: 99px; background: #050505; }

/* 6. Home ------------------------------------------------------------------ */

/* Selected work: editorial index. Spans, ratios and order come from js/lib/work-index.js. */
.work { padding: calc(var(--nav-h) + var(--space-s)) var(--margin) 0; }
.work__head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding-bottom: var(--space-s);
}
.tabs { display: flex; flex-wrap: wrap; gap: 0.4em clamp(1.25rem, 3vw, 3.5rem); }
.tab {
  padding: 0; border: 0; background: none;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: var(--fs-tile);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.025em;
  text-transform: uppercase;
  cursor: var(--cursor-link);
  transition: color 0.4s var(--ease);
}
.tab sup {
  margin-left: 0.4em;
  font-family: var(--font);
  font-size: var(--fs-label);
  letter-spacing: 0.02em;
  vertical-align: top;
}
.tab[aria-pressed="true"] { color: var(--ink); }
@media (hover: hover) {
  .tab:hover { color: var(--ink); }
}
.index__empty { padding: var(--space-m) 0; color: var(--muted); }

.index {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: clamp(2.5rem, 5vw, 5.5rem) var(--gutter);
}
.tile { display: block; position: relative; grid-column: 1 / -1; min-width: 0; }
.tile[hidden] { display: none; }
.tile__media { position: relative; overflow: hidden; aspect-ratio: 16 / 10; }
.tile__info {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem var(--gutter);
  padding-top: 0.9rem;
}
.tile__year { text-align: right; }
.tile__title {
  grid-column: 1 / -1;
  font-family: var(--font-display);
  font-size: var(--fs-tile);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.025em;
  text-transform: uppercase;
  transition: transform 0.6s var(--ease);
}
.tile__cat { grid-column: 1 / -1; color: var(--muted); }


@media (hover: hover) {
  .tile .media--fill, .next .media--fill { transition: transform 1.2s var(--ease); }
  .tile:hover .media--fill, .next:hover .media--fill { transform: scale(1.035); }
  .tile:hover .tile__title { transform: translateX(0.35em); }
}

@media (min-width: 900px) {
  .tile { grid-column: span var(--span, 12); align-self: var(--align, end); }
  .tile__media { aspect-ratio: var(--ratio, 16 / 10); }
}

.closing {
  display: flex; flex-direction: column;
  gap: var(--space-s);
  padding: var(--space-l) var(--margin) var(--margin);
}
.closing__links, .biglist--links {
  display: flex; flex-wrap: wrap;
  gap: 0.4em clamp(1.5rem, 4vw, 4rem);
  font-size: var(--fs-lead);
  letter-spacing: -0.02em;
}
.footer {
  display: flex; justify-content: space-between; gap: var(--gutter);
  margin-top: var(--space-m);
  padding-top: var(--margin);
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.missing {
  min-height: 100svh;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start;
  gap: var(--space-s);
  padding: var(--nav-h) var(--margin) var(--margin);
}

/* 7. About ----------------------------------------------------------------- */

.about { padding: 0 var(--margin) var(--margin); }
.about__head {
  min-height: 72svh;
  display: flex; align-items: flex-end;
  padding: var(--nav-h) 0 var(--space-m);
}

.row { padding: var(--space-s) 0 var(--space-m); border-top: 1px solid var(--line); }
.row__label { grid-column: 1 / -1; padding-bottom: 1.25rem; color: var(--muted); }
.row__body { grid-column: 1 / -1; }

/* Journey: education → experience as a typographic sequence. */
.step {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem var(--gutter);
}
.step__stage, .step__note { color: var(--muted); }
.step__note { padding-top: 0.6em; }
.step__tags {
  display: flex; flex-wrap: wrap;
  gap: 0.4em 0.5em;
  padding-top: 0.5rem;
}
.step__tags li { padding: 0.45em 0.7em; border: 1px solid var(--line); }
.journey__arrow {
  padding: clamp(1.25rem, 3vw, 3rem) 0;
  font-size: var(--fs-m);
  font-weight: 300;
  line-height: 1;
}

.biglist { font-family: var(--font-display); font-size: var(--fs-m); font-weight: 500; line-height: 1.12; letter-spacing: -0.025em; text-transform: uppercase; }
.biglist--links {
  font-family: var(--font); font-size: clamp(1.9rem, 1rem + 3.4vw, 5rem); font-weight: 400;
  letter-spacing: -0.035em; text-transform: none; line-height: 1.2; flex-direction: column;
}
.plainlist { columns: 2; column-gap: var(--gutter); }
.plainlist li { padding-bottom: 0.3em; break-inside: avoid; }

@media (min-width: 800px) {
  .row__label { grid-column: 1 / span 4; padding-bottom: 0; padding-top: 0.4em; }
  .row__body { grid-column: 5 / -1; }
  .row__body > .lead { max-width: 24em; }
  .step { grid-template-columns: 5fr 3fr; grid-template-areas: "stage stage" "title detail" "tags tags"; align-items: start; }
  .step__stage { grid-area: stage; }
  .step__title { grid-area: title; }
  .step__detail { grid-area: detail; padding-top: 0.3em; }
  .step__tags { grid-area: tags; }
}

/* 8. Project --------------------------------------------------------------- */

.project { padding: 0 var(--margin) var(--margin); }
.project .footer { margin-top: 0; }
.project .footer a { color: var(--ink); }
.project__head {
  min-height: 62svh;
  display: flex; flex-direction: column; justify-content: flex-end;
  gap: var(--space-s);
  padding: var(--nav-h) 0 var(--space-s);
}
.project__top { display: flex; justify-content: space-between; gap: var(--gutter); }
.project__num { color: var(--muted); }
.project__meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem var(--gutter);
  padding-top: var(--margin);
  border-top: 1px solid var(--line);
}
.project__meta dt { color: var(--muted); padding-bottom: 0.4em; }

.block { margin-top: var(--gutter); }
.block--text, .block--split { margin-block: var(--space-m); }
.block__label { grid-column: 1 / -1; padding-bottom: 1.25rem; color: var(--muted); }
.block__body { grid-column: 1 / -1; }
.block--columns, .block--grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gutter);
  align-items: start;
}
.block--grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.block__aside, .block__media { grid-column: 1 / -1; }
.block__aside { padding-bottom: var(--space-s); }

@media (min-width: 800px) {
  .project__meta { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .block__label { grid-column: 1 / span 4; padding-bottom: 0; padding-top: 0.4em; }
  .block--text .block__body { grid-column: 5 / span 7; }
  .block--columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .block--grid { grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); }
  .block__aside {
    grid-column: 1 / span 4;
    position: sticky; top: var(--nav-h);
    align-self: start;
    display: grid; gap: 1.25rem;
    padding: 0;
  }
  .block__aside .block__body { max-width: 22em; }
  .block__media { grid-column: 7 / -1; }
}

.next {
  display: grid;
  gap: var(--space-s);
  margin-top: var(--space-l);
  padding: var(--margin) 0;
  border-top: 1px solid var(--line);
}
.next__text { display: flex; flex-direction: column; gap: 1.25rem; }
.next__text .label:last-child { color: var(--muted); }
.next__media { position: relative; overflow: hidden; aspect-ratio: 16 / 10; }

@media (min-width: 800px) {
  .next { grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); align-items: end; }
  .next__text { grid-column: 1 / span 7; }
  .next__media { grid-column: 9 / -1; }
}

/* 9. Motion + transitions -------------------------------------------------- */

/* Masked line reveal for display headings. */
.line { display: block; overflow: clip; overflow-clip-margin: 0.06em; }
.line > span {
  display: block;
  animation: rise 1.1s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 90ms + 80ms);
}
@keyframes rise { from { transform: translateY(105%); } }

.js [data-reveal] {
  opacity: 0;
  transform: translateY(1.5rem);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}
.js [data-reveal].is-in { opacity: 1; transform: none; }

/* Fallback page transition (browsers without the View Transitions API). */
main { transition: opacity 0.22s ease; }
main.is-leaving { opacity: 0; }

/* View transitions: quick cross-fade, shared project image morphs. */
.vt-hero { view-transition-name: project-media; }

::view-transition-old(root) { animation: vt-out 0.28s ease both; }
::view-transition-new(root) { animation: vt-in 0.45s ease 0.12s both; }
::view-transition-group(project-media) {
  animation-duration: 0.7s;
  animation-timing-function: var(--ease-in-out);
}
::view-transition-old(project-media),
::view-transition-new(project-media) {
  width: 100%; height: 100%;
  object-fit: cover;
  animation-duration: 0.7s;
}
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .line > span { animation: none; }
  .js [data-reveal] { opacity: 1; transform: none; transition: none; }
  .tile .media--fill, .tile__title, .next .media--fill, .cursor span, .link { transition: none; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
