/* ==========================================================================
   Peter Gerdzhikov — Portfolio
   Hand-written CSS. No frameworks.
   ========================================================================== */

:root {
  --bg: #0b0b0c;
  --bg-2: #111113;
  --bg-3: #17171a;
  --fg: #ece8e1;
  --muted: #8b8780;
  --dim: #5a5852;
  --line: rgba(236, 232, 225, 0.11);
  --line-2: rgba(236, 232, 225, 0.2);
  --accent: #ff5b1f;
  --accent-2: #ffb347;
  --violet: #7b6cff;
  --green: #4ade80;

  --sans: "Inter Tight", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Instrument Serif", ui-serif, Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --pad: clamp(1.25rem, 4vw, 4rem);
  --ease: cubic-bezier(0.19, 1, 0.22, 1);
  --ease-io: cubic-bezier(0.76, 0, 0.24, 1);
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
}
body.is-loading { overflow: hidden; }
::selection { background: var(--accent); color: #0b0b0c; }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img { display: block; max-width: 100%; }
ul, ol { list-style: none; }
kbd { font-family: var(--mono); }
em { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: -0.01em; }
code { font-family: var(--mono); font-size: 0.9em; color: var(--accent); }

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

.mono {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 400;
}
.dim { color: var(--muted); }
.acc { color: var(--accent); }
.blu { color: var(--violet); }

@media (hover: hover) and (pointer: fine) {
  html.has-cursor, html.has-cursor * { cursor: none !important; }
}

/* ============ Preloader ============ */
.preloader {
  position: fixed; inset: 0; z-index: 1000;
  background: var(--bg);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: var(--pad);
  clip-path: inset(0 0 0 0);
  transition: clip-path 1.1s var(--ease-io);
}
.preloader.done { clip-path: inset(0 0 100% 0); }
.no-js .preloader { display: none; }
.preloader__top { display: flex; justify-content: space-between; color: var(--muted); }
.preloader__count {
  font-size: clamp(6rem, 26vw, 24rem);
  font-weight: 600; letter-spacing: -0.06em; line-height: 0.8;
  font-variant-numeric: tabular-nums;
}
.preloader__bottom { display: flex; flex-direction: column; gap: 1rem; color: var(--muted); }
.preloader__bar { height: 1px; background: var(--line); overflow: hidden; }
.preloader__bar i { display: block; height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; }
.blink { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ============ Cursor ============ */
.cursor { position: fixed; top: 0; left: 0; z-index: 999; pointer-events: none; display: none; }
.has-cursor .cursor { display: block; }
.cursor__dot, .cursor__ring { position: fixed; top: 0; left: 0; border-radius: 50%; will-change: transform; }
.cursor__dot { width: 6px; height: 6px; margin: -3px 0 0 -3px; background: var(--accent); }
.cursor__ring {
  width: 38px; height: 38px; margin: -19px 0 0 -19px;
  border: 1px solid rgba(236, 232, 225, 0.45);
  display: grid; place-items: center;
}
.cursor__ring::before {
  content: ""; position: absolute; inset: -1px; border-radius: 50%;
  background: var(--accent); transform: scale(0);
  transition: transform 0.45s var(--ease);
}
.cursor__ring { transition: width .45s var(--ease), height .45s var(--ease), margin .45s var(--ease), border-color .3s, opacity .3s; }
.cursor.is-hover .cursor__ring { width: 64px; height: 64px; margin: -32px 0 0 -32px; border-color: rgba(255, 91, 31, 0.7); }
.cursor.is-label .cursor__ring { width: 86px; height: 86px; margin: -43px 0 0 -43px; border-color: transparent; }
.cursor.is-label .cursor__ring::before { transform: scale(1); }
.cursor__label {
  position: relative; color: #0b0b0c; font-family: var(--mono); font-size: 0.68rem;
  letter-spacing: 0.06em; text-transform: uppercase; font-weight: 500;
  opacity: 0; transition: opacity 0.2s;
}
.cursor.is-label .cursor__label { opacity: 1; transition-delay: 0.1s; }
.cursor.is-label .cursor__dot { opacity: 0; }
.cursor.is-down .cursor__ring { transform: scale(0.85); }
.cursor.is-hidden { opacity: 0; }
.cursor.is-text .cursor__ring { width: 3px; height: 26px; margin: -13px 0 0 -1.5px; border-radius: 2px; border-color: transparent; background: var(--accent); }
.cursor.is-text .cursor__dot { opacity: 0; }

/* ============ Grain + Progress ============ */
.grain {
  position: fixed; inset: -50%; z-index: 900; pointer-events: none; opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 0.9s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); } 40% { transform: translate(2%, -4%); }
  60% { transform: translate(-4%, -1%); } 80% { transform: translate(3%, 3%); } 100% { transform: translate(0, 0); }
}
.progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 600; pointer-events: none; }
.progress i { display: block; height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; }

