@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Orbitron:wght@500;600;700;800&family=Space+Mono:wght@400;700&display=swap');

:root {
  color-scheme: dark;
  --bg: #05060a;
  --panel: #0b0e15;
  --panel-2: #101521;
  --line: #262c3a;
  --text: #f2f4fa;
  --muted: #929bad;
  --yellow: #ffd447;
  --blue: #649cff;
  --pink: #ff70bd;
  --radius: 16px;
  --page-width: 1160px;
  --ease: cubic-bezier(.22,.68,0,1.05);
}

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

html {
  min-width: 320px;
  scroll-behavior: smooth;
  scroll-padding-top: 100px;
  background: var(--bg);
  overflow-x: clip;
}

body {
  position: relative;
  min-width: 320px;
  margin: 0;
  overflow-x: clip;
  background:
    radial-gradient(ellipse at 8% 12%, #244b8520, transparent 32%),
    radial-gradient(ellipse at 92% 32%, #8a285020, transparent 30%),
    radial-gradient(ellipse at 48% 75%, #9b791318, transparent 35%),
    var(--bg);
  color: var(--text);
  font: 15px/1.7 'Manrope', sans-serif;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .16;
  background-image:
    linear-gradient(#69789418 1px, transparent 1px),
    linear-gradient(90deg, #69789418 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, #000, transparent 90%);
  animation: grid-drift 24s linear infinite;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .13;
  background: linear-gradient(115deg, transparent 30%, #649cff12 48%, #ff70bd10 52%, transparent 70%);
  background-size: 240% 100%;
  animation: ambient-sweep 18s linear infinite;
}

::selection {
  background: var(--yellow);
  color: #08090c;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color .25s, background .25s, border-color .25s, transform .25s, box-shadow .25s;
}

button, input, textarea {
  font: inherit;
}

button {
  color: inherit;
}

img, canvas, svg, video {
  max-width: 100%;
}

#particles {
  position: fixed !important;
  inset: 0 !important;
  z-index: 0 !important;
  width: 100% !important;
  height: 100% !important;
  pointer-events: none !important;
  opacity: .65;
}

.topbar, main, .footer, footer {
  position: relative;
  z-index: 1;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 76px;
  padding: 12px max(5vw, 24px);
  border-bottom: 1px solid #ffffff12;
  background: #070910d9;
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  animation: topbar-in .8s var(--ease) both;
}

.brand, .logo, .brand-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.brand-mark, .logo-mark, .monogram, #monogram {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border: 1px solid #ffd44780;
  border-radius: 12px;
  background: linear-gradient(145deg, #ffd4471c, #ffd44704);
  color: var(--yellow);
  font: 700 14px 'Space Mono', monospace;
  box-shadow: inset 0 0 20px #ffd44709, 0 0 24px #ffd4470a;
  transition: transform .35s var(--ease), box-shadow .35s;
}

.brand:hover .brand-mark {
  transform: rotate(-7deg) scale(1.06);
  box-shadow: 0 0 25px #ffd44730;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.45;
}

.brand-copy strong {
  font-size: 12px;
  letter-spacing: .12em;
}

.brand-copy small {
  margin-top: 3px;
  color: var(--muted);
  font: 9px 'Space Mono', monospace;
  letter-spacing: .1em;
}

.nav, #nav, .topbar nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.nav a, #nav a, .topbar nav a {
  padding: 9px 13px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #a8b0c0;
  font-size: 12px;
  font-weight: 700;
}

.nav a:hover, #nav a:hover, .topbar nav a:hover {
  transform: translateY(-2px);
  border-color: #649cff45;
  background: #649cff10;
  color: var(--blue);
}

.nav .nav-contact {
  border-color: #ffd44745;
  color: var(--yellow);
}

#menuToggle, .menu-toggle {
  display: none;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  cursor: pointer;
}

main {
  width: min(var(--page-width), calc(100% - 64px));
  margin-inline: auto;
}

section {
  position: relative;
  min-width: 0;
  padding-block: 100px 86px;
  border-bottom: 1px solid #ffffff0c;
  scroll-margin-top: 76px;
}

.section-shell {
  width: 100%;
  max-width: var(--page-width);
  margin-inline: auto;
}

.section-block {
  min-width: 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr);
  align-items: center;
  gap: clamp(32px, 6vw, 84px);
  min-height: min(790px, calc(100svh - 76px));
  padding-block: 100px 90px;
}

.hero::before {
  content: "ARCHIVE SCP / PERSONNEL";
  position: absolute;
  top: 30px;
  left: 0;
  color: #7f899b;
  font: 10px 'Space Mono', monospace;
  letter-spacing: .22em;
}

.hero-copy {
  min-width: 0;
}

.eyebrow, .panel-label, .section-index, .timeline-date, .meta-label {
  color: var(--yellow);
  font: 10px/1.6 'Space Mono', monospace;
  letter-spacing: .13em;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid #ffd44725;
  border-radius: 6px;
  background: #ffd44708;
  animation: fade-up .8s .1s both;
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #9cffad;
  box-shadow: 0 0 12px #9cffad80;
  animation: status-pulse 2s ease-in-out infinite;
}

.hero-kicker {
  margin: 24px 0 12px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .07em;
  animation: fade-up .8s .2s both;
}

.hero h1 {
  margin: 0;
  font: 800 clamp(42px, 6.5vw, 82px)/1.05 Orbitron, sans-serif;
  letter-spacing: -.055em;
  overflow-wrap: anywhere;
  animation: title-in 1s .15s var(--ease) both;
}

.hero h1 span {
  color: var(--blue);
  text-shadow: 0 0 36px #649cff20;
}

.title-cursor {
  color: var(--yellow);
  font-style: normal;
  animation: cursor-blink 1s steps(2, start) infinite;
}

.hero-description {
  max-width: 570px;
  margin: 24px 0 0;
  color: #a8b0c0;
  font-size: 15px;
  line-height: 1.9;
  animation: fade-up .8s .35s both;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
  animation: fade-up .8s .45s both;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  min-height: 46px;
  padding: 11px 18px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 12px;
  font-weight: 800;
  transition: transform .25s var(--ease), box-shadow .25s, background .25s, border-color .25s;
}

.button:hover {
  transform: translateY(-3px);
}

.button-primary {
  border-color: var(--yellow);
  background: var(--yellow);
  color: #11120e;
  box-shadow: 0 7px 24px #ffd44712;
}

.button-primary:hover {
  box-shadow: 0 10px 32px #ffd44735;
}

.button-ghost {
  background: #ffffff04;
  color: var(--text);
}

.button-ghost:hover {
  border-color: var(--blue);
  background: #649cff10;
  color: var(--blue);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 38px;
  margin-top: 38px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  animation: fade-up .8s .55s both;
}

.hero-meta > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hero-meta strong {
  font-size: 13px;
  font-weight: 700;
}

.meta-label {
  color: #727d91;
  font-size: 9px;
}

.hero-visual {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  padding: 25px 0;
  perspective: 1000px;
  animation: visual-in 1s .25s var(--ease) both;
}

.profile-line {
  position: absolute;
  width: 78%;
  height: 78%;
  border: 1px solid #649cff2a;
  border-radius: 50%;
  pointer-events: none;
  animation: orbit 22s linear infinite;
}

.profile-line-top {
  transform: rotate(25deg) scaleX(.7);
}

.profile-line-bottom {
  border-color: #ff70bd24;
  transform: rotate(-40deg) scaleX(.75);
  animation-direction: reverse;
  animation-duration: 29s;
}

.profile-card {
  position: relative;
  z-index: 1;
  width: min(100%, 360px);
  padding: 25px;
  overflow: hidden;
  border: 1px solid #3c4659;
  border-radius: 15px;
  background: linear-gradient(145deg, #141b29f5, #090c13f7);
  box-shadow: 0 25px 80px #0008, 0 0 60px #649cff0a;
  transform-style: preserve-3d;
  transition: transform .4s var(--ease), border-color .4s, box-shadow .4s;
}

.profile-card:hover {
  transform: translateY(-7px) rotateY(-2deg);
  border-color: #649cff80;
  box-shadow: 0 30px 85px #0009, 0 0 35px #649cff14;
}

.profile-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
  color: #9ca7ba;
  font: 9px 'Space Mono', monospace;
  letter-spacing: .1em;
}

.tiny-square {
  width: 8px;
  height: 8px;
  background: var(--yellow);
  box-shadow: 0 0 12px #ffd44760;
  animation: status-pulse 2s infinite;
}

.profile-card .monogram, .profile-card #monogram {
  display: grid;
  width: 100%;
  height: 145px;
  margin-block: 22px;
  border: 1px solid #649cff2b;
  border-radius: 10px;
  background:
    radial-gradient(circle at center, #649cff17, transparent 65%),
    linear-gradient(135deg, #649cff08, #ff70bd08);
  color: var(--blue);
  font: 800 60px Orbitron, sans-serif;
  letter-spacing: -.08em;
  animation: monogram-glow 5s ease-in-out infinite;
}

.profile-name {
  font: 700 17px Orbitron, sans-serif;
  letter-spacing: -.02em;
  overflow-wrap: anywhere;
}

.profile-role {
  margin-top: 6px;
  color: var(--muted);
  font: 9px 'Space Mono', monospace;
  letter-spacing: .06em;
  overflow-wrap: anywhere;
}

.profile-divider {
  height: 1px;
  margin: 22px 0 10px;
  background: linear-gradient(90deg, var(--yellow), var(--blue), transparent);
}

.profile-data {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid #ffffff0b;
  font-size: 10px;
}

.profile-data > span {
  color: #7f899b;
  font: 9px 'Space Mono', monospace;
}

.profile-data b {
  text-align: right;
  font: 700 10px 'Space Mono', monospace;
  overflow-wrap: anywhere;
}

.cyan-text {
  color: var(--blue);
}

.card-corner {
  position: absolute;
  width: 17px;
  height: 17px;
  border-color: var(--yellow);
  border-style: solid;
  opacity: .7;
}

.corner-a {
  top: 8px;
  left: 8px;
  border-width: 1px 0 0 1px;
}

.corner-b {
  right: 8px;
  bottom: 8px;
  border-width: 0 1px 1px 0;
}

.scroll-cue {
  position: absolute;
  bottom: 24px;
  left: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #727d91;
  font: 9px 'Space Mono', monospace;
  letter-spacing: .12em;
}

.scroll-cue span {
  width: 27px;
  height: 1px;
  background: var(--yellow);
  animation: cue-line 1.8s ease-in-out infinite;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 36px;
}

.section-index {
  margin: 0 0 10px;
}

.section-heading h2, .contact-inner h2 {
  margin: 0;
  font: 700 clamp(30px, 4vw, 48px)/1.2 Orbitron, sans-serif;
  letter-spacing: -.045em;
  overflow-wrap: anywhere;
}

.section-heading h2 span, .contact-inner h2 span {
  color: var(--blue);
}

.section-aside {
  max-width: 300px;
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
  text-align: right;
}

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr);
  align-items: stretch;
  gap: 18px;
}

