/* Alyona Moskalets — portfolio
   One stylesheet, no build step, no dependencies.

   Everything is driven by the custom properties in :root. To restyle the whole
   site, change values there and nothing else. */

:root {
  /* Paper is the brand: a pale yellow-green. Everything else is tuned to sit
     on it — the inks are warm and slightly olive so nothing looks pasted on. */
  --paper:        #F2FDE6;
  --surface:      #FFFFFF;   /* tiles */
  --tile:         #E9F5D8;   /* image wells inside tiles */
  --ink:          #15180E;
  --ink-2:        #52584A;
  --ink-3:        #6A7161;   /* still 4.5:1 on paper — safe for small text */
  --line:         #DCE9C9;
  --edge:         rgb(21 24 14 / 0.1);  /* hairline on images, so light covers keep their shape */

  /* One accent: availability dot, active states, focus ring. */
  --accent:       #1F6F4A;
  --accent-soft:  #E2F1D7;

  /* Type. System stack by default: zero network cost, already good everywhere.
     To swap in a webfont, add the <link> in the page head and change --font. */
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Inter, Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;

  /* Fluid scale. clamp() means no breakpoints are needed for type at all. */
  --t-display: clamp(2.5rem, 1.4rem + 4.6vw, 5rem);
  --t-h1:      clamp(2rem, 1.3rem + 3vw, 3.5rem);
  --t-h2:      clamp(1.5rem, 1.2rem + 1.4vw, 2.125rem);
  --t-h3:      clamp(1.125rem, 1rem + 0.5vw, 1.375rem);
  --t-lead:    clamp(1.125rem, 1rem + 0.6vw, 1.5rem);
  --t-body:    1.0625rem;
  --t-small:   0.9375rem;
  --t-tag:     0.8125rem;
  --t-micro:   0.75rem;

  /* Spacing. A single 8-based scale, same idea as a design system. */
  --s-1: 0.5rem;  --s-2: 1rem;   --s-3: 1.5rem;  --s-4: 2rem;
  --s-5: 3rem;    --s-6: 4rem;   --s-7: 6rem;    --s-8: 8rem;

  --w-page: 1240px;   /* outer container */
  --w-text: 68ch;     /* measure for long-form reading */
  --radius: 16px;
  --radius-sm: 10px;
  --gap: 0.75rem;     /* bento gutter */

  --ease: cubic-bezier(0.23, 1, 0.32, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:       #14170F;
    --surface:     #1C2016;
    --tile:        #232819;
    --ink:         #EEF5E2;
    --ink-2:       #A9B29C;
    --ink-3:       #8A9380;
    --line:        #2C3323;
    --edge:        rgb(238 245 226 / 0.12);
    --accent:      #8FD9A8;
    --accent-soft: #1F2B1D;
  }
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--t-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img, svg, video { display: block; max-width: 100%; height: auto; }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }

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

.skip {
  position: absolute; left: -9999px;
  padding: var(--s-1) var(--s-2); background: var(--ink); color: var(--paper);
  border-radius: 8px; z-index: 20;
}
.skip:focus { left: var(--s-2); top: var(--s-2); }

/* ---------- Layout ---------- */

.wrap { width: min(100% - 2.5rem, var(--w-page)); margin-inline: auto; }
.prose { max-width: var(--w-text); }
.section { padding-block: var(--s-7); }

/* ---------- Site header ----------
   Two rows. The identity row scrolls away; the menu row sticks, because that
   is the one you reach for again while reading down the grid. */

.masthead__top {
  display: grid;
  gap: var(--s-2) var(--s-5);
  padding-block: var(--s-3) var(--s-4);
}

@media (min-width: 800px) {
  .masthead__top { grid-template-columns: 1fr 1fr; align-items: start; }
}

.wordmark {
  display: block;
  font-size: var(--t-body); font-weight: 600; letter-spacing: -0.01em;
  text-decoration: none;
}

