/* =====================================================================
   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;
}

.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); }

/* ---------- 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-title {
  font-size: var(--step-6);
  margin: 0;
}

.hero-intro {
  margin: 0;
  max-width: 34rem;
  font-size: var(--step-1);
  line-height: var(--leading-snug);
  color: var(--text-muted);
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: var(--sp-2) var(--sp-3);
  margin: var(--sp-2) 0 0;
  font-size: var(--step-0);
}

.hero-links a {
  color: var(--text-strong);
  text-decoration: underline;
  text-decoration-color: rgba(var(--accent-rgb), 0.45);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
  transition: color var(--dur-2) ease, text-decoration-color var(--dur-2) ease;
}

.hero-links a:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

.hero-links a:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: 4px;
}

.hero-links-sep { color: var(--text-dim); }

/* ---------- 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-meta {
  margin: 0;
  font-size: var(--step--1);
  color: var(--text-dim);
}

.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);
}

/* Wrapping flex rather than grid: a short last row stays centred under the
   full ones instead of hanging off the left edge. */
.projects-list {
  --cols: 3;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-5);
  max-width: var(--w-xl);
  margin-inline: auto;
}

.projects-list > .project-card {
  flex: 0 1 calc((100% - (var(--cols) - 1) * var(--sp-5)) / var(--cols));
}

/* 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); }

/* Featured card without a screenshot yet */
.pc-media--placeholder {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 42%, rgba(var(--accent-rgb), 0.22), transparent 62%),
    linear-gradient(160deg, var(--surface-2), var(--surface-1));
}

.pc-media-icon {
  font-size: 3.6rem;
  line-height: 1;
  transition: transform 0.6s var(--ease-out-quart);
}

.project-card:hover .pc-media-icon { transform: scale(1.08); }

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

/* Same badge as the Journey "Now" marker; kept at its natural width */
.pc-status { align-self: flex-start; }

.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: 701px) and (max-width: 1000px) {
  .projects-featured { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* An odd card out sits centred under the pair, not stranded on the left */
  .projects-featured > .project-card:last-child:nth-child(odd):not(.project-card--headline) {
    grid-column: 1 / -1;
    justify-self: center;
    width: calc((100% - var(--sp-6)) / 2);
  }
}

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

/* Equal-height featured cards: the CTA sits on the bottom edge of each */
.project-card--featured .pc-body { flex: 1; }
.project-card--featured .pc-cta { margin-top: auto; padding-top: var(--sp-3); }

/* Reserved for a future flagship project: add .project-card--headline to the
   first featured card and it spans the full row, image beside text. */
@media (min-width: 901px) {
  .project-card--headline {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: stretch;
  }

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

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

  .project-card--headline .pc-title { font-size: var(--step-3); }
  .project-card--headline .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-list {
  display: grid;
  gap: var(--sp-5);
  width: 100%;
  max-width: var(--w-sm);
  margin: 0 auto;
}

.skills-row {
  display: grid;
  gap: var(--sp-1);
}

.skills-row dt {
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}

.skills-row dd {
  margin: 0;
  font-size: var(--step-1);
  line-height: var(--leading-snug);
  color: var(--text);
}

/* ---------- 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-socials { justify-content: center; }

.contact-note {
  margin: 0;
  font-size: var(--step-0);
  color: var(--text-muted);
}

/* 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 { --cols: 2; }
  .project-card--featured { --pc-ratio: 16 / 10; }
  .section-head { margin-bottom: var(--sp-6); }
}

@media (max-width: 560px) {
  .projects-list { --cols: 1; }
  /* The link row wraps here, and a separator would dangle at a line end */
  .hero-links-sep { display: none; }
  .hero-links { gap: var(--sp-2) var(--sp-5); }
}

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

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

  .project-card::after { display: none; }

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