/* ==========================================================================
   Maksym Viushkin — portfolio
   Plain CSS, no build step. Figma source: M55voWP21TfbR4csa6nyjT / 2292:7465
   (1584px frame, 128px side padding → 1328px content).
   ========================================================================== */

/* ---- Self-hosted alternative font (ABC Areal, Dinamo) ------------------- */
@font-face { font-family: "ABC Areal"; src: url("assets/fonts/ABCAreal-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "ABC Areal"; src: url("assets/fonts/ABCAreal-Medium.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "ABC Areal"; src: url("assets/fonts/ABCAreal-Bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }

/* ---- Tokens ------------------------------------------------------------- */
:root {
  /* FONT SWITCH — change this one variable (or use ?font=areal) */
  --font: var(--font-geist);

  --font-geist: "Geist", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-areal: "ABC Areal", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --track-display: -0.02em;          /* hero tracking tuned per font */
  --track-text: 0;

  --ink: #000;
  --bg: #fff;
  --muted: #8a8a8e;
  --disabled: #d5d5d5;
  --line: #e8e8e9;
  --star: #f29937;
  --star-off: #bfbfbf;
  --star-inline: #fe8209;

  --max: 1328px;
  --pad: clamp(20px, 8.08vw, 128px);          /* 128 @1584 */
  --col-gap: clamp(16px, 8.08vw, 128px);      /* logo → text gap */
  --logo: clamp(48px, 6.06vw, 96px);          /* avatar / logo size */

  --fs-text: clamp(17px, 1.515vw, 24px);      /* 24 @1584 */
  --lh-text: 1.6667;                          /* 40/24 */
  --fs-hero: clamp(32px, 5.3vw, 84px);        /* 84 @1584 */

  --radius: 8px;
  --shadow: 0 4px 12px rgba(0, 0, 0, .08);
  --ease: cubic-bezier(.65, 0, .25, 1);
}
:root[data-font="areal"] { --font: var(--font-areal); --track-display: -0.001em; --track-text: .001em; }
:root[data-font="geist"] { --font: var(--font-geist); }

/* ---- Base ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-text);
  line-height: 1.3333;
  letter-spacing: var(--track-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: .18em; text-decoration-thickness: 1px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; border-radius: 2px; }
h1, h2, p, ul, figure { margin: 0; padding: 0; }
ul { list-style: none; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 16px; top: -100px; z-index: 10; background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: 4px; }
.skip-link:focus { top: 16px; }

.wrap { width: min(var(--max), 100% - 2 * var(--pad)); margin-inline: auto; }

/* ---- Header -------------------------------------------------------------- */
.site-header {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  padding-top: clamp(16px, 1.515vw, 24px);
}

/* ---- Hero ---------------------------------------------------------------- */
.hero {
  display: grid;
  grid-template-columns: var(--logo) minmax(0, 1fr) auto;
  align-items: start;
  padding-top: clamp(96px, 22.2vw, 352px);
  padding-bottom: clamp(88px, 10.6vw, 168px);
}
.avatar { width: var(--logo); height: var(--logo); border-radius: 50%; background: #000; object-fit: cover; }
.headline {
  /* wider hero line: may extend up to 48px from the links so the longest phrase fits on one line */
  margin-left: var(--col-gap);
  margin-right: clamp(24px, 3.03vw, 48px);
  font-weight: 400;
  font-size: var(--fs-hero);
  line-height: 1.0476;                         /* 88/84 */
  letter-spacing: var(--track-display);
  margin-top: -.06em;                           /* optical: cap-height aligns with avatar top */
}
.headline .lead { display: block; }
.rotator { display: inline-grid; vertical-align: top; max-width: 100%; }
.rotator > * { grid-area: 1 / 1; }
.rotator .ghost { visibility: hidden; padding-right: .12em; }  /* reserve the largest phrase + caret → no layout jump */
.rotator .live { white-space: pre-wrap; }
.caret {
  display: inline-block; width: .06em; height: .86em; margin-left: .04em;
  background: currentColor; vertical-align: -.1em;
  animation: blink 1s steps(1) infinite;
}
.rotator.is-typing .caret { animation: none; }
.rotator[data-effect="scramble"] .caret { display: none; }
.rotator .live.is-fading { opacity: 0; }
.rotator .live { transition: opacity .35s ease; }
@keyframes blink { 50% { opacity: 0; } }

.hero-links { text-align: right; }
.link-list--col { display: flex; flex-direction: column; gap: clamp(16px, 2.525vw, 40px); }
.link-list--row { display: flex; gap: clamp(20px, 2.525vw, 40px); }

/* ---- Projects ------------------------------------------------------------ */
.work { display: grid; }
.project {
  width: min(var(--max), 100% - 2 * var(--pad)); margin-inline: auto;
  display: grid;
  grid-template-columns: var(--logo) minmax(0, 1fr) auto;
  grid-template-areas:
    "logo  role  ctrl"
    "media media media"
    "copy  copy  copy";
  column-gap: var(--col-gap);
  row-gap: clamp(24px, 3.03vw, 48px);
}
.project + .project { margin-top: clamp(104px, 13.1vw, 208px); }

.logo { grid-area: logo; display: block; width: var(--logo); height: var(--logo); align-self: center; }
.logo img { width: 100%; height: 100%; object-fit: contain; }
.role { grid-area: role; line-height: 2; min-width: 0; }   /* 48/24 */
.role h2 { font: inherit; letter-spacing: inherit; }
.role h2 a { font-weight: 700; text-decoration: underline; text-underline-offset: .18em; text-decoration-thickness: 1.5px; }
.role h2 a:hover { text-decoration-thickness: 2.5px; }

.ctrl { grid-area: ctrl; align-self: end; display: flex; align-items: center; gap: 4px; line-height: 2; margin-right: -.3em; } /* glyph optically flush with the content edge */
.count { color: var(--muted); font-size: max(14px, .75em); font-variant-numeric: tabular-nums; margin-right: 12px; }
.arrow {
  appearance: none; border: 0; background: none; padding: 0; margin: 0;
  width: 1.6em; height: 1.6em; display: inline-grid; place-items: center;
  font: inherit; font-size: var(--fs-text); line-height: 1; color: var(--ink);
  cursor: pointer; border-radius: 50%;
  transition: color .2s, background-color .2s;
}
.arrow:hover:not([aria-disabled="true"]) { background: #f3f3f3; }
.arrow[aria-disabled="true"] { color: var(--disabled); cursor: default; }

/* ---- Slider -------------------------------------------------------------- */
.slider {
  grid-area: media;
  position: relative;
  overflow: hidden;
  /* room so the card shadow is not clipped */
  padding: 12px; margin: -12px;
  touch-action: pan-y;
  cursor: grab;
  outline: none;
}
.slider:focus-visible .slide.is-active { outline: 2px solid var(--ink); outline-offset: 4px; }
.slider.is-dragging { cursor: grabbing; }
.track {
  --i: 0; --drag: 0px;
  display: flex; gap: 24px;
  transform: translate3d(calc(var(--i) * (-100% - 24px) + var(--drag)), 0, 0);
  transition: transform .6s var(--ease);
  will-change: transform;
}
.slider.is-dragging .track { transition: none; }
.slide {
  flex: 0 0 100%;
  aspect-ratio: 1328 / 720;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  background: #f5f5f4;
  user-select: none; -webkit-user-select: none;
}
.slide > img { width: 100%; height: 100%; object-fit: cover; object-position: top center; -webkit-user-drag: none; }
.slide.is-placeholder > img { object-position: center; }

/* Chapps: phones composition (no card frame in Figma) */
.project--chapps .slide { aspect-ratio: 1328 / 912; }
.project--chapps .slide:first-child { border: 0; box-shadow: none; border-radius: 0; background: transparent; }
.phones { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(8px, 3.24vw, 43px); height: 100%; align-content: start; }
.phone img { width: 100%; aspect-ratio: 412 / 840; object-fit: contain; }
.rating {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 2px 8px;
  margin-top: clamp(10px, 1.515vw, 24px);
  color: var(--muted); font-size: clamp(11px, 1.01vw, 16px); line-height: 1.5; letter-spacing: 0;
}
.stars { display: inline-flex; gap: 1px; letter-spacing: 0; }
.s { color: var(--star); }
.s.off { color: var(--star-off); }
.s.half { background: linear-gradient(90deg, var(--star) 50%, var(--star-off) 50%); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---- Copy ---------------------------------------------------------------- */
.copy { grid-area: copy; max-width: 880px; line-height: var(--lh-text); }
.copy p + p { margin-top: calc(var(--lh-text) * 1em); }   /* blank line between paragraphs, as in Figma */
.star { color: var(--star-inline); }

/* ---- Footer -------------------------------------------------------------- */
.site-footer {
  display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 16px 24px;
  margin-top: clamp(160px, 29.8vw, 472px);
  padding-bottom: clamp(16px, 1.515vw, 24px);
}

/* ---- Small screens (hero stacks, controls under the card) ---------------- */
@media (max-width: 760px) {
  :root { --logo: 56px; --col-gap: 16px; }
  .hero { grid-template-columns: 1fr; row-gap: 28px; padding-top: clamp(72px, 18vw, 120px); }
  .avatar { width: 64px; height: 64px; }
  .headline { margin: 0; }
  .link-list--col { flex-direction: row; gap: 24px; }
  .hero-links { text-align: left; }

  .project {
    grid-template-columns: var(--logo) minmax(0, 1fr);
    grid-template-areas:
      "logo  role"
      "media media"
      "ctrl  ctrl"
      "copy  copy";
    row-gap: 20px;
  }
  .role { line-height: 1.5; }
  .ctrl { justify-self: end; margin-top: -8px; margin-right: -12px; }
  .arrow { width: 44px; height: 44px; }   /* comfortable touch targets */
  .copy { margin-top: 4px; }
  .project--chapps .slide { aspect-ratio: 1328 / 960; }
}
@media (max-width: 420px) {
  .rating { flex-direction: column; gap: 0; }
  .project--chapps .slide { aspect-ratio: 1328 / 1010; }
}

/* ---- Motion preferences --------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .track { transition: none; }
  .caret { animation: none; display: none; }
  .arrow { transition: none; }
}
:root.reduce-motion .track { transition: none; }
:root.reduce-motion .caret { display: none; }

/* reset: jump sliders back without animating */
.track.no-anim, .track.no-anim * { transition: none !important; }
a.site-name { color: inherit; text-decoration: none; cursor: pointer; }

/* footer email: copy to clipboard with tooltip */
.copy-email { position: relative; font: inherit; color: inherit; letter-spacing: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; text-align: inherit; }
.copy-email:hover { opacity: .6; }
.copy-email:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; border-radius: 2px; }
.copy-email .tooltip { position: absolute; left: 50%; bottom: calc(100% + 10px); transform: translate(-50%, 4px); padding: 6px 10px; border-radius: 6px; background: #111; color: #fff; font-size: 14px; line-height: 1; letter-spacing: 0; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease; }
.copy-email .tooltip::after { content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 5px solid transparent; border-top-color: #111; }
.copy-email.is-copied .tooltip { opacity: 1; transform: translate(-50%, 0); }
.copy-email.is-copied:hover { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .copy-email .tooltip { transition: none; } }
/* footer row wraps on narrow screens so the full email always fits */
.site-footer .link-list--row { flex-wrap: wrap; row-gap: 12px; }
@media (max-width: 760px) { .site-footer nav { width: 100%; } .site-footer .link-list--row { column-gap: 24px; } }
/* Material Symbols Outlined chevrons (wght 400, opsz 24) */
.arrow .chev { width: 1.2em; height: 1.2em; fill: currentColor; display: block; }