.panel, .project-card, .contact-links > a {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, #111622, #0a0d14);
  box-shadow: 0 14px 38px #0002;
  transition: border-color .3s, background .3s, transform .35s var(--ease), box-shadow .35s;
}

.panel {
  padding: 26px;
}

.panel:hover {
  border-color: #649cff4d;
  box-shadow: 0 18px 45px #0003, 0 0 25px #649cff07;
}

.panel-label {
  display: flex;
  align-items: center;
  gap: 10px;
}

.label-square {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  background: var(--yellow);
  box-shadow: 0 0 10px #ffd44750;
}

.about-main h3, .timeline-item h3 {
  margin: 22px 0 12px;
  font-size: 21px;
  line-height: 1.45;
  font-weight: 800;
}

.about-main p, .panel p, .timeline-item p, .contact-inner > p {
  color: #a1aabb;
  font-size: 13px;
  line-height: 1.9;
}

.facts-list {
  display: flex;
  flex-direction: column;
  margin-top: 18px;
}

.fact-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid #ffffff0e;
}

.fact-row:last-child {
  border-bottom: 0;
}

.fact-row span {
  color: var(--muted);
  font-size: 11px;
}

.fact-row strong {
  max-width: 58%;
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  text-align: right;
  overflow-wrap: anywhere;
}

