/* ==========================================================================
   Ilya Ivankin — personal site
   Same palette family as Looma, different composition: sans body, mono labels,
   stacked timeline, no rail grid / warp threads.
   ========================================================================== */

@font-face {
  font-family: "Plex Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/plex-sans-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Plex Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/plex-sans-400-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Plex Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/plex-sans-500-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Plex Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/plex-sans-500-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/plex-mono-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/plex-mono-400-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #0c0d0f;
  --ink: #ebe8e1;
  --muted: #9a968b;
  --faint: #7a776e;
  --accent: #c9713f;
  --accent-ink: #c9713f;
  --live: #86c98b;
  --line: rgb(235 232 225 / 0.12);
  --line-soft: rgb(235 232 225 / 0.07);
  --grain-opacity: 0.025;
  --sans: "Plex Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --pad: clamp(1.5rem, 5vw, 4rem);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --radius: 0.375rem;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f3f0e9;
    --ink: #17171a;
    --muted: #64615a;
    --faint: #6f6c64;
    --accent: #c9713f;
    --accent-ink: #9c4f1c;
    --live: #2f7a44;
    --line: rgb(23 23 26 / 0.14);
    --line-soft: rgb(23 23 26 / 0.08);
    --grain-opacity: 0.018;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100svh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

.sheet {
  position: relative;
  z-index: 2;
  padding: clamp(2.5rem, 8vh, 5rem) var(--pad) clamp(3rem, 10vh, 6rem);
}

.panel {
  max-width: 40rem;
  margin: 0 auto;
}

/* ---------- masthead ---------- */

.mast {
  animation: rise 0.85s var(--ease) backwards;
  animation-delay: 60ms;
}

.mast-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: clamp(1.75rem, 4vh, 2.5rem);
}

.mark {
  display: block;
  width: 1.75rem;
  height: auto;
  color: var(--accent);
}

.mast-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.where {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.where .dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 0.55em;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: 1px;
}

.cv-btn {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius);
  transition:
    color 0.25s var(--ease),
    border-color 0.25s var(--ease),
    background 0.25s var(--ease);
}

.cv-btn::after {
  display: none;
}

.cv-btn:hover,
.cv-btn:focus-visible {
  color: var(--accent-ink);
  border-color: var(--accent-ink);
  background: transparent;
}

.wordmark {
  margin: 0;
  font-weight: 500;
  font-size: clamp(2.4rem, 8vw, 3.5rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.lede {
  max-width: 38ch;
  margin: 1.1rem 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.55;
}

/* ---------- sections ---------- */

.block {
  margin-top: clamp(2.5rem, 6vh, 3.5rem);
  padding-top: clamp(1.75rem, 4vh, 2.25rem);
  border-top: 1px solid var(--line);
  animation: rise 0.85s var(--ease) backwards;
  animation-delay: calc(var(--d, 0) * 100ms + 80ms);
}

.label {
  margin: 0 0 1.25rem;
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

/* ---------- work timeline ---------- */

.timeline {
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline li {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 0.75rem 1.25rem;
  align-items: start;
}

.timeline li + li {
  margin-top: 1.35rem;
  padding-top: 1.35rem;
  border-top: 1px solid var(--line-soft);
}

.when {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  padding-top: 0.2rem;
}

.title {
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: -0.015em;
}

.note {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.55;
}

@media (max-width: 36rem) {
  .timeline li {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .when {
    padding-top: 0;
  }
}

/* ---------- projects ---------- */

.projects {
  margin: 0;
  padding: 0;
  list-style: none;
}

.projects li + li {
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line-soft);
}

.project-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 0.85rem;
  margin: 0;
}

.project-name {
  font-weight: 500;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.project-note {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

.state {
  font-family: var(--mono);
  font-size: 0.625rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.state.is-live {
  color: var(--live);
}

.state.is-live::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 0.45em;
  border-radius: 50%;
  background: currentColor;
  vertical-align: 1px;
  animation: pulse 2.8s ease-in-out infinite;
}

.repos {
  margin: 0.65rem 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.7;
}

.repos li + li {
  margin-top: 0;
}

.amp {
  display: inline-block;
  padding: 0 0.4em;
  color: var(--faint);
}

/* ---------- contact ---------- */

.mailto {
  display: inline-block;
  font-size: clamp(1.2rem, 3vw, 1.5rem);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.3;
}

.elsewhere {
  margin: 0.85rem 0 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}

.fine {
  margin: 1.5rem 0 0;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

/* ---------- links ---------- */

a {
  color: inherit;
  text-decoration: none;
  position: relative;
}

a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.1em;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s var(--ease);
}

a:hover::after,
a:focus-visible::after {
  transform: scaleX(1);
}

a:hover,
a:focus-visible {
  color: var(--accent-ink);
}

.repos a {
  color: var(--muted);
}

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

/* ---------- CV page ---------- */

.cv-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 1.75rem;
}

.cv-back {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

button.cv-btn {
  cursor: pointer;
  background: transparent;
  font: inherit;
}

.cv-head {
  display: grid;
  gap: 1.25rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--line);
}

@media (min-width: 40rem) {
  .cv-head {
    grid-template-columns: 1fr auto;
    align-items: end;
  }
}

.cv-name {
  margin: 0;
  font-size: clamp(1.85rem, 5vw, 2.4rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.1;
}

.cv-role {
  margin: 0.4rem 0 0;
  color: var(--muted);
}

.cv-meta {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.7;
  color: var(--muted);
}

.cv-meta p {
  margin: 0;
}

.cv-section {
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line-soft);
}

.cv-section .label {
  margin-bottom: 0.85rem;
}

.cv-text {
  margin: 0;
  max-width: 48ch;
  color: var(--muted);
  font-size: 0.95rem;
}

.cv-list {
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.95rem;
}

.cv-list li + li {
  margin-top: 0.55rem;
}

@media print {
  body::after {
    display: none;
  }

  .sheet {
    padding: 0;
  }

  .cv-toolbar {
    display: none;
  }

  :root {
    --bg: #fff;
    --ink: #111;
    --muted: #444;
    --faint: #666;
    --line: #ddd;
    --line-soft: #eee;
    --accent-ink: #9c4f1c;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
