/* =====================================================================
   REDESIGN LAYER
   Loaded after style.css so it wins the cascade over the older rules.
   Everything here is centre-axis only: variety comes from section shape,
   density and rhythm, never from horizontal offset.
   ===================================================================== */

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5,
.hero-title, .nav-brand, .stat-value, .section-index, .pc-title {
  font-family: var(--font-display);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}

.stat-value, .tl-entry-period, .tl-yearcell {
  font-variant-numeric: tabular-nums;
}

/* Emoji must not inherit the webfont or they render as tofu */
.about-emoji, .pc-icon, .project-icon {
  font-family: var(--font-emoji);
}

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

/* ---------- Section rhythm ---------- */
/* Padding, not margin, so a full-bleed band can cover the whole section. */
.about,
.tl-section,
.projects,
.skills,
.contact {
  margin: 0 auto;
  padding-block: var(--section-py);
  padding-inline: var(--gutter);
  width: 100%;
}

.projects {
  padding-block: var(--section-py-loose);
  max-width: none;
}

.skills {
  padding-block: var(--section-py-tight);
}

.about { --section-glow-rgb: var(--accent-rgb); display: block; }
.tl-section { --section-glow-rgb: var(--amber-rgb); }
.projects { --section-glow-rgb: var(--violet-rgb); }
.skills { --section-glow-rgb: var(--accent-rgb); }
.contact { --section-glow-rgb: var(--accent-rgb); }

/* ---------- Section shape: dark well (full-bleed band) ---------- */
/* The mask fades the top and bottom edges, so when GSAP translates the
   section there is no hard seam sliding against the viewport. Banded
   sections carry data-depth="flat" and are never scaled. */
.section--well {
  position: relative;
  isolation: isolate;
}

.section--well::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0;
  margin-inline: calc(50% - 50vw);
  background:
    linear-gradient(180deg, rgba(var(--section-glow-rgb), 0.05) 0%, transparent 60%),
    var(--surface-well);
  border-block: 1px solid var(--border-hairline);
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 9%, #000 91%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0, #000 9%, #000 91%, transparent 100%);
}

/* ---------- Section header ---------- */
.section-head {
  max-width: var(--measure);
  margin: 0 auto var(--sp-8);
  text-align: center;
}

.section-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  margin: 0 0 var(--sp-3);
  font-size: var(--step--2);
  font-weight: 600;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: rgba(var(--section-glow-rgb), 0.9);
}

.section-index {
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
}

.section-index::after {
  content: '';
  display: inline-block;
  width: 28px;
  height: 1px;
  margin-left: var(--sp-3);
  vertical-align: middle;
  background: linear-gradient(90deg, rgba(var(--section-glow-rgb), 0.7), transparent);
}

.section-title {
  font-size: var(--step-4);
  font-weight: 700;
  color: var(--text-strong);
  margin: 0;
}

.section-lede {
  margin: var(--sp-4) auto 0;
  max-width: 52ch;
  font-size: var(--step-1);
  line-height: var(--leading-snug);
  color: var(--text-muted);
}

/* ---------- Button primitive ---------- */
.btn {
  --btn-bg: var(--surface-2);
  --btn-fg: var(--text);
  --btn-bd: var(--border-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 48px;
  padding: 0.85rem 1.6rem;
  border: 1px solid var(--btn-bd);
  border-radius: var(--r-pill);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font: 600 var(--step-0) / 1 var(--font-body);
  letter-spacing: 0.2px;
  text-decoration: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform var(--dur-2) var(--ease-out-quart),
              box-shadow var(--dur-2) ease,
              border-color var(--dur-2) ease,
              background var(--dur-2) ease;
}

/* .contact-form button is (0,1,1), so the plain .btn--primary class would
   lose to it — hence the element qualifier here. */
.btn--primary,
button.btn--primary {
  --btn-bg: var(--grad-accent-fill);
  --btn-fg: var(--accent-ink);
  --btn-bd: transparent;
  background: var(--grad-accent-fill);
  color: var(--accent-ink);
  box-shadow: var(--e-3);
}

.btn--ghost { --btn-bg: transparent; }

.btn:hover { transform: translateY(-2px); box-shadow: var(--e-3), var(--glow-accent); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.btn-arrow { transition: transform var(--dur-2) var(--ease-out-quart); }
.btn:hover .btn-arrow { transform: translateX(4px); }

@media (hover: hover) {
  .btn--primary::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.42) 50%, transparent 65%);
    transform: translateX(-130%);
    transition: transform 0.65s var(--ease-out-expo);
  }
  .btn--primary:hover::after { transform: translateX(130%); }
}

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh;
  min-height: 100svh;
  padding: 7rem var(--gutter) 5rem;
}

