/* ============================================================
   Juanito Lansangan — portfolio · "Liwanag"
   The Giant Lantern, rebuilt in code.

   Palette: violet night, aqua lantern glow, magenta ember,
            one accent per product
   Type:    Bricolage Grotesque (display) · Figtree (body)
            Spline Sans Mono (machine voice)
   Motion:  three.js light-field (hero) · GSAP ScrollTrigger scroll
            story · Lenis smooth scroll (fine pointers) ·
            magnetic buttons + cursor (fine pointers)
   Every effect degrades: no JS / no WebGL / reduced motion
   all keep content fully visible.
   ============================================================ */

:root {
  --night:      #0D0A20;
  --night-soft: #14102E;
  --night-deep: #080617;
  --line:       #2A2354;
  --ink:        #EFEDFB;
  --muted:      #A9A2D3;
  --lantern:    #5FE8D2;
  --ember:      #FF7AC2;
  --accent:     var(--lantern);

  --font-display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", sans-serif;
  --font-body:    "Figtree", "Helvetica Neue", Arial, sans-serif;
  --font-mono:    "Spline Sans Mono", "SF Mono", Menlo, Consolas, monospace;

  --ease-out-quint: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out-expo:  cubic-bezier(0.16, 1, 0.3, 1);

  --space-section: clamp(7rem, 16vh, 11rem);
  --gutter: clamp(1.25rem, 5vw, 4rem);
  --measure: 62ch;

  /* z scale: content < sticky header < overlays (progress, cursor) */
  --z-sticky: 40;
  --z-overlay: 60;
  --z-cursor: 80;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
  overflow-x: clip;
}

html.reduce { scroll-behavior: auto; }

body {
  overflow-x: clip;
  background: var(--night);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

main { overflow-x: clip; }

::selection { background: var(--lantern); color: var(--night); }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

p { text-wrap: pretty; }

a { color: inherit; }

img { display: block; max-width: 100%; height: auto; }

.mono {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
}

.glow { color: var(--lantern); }

:focus-visible {
  outline: 2px solid var(--lantern);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: var(--z-overlay);
  padding: 0.6rem 1rem;
  background: var(--lantern);
  color: var(--night);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  text-decoration: none;
  border-radius: 999px;
  transform: translateY(-300%);
  transition: transform 0.3s var(--ease-out-quint);
}
.skip-link:focus-visible { transform: translateY(0); }

/* ---------- custom cursor (added only on fine pointers via JS) ---------- */

.cursor { display: none; }

html.fine-cursor .cursor {
  display: block;
  position: fixed;
  top: 0; left: 0;
  z-index: var(--z-cursor);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}
html.fine-cursor.cursor-live .cursor { opacity: 1; }
html.fine-cursor .cursor-dot,
html.fine-cursor .cursor-ring {
  position: fixed;
  top: 0; left: 0;
  border-radius: 50%;
  translate: -50% -50%;
}
html.fine-cursor .cursor-dot {
  width: 6px; height: 6px;
  background: var(--lantern);
}
html.fine-cursor .cursor-ring {
  width: 34px; height: 34px;
  border: 1px solid color-mix(in srgb, var(--lantern) 55%, transparent);
  transition: width 0.25s var(--ease-out-quint), height 0.25s var(--ease-out-quint),
              border-color 0.25s var(--ease-out-quint);
}
html.fine-cursor .cursor.is-hover .cursor-ring {
  width: 56px; height: 56px;
  border-color: color-mix(in srgb, var(--ember) 70%, transparent);
}
html.fine-cursor { cursor: none; }
html.fine-cursor a, html.fine-cursor button { cursor: none; }

/* ---------- scroll progress ---------- */

.scroll-progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  z-index: var(--z-overlay);
  background: linear-gradient(90deg, var(--lantern), var(--ember));
  transform: scaleX(0);
  transform-origin: left;
  pointer-events: none;
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 0.9rem var(--gutter);
  background: color-mix(in srgb, var(--night) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding-block: 0.5rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
  letter-spacing: -0.01em;
}
.brand em { color: var(--lantern); font-style: normal; }
.brand-star {
  width: 1.05rem; height: 1.05rem;
  fill: var(--lantern);
  transition: rotate 0.6s var(--ease-out-quint);
}
.brand:hover .brand-star { rotate: 72deg; }

.site-nav {
  display: flex;
  gap: clamp(1rem, 2.5vw, 2rem);
  margin-inline: auto;
}
.site-nav a {
  position: relative;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  padding: 0.35rem 0;
  transition: color 0.25s;
}
.site-nav a::after {
  content: "";
  position: absolute;
  left: 0; right: 100%; bottom: 0;
  height: 1.5px;
  background: var(--lantern);
  transition: right 0.35s var(--ease-out-quint);
}
.site-nav a:hover, .site-nav a.active { color: var(--ink); }
.site-nav a:hover::after, .site-nav a.active::after { right: 0; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.8rem 1.7rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: box-shadow 0.35s var(--ease-out-quint), background 0.35s, color 0.35s,
              border-color 0.35s;
  will-change: transform;
}
.btn-primary {
  background: var(--lantern);
  color: var(--night);
}
.btn-primary:hover {
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--lantern) 60%, transparent),
              0 0 34px color-mix(in srgb, var(--lantern) 45%, transparent);
}
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn-ghost:hover {
  border-color: var(--lantern);
  box-shadow: 0 0 24px color-mix(in srgb, var(--lantern) 22%, transparent);
}
.btn-small {
  min-height: 42px;
  padding: 0.5rem 1.15rem;
  font-size: 0.9rem;
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}
.btn-small:hover { border-color: var(--lantern); }