/* ============ Nav ============ */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 500;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem var(--pad);
  transition: transform 0.6s var(--ease), background 0.4s, backdrop-filter 0.4s, padding .4s var(--ease);
}
.nav.scrolled {
  background: rgba(11, 11, 12, 0.6);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  padding-top: 0.85rem; padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line);
}
.nav.hidden { transform: translateY(-110%); }
.nav__logo { font-weight: 700; font-size: 1.35rem; letter-spacing: -0.05em; }
.nav__logo span { color: var(--accent); }
.nav__links { display: flex; gap: 2.1rem; }
.nav__links a {
  font-family: var(--mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); position: relative; padding: 0.3rem 0; transition: color 0.3s;
}
.nav__links a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--accent);
  transform: scaleX(0); transform-origin: right; transition: transform 0.5s var(--ease);
}
.nav__links a:hover, .nav__links a.active { color: var(--fg); }
.nav__links a:hover::after, .nav__links a.active::after { transform: scaleX(1); transform-origin: left; }
.nav__right { display: flex; align-items: center; gap: 0.75rem; }
.nav__k {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.45rem 0.6rem; border: 1px solid var(--line-2); border-radius: 8px;
  transition: border-color 0.3s, background 0.3s;
}
.nav__k:hover { border-color: var(--accent); background: rgba(255, 91, 31, 0.08); }
.nav__k-keys { display: flex; gap: 0.25rem; }
.nav__k kbd {
  font-size: 0.72rem; min-width: 1.4rem; height: 1.4rem; display: grid; place-items: center;
  border-radius: 4px; background: var(--bg-3); border: 1px solid var(--line); color: var(--fg);
}
.nav__k-menu { display: none; }
.lang { display: flex; gap: 0.3rem; align-items: center; padding: 0.55rem 0.4rem; color: var(--dim); }
.lang i { font-style: normal; }
.lang span { transition: color 0.3s; }
.lang span.on { color: var(--fg); }

/* ============ Hero ============ */
.hero {
  position: relative; height: 100vh; height: 100svh; min-height: 640px;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 0 var(--pad) clamp(1.5rem, 4vh, 3rem);
  overflow: hidden; isolation: isolate;
}
.hero__gl { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -2; }
.hero__gl.fallback {
  background:
    radial-gradient(60% 50% at 70% 40%, rgba(255, 91, 31, 0.25), transparent 60%),
    radial-gradient(50% 50% at 20% 70%, rgba(123, 108, 255, 0.18), transparent 60%), var(--bg);
}
.hero__fade { position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(to bottom, rgba(11,11,12,.5) 0%, transparent 18%, transparent 60%, rgba(11,11,12,.8) 90%, var(--bg) 100%); }
.hero__meta {
  position: absolute; top: 5.5rem; left: var(--pad); right: var(--pad);
  display: flex; justify-content: space-between; gap: 1rem; color: var(--muted);
  opacity: 0; transform: translateY(10px); transition: opacity 1s var(--ease) 0.9s, transform 1s var(--ease) 0.9s;
}
.loaded .hero__meta { opacity: 1; transform: none; }
.status { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--fg); }
.status i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); position: relative; }
.status i::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--green); animation: ping 2s var(--ease) infinite; }
@keyframes ping { 0% { transform: scale(1); opacity: 0.8; } 100% { transform: scale(3.2); opacity: 0; } }