.clock {
  margin: 0;
  font-size: var(--t-body);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.masthead__bio {
  margin: 0;
  font-size: var(--t-body);
  line-height: 1.4;
  color: var(--ink-3);
  max-width: 56ch;
}

.menubar {
  position: sticky; top: 0; z-index: 10;
  background: var(--paper);
  border-block: 1px solid var(--line);
}

.menubar__inner {
  display: flex; align-items: center; gap: var(--s-1) var(--s-3);
  flex-wrap: wrap;
  padding-block: 0.75rem;
}

#filters { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-3); align-items: baseline; }

/* Menu items are filters, not links: several can be on at once. They look like
   a plain nav on purpose — the weight change is the whole affordance. */
.filter {
  appearance: none; border: 0; background: none; padding: 0;
  font: inherit; font-size: var(--t-small);
  color: var(--ink-3);
  cursor: pointer;
  transition: color 160ms ease;
}
.filter:hover { color: var(--ink-2); }
.filter[aria-pressed="true"] { color: var(--ink); font-weight: 600; }

.filter__count { color: var(--ink-3); font-weight: 400; font-size: var(--t-micro); }

.menubar__reset {
  margin-left: auto;
  font-size: var(--t-micro); color: var(--ink-3);
  appearance: none; border: 0; background: none; padding: 0;
  font-family: inherit; cursor: pointer;
}
.menubar__reset:hover { color: var(--ink); }
.menubar__reset[hidden] { display: none; }

/* ---------- Bento grid ---------- */

.bento {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: 176px;
  /* Dense packing matters once filtering starts: without it a hidden wide tile
     leaves a hole the rest of the grid will not flow into. */
  grid-auto-flow: row dense;
  padding-block: var(--s-4) var(--s-6);
}

@media (min-width: 700px)  { .bento { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1000px) { .bento { grid-template-columns: repeat(4, 1fr); grid-auto-rows: 196px; } }

.tile {
  position: relative;
  display: flex; flex-direction: column; justify-content: space-between;
  gap: var(--s-2);
  padding: var(--s-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  /* Only transform and opacity animate — both skip layout and paint. */
  transition: transform 200ms var(--ease), border-color 200ms ease;
}

@media (min-width: 700px) { .tile { padding: var(--s-3); } }

.tile--w2 { grid-column: span 2; }
.tile--h2 { grid-row: span 2; }

@media (min-width: 1000px) {
  .tile--w3 { grid-column: span 3; }
}

/* A case needs room to be read; on a two-column phone it always takes the row. */
@media (max-width: 699px) {
  .tile--case, .tile--intro { grid-column: span 2; }
  .tile--w3 { grid-column: span 2; }
}

/* Hover lives behind this query so a tap on a phone does not leave a tile
   stuck in its hover state. */
@media (hover: hover) and (pointer: fine) {
  a.tile:hover { transform: translateY(-3px); border-color: var(--ink-3); }
  a.tile:hover .tile__well > * { transform: scale(1.05); }
  a.tile:hover .tile__cta { color: var(--accent); }
}

a.tile:active { transform: translateY(0) scale(0.995); }

.tile__label {
  font-size: var(--t-micro); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-3);
}

.tile__title {
  margin: 0;
  font-size: var(--t-h3); font-weight: 600;
  letter-spacing: -0.015em; line-height: 1.15;
}

.tile__text { margin: 0; font-size: var(--t-small); color: var(--ink-2); line-height: 1.4; }
.tile__cta  { font-size: var(--t-small); font-weight: 500; transition: color 200ms ease; }
.tile__cta[data-state="soon"] { color: var(--ink-3); font-weight: 400; }

/* A big number is the whole point of a widget: it should be readable across
   the room, and it must not reflow when the digits change. */
.tile__figure {
  font-size: clamp(2rem, 1.2rem + 2.4vw, 3rem);
  font-weight: 600; letter-spacing: -0.03em; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.tile__figure sup { font-size: 0.4em; font-weight: 500; letter-spacing: 0; top: -1.1em; }
/* An unfilled widget should read as waiting, not as a redaction bar. */
.tile__figure.is-empty { color: var(--ink-3); font-weight: 400; }

/* Image well. Keeps its shape before an image exists, so nothing looks broken
   while the covers are still being made. */
.tile__well {
  flex: 1 1 auto; min-height: 0;
  border-radius: var(--radius-sm);
  background: var(--tile);
  overflow: hidden;
}
.tile__well > * {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 260ms var(--ease);
}

/* Book tile: cover on the left at its own 2:3 shape, text on the right.
   The tile height is fixed by the grid row, so the cover sizes off that. */
.tile--book { flex-direction: row; justify-content: flex-start; }

.book__cover {
  flex: 0 0 auto;
  height: 100%;
  aspect-ratio: 2 / 3;
}
.book__cover > img {
  outline: 1px solid var(--edge);
  outline-offset: -1px;
  border-radius: inherit;
  opacity: 0;
  transition: transform 260ms var(--ease), opacity 200ms ease-out;
}
/* Fade the cover in once it has actually loaded, instead of painting it
   top to bottom over the placeholder. */
.book__cover > img.is-loaded { opacity: 1; }

.book__body {
  display: flex; flex-direction: column; justify-content: space-between;
  gap: var(--s-1);
  min-width: 0;
}
.book__title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  text-wrap: pretty;
}

.tile--intro { justify-content: flex-start; gap: var(--s-2); }
.tile--intro .dot { margin-top: auto; }
.tile--intro .tile__text { font-size: var(--t-body); color: var(--ink); }

.tile--quote { background: var(--accent-soft); border-color: transparent; }
.tile--quote p { margin: 0; font-size: var(--t-small); line-height: 1.35; }
.tile--quote .tile__label { color: var(--ink-2); }

.tile--link .tile__text { word-break: break-word; }

/* Availability dot, the one place the accent appears unprompted. */
.dot {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: var(--t-micro); color: var(--accent);
}
.dot::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: currentColor; flex: 0 0 auto;
}

.copy {
  appearance: none; border: 0; background: none; padding: 0;
  font: inherit; text-align: left; color: inherit; cursor: pointer;
}

.tile[hidden] { display: none; }

/* Entering tiles: 160ms, tiny travel, stagger capped in JS. Decorative only —
   nothing waits on it. */
@keyframes tile-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.bento[data-animate="on"] .tile:not([hidden]) {
  animation: tile-in 200ms var(--ease) both;
  animation-delay: calc(var(--i, 0) * 25ms);
}

@media (prefers-reduced-motion: reduce) {
  .bento[data-animate="on"] .tile:not([hidden]) { animation: none; }
  .tile, .tile__well > * { transition: none; }
  /* Fades stay: they carry no motion, only the arrival of content. */
  .book__cover > img { transition: opacity 200ms ease-out; }
  a.tile:hover { transform: none; }
}

.empty {
  grid-column: 1 / -1;
  padding: var(--s-5) 0;
  color: var(--ink-3); font-size: var(--t-small);
}
.empty[hidden] { display: none; }

/* ---------- Case page ---------- */

.case-head { padding-block: var(--s-5); }

.case-head h1 {
  margin: 0 0 var(--s-3);
  font-size: var(--t-h1); font-weight: 600;
  letter-spacing: -0.03em; line-height: 1.05;
  max-width: 20ch;
}

.case-head .lead {
  margin: 0; font-size: var(--t-lead); line-height: 1.45;
  color: var(--ink-2); max-width: 56ch;
}

/* Depth switch. Two passes at the same story: five bullets, or the whole
   thing. Both live in the DOM — crawlers and link previews see the full case
   either way. */
.depth {
  display: inline-flex; gap: 2px;
  margin-bottom: var(--s-4);
  padding: 3px;
  background: var(--tile);
  border-radius: 999px;
}
.depth button {
  appearance: none; border: 0; background: none;
  padding: 0.3rem 0.85rem;
  font: inherit; font-size: var(--t-tag); color: var(--ink-2);
  border-radius: 999px; cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease;
}
.depth button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 500; }
.depth button:active { transform: scale(0.97); }