/* ---------- hero ---------- */

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 6rem var(--gutter) 5rem;
  isolation: isolate;
}

#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  opacity: 0;
  transition: opacity 1.2s ease;
}
html.webgl-ok #hero-canvas { opacity: 1; }

/* ambient glow — the whole visual when WebGL is absent, an underlay when it isn't */
.hero-glow {
  position: absolute;
  inset: 0;
  z-index: -3;
  background:
    radial-gradient(55% 42% at 50% 82%,
      color-mix(in srgb, var(--lantern) 11%, transparent), transparent 72%),
    radial-gradient(38% 30% at 72% 88%,
      color-mix(in srgb, var(--ember) 7%, transparent), transparent 75%);
  pointer-events: none;
}

/* soft vignette so hero text stays readable over the scene */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(ellipse 90% 70% at 50% 55%,
              transparent 30%, color-mix(in srgb, var(--night) 78%, transparent) 100%);
  pointer-events: none;
}

.hero-content {
  max-width: 62rem;
  margin-inline: auto;
  text-align: center;
}

.hero-name {
  color: var(--lantern);
  margin-bottom: 1.4rem;
}

.hero h1 {
  font-size: clamp(2.5rem, 6.2vw + 0.6rem, 5.6rem);
  font-weight: 800;
  margin-bottom: 1.6rem;
}
.hero h1 .line { display: block; }
.hero h1 .w { display: inline-block; }

.lede {
  max-width: var(--measure);
  margin-inline: auto;
  font-size: clamp(1.05rem, 1.3vw + 0.6rem, 1.25rem);
  color: var(--muted);
  margin-bottom: 2.2rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  justify-content: center;
  margin-bottom: 2.2rem;
}
.hero-actions.center { justify-content: center; }

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

.scroll-cue {
  position: absolute;
  bottom: 1.4rem;
  left: 50%;
  translate: -50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  letter-spacing: 0.18em;
}
.scroll-cue-line {
  width: 1px;
  height: 42px;
  background: linear-gradient(var(--lantern), transparent);
  animation: cue-drop 2.2s var(--ease-out-quint) infinite;
  transform-origin: top;
}
@keyframes cue-drop {
  0% { transform: scaleY(0); }
  45% { transform: scaleY(1); }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

/* ---------- sections ---------- */

.section { padding: var(--space-section) var(--gutter); }

.section-head {
  max-width: 72rem;
  margin: 0 auto clamp(3.5rem, 8vh, 5.5rem);
}

.section-title {
  font-size: clamp(2.1rem, 4.2vw + 0.5rem, 4rem);
  margin-bottom: 1.2rem;
}

.section-sub {
  max-width: var(--measure);
  color: var(--muted);
  font-size: 1.05rem;
}
.section-sub.center { margin-inline: auto; text-align: center; }

/* ---------- work / showcases ---------- */

.section-work { padding-bottom: calc(var(--space-section) * 0.6); }

.showcases {
  list-style: none;
  max-width: 76rem;
  margin-inline: auto;
}

.showcase {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
  padding-block: clamp(3.5rem, 9vh, 6rem);
}
.showcase:nth-child(even) .showcase-media { order: 2; }
.showcase:nth-child(even) .showcase-body { order: 1; }

.showcase-media {
  position: relative;
}
.showcase-media::before {
  content: "";
  position: absolute;
  inset: -18%;
  background: radial-gradient(closest-side,
              color-mix(in srgb, var(--accent) 20%, transparent), transparent 72%);
  pointer-events: none;
}

.shot {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--line));
  background: var(--night-soft);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.65);
}
.shot img { width: 100%; }

.shot-main { position: relative; z-index: 1; }

.shot-float {
  position: absolute;
  z-index: 2;
  width: 52%;
  bottom: -14%;
  right: -6%;
  box-shadow: 0 30px 70px -18px rgba(0, 0, 0, 0.8);
}
.showcase:nth-child(even) .shot-float { right: auto; left: -6%; }

