/* ============ Tokens & base ============ */
:root {
  --bg: #f7f5f2;
  --surface: #fdfbf8;
  --ink: #141311;
  --muted: #6f6a63;
  --line: #e3ded6;
  --accent: #c2410c;
  /* the dark overlays (preloader, hire-me) keep their own palette in both themes */
  --overlay-bg: #141311;
  --overlay-ink: #f7f5f2;
  --font-display: "Bricolage Grotesque", sans-serif;
  --font-body: "Public Sans", sans-serif;
  --nav-h: 72px;
}

html.dark {
  --bg: #0f1214;
  --surface: #16191d;
  --ink: #e8eaec;
  --muted: #969ca3;
  --line: #24292e;
  --accent: #5b9ee8;
  --overlay-bg: #0a0c0e;
  --overlay-ink: #e8eaec;
}
html.dark .nav.scrolled { background: rgba(15, 18, 20, 0.82); }
html.dark .hero-photo-fallback { background: linear-gradient(150deg, #1b1f23 0%, #22272c 60%, #2a3138 100%); }
html.dark .project-info > p:not(.project-url) { color: #b7bdc3; }

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

html { scroll-behavior: smooth; }
html.js { scroll-behavior: auto; } /* GSAP handles smooth scroll when JS is on */

html { color-scheme: light; }
html.dark { color-scheme: dark; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  transition: background 0.4s ease, color 0.4s ease;
}

img { max-width: 100%; display: block; }
ul { list-style: none; }
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

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

/* ============ Custom cursor ============ */
.cursor-dot, .cursor-ring {
  position: fixed;
  top: 0; left: 0;
  z-index: 200;
  pointer-events: none;
  border-radius: 50%;
  opacity: 0;
  visibility: hidden;
}
.cursor-dot { width: 8px; height: 8px; background: var(--accent); }
.cursor-ring { width: 36px; height: 36px; border: 1.5px solid var(--ink); }
.cursor-tag {
  position: fixed;
  top: 0; left: 0;
  z-index: 201;
  pointer-events: none;
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0;
  visibility: hidden;
}
.custom-cursor, .custom-cursor * { cursor: none; }
.overdrive-open .cursor-ring { border-color: var(--overlay-ink); }

/* ============ Hire-me overdrive (easter egg) ============ */
.overdrive {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  background: var(--overlay-bg);
  color: var(--overlay-ink);
  overflow: hidden;
}
.overdrive.open { display: block; }
.od-rows {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-block: 1vh;
  opacity: 0.18;
}
.od-row {
  display: flex;
  width: max-content;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 13vh;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  letter-spacing: -0.02em;
  user-select: none;
}
.od-row:nth-child(even) {
  color: var(--overlay-bg);
  -webkit-text-stroke: 4px var(--overlay-ink);
  paint-order: stroke fill;
}
.od-row .accent { -webkit-text-stroke: 0; }
.od-center {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.4rem;
  text-align: center;
  padding: 1.5rem;
}
.od-kicker {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--accent);
}
.od-title {
  font-family: var(--font-display);
  font-weight: 800;
  /* min() keeps landscape phones from overflowing horizontally */
  font-size: clamp(2.6rem, min(14vw, 16vh), 11rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  max-width: 100%;
}
.od-title .char { display: inline-block; white-space: pre; }
.od-sub { color: #b9b3aa; max-width: 30em; }
.overdrive .od-btn-fill { background: var(--accent); color: var(--overlay-ink); }
.overdrive .od-btn-fill:hover { background: var(--overlay-ink); color: var(--overlay-bg); transform: translateY(-3px); }
.overdrive .od-btn-ghost { border: 1px solid rgba(247, 245, 242, 0.35); color: var(--overlay-ink); }
.overdrive .od-btn-ghost:hover { border-color: var(--overlay-ink); transform: translateY(-3px); }
.od-close {
  position: absolute;
  top: max(clamp(1rem, 3vw, 2rem), env(safe-area-inset-top));
  right: max(clamp(1rem, 3vw, 2rem), env(safe-area-inset-right));
  z-index: 3;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(247, 245, 242, 0.4);
  background: none;
  color: var(--overlay-ink);
  font-size: 1.1rem;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s, background 0.2s;
}
.od-close:hover { border-color: var(--overlay-ink); background: rgba(247, 245, 242, 0.1); transform: rotate(90deg); }
.od-confetti {
  position: fixed;
  z-index: 95;
  width: 10px;
  height: 10px;
  pointer-events: none;
  border-radius: 2px;
}
@media (max-width: 640px) {
  .od-row { font-size: 9vh; opacity: 0.9; }
  .od-rows { opacity: 0.14; }
  .od-center { gap: 1.1rem; padding: 1.25rem; }
  .od-sub { font-size: 0.9rem; }
  .overdrive .contact-actions {
    flex-direction: column;
    align-items: stretch;
    width: min(100%, 320px);
  }
  .overdrive .btn { justify-content: center; }
  .od-btn-fill { font-size: 0.84rem; padding-inline: 1rem; }
}

/* ============ Preloader ============ */
.preloader { display: none; }
.js .preloader {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--overlay-bg);
  color: var(--overlay-ink);
  align-items: center;
  justify-content: center;
}
@media (prefers-reduced-motion: reduce) {
  .js .preloader { display: none; }
}
.preloader-name-wrap { text-align: center; }
.preloader-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2rem, 7vw, 5rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  overflow: hidden;
}
/* char-split helpers (preloader name, overdrive title) */
.word { display: inline-block; white-space: nowrap; }
.char { display: inline-block; }
.preloader-role {
  margin-top: 1rem;
  font-size: 0.8rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: #8f8a82;
}
.preloader-count {
  position: absolute;
  right: clamp(1.5rem, 4vw, 3.5rem);
  bottom: clamp(1rem, 3vw, 2.5rem);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(3rem, 8vw, 6rem);
  color: #8f8a82;
}

/* ============ Nav ============ */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0 clamp(1.25rem, 4vw, 3rem);
  transition: background 0.3s, box-shadow 0.3s;
}
.nav.scrolled {
  background: rgba(247, 245, 242, 0.82);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 var(--line);
}
.nav-logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}
.nav-links { display: flex; gap: clamp(1rem, 3vw, 2.25rem); }
.nav-links a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--ink); }
.nav-icons { display: flex; gap: 0.9rem; }
.nav-icons a,
.nav-icons button {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, transform 0.2s;
}
.nav-icons a:hover,
.nav-icons button:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }
.nav-icons svg { width: 17px; height: 17px; }
.nav-icons .icon-sun { display: none; }
html.dark .nav-icons .icon-sun { display: block; }
html.dark .nav-icons .icon-moon { display: none; }
@media (max-width: 640px) {
  .nav-links { display: none; }
}