.timeline {
  position: relative;
  display: grid;
  gap: 0;
  margin-top: 34px;
  padding-left: 26px;
}

.timeline-line {
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 5px;
  width: 1px;
  background: linear-gradient(var(--yellow), var(--blue), var(--pink), transparent);
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  padding: 0 0 30px 20px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-point {
  position: absolute;
  top: 7px;
  left: -25px;
  width: 10px;
  height: 10px;
  border: 2px solid var(--bg);
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 14px #ffd44750;
}

.timeline-date {
  color: var(--blue);
  font-size: 9px;
}

.timeline-item h3 {
  margin: 8px 0;
  font-size: 16px;
}

.timeline-item p {
  max-width: 700px;
  margin: 0;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.project-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 26px;
  overflow: hidden;
  isolation: isolate;
}

.project-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(circle at 100% 0, #649cff12, transparent 45%);
  opacity: 0;
  transition: opacity .35s;
}

.project-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 35%;
  height: 1px;
  background: linear-gradient(90deg, var(--yellow), var(--blue), transparent);
  transition: width .4s var(--ease);
}

.project-card:hover {
  transform: translateY(-5px);
  border-color: #649cff66;
  box-shadow: 0 22px 48px #0004, 0 0 24px #649cff0a;
}

.project-card:hover::before {
  opacity: 1;
}