.showcase-body { max-width: 34rem; }

.showcase-body h3 {
  font-size: clamp(1.7rem, 2.4vw + 0.4rem, 2.4rem);
  margin-bottom: 0.9rem;
}

.showcase-desc {
  color: var(--muted);
  margin-bottom: 1.1rem;
}

.my-part {
  color: var(--ink);
  margin-bottom: 1.3rem;
}

.chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.6rem;
}
.chips li {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--line));
  color: color-mix(in srgb, var(--ink) 88%, var(--accent));
}

.visit-link {
  display: inline-block;
  padding: 0.5rem 0;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  transition: border-color 0.25s, text-shadow 0.25s;
}
.visit-link:hover {
  border-color: var(--accent);
  text-shadow: 0 0 16px color-mix(in srgb, var(--accent) 60%, transparent);
}

/* ---------- experience / timeline ---------- */

.timeline-wrap {
  position: relative;
  max-width: 72rem;
  margin-inline: auto;
}

.timeline { list-style: none; }

.stop {
  position: relative;
  padding-block: 1.6rem;
}

.stop .when { color: var(--lantern); display: block; margin-bottom: 0.4rem; }
.stop h3 { font-size: 1.25rem; margin-bottom: 0.45rem; letter-spacing: -0.01em; }
.stop p { color: var(--muted); max-width: var(--measure); }

/* ---------- about ---------- */

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: clamp(2.5rem, 6vw, 5rem);
  max-width: 72rem;
  margin-inline: auto;
  align-items: start;
}

.about-bio p {
  max-width: var(--measure);
  margin-bottom: 1.4rem;
}
.about-bio p:last-child { margin-bottom: 0; }

.stack-panel {
  padding: 1.8rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--night-soft) 75%, transparent);
}
.stack-label { color: var(--lantern); margin-bottom: 1.1rem; }
.stack-panel .chips { margin-bottom: 0; }
.stack-panel .chips li { border-color: var(--line); color: var(--ink); }

/* ---------- contact ---------- */

.section-contact {
  text-align: center;
  padding-block: calc(var(--space-section) * 1.15);
  position: relative;
  isolation: isolate;
}
.section-contact::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(ellipse 60% 55% at 50% 60%,
              color-mix(in srgb, var(--lantern) 9%, transparent), transparent 75%);
  pointer-events: none;
}

.contact-title {
  font-size: clamp(2.2rem, 5vw + 0.5rem, 4.6rem);
  margin-bottom: 1.4rem;
}

.section-contact .section-sub { margin-bottom: 2.4rem; }
.section-contact .hero-actions { margin-bottom: 2.6rem; }

.contact-links {
  display: flex;
  gap: 2rem;
  justify-content: center;
}
.contact-links a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.6rem 0.2rem;
  transition: color 0.25s, text-shadow 0.25s;
}
.contact-links a:hover {
  color: var(--lantern);
  text-shadow: 0 0 16px color-mix(in srgb, var(--lantern) 55%, transparent);
}

/* copy-email burst stars live here */
.burst-star {
  position: fixed;
  z-index: var(--z-overlay);
  width: 12px; height: 12px;
  pointer-events: none;
  fill: var(--lantern);
}

/* ---------- footer ---------- */

.site-footer {
  padding: 2.2rem var(--gutter) 2.8rem;
  text-align: center;
  color: var(--muted);
  border-top: 1px solid color-mix(in srgb, var(--line) 55%, transparent);
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 940px) {
  .showcase {
    grid-template-columns: 1fr;
    gap: 2.4rem;
    padding-block: clamp(2.6rem, 7vh, 4rem);
  }
  .showcase:nth-child(even) .showcase-media { order: 0; }
  .showcase:nth-child(even) .showcase-body { order: 0; }
  .showcase-media { margin-bottom: 1rem; }
  .shot-float { width: 46%; bottom: -10%; right: 0; }
  .showcase:nth-child(even) .shot-float { left: 0; }
  .showcase-body { max-width: var(--measure); }

  .about-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .site-nav { display: none; }
  .site-header { justify-content: space-between; }

  .hero { padding-top: 5rem; }
  .hero-actions .btn { flex: 1 1 auto; }
}

@media (max-width: 430px) {
  body { font-size: 1rem; }
  .shot, .shot-float { border-radius: 10px; }
  .stack-panel { padding: 1.3rem; }
}

/* touch devices: no floating-shot overlap tricks needed, but keep them —
   they're absolutely positioned and scale fine. Kill hover-only affordances. */
@media (hover: none) {
  .site-nav a::after { display: none; }
}

/* ============================================================
   Reduced motion — static, fully readable presentation
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .scroll-cue-line { animation: none; transform: scaleY(1); }
  .brand-star { transition: none; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
