/* ============ base ============ */
:root {
  --bg: #0c0b0e;
  --bg-soft: #121116;
  --fg: #e4e2e8;
  --fg-dim: #858192;
  --crimson: #f75049;
  --cyan: #5ef6ff;
  --accent: var(--crimson);
  --border: #221f28;
  --cut: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 16px 100%, 0 calc(100% - 16px));
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
}

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

/* Carousel deck: the page never scrolls, #deck slides between sections. */
html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

#deck {
  transition: transform 0.85s cubic-bezier(0.77, 0, 0.175, 1);
  will-change: transform;
}

body {
  color: var(--fg);
  font-family: var(--mono);
  line-height: 1.6;
  background-color: var(--bg);
  background-image:
    radial-gradient(55% 40% at 50% 0%, rgba(247, 80, 73, 0.07), transparent 70%),
    radial-gradient(120% 85% at 50% 0%, #17141a 0%, var(--bg) 60%);
  background-repeat: no-repeat;
}

/* subtle CRT scanlines overlay */
.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 3px,
    rgba(0, 0, 0, 0.12) 4px
  );
}

::selection { background: #cfcdd6; color: var(--bg); }

/* ============ topbar ============ */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  z-index: 50;
}

.logo { color: var(--fg-dim); font-size: 0.85rem; }

.lang-toggle {
  font-family: var(--mono);
  font-size: 0.8rem;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
  padding: 0.3rem 0.8rem;
  cursor: pointer;
  transition: border-color 0.2s;
}
.lang-toggle:hover { border-color: var(--fg-dim); }

/* ============ section nav (right-side diamonds) ============ */
.section-nav {
  position: fixed;
  right: 1.4rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  z-index: 60;
}

.nav-dot {
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-dot::before {
  content: "";
  width: 9px;
  height: 9px;
  border: 1px solid var(--fg-dim);
  transform: rotate(45deg);
  transition: border-color 0.25s, background 0.25s, box-shadow 0.25s;
}

.nav-dot:hover::before { border-color: var(--crimson); }

.nav-dot.active::before {
  background: var(--crimson);
  border-color: var(--crimson);
  box-shadow: 0 0 12px rgba(247, 80, 73, 0.7);
}

.nav-label {
  position: absolute;
  right: 100%;
  margin-right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-dim);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.nav-dot:hover .nav-label,
.nav-dot.active .nav-label { opacity: 1; }
.nav-dot.active .nav-label { color: var(--crimson); }

/* ============ HUD kit: ghost numbers, corner brackets, slide counter ============ */
[data-num] { position: relative; }
[data-num]::before {
  content: attr(data-num);
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: clamp(10rem, 26vw, 20rem);
  font-weight: 800;
  line-height: 1;
  color: #191622;
  z-index: -1;
  pointer-events: none;
  user-select: none;
}

.skill-block, .statement {
  position: relative;
}
.skill-block::before, .skill-block::after,
.statement::before, .statement::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  pointer-events: none;
}
.skill-block::before, .statement::before {
  top: -1px;
  left: -1px;
  border-top: 1px solid var(--fg-dim);
  border-left: 1px solid var(--fg-dim);
}
.skill-block::after, .statement::after {
  bottom: -1px;
  right: -1px;
  border-bottom: 1px solid var(--fg-dim);
  border-right: 1px solid var(--fg-dim);
}

.slide-counter {
  position: fixed;
  left: 1.5rem;
  bottom: 1.3rem;
  z-index: 60;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: var(--fg-dim);
}
.slide-counter #slide-now { color: var(--accent); }

/* ============ slide entrances ============ */
#deck section > *, #deck footer > * {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
#deck .is-active > * { opacity: 1; transform: none; }
#deck .is-active > *:nth-child(1) { transition-delay: 0.25s; }
#deck .is-active > *:nth-child(2) { transition-delay: 0.35s; }
#deck .is-active > *:nth-child(3) { transition-delay: 0.45s; }
#deck .is-active > *:nth-child(4) { transition-delay: 0.55s; }
#deck .is-active > *:nth-child(5) { transition-delay: 0.65s; }

