/* ============================================================
   Sharip Alikhanov — "Uptime"
   Kinetic personal site. Hand-authored, dependency-free.
   Palette avoids AI-default accents; identity lives in the
   heartbeat signature + monospace register + kinetic hero.
   ============================================================ */

:root {
  --ink: #0a0a0f;
  --ink-2: #101017;
  --ink-3: #16161f;
  --bone: #f3efe6;
  --bone-2: #ece7db;
  --dim: #8b8b99;
  --dim-2: #565663;
  --volt: #5646ff;
  --volt-2: #9b90ff;
  --spark: #c9ff3d;
  --line: rgba(243, 239, 230, 0.10);
  --line-2: rgba(243, 239, 230, 0.06);
  --ink-line: rgba(10, 10, 15, 0.12);

  --shell: 1280px;
  --gutter: clamp(20px, 5vw, 64px);

  --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  scroll-behavior: smooth;
  background: var(--ink);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  color: var(--bone);
  background: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
ul { margin: 0; padding: 0; list-style: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: fixed; top: -60px; left: 16px; z-index: 2000;
  padding: 10px 16px; border-radius: 8px;
  background: var(--volt); color: #fff;
  font-family: var(--font-mono); font-size: 13px;
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 16px; }

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

.shell { width: min(100%, var(--shell)); margin-inline: auto; padding-inline: var(--gutter); }

/* ---------------- Masthead ---------------- */
.masthead {
  position: fixed; inset: 0 0 auto; z-index: 1000;
  border-bottom: 1px solid transparent;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease), backdrop-filter 0.3s var(--ease);
}
.masthead[data-scrolled="true"] {
  background: rgba(10, 10, 15, 0.72);
  border-bottom-color: var(--line);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
}
.masthead-inner {
  width: min(100%, var(--shell)); margin-inline: auto;
  padding: 18px var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand-mark { display: inline-flex; color: var(--volt-2); }
.brand-pulse {
  stroke-dasharray: 64; stroke-dashoffset: 0;
}
.brand:hover .brand-pulse { animation: trace 1.1s var(--ease); }
.brand-name {
  font-family: var(--font-mono); font-size: 13px; font-weight: 500;
  letter-spacing: 0.02em; color: var(--bone);
}

.nav { display: flex; gap: 28px; }
.nav a {
  font-family: var(--font-mono); font-size: 13px; color: var(--dim);
  transition: color 0.2s var(--ease);
}
.nav a span { color: var(--volt-2); opacity: 0.5; }
.nav a:hover { color: var(--bone); }

.nav-toggle { display: none; }

.mobile-nav { display: none; }

/* ---------------- Hero ---------------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 140px var(--gutter) 96px;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 82% 8%, rgba(86, 70, 255, 0.16), transparent 46%),
    radial-gradient(90% 70% at 8% 100%, rgba(155, 144, 255, 0.06), transparent 50%),
    var(--ink);
}
.hero-lattice { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
.hero-veil {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(140% 120% at 50% 40%, transparent 40%, rgba(10, 10, 15, 0.55) 100%);
}
.hero-inner { position: relative; z-index: 2; width: min(100%, var(--shell)); margin-inline: auto; }

.status {
  display: inline-flex; align-items: center; gap: 10px;
  margin: 0 0 34px;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.04em;
  color: var(--dim);
}
.status-led {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--spark); box-shadow: 0 0 0 4px rgba(201, 255, 61, 0.12);
  animation: led-pulse 2.4s ease-in-out infinite;
}
.status-text { color: var(--spark); }
.status-sep { color: var(--dim-2); }

.hero-title {
  margin: 0;
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(56px, 11.5vw, 176px);
  line-height: 0.9; letter-spacing: -0.045em;
  color: var(--bone);
}
.hero-title .line { display: block; overflow: hidden; }
.hero-title .line > span { display: block; will-change: transform; }
.hero-title .line-accent > span {
  color: transparent;
  background: linear-gradient(100deg, var(--volt-2) 0%, var(--volt) 60%);
  -webkit-background-clip: text; background-clip: text;
}

.hero-lede {
  max-width: 620px; margin: 34px 0 0;
  font-size: clamp(17px, 1.5vw, 20px); line-height: 1.65;
  color: var(--dim); letter-spacing: -0.01em;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 40px; }

.btn {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 52px; padding: 0 24px; border-radius: 999px;
  font-family: var(--font-mono); font-size: 13px; font-weight: 500;
  border: 1px solid transparent;
  transition: transform 0.25s var(--ease), background 0.25s var(--ease),
              border-color 0.25s var(--ease), color 0.25s var(--ease);
}
.btn:hover { transform: translateY(-2px); }
.btn-solid { background: var(--bone); color: var(--ink); }
.btn-solid:hover { background: #fff; }
.btn-line { color: var(--bone); border-color: var(--line); }
.btn-line:hover { border-color: var(--volt-2); color: #fff; }
.btn-arrow { transition: transform 0.25s var(--ease); }
.btn:hover .btn-arrow { transform: translateX(4px); }

.hero-readout {
  position: relative; z-index: 2;
  width: min(100%, var(--shell)); margin: 64px auto 0;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.16em;
  color: var(--dim-2); text-transform: uppercase;
}
.heartbeat { width: 100%; height: 24px; color: var(--volt-2); overflow: visible; }
.heartbeat-line {
  stroke-dasharray: 620; stroke-dashoffset: 620;
  animation: heartbeat 5s linear infinite;
}

/* ---------------- About (inverted / bone) ---------------- */
.about {
  position: relative;
  padding: clamp(96px, 13vw, 190px) 0;
  color: var(--ink);
  background: var(--bone);
}
.about-title {
  margin: 26px 0 0; max-width: 16ch;
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(34px, 5.4vw, 76px); line-height: 1.03; letter-spacing: -0.04em;
}
.about-body {
  margin-top: 56px; padding-top: 34px;
  border-top: 1px solid var(--ink-line);
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(28px, 5vw, 72px);
  max-width: 980px;
}
.about-body p { margin: 0; max-width: 46ch; color: #46464f; font-size: 16px; line-height: 1.8; }

.marker {
  display: inline-flex; align-items: center; gap: 8px; margin: 0;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.06em;
  color: var(--dim-2); text-transform: lowercase;
}
.marker span { color: var(--volt); }
.marker-dim { color: var(--dim); }
.marker-dim span { color: var(--volt-2); }

/* ---------------- Stack — capability ledger ---------------- */
.stack {
  padding: clamp(96px, 13vw, 190px) 0;
  background:
    radial-gradient(90% 60% at 100% 0%, rgba(86, 70, 255, 0.10), transparent 55%),
    var(--ink);
}
.stack-head { max-width: 900px; margin-bottom: clamp(48px, 7vw, 84px); }
.stack-title {
  margin: 22px 0 0;
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(30px, 4.4vw, 58px); line-height: 1.06; letter-spacing: -0.035em;
  color: var(--bone);
}

.ledger { border-top: 1px solid var(--line); }
.ledger-row {
  display: grid;
  grid-template-columns: 68px minmax(0, 0.9fr) minmax(0, 1.3fr);
  align-items: baseline; gap: 24px;
  padding: clamp(22px, 3vw, 34px) 0;
  border-bottom: 1px solid var(--line);
  transition: background 0.3s var(--ease), padding-left 0.3s var(--ease);
}
.ledger-row:hover {
  background: linear-gradient(90deg, rgba(86, 70, 255, 0.07), transparent 70%);
  padding-left: 16px;
}
.ledger-index { font-family: var(--font-mono); font-size: 12px; color: var(--dim-2); }
.ledger-name {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(22px, 3vw, 34px); letter-spacing: -0.03em; color: var(--bone);
}
.ledger-tools { font-family: var(--font-mono); font-size: 13px; line-height: 1.7; color: var(--dim); }
.ledger-row-open .ledger-name { color: var(--volt-2); }

/* ---------------- Contact ---------------- */
.contact {
  position: relative; overflow: hidden;
  padding: clamp(110px, 15vw, 220px) 0;
  background:
    radial-gradient(80% 80% at 78% 20%, rgba(86, 70, 255, 0.18), transparent 55%),
    #06060a;
}
.contact-kicker {
  margin: 22px 0 0; font-family: var(--font-mono); font-size: 13px; color: var(--volt-2);
}
.contact-title {
  margin: 18px 0 0;
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(48px, 9vw, 132px); line-height: 0.92; letter-spacing: -0.05em;
  color: var(--bone);
}
.contact-mail {
  display: inline-flex; align-items: center; gap: 12px; margin-top: 44px;
  padding-bottom: 8px; border-bottom: 1px solid var(--line);
  font-family: var(--font-mono); font-size: clamp(16px, 2.4vw, 24px); color: var(--bone);
  transition: border-color 0.25s var(--ease), color 0.25s var(--ease);
}
.contact-mail:hover { border-color: var(--volt-2); color: var(--volt-2); }
.contact-mail:hover .btn-arrow { transform: translateX(5px); }

/* ---------------- Footer ---------------- */
.footer { padding: 34px 0 40px; background: #06060a; border-top: 1px solid var(--line-2); }
.footer-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  font-family: var(--font-mono); font-size: 12px; color: var(--dim);
}
.heartbeat-sm { max-width: 160px; opacity: 0.7; }

/* ---------------- Reveal animation ---------------- */
[data-reveal] {
  opacity: 0; transform: translateY(22px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
[data-reveal].is-in { opacity: 1; transform: none; }
.hero-title .line[data-reveal] { transform: none; opacity: 1; }
.hero-title .line[data-reveal] > span { transform: translateY(105%); transition: transform 0.9s var(--ease); }
.hero-title .line[data-reveal].is-in > span { transform: translateY(0); }

/* stagger */
[data-reveal].is-in { transition-delay: var(--delay, 0s); }

/* ---------------- Keyframes ---------------- */
@keyframes heartbeat {
  0% { stroke-dashoffset: 620; }
  100% { stroke-dashoffset: 0; }
}
@keyframes led-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(201, 255, 61, 0.12); }
  50% { box-shadow: 0 0 0 7px rgba(201, 255, 61, 0.02); }
}
@keyframes trace {
  from { stroke-dashoffset: 64; }
  to { stroke-dashoffset: 0; }
}

/* ---------------- Responsive ---------------- */
@media (max-width: 860px) {
  .nav { display: none; }
  .nav-toggle {
    position: relative; display: grid; place-items: center;
    width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 12px;
    background: rgba(243, 239, 230, 0.03);
  }
  .nav-toggle-bar {
    position: absolute; width: 18px; height: 1.5px; background: var(--bone);
    transition: transform 0.25s var(--ease), top 0.25s var(--ease);
  }
  .nav-toggle-bar:nth-child(1) { top: 18px; }
  .nav-toggle-bar:nth-child(2) { top: 25px; }
  .nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { top: 21px; transform: rotate(45deg); }
  .nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { top: 21px; transform: rotate(-45deg); }

  .mobile-nav {
    display: grid; max-height: 0; overflow: hidden;
    background: rgba(10, 10, 15, 0.96);
    border-top: 1px solid transparent;
    transition: max-height 0.3s var(--ease), opacity 0.2s var(--ease), border-color 0.3s var(--ease);
    opacity: 0;
  }
  .mobile-nav.is-open { max-height: 240px; opacity: 1; border-top-color: var(--line); }
  .mobile-nav a {
    padding: 16px var(--gutter); border-bottom: 1px solid var(--line-2);
    font-family: var(--font-mono); font-size: 14px; color: var(--dim);
  }

  .about-body { grid-template-columns: 1fr; gap: 22px; }
  .ledger-row { grid-template-columns: 48px 1fr; row-gap: 8px; }
  .ledger-tools { grid-column: 2; }
}

@media (max-width: 520px) {
  .hero { padding-top: 120px; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .btn { width: 100%; }
  .hero-readout > span:last-child { display: none; }
  .hero-readout { grid-template-columns: auto 1fr; }
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 14px; }
  .heartbeat-sm { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  [data-reveal] { opacity: 1 !important; transform: none !important; }
  .hero-title .line[data-reveal] > span { transform: none !important; }
  .heartbeat-line { stroke-dashoffset: 0 !important; }
}