.hero__inner { will-change: transform, opacity; }
.hero__title {
  font-size: clamp(3.6rem, 15.2vw, 19rem);
  font-weight: 600; line-height: 0.84; letter-spacing: -0.06em;
  margin-left: -0.04em;
}
.line { display: block; overflow: hidden; padding-bottom: 0.06em; margin-bottom: -0.06em; }
.line--2 { padding-left: 0.6em; }
.split { display: inline-block; white-space: nowrap; }
.char { display: inline-block; transform: translate3d(0, 108%, 0) rotate(6deg); transform-origin: left bottom;
  transition: transform 1.25s var(--ease) calc(var(--i) * 38ms + 0.05s); }
.loaded .char { transform: none; }
.char.pre { transform: translate3d(0, 108%, 0) rotate(6deg) !important; transition: none !important; }
.hero__dot { display: inline-block; color: var(--accent); transform: translate3d(0, 108%, 0); transition: transform 1.25s var(--ease) 0.6s; }
.loaded .hero__dot { transform: none; }

.hero__bottom {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 2rem;
  margin-top: clamp(1.25rem, 3vh, 2.25rem);
  border-top: 1px solid var(--line); padding-top: 1.25rem;
  opacity: 0; transform: translateY(20px); transition: opacity 1.2s var(--ease) 0.8s, transform 1.2s var(--ease) 0.8s;
}
.loaded .hero__bottom { opacity: 1; transform: none; }
.hero__lede { max-width: 32rem; font-size: clamp(1.05rem, 1.5vw, 1.35rem); line-height: 1.35; color: var(--fg); }
.hero__lede em { color: var(--accent); font-size: 1.12em; }
.hero__role { font-size: 0.85rem; color: var(--fg); white-space: nowrap; text-transform: none; letter-spacing: 0; }
.caret { display: inline-block; width: 0.55em; height: 1.1em; margin-left: 2px; vertical-align: -0.2em; background: var(--accent); animation: blink 1s steps(1) infinite; }
.hero__scroll {
  position: absolute; right: var(--pad); top: 50%; writing-mode: vertical-rl;
  display: flex; align-items: center; gap: 0.8rem; color: var(--muted);
  opacity: 0; transition: opacity 1s 1.4s;
}
.loaded .hero__scroll { opacity: 1; }
.hero__scroll i { width: 1px; height: 60px; background: var(--line-2); position: relative; overflow: hidden; }
.hero__scroll i::after { content: ""; position: absolute; inset: 0; background: var(--accent); animation: scrollLine 2.2s var(--ease-io) infinite; }
@keyframes scrollLine { 0% { transform: translateY(-100%); } 100% { transform: translateY(100%); } }