.project-card:hover::after {
  width: 100%;
}

.project-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin-bottom: 20px;
}

.project-top > span:first-child {
  color: var(--blue);
  font: 9px 'Space Mono', monospace;
  letter-spacing: .12em;
}

.project-number {
  color: #657086;
  font: 11px 'Space Mono', monospace;
}

.project-icon {
  display: grid;
  place-items: center;
  width: 49px;
  height: 49px;
  margin-bottom: 18px;
  border: 1px solid #ffd44735;
  border-radius: 12px;
  background: #ffd4470a;
  color: var(--yellow);
  font: 700 15px 'Space Mono', monospace;
  transition: transform .35s var(--ease), background .35s, color .35s;
}

.project-card:hover .project-icon {
  transform: translateY(-3px) rotate(-4deg);
  background: #ffd44718;
}

.project-card h3 {
  margin: 0 0 10px;
  font-size: 19px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.project-card p {
  flex: 1;
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.9;
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 4px;
  border-bottom: 1px solid #649cff55;
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
}

.project-link:hover {
  gap: 16px;
  border-color: var(--pink);
  color: var(--pink);
}

.skills-panel {
  display: grid;
  grid-template-columns: minmax(200px, .7fr) minmax(0, 1.3fr);
  gap: 38px;
}

.skills-intro p {
  max-width: 270px;
  color: var(--muted);
  font-size: 12px;
}

.skills-list {
  display: grid;
  gap: 22px;
  min-width: 0;
}

.skill {
  min-width: 0;
}

.skill-label {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 700;
}

.skill-label span:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.skill-label span:last-child {
  flex: 0 0 auto;
  color: var(--yellow);
  font: 11px 'Space Mono', monospace;
}

.skill-track {
  height: 6px;
  overflow: hidden;
  border-radius: 99px;
  background: #252b39;
}

.skill-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--pink), var(--yellow));
  box-shadow: 0 0 14px #649cff30;
  transition: width 1.5s cubic-bezier(.16,1,.3,1);
}

