:root {
  --bg: #0a0e14;
  --bg-alt: #0d131e;
  --surface: #111a29;
  --surface-2: #0d1522;
  --border: #1e2b3d;
  --border-bright: #2a3d54;
  --text: #e7edf5;
  --text-dim: #8fa1b8;
  --text-dimmer: #5c6f85;
  --cyan: #22d3ee;
  --cyan-dim: rgba(34, 211, 238, 0.35);
  --green: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
  --section-max: 1080px;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.5;
  overflow-x: hidden;
}

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

::selection { background: var(--cyan-dim); color: var(--text); }

/* ---------- Boot screen ---------- */
.boot-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 8vw;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
.boot-screen.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-text {
  font-family: var(--mono);
  font-size: clamp(0.85rem, 1.6vw, 1.05rem);
  color: var(--cyan);
  white-space: pre-wrap;
  min-height: 8em;
}
.boot-text .line-dim { color: var(--text-dimmer); }
.boot-text .cursor { display: inline-block; width: 0.55em; background: var(--cyan); animation: blink 1s steps(1) infinite; }
.boot-skip {
  margin-top: 1.5rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-dimmer);
  letter-spacing: 0.05em;
  opacity: 0;
  animation: fadeIn 0.4s ease 1.2s forwards;
}
@keyframes blink { 50% { opacity: 0; } }
@keyframes fadeIn { to { opacity: 1; } }

/* ---------- Grid background ---------- */
.grid-bg {
  position: fixed;
  inset: -10%;
  z-index: 0;
  background-image:
    linear-gradient(rgba(34, 211, 238, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 211, 238, 0.055) 1px, transparent 1px);
  background-size: 42px 42px;
  transition: transform 0.3s ease-out;
  pointer-events: none;
}
.grid-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 45% at 50% 20%, rgba(34,211,238,0.08), transparent 70%);
}

/* ---------- Scroll rail ---------- */
.scroll-rail {
  position: fixed;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  height: 46vh;
  z-index: 40;
  display: none;
  align-items: center;
}
.scroll-rail-track {
  position: relative;
  width: 2px;
  height: 100%;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.scroll-rail-fill {
  position: absolute;
  top: 0; left: 0; width: 100%;
  height: 0%;
  background: linear-gradient(var(--cyan), var(--green));
  box-shadow: 0 0 8px var(--cyan-dim);
  transition: height 0.1s linear;
}
.scroll-rail-nodes {
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 2px; height: 100%;
}
.rail-node {
  position: absolute;
  left: 50%;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border-bright);
  transform: translate(-50%, -50%);
  transition: border-color 0.3s, background 0.3s, box-shadow 0.3s;
}
.rail-node.active {
  border-color: var(--cyan);
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan-dim);
}

/* ---------- Nav ---------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px clamp(20px, 5vw, 56px);
  background: rgba(10, 14, 20, 0.7);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-logo {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--cyan);
  letter-spacing: 0.05em;
}
.nav-links {
  display: flex;
  gap: clamp(16px, 2.5vw, 32px);
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.03em;
}
.nav-links a {
  color: var(--text-dim);
  position: relative;
  padding-bottom: 4px;
  transition: color 0.2s;
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 0; height: 1px;
  background: var(--cyan);
  transition: width 0.25s ease;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); }
.nav-links a:hover::after, .nav-links a.active::after { width: 100%; }
.nav-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--green);
  letter-spacing: 0.05em;
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.nav-toggle { display: none; flex-direction: column; gap: 4px; background: none; border: none; cursor: pointer; padding: 6px; }
.nav-toggle span { width: 20px; height: 2px; background: var(--text); display: block; }

/* ---------- Layout helpers ---------- */
main { position: relative; z-index: 1; }
.section {
  max-width: var(--section-max);
  margin: 0 auto;
  padding: 100px 24px;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.section.is-visible { opacity: 1; transform: translateY(0); }
.section-title {
  display: flex;
  align-items: baseline;
  gap: 14px;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  margin-bottom: 44px;
}
.section-num {
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--cyan);
  border: 1px solid var(--border-bright);
  padding: 3px 9px;
  border-radius: 4px;
}

