/* ==========================================================================
   vladmas.com
   One typeface (0xProto), one accent (silk blue from the login wallpaper).
   ========================================================================== */

@font-face {
  font-family: "0xProto";
  src: url("../fonts/0xProto-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "0xProto";
  src: url("../fonts/0xProto-Italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "0xProto";
  src: url("../fonts/0xProto-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* palette */
  --room: #000;            /* the dark room around the laptop */
  --night: #04060b;        /* page base */
  --navy: #0a1222;         /* wallpaper body */
  --silk: #7fa4ff;         /* wallpaper wave highlight: the only accent */
  --glow: #dce5ff;         /* screen-lit text */
  --fog: #8e9ab3;          /* secondary text */
  --line: rgba(160, 185, 255, 0.14);

  /* type scale (16px base) */
  --fs-xs: 0.8125rem;      /* 13 */
  --fs-s: 0.9375rem;       /* 15 */
  --fs-m: 1.0625rem;       /* 17 */

  --pad: clamp(20px, 5vw, 72px);
  --font: "0xProto", ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  color-scheme: dark;
}

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

html {
  background: var(--night);
  color: var(--glow);
  font-family: var(--font);
  font-size: 100%;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body { margin: 0; min-height: 100vh; }
h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
img { display: block; max-width: none; }
a { color: inherit; }

::selection { background: rgba(127, 164, 255, 0.35); color: #fff; }

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

.wrap { padding-inline: var(--pad); }

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

/* ==========================================================================
   Stage: the fixed scene behind the page
   ========================================================================== */

.stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: var(--room);
  pointer-events: none;
}

/* film grain, so the photo plate and the crisp UI sit in the same world */
.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.07;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* "world" = the 1672×941 photo plate. JS positions and zooms it. */
.world,
.man {
  position: absolute;
  left: 0;
  top: 0;
  width: 1672px;
  height: 941px;
  transform-origin: 0 0;
}

.world__plate {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.world__screen,
.world__sheen {
  position: absolute;
  left: 528px;
  top: 228px;
  width: 616px;
  height: 381px;
}
.world__screen {
  object-fit: cover;
  box-shadow: 0 0 70px 8px rgba(64, 104, 214, 0.16);
}
/* a faint glass reflection across the screen */
.world__sheen {
  background:
    linear-gradient(116deg, rgba(210, 225, 255, 0.075) 0%, rgba(210, 225, 255, 0.025) 34%, transparent 34.2%),
    radial-gradient(120% 90% at 50% 40%, transparent 55%, rgba(0, 0, 0, 0.22));
}

/* the man: two silhouettes, cross-faded as he turns to leave */
.man__part {
  position: absolute;
}
.man__part img {
  width: 100%;
  height: auto;
  /* backlight: the screen behind him catches the edge of the hood */
  filter:
    drop-shadow(0 0 1px rgba(150, 180, 255, 0.5))
    drop-shadow(0 -6px 14px rgba(60, 100, 220, 0.12));
}
/* Seated right at the laptop: the hood (peak at world 836,296) hides the photo on screen */
.man__part--seated {
  left: 480.5px;
  top: 288.2px;
  width: 711px;
  transform-origin: 355.5px 7.8px; /* the peak of the hood */
}
.man__part--seated img {
  transform-origin: 50% 12%;
}
.man__part--walking {
  left: 436.6px;
  top: 281.4px;
  width: 639.6px;
  opacity: 0;
  transform-origin: 399.4px 14.6px;
}

/* after the zoom: the wallpaper, blurred, becomes the page background */
.stage__backdrop,
.stage__dim {
  position: absolute;
  inset: 0;
  opacity: 0;
}
.stage__backdrop {
  background: var(--navy) url("../img/screen-blur.webp") center / cover no-repeat;
}
.stage__dim {
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(4, 7, 14, 0.2), rgba(4, 7, 14, 0.75)),
    rgba(4, 7, 14, 0.35);
}

/* the laptop wakes up on load */
.is-ready .world { animation: wake 2.2s var(--ease-out) both 0.15s; }
.is-ready .man { animation: fade-in 1.2s ease both 0.5s; }
html.js:not(.is-ready) .world,
html.js:not(.is-ready) .man { opacity: 0; }

@keyframes wake {
  0%   { opacity: 0; }
  22%  { opacity: 0.9; }
  30%  { opacity: 0.55; }
  100% { opacity: 1; }
}
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes rise-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: no-preference) {
  .is-ready:not(.is-scrolled) .man__part--seated img {
    animation: breathe 5.5s ease-in-out infinite;
  }
}
@keyframes breathe {
  0%, 100% { transform: none; }
  50%      { transform: translateY(-3px) scaleX(1.004); }
}

/* ==========================================================================
   Top bar
   ========================================================================== */

.bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: max(16px, env(safe-area-inset-top)) var(--pad) 16px;
  font-size: var(--fs-xs);
  pointer-events: none;
}
/* once past the intro, content scrolls under the bar: frost it, fading out downward */
.bar::before {
  content: "";
  position: absolute;
  inset: 0 0 -24px;
  z-index: -1;
  background: rgba(5, 9, 18, 0.55);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  -webkit-mask-image: linear-gradient(#000 55%, transparent);
  mask-image: linear-gradient(#000 55%, transparent);
  opacity: 0;
  transition: opacity 0.5s;
}
.is-in .bar::before,
.sub .bar::before { opacity: 1; }
.bar a {
  pointer-events: auto;
  color: var(--fog);
  text-decoration: none;
  transition: color 0.2s;
}
.bar a:hover { color: var(--glow); }
.bar__name { opacity: 0; transition: opacity 0.5s, color 0.2s; }
.is-in .bar__name,
.sub .bar__name { opacity: 1; color: var(--glow); }
.bar__nav { display: flex; gap: clamp(18px, 2.6vw, 36px); margin-left: auto; }

@media (max-width: 560px) {
  .home .bar__name { display: none; }
}
/* sub-pages: too narrow for the name and the nav on one line; "Back to projects" sits just below */
@media (max-width: 440px) {
  .sub .bar__name { display: none; }
}

/* ==========================================================================
   Intro: tall scroll room; the stage animates while this is pinned
   ========================================================================== */

main { position: relative; z-index: 1; }

.intro { height: 300vh; }
html:not(.js) .intro { height: 100vh; }

.intro__pin {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
}

.intro__title {
  position: absolute;
  left: var(--pad);
  right: var(--pad);
  bottom: 18svh;
  text-align: center;
  text-shadow: 0 2px 28px rgba(0, 0, 0, 0.65);
}
.intro__name {
  font-size: clamp(2.6rem, 7.2vw, 6.5rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.045em;
  text-wrap: balance;
}
.intro__role {
  margin-top: 0.9em;
  font-size: clamp(var(--fs-s), 1.5vw, 1.375rem);
  color: var(--fog);
}

.intro__cue {
  position: absolute;
  left: 50%;
  bottom: calc(3svh + env(safe-area-inset-bottom));
  translate: -50% 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  font-size: var(--fs-xs);
  color: var(--fog);
  text-decoration: none;
  white-space: nowrap;
}
.intro__cue:hover { color: var(--glow); }
.intro__cue-line {
  order: 2;
  position: relative;
  width: 1px;
  height: 48px;
  overflow: hidden;
  background: var(--line);
}
.intro__cue-line::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 45%;
  background: var(--silk);
  transform: translateY(-100%);
}
@media (prefers-reduced-motion: no-preference) {
  .intro__cue-line::after { animation: cue 2.4s cubic-bezier(0.65, 0, 0.35, 1) infinite 2.4s; }
}
@keyframes cue {
  from { transform: translateY(-100%); }
  to   { transform: translateY(230%); }
}

.is-ready .intro__name { animation: rise-in 1.1s var(--ease-out) both 0.9s; }
.is-ready .intro__role { animation: rise-in 1.1s var(--ease-out) both 1.1s; }
.is-ready .intro__cue > * { animation: fade-in 1s ease both 1.6s; }
html.js:not(.is-ready) .intro__name,
html.js:not(.is-ready) .intro__role,
html.js:not(.is-ready) .intro__cue > * { opacity: 0; }

/* ==========================================================================
   Shared section type
   ========================================================================== */

.section-title {
  font-size: clamp(2.25rem, 4.6vw, 4rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.045em;
}
.count {
  margin-left: 0.4em;
  font-size: 0.28em;
  letter-spacing: 0;
  vertical-align: top;
  position: relative;
  top: 0.15em;
  color: var(--silk);
}
.lede {
  max-width: 52ch;
  margin-top: 1.1rem;
  font-size: clamp(var(--fs-s), 1.15vw, var(--fs-m));
  line-height: 1.7;
  color: var(--fog);
}
.lede__accent {
  color: var(--silk);
  white-space: nowrap;
}

/* ==========================================================================
   Projects: one screen, cards scroll sideways while the section is pinned
   ========================================================================== */

.projects { position: relative; }
/* overlap the last screen of the intro, so projects fade in while the wallpaper blurs */
html.js .projects { margin-top: -100vh; }

.projects__pin {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(28px, 5.5vh, 64px);
  min-height: 100vh;
  min-height: 100svh;
  padding-block: 72px 40px;
}
html.js .projects__pin {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}

/* a real horizontal scroller: swipe it directly, or scroll the page and it follows */
.rail {
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  margin-block: -12px;         /* room for focus rings without shifting the layout */
}
.rail::-webkit-scrollbar { display: none; }

.track {
  position: relative;
  display: flex;
  gap: clamp(14px, 1.6vw, 24px);
  width: max-content;
  padding: 12px var(--pad);
}

.card {
  --tint: var(--silk);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  width: clamp(272px, 24vw, 360px);
  height: clamp(340px, 50vh, 440px);
  padding: clamp(20px, 1.8vw, 28px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(22, 34, 64, 0.58), rgba(8, 13, 26, 0.66));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  -webkit-backdrop-filter: blur(16px) saturate(130%);
  backdrop-filter: blur(16px) saturate(130%);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.35s, background-color 0.35s;
}
.card:hover,
.card:focus-visible {
  border-color: color-mix(in oklab, var(--tint) 55%, transparent);
}
.card:focus-visible { outline-offset: 6px; border-radius: 24px; }

.card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.card__icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  flex: none;
  border-radius: 18px;
  border: 1px solid color-mix(in oklab, var(--tint) 30%, transparent);
  background:
    radial-gradient(120% 120% at 25% 15%, color-mix(in oklab, var(--tint) 38%, var(--navy)), var(--navy) 72%);
  transition: transform 0.4s var(--ease-out);
}
.card__icon img { width: 36px; height: 36px; }
.card:hover .card__icon,
.card:focus-visible .card__icon {
  transform: translateY(-2px);
}
.card__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  padding-top: 4px;
  font-size: var(--fs-xs);
  text-align: right;
}
.card__kind { color: var(--fog); }
.card__status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--silk);
}
.card__status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
}