.contact-section {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid #ffffff0c;
}

.contact-glow {
  position: absolute;
  top: 0;
  right: -15%;
  width: 60%;
  height: 100%;
  pointer-events: none;
  background: radial-gradient(ellipse, #649cff13, #ff70bd08 35%, transparent 70%);
  animation: glow-breathe 8s ease-in-out infinite alternate;
}

.contact-inner {
  position: relative;
  padding-block: 100px;
}

.contact-inner h2 {
  margin-top: 16px;
  font-size: clamp(36px, 5.5vw, 64px);
}

.contact-inner > p {
  max-width: 620px;
  margin: 22px 0 0;
}

.contact-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 30px;
}

.contact-links > a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 20px;
}

.contact-links > a:hover {
  transform: translateY(-3px);
  border-color: #ff70bd65;
  background: #ff70bd08;
}

.contact-links strong {
  color: var(--text);
  font-size: 13px;
}

.contact-links span {
  color: var(--muted);
  font-size: 11px;
}

.contact-code {
  margin-top: 30px;
  color: #687388;
  font: 9px 'Space Mono', monospace;
  letter-spacing: .08em;
}

.contact-code span {
  color: var(--yellow);
}

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  width: min(var(--page-width), calc(100% - 64px));
  margin-inline: auto;
  padding-block: 28px;
}

.footer p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.back-top {
  color: var(--yellow);
  font: 9px 'Space Mono', monospace;
  letter-spacing: .1em;
}

.back-top:hover {
  transform: translateY(-3px);
  color: var(--pink);
}

/* Scroll reveal: совместимо с текущим script-v2.js */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .75s ease, transform .75s var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}

.reveal.is-visible,
.reveal.visible,
.reveal.revealed,
.reveal.acp-revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Бегущие боковые надписи, если их создаёт JS */
.side-marquee {
  position: fixed;
  top: 50%;
  z-index: 2;
  width: 24px;
  height: min(70vh, 620px);
  overflow: hidden;
  pointer-events: none;
  opacity: .48;
  color: #75829a;
  writing-mode: vertical-rl;
  font: 8px 'Space Mono', monospace;
  letter-spacing: .18em;
}

.side-marquee-left { left: 8px; }
.side-marquee-right { right: 8px; transform: rotate(180deg); }

.side-marquee-track, .side-marquee-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  animation: marquee-flow 24s linear infinite;
}

.side-marquee span {
  white-space: nowrap;
}