/* Crossfade only. Height changes a lot between the two modes, and animating
   that makes the page breathe in a way that reads as broken. */
.case .tldr, .case .detailed { animation: depth-in 150ms var(--ease) both; }
@keyframes depth-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .case .tldr, .case .detailed { animation: none; }
}

.case[data-mode="tldr"] .detailed { display: none; }
.case[data-mode="full"] .tldr { display: none; }

.tldr { padding-block: var(--s-3) var(--s-5); }
.tldr ol { max-width: var(--w-text); padding-left: 1.25rem; margin: 0 0 var(--s-4); }
.tldr li { margin-bottom: var(--s-2); }
.tldr li b { font-weight: 600; }

/* Facts strip: role, team, timeline, status. Recruiters read this first. */
.facts {
  display: grid; gap: var(--s-3);
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  margin-top: var(--s-4); padding-top: var(--s-4);
  border-top: 1px solid var(--line);
}
.facts dt {
  font-size: var(--t-tag); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 0.25rem;
}
.facts dd { margin: 0; font-size: var(--t-small); }

.case section { padding-block: var(--s-5); }
.case section + section { border-top: 1px solid var(--line); }

.case h2 {
  margin: 0 0 var(--s-3);
  font-size: var(--t-h2); font-weight: 600; letter-spacing: -0.02em; line-height: 1.2;
  max-width: 24ch;
}
.case h3 {
  margin: var(--s-4) 0 var(--s-2);
  font-size: var(--t-h3); font-weight: 600; letter-spacing: -0.01em;
}
.case p { max-width: var(--w-text); }
.case ul, .case ol { max-width: var(--w-text); padding-left: 1.25rem; }
.case li { margin-bottom: var(--s-1); }