.card__body { display: flex; flex-direction: column; }
.card__title {
  font-size: clamp(1.375rem, 1.7vw, 1.625rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
}
.card__desc {
  margin-top: 0.75rem;
  font-size: var(--fs-s);
  line-height: 1.6;
  color: var(--fog);
}
.card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 1.25rem;
  font-size: 0.75rem;
}
.card__tags > * {
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--fog);
}
.card__tags > .is-status {
  border-color: color-mix(in oklab, var(--silk) 45%, transparent);
  color: var(--silk);
}

.rail-progress {
  position: relative;
  height: 1px;
  margin-inline: var(--pad);
  padding: 0;
  background: var(--line);
  visibility: hidden;
}
.projects.is-scrollable .rail-progress { visibility: visible; }
.rail-progress__fill {
  position: absolute;
  inset: 0;
  background: var(--silk);
  transform-origin: 0 50%;
  transform: scaleX(0);
}

/* ==========================================================================
   Skills + contact
   ========================================================================== */

.skills {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  row-gap: clamp(48px, 8vh, 88px);
  min-height: 100vh;
  min-height: 100svh;
  padding-top: clamp(112px, 18vh, 200px);
  padding-bottom: max(28px, env(safe-area-inset-bottom));
}

.skillflow {
  max-width: 34em;
  font-size: clamp(1.25rem, 2.35vw, 2.125rem);
  line-height: 1.5;
  letter-spacing: -0.03em;
  color: var(--glow);
}
.skillgroup {
  display: inline;
  margin-right: 0.85em;
  transition: opacity 0.35s;
}
.skillgroup i { font-style: normal; color: var(--fog); opacity: 0.6; }
.skillgroup__label {
  margin-right: 0.45em;
  font-size: max(0.4em, 0.6875rem);
  letter-spacing: 0;
  vertical-align: 0.95em;
  color: var(--silk);
  white-space: nowrap;
}
@media (hover: hover) {
  .skillflow:hover .skillgroup { opacity: 0.32; }
  .skillflow .skillgroup:hover { opacity: 1; }
}