.hero-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-5);
  max-width: var(--w-md);
}

.hero-eyebrow {
  margin: 0;
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.hero-eyebrow-dot { color: var(--accent); }

.hero-title {
  font-size: var(--step-6);
  margin: 0;
}

.hero-subtitle {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 0.4em;
  margin: 0;
  font-size: var(--step-2);
  color: var(--text-muted);
}

.hero-lead { color: var(--text-muted); }

/* All roles share one grid cell, so the line never resizes when the text
   swaps — a width change here would fight the Peti/Yeti morph next to it. */
.hero-roles {
  display: inline-grid;
  justify-items: start;
  text-align: left;
  overflow: hidden;
  transition: width var(--dur-3) var(--ease-out-expo);
}

.hero-role {
  grid-area: 1 / 1;
  width: max-content;
  color: var(--accent);
  font-weight: 600;
  opacity: 0;
  transform: translateY(0.35em);
  transition: opacity var(--dur-3) ease, transform var(--dur-3) var(--ease-out-expo);
}

.hero-role.is-active {
  opacity: 1;
  transform: none;
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-4);
  margin-top: var(--sp-2);
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(1.5rem, 5vw, 3.5rem);
  margin: var(--sp-5) 0 0;
}

.stat { padding-inline: var(--sp-4); }
.stat + .stat { border-left: 1px solid var(--border-hairline); }

.stat-value {
  margin: 0;
  font-size: var(--step-5);
  font-weight: 700;
  background: var(--grad-accent);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-label {
  margin: var(--sp-1) 0 0;
  font-size: var(--step--1);
  color: var(--text-dim);
  letter-spacing: 0.04em;
}

.scroll-cue {
  position: absolute;
  bottom: clamp(1.25rem, 4vh, 2.5rem);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  text-decoration: none;
  color: var(--text-dim);
  font-size: var(--step--2);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  transition: opacity var(--dur-3) ease, color var(--dur-2) ease;
}

.scroll-cue:hover { color: var(--accent); }
.scroll-cue.is-hidden { opacity: 0; pointer-events: none; }

.scroll-cue:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--r-xs);
}

.scroll-cue-line {
  position: relative;
  width: 1px;
  height: 28px;
  overflow: hidden;
  background: var(--border-hairline);
}

.scroll-cue-line::after {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 10px;
  background: linear-gradient(180deg, transparent, var(--accent));
  animation: scroll-cue-travel 1.8s var(--ease-in-out) infinite;
}

@keyframes scroll-cue-travel {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(280%); }
}

@media (max-height: 620px) {
  .scroll-cue { display: none; }
}

/* ---------- About ---------- */
/* No backdrop-filter on the big panels. A blurred backdrop on a large
   scrolling element is re-blurred every frame, and what sits behind these is
   a soft aurora wash that the blur barely changes — so it cost real frames
   and bought nothing. The surface colour carries the glass read instead. */
.about-container.about-panel {
  max-width: var(--w-sm);
  margin-inline: auto;
  background: var(--surface-panel);
  border: 1px solid var(--border-hairline);
  border-radius: var(--r-xl);
  box-shadow: var(--e-3);
  padding: clamp(1.75rem, 5vw, 3rem);
  position: relative;
  overflow: hidden;
}

.about-panel::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 160px;
  background: radial-gradient(120% 100% at 50% 0%, rgba(var(--section-glow-rgb), 0.13), transparent 70%);
  pointer-events: none;
}

.about-panel > * { position: relative; }

.about-info-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  justify-content: center;
  background: none;
  border: 0;
  padding: 0;
  width: auto;
}

.about-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.85rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-hairline);
  background: var(--surface-1);
  font-size: var(--step--1);
  color: var(--text-muted);
  white-space: nowrap;
  -webkit-text-fill-color: currentColor;
  background-clip: border-box;
}

.about-chip.about-location {
  color: var(--accent);
  border-color: var(--border-accent);
}

.about-social-icon:focus-visible,
.contact-icon:focus-visible,
.footer-icon:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--r-pill);
}

/* ---------- Projects ---------- */
.projects-featured {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-6);
  max-width: var(--w-xl);
  margin: 0 auto var(--sp-9);
}

.projects-subhead {
  max-width: var(--w-xl);
  margin: 0 auto var(--sp-6);
  font-size: var(--step-2);
  font-weight: 600;
  color: var(--text-muted);
}