.step {
  display: inline-block; margin-bottom: var(--s-2);
  font-family: var(--font-mono); font-size: var(--t-tag);
  color: var(--ink-3); letter-spacing: 0.04em;
}

/* A pulled-out sentence. One per section at most, or it stops pulling. */
.callout {
  margin: var(--s-4) 0;
  padding: var(--s-3) var(--s-4);
  border-left: 2px solid var(--accent);
  background: var(--surface);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: var(--t-lead); line-height: 1.4; letter-spacing: -0.01em;
  max-width: var(--w-text);
}

/* Honest notes — measured findings, caveats, things that went wrong. */
.note {
  margin: var(--s-3) 0;
  padding: var(--s-3);
  border: 1px solid var(--line); border-radius: var(--radius);
  font-size: var(--t-small); color: var(--ink-2);
  max-width: var(--w-text);
}
.note strong { color: var(--ink); }

figure { margin: var(--s-4) 0; }
figure img, .figure-box {
  width: 100%; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface);
}
.figure-box { aspect-ratio: 4 / 3; }
figcaption {
  margin-top: var(--s-2);
  font-size: var(--t-small); color: var(--ink-2);
  max-width: var(--w-text);
}

/* Numbers row — measured results. Keep to four; more reads as filler. */
.metrics {
  display: grid; gap: var(--s-3);
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  margin: var(--s-4) 0;
}
.metric {
  padding: var(--s-3);
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface);
}
.metric b {
  display: block;
  font-size: var(--t-h2); font-weight: 600; letter-spacing: -0.02em;
  line-height: 1.1; margin-bottom: 0.25rem;
}
.metric span { font-size: var(--t-small); color: var(--ink-2); }

.tags { display: flex; flex-wrap: wrap; gap: 0.375rem; margin: 0; padding: 0; list-style: none; }
.tags li {
  font-size: var(--t-micro); color: var(--ink-2);
  padding: 0.125rem 0.5rem;
  border: 1px solid var(--line); border-radius: 999px;
}

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

.foot {
  padding-block: var(--s-4) var(--s-5);
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--s-2);
  font-size: var(--t-small); color: var(--ink-3);
}
.foot a { text-decoration: none; }

.back {
  display: inline-block; margin-top: var(--s-5);
  font-size: var(--t-small); text-decoration: none; color: var(--ink-2);
}
.back:hover { color: var(--accent); }

.case-nav { display: flex; gap: var(--s-3); font-size: var(--t-small); }
.case-nav a { color: var(--ink-3); text-decoration: none; }
.case-nav a:hover { color: var(--ink); }
@media (min-width: 800px) { .case-nav { justify-content: flex-end; } }