/* ---------- Landing ---------- */
.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 0 clamp(24px, 6vw, 72px);
  position: relative;
  z-index: 1;
}
.landing-inner { opacity: 0; transform: translateY(16px); transition: opacity 0.8s ease, transform 0.8s ease; }
.landing-inner.is-visible { opacity: 1; transform: translateY(0); }
.landing-eyebrow {
  font-family: var(--mono);
  color: var(--cyan);
  font-size: 0.9rem;
  margin-bottom: 18px;
  letter-spacing: 0.04em;
}
.landing-name {
  font-size: clamp(2.8rem, 8vw, 5.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.02;
  margin-bottom: 24px;
}
.landing-tags { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 26px; }
.tag {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  border: 1px solid var(--border-bright);
  padding: 6px 12px;
  border-radius: 20px;
  background: rgba(34, 211, 238, 0.04);
}
.landing-meta { color: var(--text-dim); font-size: 0.95rem; }
.scroll-cue {
  position: absolute;
  bottom: 40px;
  left: clamp(24px, 6vw, 72px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-dimmer);
  letter-spacing: 0.15em;
}
.scroll-cue-line {
  width: 1px; height: 34px;
  background: linear-gradient(var(--cyan), transparent);
  animation: scrollcue 1.8s ease-in-out infinite;
}
@keyframes scrollcue { 0%,100% { transform: scaleY(1); opacity: 0.8; } 50% { transform: scaleY(0.5); opacity: 0.3; } }

/* ---------- Cards grid / Projects ---------- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  transition: border-color 0.25s, transform 0.25s;
}
.card:hover { border-color: var(--border-bright); transform: translateY(-3px); }
.card-flagship { grid-column: 1 / -1; display: grid; grid-template-columns: 1.3fr 1fr; gap: 32px; }
.card-status {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber);
  border: 1px solid rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.08);
  padding: 3px 9px;
  border-radius: 4px;
  margin-bottom: 14px;
}
.card-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 10px; }
.card-desc { color: var(--text-dim); font-size: 0.92rem; margin-bottom: 18px; }
.card-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.card-tag {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.08);
  border: 1px solid var(--cyan-dim);
  padding: 4px 9px;
  border-radius: 4px;
}
.card-link { font-family: var(--mono); font-size: 0.8rem; color: var(--text-dimmer); }
.card-link-active { display: inline-block; color: var(--cyan); text-decoration: none; transition: opacity 0.2s; }
.card-link-active:hover { opacity: 0.75; text-decoration: underline; }

.card-placeholder {
  border-style: dashed;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-dimmer);
  min-height: 180px;
}
.card-placeholder .card-title { color: var(--text-dimmer); font-size: 1.05rem; }
.card-placeholder .card-desc { margin-bottom: 0; font-size: 0.85rem; }

/* ---------- Gauge widget ---------- */
.gauge-widget {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}
.gauge {
  position: relative;
  width: 200px;
  height: 108px;
  margin-bottom: 10px;
}
.gauge-arc {
  width: 200px;
  height: 100px;
  border-radius: 100px 100px 0 0;
  overflow: hidden;
  background: conic-gradient(from 270deg at 50% 100%,
    var(--green) 0deg, var(--green) 60deg,
    var(--amber) 60deg, var(--amber) 120deg,
    var(--red) 120deg, var(--red) 180deg);
  position: relative;
}
.gauge-arc::after {
  content: "";
  position: absolute;
  left: 50%; bottom: 0;
  width: 156px; height: 78px;
  background: var(--surface-2);
  border-radius: 78px 78px 0 0;
  transform: translateX(-50%);
}
.gauge-needle {
  position: absolute;
  left: 50%; bottom: 8px;
  width: 3px; height: 82px;
  background: var(--text);
  border-radius: 2px;
  transform-origin: bottom center;
  transform: translateX(-50%) rotate(-60deg);
  transition: transform 0.9s cubic-bezier(0.34, 1.2, 0.4, 1), background 0.4s;
  box-shadow: 0 0 8px rgba(255,255,255,0.4);
}
.gauge-pivot {
  position: absolute;
  left: 50%; bottom: 0;
  width: 14px; height: 14px;
  background: var(--text);
  border: 3px solid var(--surface-2);
  border-radius: 50%;
  transform: translate(-50%, 50%);
}
.gauge-status {
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  margin-bottom: 16px;
  transition: color 0.4s;
}
.gauge-status-value { font-weight: 700; }
.gauge-hint { font-family: var(--mono); font-size: 0.65rem; color: var(--text-dimmer); margin-top: 10px; text-align: center; }

/* ---------- Experience ---------- */
.experience-list { display: flex; flex-direction: column; gap: 18px; }
.exp-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--cyan);
  border-radius: 8px;
  padding: 24px 28px;
}
.exp-header { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.exp-title { font-size: 1.1rem; font-weight: 700; }
.exp-org { color: var(--cyan); font-weight: 600; }
.exp-dates { font-family: var(--mono); font-size: 0.78rem; color: var(--text-dimmer); }
.exp-bullets { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.exp-bullets li { color: var(--text-dim); font-size: 0.9rem; padding-left: 18px; position: relative; }
.exp-bullets li::before { content: "»"; position: absolute; left: 0; color: var(--cyan); }

/* ---------- Activity log ---------- */
.activity-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; }
.activity-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px 24px;
}
.activity-group h3 {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--cyan);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.activity-entry { display: flex; gap: 10px; margin-bottom: 14px; font-size: 0.9rem; }
.activity-entry:last-child { margin-bottom: 0; }
.activity-marker { color: var(--text-dimmer); font-family: var(--mono); }
.activity-name { font-weight: 600; color: var(--text); }
.activity-detail { display: block; color: var(--text-dim); font-size: 0.85rem; margin-top: 2px; }
.activity-photos { display: flex; gap: 6px; margin-top: 8px; }
.activity-thumb {
  width: 44px; height: 44px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border-bright);
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
}
.activity-thumb:hover { transform: scale(1.08); border-color: var(--cyan); }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(5, 8, 12, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  cursor: zoom-out;
}
.lightbox.open { opacity: 1; visibility: visible; }
.lightbox-img {
  max-width: min(90vw, 900px);
  max-height: 85vh;
  border-radius: 10px;
  border: 1px solid var(--border-bright);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

/* ---------- About + Skills ---------- */
.about-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; }
.about-bio { color: var(--text-dim); font-size: 1rem; line-height: 1.75; }
.skills-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 26px;
}
.skill-group { margin-bottom: 22px; }
.skill-group:last-child { margin-bottom: 0; }
.skill-group h4 {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-dimmer);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.skill-switch { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 0.9rem; }
.skill-led { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 6px var(--green); flex-shrink: 0; }