.projects-list {
  display: grid;
  gap: var(--sp-5);
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  max-width: var(--w-xl);
  margin-inline: auto;
}

/* Cards are real anchors now: keyboard-focusable and middle-clickable. */
.project-card {
  display: flex;
  flex-direction: column;
  text-align: left;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  background: var(--surface-2);
  border: 1px solid var(--border-hairline);
  border-radius: var(--r-lg);
  box-shadow: var(--e-2);
  overflow: hidden;
  position: relative;
  isolation: isolate;
  min-width: 0;
  max-width: none;
  padding: 0;
  transition: transform var(--dur-3) var(--ease-out-quart),
              box-shadow var(--dur-3) ease,
              border-color var(--dur-3) ease;
}

/* The global user-select rule sets cursor:default on every div/span/p */
.project-card * { cursor: pointer; }

.project-card:hover,
.project-card:focus-visible {
  transform: translateY(-6px);
  border-color: var(--border-accent-hi);
  box-shadow: var(--e-4), var(--glow-accent);
}

.project-card:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring), var(--e-4);
}

/* flex: 0 0 auto is load-bearing. As a stretched flex item the media box
   takes its height from content, so aspect-ratio reserves nothing until the
   lazy image arrives — and the page grows ~650px mid-scroll, landing every
   in-page link short of its section. */
.pc-media {
  margin: 0;
  flex: 0 0 auto;
  width: 100%;
  aspect-ratio: var(--pc-ratio, 16 / 10);
  overflow: hidden;
  background: var(--surface-1);
}

.pc-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
  transition: transform 0.6s var(--ease-out-quart);
}

.project-card:hover .pc-media img { transform: scale(1.045); }

.pc-body {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-5);
}

.pc-kicker {
  margin: 0;
  font-size: var(--step--2);
  font-weight: 600;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: rgba(var(--section-glow-rgb), 0.85);
}

.pc-title {
  margin: 0;
  font-size: var(--step-2);
  font-weight: 600;
  color: var(--text-strong);
}

.pc-desc {
  margin: 0;
  font-size: var(--step--1);
  line-height: var(--leading-snug);
  color: var(--text-muted);
}

.pc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  list-style: none;
  margin: var(--sp-1) 0 0;
  padding: 0;
}

.pc-tags li {
  padding: 0.2rem 0.6rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-hairline);
  background: var(--surface-1);
  font-size: var(--step--2);
  color: var(--text-dim);
}

.pc-cta {
  margin-top: var(--sp-3);
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--accent);
}

.pc-cta span {
  display: inline-block;
  transition: transform var(--dur-2) var(--ease-out-quart);
}

.project-card:hover .pc-cta span { transform: translateX(4px); }

.project-card--compact {
  padding: var(--sp-5);
  gap: var(--sp-2);
}

.pc-icon {
  font-size: 1.9rem;
  line-height: 1;
  margin-bottom: var(--sp-1);
}

.project-card--compact .pc-title { font-size: var(--step-1); }

.project-card--compact .pc-cta {
  margin-top: auto;
  padding-top: var(--sp-3);
}

/* Pointer spotlight — one radial, no repaint of the card contents */
@media (hover: hover) and (pointer: fine) {
  .project-card::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--dur-3) ease;
    background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 50%),
      rgba(var(--accent-rgb), 0.13), transparent 62%);
  }
  .project-card:hover::after { opacity: 1; }
}

@media (min-width: 901px) {
  .projects-featured { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* The lead card spans the full width of a centred container — not an
     offset. Side-by-side rather than a very tall banner. */
  .project-card--featured:first-child {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: stretch;
  }

  .project-card--featured:first-child .pc-media {
    flex: 1 1 58%;
    aspect-ratio: auto;
  }

  .project-card--featured:first-child .pc-body {
    flex: 1 1 42%;
    justify-content: center;
    padding: var(--sp-7);
  }

  .project-card--featured:first-child .pc-title { font-size: var(--step-3); }
  .project-card--featured:first-child .pc-desc { font-size: var(--step-0); }
}

.projects-empty {
  grid-column: 1 / -1;
  color: var(--text-muted);
  font-size: var(--step-0);
}

/* ---------- Skills ---------- */
.skills {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.skills-shell {
  --skills-min-h: auto;
  width: 100%;
  max-width: var(--w-md);
  margin-inline: auto;
  background: var(--surface-panel);
  border: 1px solid var(--border-hairline);
  border-radius: var(--r-xl);
  box-shadow: var(--e-3);
  padding: clamp(1.25rem, 4vw, 2rem);
}

.skills-tabs {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-1);
  margin: 0 auto var(--sp-6);
  padding: var(--sp-1);
  border-radius: var(--r-pill);
  background: var(--surface-1);
  border: 1px solid var(--border-hairline);
  width: fit-content;
}

.skills-tab {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 42px;
  padding: 0 1.1rem;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--text-muted);
  font: 600 var(--step--1) / 1 var(--font-body);
  cursor: pointer;
  transition: color var(--dur-2) ease;
}