.links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
  gap: 28px 40px;
  align-self: end;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 30vh;
}
.links__label {
  display: block;
  margin-bottom: 6px;
  font-size: var(--fs-xs);
  color: var(--fog);
}
.links a {
  padding-bottom: 3px;
  font-size: clamp(1.0625rem, 1.5vw, 1.375rem);
  letter-spacing: -0.02em;
  text-decoration: none;
  background: linear-gradient(var(--silk), var(--silk)) 0 100% / 0 1px no-repeat;
  transition: background-size 0.4s var(--ease-out), color 0.2s;
}
.links a:hover,
.links a:focus-visible {
  color: var(--silk);
  background-size: 100% 1px;
}

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  font-size: var(--fs-xs);
  color: var(--fog);
}
.foot a { color: var(--glow); text-decoration-color: var(--line); text-underline-offset: 3px; }
.foot a:hover { text-decoration-color: var(--silk); }

@media (min-width: 1100px) {
  .skills {
    grid-template-columns: minmax(280px, 4fr) 8fr;
    column-gap: 6vw;
    align-content: start;
  }
  .skills__intro { grid-column: 1; grid-row: 1; }
  .skillflow { grid-column: 2; grid-row: 1; padding-top: 0.2em; }
  .links { grid-column: 1 / -1; }
  .foot { grid-column: 1 / -1; }
}