/* ============ Marquee ============ */
.marquee {
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  overflow: hidden; padding: 1.6rem 0; position: relative;
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
.marquee__track { display: flex; width: max-content; animation: marquee 40s linear infinite; }
.marquee:hover .marquee__track { animation-play-state: paused; }
.marquee__track span {
  font-size: clamp(1.8rem, 4.2vw, 4rem); font-weight: 500; letter-spacing: -0.04em;
  white-space: nowrap; padding-right: 2.5rem; display: inline-flex; align-items: center; gap: 2.5rem;
}
.marquee__track span:nth-child(even) { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--muted); }
.marquee__track span::after { content: "✦"; font-size: 0.45em; color: var(--accent); font-style: normal; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ============ Sections ============ */
.section { padding: clamp(6rem, 16vh, 12rem) var(--pad); position: relative; }
.section__head { margin-bottom: clamp(3rem, 7vh, 5rem); }
.section__head--split { display: flex; justify-content: space-between; align-items: flex-end; gap: 2rem; flex-wrap: wrap; }
.kicker { display: inline-flex; align-items: center; gap: 0.75rem; color: var(--muted); margin-bottom: 1.25rem; }
.kicker::before { content: ""; width: 2.25rem; height: 1px; background: var(--accent); }
.h2 { font-size: clamp(2.8rem, 8vw, 8.5rem); font-weight: 500; line-height: 0.92; letter-spacing: -0.055em; }
.h2 em { color: var(--accent); padding-right: 0.05em; }
.section__hint { color: var(--muted); }

[data-reveal] { opacity: 0; transform: translateY(40px); transition: opacity 1.2s var(--ease), transform 1.2s var(--ease); transition-delay: var(--d, 0s); }
[data-reveal].in { opacity: 1; transform: none; }
.no-js [data-reveal] { opacity: 1; transform: none; }

/* ============ About ============ */
.about__statement {
  font-size: clamp(1.75rem, 4.1vw, 4.1rem); font-weight: 500; line-height: 1.1; letter-spacing: -0.035em;
  max-width: 1400px;
}
.about__statement .w { opacity: 0.14; transition: opacity 0.5s, color 0.5s; }
.about__statement .w.on { opacity: 1; }
.about__statement .w.em { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: -0.01em; }
.about__statement .w.em.on { color: var(--accent); }
.about__grid {
  display: grid; grid-template-columns: 1fr 1.1fr; gap: clamp(2rem, 6vw, 7rem);
  margin-top: clamp(4rem, 10vh, 8rem); align-items: start;
}
.about__text { display: grid; gap: 1.25rem; color: var(--muted); font-size: 1.08rem; max-width: 34rem; }
.about__text p:first-child { color: var(--fg); }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.stats li { padding: 1.75rem 1.5rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stats strong {
  display: block; font-size: clamp(2.6rem, 5vw, 4.6rem); font-weight: 500; letter-spacing: -0.05em; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stats strong sup { color: var(--accent); font-size: 0.45em; vertical-align: 0.9em; margin-left: 0.08em; }
.stats li > span { display: block; margin-top: 0.6rem; }

/* ============ Work ============ */
.work__list { border-top: 1px solid var(--line); counter-reset: w; }
.work__row {
  position: relative; display: grid;
  grid-template-columns: 3.5rem minmax(0, 1.25fr) minmax(0, 1.2fr) minmax(0, 1fr) 4rem 2.5rem;
  align-items: center; gap: 1.5rem;
  padding: clamp(1.4rem, 3.2vh, 2.4rem) 0.25rem;
  border-bottom: 1px solid var(--line);
  overflow: hidden; isolation: isolate;
  transition: color 0.5s var(--ease), padding 0.6s var(--ease);
  width: 100%; text-align: left;
}
.work__row::before {
  content: ""; position: absolute; inset: 0; z-index: -1; background: var(--accent);
  transform: scaleY(0); transform-origin: bottom; transition: transform 0.6s var(--ease);
}
.work__row:hover, .work__row:focus-visible { color: #0b0b0c; padding-left: 1.25rem; padding-right: 1.25rem; outline: none; }
.work__row:hover::before, .work__row:focus-visible::before { transform: scaleY(1); }
.work__row:hover .mono, .work__row:focus-visible .mono { color: #0b0b0c; }
.work__num { color: var(--muted); }
.work__title { font-size: clamp(1.9rem, 4.4vw, 4.2rem); font-weight: 500; letter-spacing: -0.05em; line-height: 1; }
.work__desc { color: inherit; opacity: 0.8; font-size: 1rem; line-height: 1.35; }
.work__tags { color: var(--muted); line-height: 1.6; }
.work__year { color: var(--muted); text-align: right; }
.work__arrow { font-size: 1.6rem; justify-self: end; transition: transform 0.6s var(--ease); }
.work__row:hover .work__arrow { transform: rotate(45deg); }
.work__thumb { display: none; }

.preview {
  position: fixed; top: 0; left: 0; z-index: 400; pointer-events: none;
  width: clamp(280px, 26vw, 420px); aspect-ratio: 4 / 3;
  will-change: transform;
}
.preview__inner {
  width: 100%; height: 100%; overflow: hidden; border-radius: 10px;
  transform: scale(0); transition: transform 0.6s var(--ease);
  box-shadow: 0 40px 80px -20px rgba(0, 0, 0, 0.7);
}
.preview.on .preview__inner { transform: scale(1); }
.preview__track { height: 100%; transition: transform 0.7s var(--ease); }
.preview__track img { width: 100%; height: 100%; object-fit: cover; }

/* ============ Stack ============ */
.stack__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.card {
  position: relative; padding: clamp(1.5rem, 2.4vw, 2.2rem); border-radius: 16px;
  background: var(--bg-2); border: 1px solid var(--line); overflow: hidden; isolation: isolate;
  min-height: 15rem; display: flex; flex-direction: column; justify-content: space-between; gap: 2rem;
  transition: border-color 0.4s, transform 0.6s var(--ease);
  --x: 50%; --y: 50%;
}
.card::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0; transition: opacity 0.4s;
  background: radial-gradient(420px circle at var(--x) var(--y), rgba(255, 91, 31, 0.16), transparent 45%);
}
.card::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; z-index: -1; opacity: 0; transition: opacity .4s;
  background: radial-gradient(260px circle at var(--x) var(--y), rgba(255, 91, 31, 0.9), transparent 60%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.card:hover::before, .card:hover::after { opacity: 1; }
.card__top { display: flex; justify-content: space-between; align-items: center; color: var(--muted); }
.card__glyph { font-family: var(--mono); color: var(--accent); font-size: 1rem; }
.card h3 { font-size: clamp(1.5rem, 2.4vw, 2.2rem); font-weight: 500; letter-spacing: -0.04em; line-height: 1; margin-bottom: 1.1rem; }
.pills { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.pills li {
  font-family: var(--mono); font-size: 0.74rem; padding: 0.38rem 0.7rem; border-radius: 999px;
  border: 1px solid var(--line-2); color: var(--fg); transition: background 0.3s, color 0.3s, border-color 0.3s;
}
.pills li:hover { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.card--accent { background: var(--accent); color: #0b0b0c; border-color: var(--accent); }
.card--accent .card__top, .card--accent .card__glyph { color: #0b0b0c; }
.card--accent .pills li { border-color: rgba(11, 11, 12, 0.35); color: #0b0b0c; }
.card--accent .pills li:hover { background: #0b0b0c; color: var(--accent); }
.card--accent::before { background: radial-gradient(420px circle at var(--x) var(--y), rgba(255, 255, 255, 0.28), transparent 45%); }
.card--accent::after { display: none; }

/* ============ Experience ============ */
.exp__list { border-top: 1px solid var(--line); }
.exp__item {
  display: grid; grid-template-columns: 14rem minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 2rem; padding: 2.25rem 0; border-bottom: 1px solid var(--line);
  transition: background 0.4s;
}
.exp__period { color: var(--muted); padding-top: 0.6rem; }
.exp__period .now { color: var(--green); }
.exp__role { font-size: clamp(1.5rem, 2.6vw, 2.4rem); font-weight: 500; letter-spacing: -0.04em; line-height: 1.05; }
.exp__co { display: block; font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--accent); font-size: 1.15em; letter-spacing: -0.01em; margin-top: 0.15rem; }
.exp__desc { color: var(--muted); font-size: 1.02rem; max-width: 36rem; padding-top: 0.45rem; }
.exp__desc .pills { margin-top: 1rem; }
.exp__desc .pills li { font-size: 0.68rem; padding: 0.3rem 0.6rem; color: var(--muted); }

/* ============ Terminal ============ */
.term {
  border-radius: 14px; overflow: hidden; border: 1px solid var(--line-2);
  background: #0d0d0f; box-shadow: 0 60px 120px -40px rgba(255, 91, 31, 0.18), 0 30px 60px -30px rgba(0, 0, 0, 0.8);
}
.term__bar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 0.85rem 1rem; border-bottom: 1px solid var(--line); background: #131316;
}
.term__dots { display: flex; gap: 0.45rem; }
.term__dots i { width: 12px; height: 12px; border-radius: 50%; background: #ff5f57; }
.term__dots i:nth-child(2) { background: #febc2e; }
.term__dots i:nth-child(3) { background: #28c840; }
.term__title { color: var(--muted); text-transform: none; }
.term__size { color: var(--dim); justify-self: end; text-transform: none; }
.term__body {
  height: clamp(340px, 52vh, 520px); overflow-y: auto; padding: 1.25rem 1.25rem 1.5rem;
  font-family: var(--mono); font-size: 0.86rem; line-height: 1.7; color: #d6d2ca;
  scrollbar-width: thin; scrollbar-color: var(--dim) transparent;
}
.tl { white-space: pre-wrap; word-break: break-word; }
.tl.err { color: #ff7b72; }
.tl.ok { color: var(--green); }
.tl.dim { color: var(--muted); }
.tl a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.tl .acc { color: var(--accent); }
.tl .blu { color: var(--violet); }
.tl .grn { color: var(--green); }
.tl .yel { color: var(--accent-2); }
.tl .k { display: inline-block; min-width: 11ch; color: var(--accent); }
.tl.gap { height: 0.6rem; }
.term__line { display: flex; gap: 0.6rem; align-items: center; }
.term__prompt { white-space: nowrap; }
.term__input {
  flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--fg);
  font: inherit; caret-color: var(--accent);
}

/* ============ Contact ============ */
.contact { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; }
.contact__title { font-size: clamp(3.4rem, 12.5vw, 15rem); font-weight: 500; line-height: 0.88; letter-spacing: -0.065em; margin: 1rem 0 clamp(3rem, 8vh, 5rem); }
.contact__title em { color: var(--accent); }
.contact__l { display: inline-block; transform: translateY(105%); transition: transform 1.3s var(--ease); }
.contact__title .line:nth-child(2) .contact__l { transition-delay: 0.1s; padding-left: 0.5em; }
.contact__title.in .contact__l { transform: none; }
.no-js .contact__l { transform: none; }
.contact__row { display: flex; align-items: center; gap: clamp(2rem, 6vw, 6rem); flex-wrap: wrap; }
.contact__btn {
  width: clamp(9rem, 14vw, 12.5rem); aspect-ratio: 1; border-radius: 50%;
  background: var(--accent); color: #0b0b0c; display: grid; place-items: center;
  font-weight: 600; font-size: 1.05rem; letter-spacing: -0.02em;
  transition: transform 0.6s var(--ease), background 0.3s;
  flex-shrink: 0;
}
.contact__btn:hover { background: var(--fg); }
.contact__btn-inner { display: block; transition: transform 0.6s var(--ease); pointer-events: none; }
.contact__info { display: grid; gap: 1rem; }
.contact__email {
  font-size: clamp(1.4rem, 3.2vw, 3rem); font-weight: 500; letter-spacing: -0.04em;
  background: linear-gradient(var(--accent), var(--accent)) 0 100% / 0 2px no-repeat;
  transition: background-size 0.6s var(--ease); padding-bottom: 0.15rem; justify-self: start;
  word-break: break-all;
}
.contact__email:hover { background-size: 100% 2px; }
.socials { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
.socials a {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 0.6rem 1rem; border: 1px solid var(--line-2); border-radius: 999px;
  transition: background 0.3s, color 0.3s, border-color 0.3s;
}
.socials a:hover { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.socials a span { transition: transform 0.4s var(--ease); }
.socials a:hover span { transform: rotate(45deg); }

/* ============ Footer ============ */
.footer {
  display: flex; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap;
  padding: 1.75rem var(--pad); border-top: 1px solid var(--line); color: var(--muted);
}
.footer a:hover { color: var(--accent); }

/* ============ Modal ============ */
.modal {
  margin: auto; border: 0; padding: 0; background: transparent; color: var(--fg);
  width: min(1120px, 94vw); max-width: none; max-height: 92vh; overflow: visible;
}
.modal::backdrop { background: rgba(5, 5, 6, 0.72); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.modal[open] .modal__panel { animation: modalIn 0.8s var(--ease); }
.modal[open]::backdrop { animation: fadeIn 0.5s; }
@keyframes modalIn { from { transform: translateY(60px) scale(0.97); opacity: 0; } }
@keyframes fadeIn { from { opacity: 0; } }
.modal__panel {
  position: relative; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 18px;
  max-height: 92vh; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--dim) transparent;
}
.modal__close {
  position: sticky; top: 1rem; float: right; margin: 1rem 1rem -4rem 0; z-index: 2;
  padding: 0.6rem 0.9rem; border-radius: 999px; background: rgba(11, 11, 12, 0.7); backdrop-filter: blur(8px);
  border: 1px solid var(--line-2); transition: background 0.3s, color 0.3s;
}
.modal__close:hover { background: var(--fg); color: var(--bg); }
.modal__hero { aspect-ratio: 21 / 9; overflow: hidden; }
.modal__hero img { width: 100%; height: 100%; object-fit: cover; }
.modal__body { padding: clamp(1.5rem, 4vw, 3.5rem); }
.modal__title { font-size: clamp(3rem, 8vw, 7rem); font-weight: 500; letter-spacing: -0.06em; line-height: 0.9; }
.modal__short { font-family: var(--serif); font-style: italic; font-size: clamp(1.4rem, 2.6vw, 2.2rem); color: var(--accent); margin-top: 0.5rem; line-height: 1.15; }
.modal__meta { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; margin: 2.5rem 0; padding: 1.5rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.modal__meta dt { font-family: var(--mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 0.4rem; }
.modal__meta dd { font-size: 0.98rem; }
.modal__meta dd a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--accent); margin-right: 0.8rem; }
.modal__desc { font-size: clamp(1.1rem, 1.5vw, 1.35rem); line-height: 1.5; max-width: 52rem; margin-bottom: 2.5rem; }
.modal__hl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: 1rem 0 3rem; }
.modal__hl li { padding: 1.25rem; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-3); line-height: 1.4; }
.modal__hl li::before { content: "↳ "; color: var(--accent); font-family: var(--mono); }
.modal__next {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.4rem; width: 100%;
  padding-top: 2rem; border-top: 1px solid var(--line); text-align: left;
}
.modal__next-title { font-size: clamp(2rem, 5vw, 4rem); font-weight: 500; letter-spacing: -0.05em; line-height: 1; transition: color 0.3s, transform 0.6s var(--ease); }
.modal__next:hover .modal__next-title { color: var(--accent); transform: translateX(0.5rem); }

/* ============ Palette ============ */
.palette { position: fixed; inset: 0; z-index: 800; display: flex; justify-content: center; align-items: flex-start; padding-top: 16vh; }
.palette[hidden] { display: none; }
.palette__backdrop { position: absolute; inset: 0; background: rgba(5, 5, 6, 0.6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fadeIn 0.3s; }
.palette__panel {
  position: relative; width: min(640px, 92vw); border-radius: 14px; overflow: hidden;
  background: rgba(19, 19, 22, 0.92); border: 1px solid var(--line-2);
  box-shadow: 0 50px 100px -20px rgba(0, 0, 0, 0.8); animation: palIn 0.4s var(--ease);
}
@keyframes palIn { from { transform: translateY(-14px) scale(0.98); opacity: 0; } }
.palette__search { display: flex; align-items: center; gap: 0.75rem; padding: 1rem 1.2rem; border-bottom: 1px solid var(--line); }
.palette__search .acc { font-size: 1.2rem; }
.palette__search input { flex: 1; background: transparent; border: 0; outline: 0; color: var(--fg); font: inherit; font-size: 1.1rem; }
.palette__search kbd { padding: 0.2rem 0.45rem; border: 1px solid var(--line-2); border-radius: 4px; color: var(--muted); }
.palette__list { max-height: min(52vh, 420px); overflow-y: auto; padding: 0.5rem; scrollbar-width: thin; }
.palette__group { padding: 0.7rem 0.75rem 0.35rem; font-family: var(--mono); font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--dim); }
.palette__item {
  display: flex; align-items: center; gap: 0.9rem; padding: 0.7rem 0.75rem; border-radius: 8px;
  color: var(--muted); transition: background 0.15s, color 0.15s;
}
.palette__item .ico { width: 1.6rem; height: 1.6rem; display: grid; place-items: center; border-radius: 6px; background: var(--bg-3); border: 1px solid var(--line); font-family: var(--mono); font-size: 0.8rem; color: var(--fg); }
.palette__item .lbl { flex: 1; color: var(--fg); }
.palette__item .lbl mark { background: none; color: var(--accent); }
.palette__item .hint { font-family: var(--mono); font-size: 0.7rem; }
.palette__item.sel { background: rgba(255, 91, 31, 0.12); }
.palette__item.sel .ico { border-color: var(--accent); color: var(--accent); }
.palette__empty { padding: 2rem; text-align: center; color: var(--muted); }
.palette__foot { display: flex; gap: 1.5rem; padding: 0.75rem 1.2rem; border-top: 1px solid var(--line); }

/* ============ Toast / Confetti ============ */
.toast {
  position: fixed; left: 50%; bottom: 2rem; z-index: 950; transform: translate(-50%, calc(100% + 3rem));
  background: var(--fg); color: var(--bg); padding: 0.85rem 1.25rem; border-radius: 999px;
  text-transform: none; font-size: 0.8rem; letter-spacing: 0.02em;
  transition: transform 0.6s var(--ease), opacity 0.4s; pointer-events: none; opacity: 0;
  display: flex; align-items: center; gap: 0.6rem;
}
.toast::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 960; pointer-events: none; }

/* ============ Party mode ============ */
.party .h2 em, .party .contact__title em, .party .hero__dot { animation: partyHue 1.6s linear infinite; }
@keyframes partyHue { to { filter: hue-rotate(360deg); } }

/* ============ Responsive ============ */
@media (max-width: 1100px) {
  .work__row { grid-template-columns: 3rem minmax(0, 1.2fr) minmax(0, 1fr) 4rem 2rem; }
  .work__tags { display: none; }
  .stack__grid { grid-template-columns: repeat(2, 1fr); }
  .exp__item { grid-template-columns: 10rem 1fr; }
  .exp__desc { grid-column: 2; padding-top: 0; }
  .modal__hl { grid-template-columns: 1fr; }
  .modal__meta { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .nav__links { display: none; }
  .nav__k-keys { display: none; }
  .nav__k-menu { display: inline; }
  .hero__coords { display: none; }
  .hero__scroll { display: none; }
  .hero__bottom { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .line--2 { padding-left: 0; }
  .about__grid { grid-template-columns: 1fr; }
  .work__row { grid-template-columns: 2.2rem minmax(0, 1fr) 2rem; gap: 0.25rem 1rem; }
  .work__desc { grid-column: 2; grid-row: 2; font-size: 0.92rem; }
  .work__year { display: none; }
  .work__arrow { grid-column: 3; grid-row: 1; }
  .work__thumb { display: block; grid-column: 1 / -1; grid-row: 3; margin-top: 1rem; border-radius: 8px; aspect-ratio: 16 / 9; object-fit: cover; width: 100%; }
  .exp__item { grid-template-columns: 1fr; gap: 0.75rem; }
  .exp__desc { grid-column: 1; }
  .exp__period { padding-top: 0; }
  .term__size { display: none; }
  .term__bar { grid-template-columns: auto 1fr; gap: 1rem; }
  .contact__title .line:nth-child(2) .contact__l { padding-left: 0; }
  .footer__mid { order: 3; width: 100%; }
}
@media (max-width: 560px) {
  .hero__meta { flex-direction: column; gap: 0.5rem; top: 4.75rem; }
  .stack__grid { grid-template-columns: 1fr; }
  .stats li { padding: 1.25rem 1rem; }
  .modal__meta { grid-template-columns: 1fr 1fr; }
  .palette { padding-top: 10vh; }
  .term__body { font-size: 0.78rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; transition-delay: 0s !important; }
  html { scroll-behavior: auto; }
  .grain { display: none; }
}

.modal:focus, .modal:focus-visible, .modal__panel:focus { outline: none; }
@media (hover: none) { .work .section__hint { display: none; } }