.cursor-blink { animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.prompt { color: var(--accent); }

/* ============ hero ============ */
.hero {
  min-height: 100svh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 6rem 1.5rem 4rem;
}

.hero-pre {
  color: var(--fg-dim);
  margin-bottom: 0.5rem;
}

.hero-name {
  font-size: clamp(2.8rem, 10vw, 6.5rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
  font-weight: 800;
  color: #fff;
  text-shadow:
    1px 0 0 color-mix(in srgb, var(--cyan) 35%, transparent),
    -1px 0 0 color-mix(in srgb, var(--crimson) 40%, transparent);
}

.hero-tag {
  margin-top: 1.2rem;
  font-size: clamp(1rem, 3vw, 1.3rem);
  color: var(--accent);
  min-height: 1.6em;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chooser-label {
  margin-top: 4rem;
  color: var(--fg-dim);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

/* ============ chooser cards ============ */
.chooser {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 380px));
  gap: 1.5rem;
  justify-content: center;
  margin-top: 1.5rem;
  width: 100%;
  max-width: 900px;
}

/* 3 cards: force a single balanced row on desktop (auto-fit would do 2+1) */
@media (min-width: 768px) {
  .chooser { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.path-card {
  font-family: var(--mono);
  text-align: left;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  clip-path: var(--cut);
  padding: clamp(1.1rem, 2.2vw, 1.8rem);
  cursor: pointer;
  color: var(--fg);
  position: relative;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.path-card:hover, .path-card:focus-visible {
  transform: translateY(-6px);
}
.path-card:hover, .path-card:focus-visible, .path-card.active {
  border-color: #3b3745;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.card-num {
  position: absolute;
  top: 1rem;
  right: 1.2rem;
  color: var(--fg-dim);
  font-size: 0.8rem;
}

.path-card h2 {
  font-size: 1.25rem;
  letter-spacing: 0.05em;
  margin-bottom: 0.6rem;
  padding-right: 2rem; /* keep clear of the absolute card-num */
}
.path-web h2 { color: var(--cyan); }
.path-any h2 { color: var(--crimson); }
.path-hw h2 { color: #fff; }

.path-card p { font-size: 0.88rem; color: var(--fg-dim); }

.card-cta {
  display: inline-block;
  margin-top: 1.2rem;
  font-size: 0.8rem;
  color: var(--fg);
  border-bottom: 1px dashed var(--fg-dim);
}

/* ============ path sections ============ */
.path-section {
  max-width: 1000px;
  margin: 0 auto;
  padding: 5rem 1.5rem;
  min-height: 100svh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-top: 1px dashed var(--border);
}

#section-web { --accent: var(--cyan); }
#section-any { --accent: var(--crimson); }
#section-hw { --accent: var(--cyan); }

.section-tag {
  display: inline-block;
  font-size: 0.75rem;
  letter-spacing: 0.25em;
  color: var(--accent);
  border: 1px solid var(--border);
  padding: 0.25rem 0.7rem;
  margin-bottom: 1rem;
}

.section-head h2 {
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  color: #fff;
  margin-bottom: 0.8rem;
}

.section-head p { color: var(--fg-dim); max-width: 60ch; }

.skill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.2rem;
  margin-top: 2.5rem;
}

/* 4 blocks in the web section: force a balanced 2x2 on wide screens */
@media (min-width: 768px) {
  #section-web .skill-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Translucent so the ghost section number stays visible behind the boxes. */
.skill-block {
  background: color-mix(in srgb, var(--bg-soft) 55%, transparent);
  border: 1px solid var(--border);
  padding: 1.5rem;
}

.skill-block h3 { font-size: 1rem; margin-bottom: 0.8rem; color: #fff; }

.skill-block ul { list-style: none; }
.skill-block li {
  font-size: 0.87rem;
  color: var(--fg-dim);
  padding-left: 1.2em;
  position: relative;
  margin-bottom: 0.4rem;
}
.skill-block li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* ============ chips ============ */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 2rem;
}

.chip {
  font-size: 0.8rem;
  color: var(--fg);
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-soft) 55%, transparent);
  padding: 0.3rem 0.8rem;
  border-radius: 2px;
  transition: border-color 0.2s;
}
.chip:hover { border-color: var(--fg-dim); }
.chip::before {
  content: "▪ ";
  color: var(--accent);
}

/* ============ statement (path: any) ============ */
.statement {
  margin: 2.5rem 0;
  padding: 1.8rem 2rem;
  border-left: 1px solid var(--fg-dim);
  background: color-mix(in srgb, var(--bg-soft) 55%, transparent);
}
.statement p {
  font-size: clamp(1.1rem, 3vw, 1.4rem);
  color: #fff;
}
.statement p + p { margin-top: 0.6rem; color: var(--fg); }

.cta-btn {
  display: inline-block;
  clip-path: var(--cut);
  margin-top: 2.2rem;
  font-family: var(--mono);
  font-size: 0.95rem;
  color: var(--accent);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  padding: 0.8rem 1.6rem;
  text-decoration: none;
  font-weight: 700;
  transition: border-color 0.2s, transform 0.2s;
}
.cta-btn:hover {
  border-color: var(--fg-dim);
  transform: translateY(-2px);
}

/* ============ timeline ============ */
.timeline-section {
  max-width: 1000px;
  margin: 0 auto;
  padding: 4rem 1.5rem;
  min-height: 100svh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-top: 1px dashed var(--border);
}

.timeline {
  list-style: none;
  margin-top: 2rem;
  border-left: 1px solid var(--border);
  padding-left: 1.8rem;
}

.timeline li {
  position: relative;
  padding-bottom: 2.2rem;
}
.timeline li:last-child { padding-bottom: 0; }

.timeline li::before {
  content: "";
  position: absolute;
  left: calc(-1.8rem - 5px);
  top: 0.45em;
  width: 9px;
  height: 9px;
  background: var(--crimson);
  box-shadow: 0 0 10px rgba(247, 80, 73, 0.6);
}

.tl-date {
  font-size: 0.78rem;
  color: var(--fg-dim);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.timeline h3 { color: #fff; font-size: 1.05rem; margin: 0.2rem 0 0.4rem; }
.timeline p { color: var(--fg-dim); font-size: 0.9rem; max-width: 65ch; }

/* ============ contact ============ */
.contact {
  text-align: center;
  padding: 5rem 1.5rem 3rem;
  min-height: 100svh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
}

.contact h2 {
  font-size: clamp(1.8rem, 6vw, 2.8rem);
  color: #fff;
  margin-bottom: 2rem;
}

.contact-links {
  display: flex;
  flex-direction: column;
  width: min(440px, 100%);
  margin-bottom: 3rem;
  border-top: 1px solid var(--border);
}

.contact-links a {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.85rem 0.3rem;
  color: var(--fg);
  text-decoration: none;
  font-size: 0.95rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  transition: color 0.2s, padding-left 0.25s;
}

.contact-links a::after {
  content: "→";
  margin-left: auto;
  color: var(--fg-dim);
  transition: transform 0.25s, color 0.25s;
}

.contact-links a:hover {
  color: #fff;
  padding-left: 0.8rem;
}
.contact-links a:hover::after {
  color: var(--crimson);
  transform: translateX(4px);
}

.contact-meta {
  color: var(--fg-dim);
  font-size: 0.85rem;
  margin-bottom: 1.2rem;
}

.footer-note { color: var(--fg-dim); font-size: 0.8rem; }

/* ============ misc ============ */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

/* ============ mobile: carousel becomes a normal scrolling page ============ */
@media (max-width: 767px) {
  :root { --dock-h: calc(4.1rem + env(safe-area-inset-bottom)); }

  html, body {
    height: auto;
    overflow: auto;
    overscroll-behavior: auto;
  }

  /* the fixed header and bottom dock are not part of the content viewport:
     scroll targets land below the header and above the dock */
  html {
    scroll-padding-top: 4rem;
    scroll-padding-bottom: var(--dock-h);
  }

  /* hero fills the visible area minus the dock, so nothing sits under it */
  .hero {
    min-height: calc(100svh - var(--dock-h));
    min-height: calc(100dvh - var(--dock-h));
    padding-bottom: 2rem;
  }

  #deck { transition: none; transform: none !important; }

  /* no viewport-locked heights: content dictates height, nothing gets clipped */
  .path-section, .timeline-section, .contact {
    min-height: 0;
    padding-top: 4rem;
    padding-bottom: 4rem;
  }

  /* keep the bottom dock from covering the footer content */
  .contact { padding-bottom: calc(4rem + var(--dock-h)); }

  /* entrance gating off: every section is simply visible */
  #deck section > *, #deck footer > * {
    opacity: 1;
    transform: none;
    transition: none;
  }

  /* slide counter is desktop-only; the section nav becomes a bottom dock */
  .slide-counter { display: none; }

  /* 6 dots now: tab-bar splits the width evenly; tight tracking so the
     longest label still fits its 1/6 slot on a 360px-wide screen */
  .section-nav {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    transform: none;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 0;
    height: var(--dock-h);
    padding: 0 0 env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--border);
  }

  /* tab-bar style: label always visible below its dot (hover is not a
     thing on touch, revealing on tap is awkward) */
  .nav-dot {
    flex: 1 1 0;
    min-width: 0;
    flex-direction: column;
    gap: 0.4rem;
    padding: 4px 0;
  }

  .nav-label {
    position: static;
    margin: 0;
    transform: none;
    opacity: 1;
    font-size: 0.52rem;
    letter-spacing: 0.04em;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* long uppercase + wide tracking overflows a 390px screen */
  .chooser-label {
    font-size: 0.75rem;
    letter-spacing: 0.12em;
  }

  [data-num]::before { font-size: 8rem; }
}

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