/* short screens (landscape phones, small laptop windows) */
@media (max-height: 560px) {
  .intro__title { bottom: 24svh; }
  .intro__name { font-size: clamp(2rem, 6vw, 3.25rem); }
  .intro__role { margin-top: 0.5em; }
  .intro__cue { gap: 0; }
  .intro__cue-line { display: none; }

  html.js .projects__pin { justify-content: flex-start; gap: 14px; padding-block: 60px 12px; }
  .projects .section-title { font-size: 1.75rem; }
  .projects .lede { display: none; }
  .card { height: auto; gap: 14px; padding: 18px; }
  .card__icon { width: 44px; height: 44px; border-radius: 13px; }
  .card__icon img { width: 26px; height: 26px; }
  .card__desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .card__tags { margin-top: 0.875rem; }
  .rail-progress { display: none; }
}

/* no JS: no animated scene, so give the sections a solid floor */
html:not(.js) .projects,
html:not(.js) .skills { background: rgba(4, 6, 11, 0.92); }

/* ==========================================================================
   Project sub-pages (shared shell; each page adds its own design later)
   ========================================================================== */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(4, 7, 14, 0.25), rgba(4, 7, 14, 0.8)),
    var(--navy) url("../img/screen-blur.webp") center / cover no-repeat;
}

.sub__main {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
  min-height: 100svh;
  padding-block: 120px 64px;
  max-width: 960px;
}
.sub__back {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  align-self: flex-start;
  margin-bottom: clamp(40px, 8vh, 80px);
  font-size: var(--fs-xs);
  color: var(--fog);
  text-decoration: none;
}
.sub__back:hover { color: var(--glow); }
.sub__back svg { transition: transform 0.3s var(--ease-out); }
.sub__back:hover svg { transform: translateX(-3px); }
.sub__head { display: flex; align-items: center; gap: 20px; }
.sub__kind { font-size: var(--fs-xs); color: var(--fog); }
.sub__title {
  margin-top: 0.15em;
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.045em;
}
.sub__main .card__tags { margin-top: 1.75rem; }
.sub__note {
  margin-top: clamp(48px, 10vh, 96px);
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: var(--fs-s);
  color: var(--fog);
}
.sub__note a { color: var(--glow); text-underline-offset: 3px; text-decoration-color: var(--line); }
.sub__note a:hover { color: var(--silk); text-decoration-color: var(--silk); }

/* ==========================================================================
   Reduced motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
  }
}