/* ============ Hero ============ */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(1rem, 2.2vh, 2rem);
  padding: calc(var(--nav-h) + 0.5rem) clamp(1rem, 4vw, 3rem) 5.5rem;
  overflow: clip;
  text-align: center;
}
/* h1 contributes its two lines as flex items so the photo can sit between them */
.hero-tagline { display: contents; }
.hero-line {
  display: block;
  overflow: hidden;
  padding-block: 0.06em;
  max-width: 100%;
  font-family: var(--font-display);
  font-weight: 800;
  /* ~9.54em line width in Bricolage: 9.4vw spans nearly edge-to-edge, overdrive style */
  font-size: clamp(2.6rem, 9.4vw, 10rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  user-select: none;
}
.hero-line--last { order: 2; }
.hero-line-inner { display: block; }
.hero-line-stroke {
  /* bg-colored fill over the stroke hides Bricolage's inner contour lines: only the outer outline shows */
  color: var(--bg);
  -webkit-text-stroke: 4px var(--ink);
  paint-order: stroke fill;
}
.hero-photo-wrap {
  order: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
}
.hero-photo {
  position: relative;
  width: clamp(180px, min(22vw, 24vh), 290px);
  aspect-ratio: 3 / 4;
  border-radius: 18px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 30px 60px -20px rgba(20, 19, 17, 0.35);
}
.hero-photo img { width: 100%; height: 100%; object-fit: cover; }
/* glare that follows the pointer while tilting */
.hero-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(230px circle at var(--gx, 50%) var(--gy, 50%), rgba(255, 255, 255, 0.38), transparent 62%);
  opacity: 0;
  transition: opacity 0.35s;
  pointer-events: none;
}
.hero-photo.tilting::after { opacity: 1; }
.hero-photo-fallback {
  display: none;
  position: absolute;
  inset: 0;
  place-items: center;
  background: linear-gradient(150deg, #ebe6de 0%, #ddd4c6 60%, #d0c3b0 100%);
}
.hero-photo.no-img img { display: none; }
.hero-photo.no-img .hero-photo-fallback { display: grid; }
.fallback-mono {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 3rem;
  letter-spacing: -0.03em;
  color: var(--accent);
}
.fallback-hint {
  position: absolute;
  bottom: 0.9rem;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.hero-meta {
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
}
.scroll-hint {
  position: absolute;
  bottom: 1.6rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
}
.scroll-hint span {
  display: block;
  width: 1px;
  height: 44px;
  background: var(--muted);
  animation: hint 2s ease-in-out infinite;
  transform-origin: top;
}
@keyframes hint {
  0%   { transform: scaleY(0); transform-origin: top; }
  45%  { transform: scaleY(1); transform-origin: top; }
  55%  { transform: scaleY(1); transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}
@media (prefers-reduced-motion: reduce) {
  .scroll-hint span { animation: none; }
}

/* ============ Sections ============ */
.section {
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(5rem, 12vw, 9rem) clamp(1.25rem, 4vw, 3rem);
}
.section-label {
  font-size: clamp(1rem, 1.6vw, 1.35rem);
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
}

/* ============ About ============ */
.about-text {
  font-size: clamp(1.35rem, 2.8vw, 2.15rem);
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: -0.01em;
  max-width: 20em;
}
.about-text .w { display: inline-block; }

/* ============ Projects ============ */
.projects {
  max-width: 1480px;
  padding-inline: clamp(1rem, 2vw, 1.75rem);
}
.project {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(1.8rem, 3.5vw, 3rem);
  padding-block: clamp(2.5rem, 6vw, 4.5rem);
  max-width: 72%;
  margin-inline: auto;
}
.project + .project { border-top: 1px solid var(--line); }
.project-info { max-width: 46em; }

.project-info { display: flex; flex-direction: column; gap: 0.9rem; }
.project-index {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--muted);
}
.project-info h3 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.7rem, 3.6vw, 2.5rem);
  letter-spacing: -0.02em;
  line-height: 1.05;
}
.project-info h3 a { transition: color 0.2s; }
.project-info h3 a:hover { color: var(--accent); }
.project-info h3 .arrow { font-size: 0.65em; vertical-align: 0.25em; color: var(--accent); }
.project-url {
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.project-info > p:not(.project-url) { color: #4b4740; max-width: 34em; }
.project-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.3rem; }
.project-tags li {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
}

/* ---- Browser mockups ---- */
.mockup {
  --mc: var(--accent);
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 50px -28px rgba(20, 19, 17, 0.28);
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.45s;
}
.project:hover .mockup {
  transform: translateY(-8px) rotate(-0.6deg);
  box-shadow: 0 40px 70px -30px rgba(20, 19, 17, 0.38);
}



/* screenshot card stacks (projects with real images) */
.mockup--stack {
  position: relative;
  aspect-ratio: 16 / 10.5;
  overflow: visible;
  background: none;
  border: none;
  box-shadow: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.stack-card img {
  -webkit-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
}
.stack-card {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 24px 50px -28px rgba(20, 19, 17, 0.28);
  display: grid;
  grid-template: 100% / 100%; /* definite track so the img's % height/max-height resolve */
  place-items: center;
  padding: 1.75%;
}
/* whole screenshot always visible, never cropped */
.stack-card img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  outline: 1px solid var(--line);
}
/* portrait screenshots read as a phone */
.stack-card.is-portrait img {
  height: 100%;
  border-radius: 22px;
  border: 7px solid #1a1817;
  outline: none;
  box-shadow: 0 14px 30px -14px rgba(20, 19, 17, 0.45);
}



/* ============ Skills ============ */
.skills { max-width: none; padding-inline: 0; }
.skills .section-label { padding-inline: clamp(1.25rem, 4vw, 3rem); max-width: 1200px; margin-inline: auto; }
.marquee {
  overflow: hidden;
  border-block: 1px solid var(--line);
  padding-block: 1.1rem;
  background: var(--surface);
}
.marquee-track { display: flex; width: max-content; }
.marquee-group {
  display: flex;
  align-items: center;
  gap: 2.5rem;
  padding-right: 2.5rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.3rem, 3vw, 2.1rem);
  text-transform: uppercase;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.marquee-group i { font-style: normal; font-size: 0.55em; color: var(--accent); }
.skills-grid {
  max-width: 1200px;
  margin: clamp(2.5rem, 6vw, 4rem) auto 0;
  padding-inline: clamp(1.25rem, 4vw, 3rem);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}
.skill-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.5rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  transition: transform 0.3s, border-color 0.3s;
}
.skill-card:hover { transform: translateY(-4px); border-color: var(--accent); }
.skill-num {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--accent);
}
.skill-card h4 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}
.skill-card p { font-size: 0.85rem; color: var(--muted); }

/* ============ Education ============ */
.edu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

/* ============ Contact / Footer ============ */
.contact { text-align: center; }
.contact-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.2rem, 6vw, 4.6rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
  text-transform: uppercase;
}
.contact-title .mask { display: block; overflow: hidden; padding-block: 0.05em; }
.contact-title .mask-inner { display: block; }
.contact-sub {
  margin: 1.6rem auto 2.5rem;
  color: var(--muted);
  max-width: 28em;
}
.contact-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.9rem;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 1.6rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.92rem;
  transition: transform 0.25s, box-shadow 0.25s, background 0.25s, color 0.25s;
}
.btn svg { width: 18px; height: 18px; }
.btn--fill { background: var(--ink); color: var(--bg); }
.btn--fill:hover {
  background: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 14px 28px -12px color-mix(in srgb, var(--accent) 50%, transparent);
}
.btn--ghost { border: 1px solid var(--line); background: var(--surface); }
.btn--ghost:hover { border-color: var(--ink); transform: translateY(-3px); }
.footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem clamp(1.25rem, 4vw, 3rem) 2.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--muted);
}