/* ---------- Contact ---------- */
.contact-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.contact-link {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  transition: border-color 0.2s, transform 0.2s;
}
.contact-link:hover { border-color: var(--cyan); transform: translateY(-2px); }
.contact-link.disabled { opacity: 0.5; cursor: default; pointer-events: none; }
.contact-label { font-family: var(--mono); font-size: 0.68rem; color: var(--text-dimmer); letter-spacing: 0.06em; text-transform: uppercase; }
.contact-value { font-size: 0.95rem; font-weight: 600; word-break: break-word; }

/* ---------- Footer ---------- */
.footer {
  text-align: center;
  padding: 40px 24px 60px;
  position: relative;
  z-index: 1;
}
.footer-status {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-dimmer);
}
.footer-status .cursor { display: inline-block; width: 0.5em; background: var(--text-dimmer); animation: blink 1s steps(1) infinite; }

/* ---------- Responsive ---------- */
@media (min-width: 900px) { .scroll-rail { display: flex; } }

@media (max-width: 860px) {
  .nav-links { display: none; }
  .nav-status { display: none; }
  .nav-toggle { display: flex; }
  .nav.open .nav-links {
    display: flex;
    position: fixed;
    top: 60px; left: 0; right: 0;
    flex-direction: column;
    background: var(--bg-alt);
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    gap: 16px;
  }
  .card-flagship { grid-template-columns: 1fr; }
  .about-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .section { padding: 72px 20px; }
}