.skills-tab:hover { color: var(--text-strong); }
.skills-tab.is-active { color: var(--accent-ink); }
.skills-tab:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.skills-tab-count {
  font-size: var(--step--2);
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}

.skills-tab-indicator {
  position: absolute;
  top: var(--sp-1);
  bottom: var(--sp-1);
  left: 0;
  width: 0;
  border-radius: var(--r-pill);
  background: var(--grad-accent-fill);
  box-shadow: var(--e-2);
  transition: left var(--dur-3) var(--ease-out-expo), width var(--dur-3) var(--ease-out-expo);
  pointer-events: none;
}

/* Locked to the tallest panel so switching tabs never shoves the page down */
.skills-panel {
  min-height: var(--skills-min-h);
  opacity: 0;
  transform: translateY(8px);
}

.skills-panel.is-active {
  opacity: 1;
  transform: none;
  transition: opacity var(--dur-3) ease, transform var(--dur-3) var(--ease-out-expo);
}

.skills-panel[hidden] { display: none; }

/* Flex rather than grid so a short final row stays centred instead of
   leaving an orphan tile hanging on the left. */
.skills .languages-icons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-4);
  max-width: 100%;
  padding: 0;
  margin: 0;
}

.skills .language-icon {
  flex: 0 0 auto;
  width: 148px;
}

/* ---------- Contact ---------- */
.contact-content {
  max-width: var(--w-sm);
  margin-inline: auto;
  gap: var(--sp-7);
}

.contact-copy {
  align-self: center;
  padding: 0.4rem 0.9rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-hairline);
  background: var(--surface-1);
  color: var(--text-dim);
  font: 500 var(--step--1) / 1 var(--font-body);
  cursor: pointer;
  transition: color var(--dur-2) ease, border-color var(--dur-2) ease;
}

.contact-copy:hover { color: var(--accent); border-color: var(--border-accent); }
.contact-copy:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.contact-copy.is-copied {
  color: var(--success);
  border-color: rgba(0, 255, 136, 0.4);
}

.contact-form {
  background: var(--surface-2);
  border: 1px solid var(--border-hairline);
  border-radius: var(--r-lg);
  box-shadow: var(--e-2);
}

.contact-form input:focus-visible,
.contact-form textarea:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* The footer sits directly under the Contact band, with no seam between */
.footer { margin-top: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero { padding: 6rem var(--gutter) 4.5rem; }
}

@media (max-width: 700px) {
  .projects-list { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .project-card--featured { --pc-ratio: 16 / 10; }
  .skills .languages-icons { gap: var(--sp-3); }
  .skills .language-icon { width: calc(33.333% - var(--sp-3)); }
  .skills-tabs { width: 100%; }
  .skills-tab { flex: 1 1 auto; justify-content: center; padding: 0 0.6rem; }
  .section-head { margin-bottom: var(--sp-6); }
}

@media (max-width: 560px) {
  /* Three equal columns rather than a 2 + 1 wrap that orphans the last stat */
  .hero-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-3);
    width: 100%;
  }
  .stat { padding-inline: 0; }
  .stat + .stat { border-left: 0; }
  .stat-value { font-size: var(--step-3); }
  .stat-label { font-size: 0.7rem; letter-spacing: 0; }
  .hero-ctas { width: 100%; flex-direction: column; }
  .hero-ctas .btn { width: 100%; }
  .projects-list { grid-template-columns: 1fr; }
  /* One narrow column makes the panels wildly different heights; a locked
     height would leave a big gap, so let each panel size itself here. */
  .skills-panel { min-height: 0; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .btn,
  .btn-arrow,
  .project-card,
  .pc-media img,
  .pc-cta span,
  .skills-panel,
  .skills-tab-indicator,
  .hero-role {
    transition: none;
  }

  .btn:hover,
  .project-card:hover { transform: none; }

  .btn--primary::after,
  .project-card::after { display: none; }

  .project-card:hover .pc-media img { transform: none; }

  .scroll-cue { display: none; }

  .hero-role { opacity: 0; }
  .hero-role.is-active { opacity: 1; }
}