@keyframes topbar-in {
  from { opacity: 0; transform: translateY(-14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes title-in {
  from { opacity: 0; transform: translateY(24px); filter: blur(7px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

@keyframes visual-in {
  from { opacity: 0; transform: translateY(18px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes status-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .45; }
}

@keyframes cursor-blink {
  to { opacity: 0; }
}

@keyframes orbit {
  from { rotate: 0deg; }
  to { rotate: 360deg; }
}

@keyframes monogram-glow {
  0%, 100% { text-shadow: 0 0 20px #649cff20; }
  50% { text-shadow: 0 0 38px #649cff55; }
}

@keyframes cue-line {
  0%, 100% { transform: scaleX(.65); transform-origin: left; opacity: .5; }
  50% { transform: scaleX(1); opacity: 1; }
}

@keyframes grid-drift {
  from { background-position: 0 0; }
  to { background-position: 48px 48px; }
}

@keyframes ambient-sweep {
  from { background-position: 100% 0; }
  to { background-position: -140% 0; }
}

@keyframes glow-breathe {
  from { opacity: .55; transform: scale(.9); }
  to { opacity: 1; transform: scale(1.08); }
}

@keyframes marquee-flow {
  from { transform: translateY(0); }
  to { transform: translateY(-50%); }
}

/* Tablets */
@media (max-width: 900px) {
  main {
    width: calc(100% - 44px);
  }

  .topbar {
    padding-inline: 22px;
  }

  .hero {
    grid-template-columns: minmax(0, 1fr) minmax(250px, .8fr);
    gap: 28px;
  }

  .hero h1 {
    font-size: clamp(38px, 6.3vw, 62px);
  }

  .about-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, .9fr);
  }

  .skills-panel {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .skills-intro p {
    max-width: 520px;
  }

  .side-marquee {
    display: none;
  }
}

/* Mobile navigation */
@media (max-width: 680px) {
  html {
    scroll-padding-top: 78px;
  }

  .topbar {
    min-height: 66px;
    gap: 12px;
    padding: 10px 16px;
  }

  .brand {
    gap: 9px;
    letter-spacing: .04em;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .brand-copy strong {
    font-size: 10px;
  }

  .brand-copy small {
    font-size: 8px;
  }

  #menuToggle, .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    min-height: 42px;
    font-size: 19px;
  }

  .nav, #nav, .topbar nav {
    position: absolute;
    top: calc(100% + 1px);
    right: 12px;
    left: 12px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 5px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: #090c14f5;
    box-shadow: 0 20px 45px #0008;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity .2s, visibility .2s, transform .2s;
  }

  .nav.is-open, #nav.is-open, .topbar nav.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .nav a, #nav a, .topbar nav a {
    padding: 12px;
  }

  main {
    width: calc(100% - 32px);
  }

  section {
    padding-block: 70px 60px;
  }

  .hero {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 38px;
    min-height: auto;
    padding-top: 82px;
    padding-bottom: 82px;
  }

  .hero::before {
    top: 24px;
    font-size: 8px;
    letter-spacing: .13em;
  }

  .hero h1 {
    font-size: clamp(38px, 11vw, 62px);
  }

  .hero-kicker {
    font-size: 11px;
  }

  .hero-description {
    font-size: 13px;
  }

  .hero-meta {
    gap: 22px;
  }

  .hero-visual {
    width: 100%;
    padding: 8px 0;
  }

  .profile-line {
    width: 90%;
    height: 88%;
  }

  .profile-card {
    width: min(100%, 360px);
    padding: 20px;
  }

  .profile-card .monogram, .profile-card #monogram {
    height: 120px;
    font-size: 50px;
  }

  .scroll-cue {
    bottom: 20px;
    font-size: 8px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 26px;
  }

  .section-heading h2 {
    font-size: clamp(28px, 8vw, 40px);
  }

  .section-aside {
    margin: 0;
    text-align: left;
  }

  .about-grid, .projects-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  .panel, .project-card {
    padding: 21px;
    border-radius: 13px;
  }

  .about-main h3 {
    font-size: 19px;
  }

  .fact-row {
    gap: 12px;
  }

  .fact-row span, .fact-row strong {
    font-size: 10px;
  }

  .fact-row strong {
    max-width: 60%;
  }

  .timeline {
    padding-left: 22px;
  }

  .timeline-item {
    padding-left: 15px;
  }

  .timeline-point {
    left: -21px;
  }

  .skills-panel {
    padding: 21px;
  }

  .skills-list {
    gap: 20px;
  }

  .contact-inner {
    padding-block: 72px;
  }

  .contact-inner h2 {
    font-size: clamp(34px, 9.5vw, 48px);
  }

  .contact-links {
    grid-template-columns: minmax(0, 1fr);
  }

  .contact-links > a {
    padding: 16px;
  }

  .footer {
    width: calc(100% - 32px);
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
    padding-block: 24px;
  }

  .footer p {
    text-align: left;
  }
}

@media (max-width: 380px) {
  .brand-copy strong {
    font-size: 9px;
  }

  .brand-copy small {
    font-size: 7px;
  }

  .hero h1 {
    font-size: 35px;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .button {
    width: 100%;
  }

  .hero-meta {
    flex-direction: column;
    gap: 14px;
  }

  .profile-card {
    padding: 16px;
  }

  .panel, .project-card, .skills-panel {
    padding: 17px;
  }
}

/* Animation accessibility */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }

  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }
}
