html { scroll-behavior: smooth; }
body {
  background-color: #FAFAFA;
  color: #0A0A0A;
  font-family: 'Inter', sans-serif;
}
.fade-up {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 600ms ease, transform 600ms ease;
}
.fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Clip-path wipe reveal for screenshots */
.reveal-wipe {
  clip-path: inset(0 100% 0 0);
  transition: clip-path 1000ms cubic-bezier(0.65, 0, 0.35, 1);
}
.reveal-wipe.visible {
  clip-path: inset(0 0 0 0);
}

/* Generic line-draw — used for timelines */
.line-draw-x .line-draw-target {
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 1100ms cubic-bezier(0.4, 0, 0.2, 1);
}
.line-draw-x.visible .line-draw-target {
  transform: scaleX(1);
}
.line-draw-y .line-draw-target {
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 900ms cubic-bezier(0.4, 0, 0.2, 1);
}
.line-draw-y.visible .line-draw-target {
  transform: scaleY(1);
}
.img-hover {
  transition: transform 350ms ease;
}
.img-hover:hover {
  transform: scale(1.03);
}

/* Top nav links */
.top-links {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 50;
  display: flex;
  gap: 12px;
  opacity: 1;
  transition: opacity 400ms ease;
}
.top-links.hidden-scroll {
  opacity: 0;
  pointer-events: none;
}
.top-links a {
  display: inline-block;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: #0A0A0A;
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  text-decoration: none;
  transition: border-color 200ms ease;
}
.top-links a:hover {
  border-color: #0A0A0A;
}

/* Scroll progress dots */
.scroll-dots {
  position: fixed;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.scroll-dots .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #E5E7EB;
  transition: background 300ms ease, transform 300ms ease;
}
.scroll-dots .dot.active {
  background: #0A0A0A;
  transform: scale(1.25);
}

/* Alternating section background */
.section-alt {
  background-color: #EAEAEA;
}

/* Per-project footer tint (data attribute toggled in app.js) */
footer { transition: background-color 320ms ease; }
footer[data-active-project="better-terp"] { background-color: #E8978B; }
footer[data-active-project="flushfm"] { background-color: #DCEBFF; }
footer[data-active-project="seatmate"] { background-color: #EAEAEA; }

/* Footer "Check out my other projects" cards */
.footer-project-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 24px;
  border: 1px solid #E5E7EB;
  border-radius: 16px;
  background: #FFFFFF;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transform: translate(var(--mag-x, 0px), var(--mag-y, 0px));
  transition: transform 280ms ease, box-shadow 280ms ease, border-color 280ms ease, background 280ms ease, color 280ms ease;
}
.footer-project-card:hover {
  transform: translate(var(--mag-x, 0px), calc(var(--mag-y, 0px) - 4px));
  border-color: #0A0A0A;
  box-shadow: 0 14px 32px -12px rgba(10, 37, 64, 0.15);
}
.footer-project-card.current {
  background: #0A0A0A;
  color: #FAFAFA;
  border-color: #0A0A0A;
}
.footer-project-course {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #6B7280;
}
.footer-project-card.current .footer-project-course { color: rgba(255, 255, 255, 0.55); }
.footer-project-name {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.footer-project-tag {
  font-size: 13px;
  color: #6B7280;
}
.footer-project-card.current .footer-project-tag { color: rgba(255, 255, 255, 0.7); }

/* Project switcher tabs */
.project-tabs-band {
  padding-top: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #E5E7EB;
}
.project-tab {
  background: transparent;
  border: 0;
  padding: 6px 2px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  color: #6B7280;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transform: translate(var(--mag-x, 0px), var(--mag-y, 0px));
  transition: color 200ms ease, border-color 200ms ease, transform 240ms ease;
}
.project-tab:hover { color: #0A0A0A; }
.project-tab.active {
  color: #0A0A0A;
  border-bottom-color: #0A0A0A;
}
.project-tab-course {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #6B7280;
  background: #F3F4F6;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
  text-transform: uppercase;
}
.project-tab.active .project-tab-course {
  background: #0A0A0A;
  color: #F3F4F6;
}

@media (max-width: 767px) {
  .scroll-dots { display: none; }
  .top-links { top: 16px; right: 16px; }
  .top-links a { padding: 6px 12px; font-size: 12px; }
}

/* ----------------------------------------------------------------------
   FlushFM section styles (scoped to [data-project="flushfm"] / .flushfm-*)
   Other projects are untouched.
   ---------------------------------------------------------------------- */

[data-project="flushfm"] {
  --flushfm-accent: #1E62D0;
}

/* Full-bleed hero */
.flushfm-hero {
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  min-height: 88vh;
  display: flex;
  align-items: flex-end;
  background: #0A0A0A;
  overflow: hidden;
}
.flushfm-hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.flushfm-hero-tint {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10,10,10,0.05) 0%, rgba(10,10,10,0.45) 100%);
  pointer-events: none;
}
.flushfm-hero-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 100px;
  color: #0A2540;
}
.flushfm-hero-text {
  max-width: 560px;
  margin-left: 64px;
  padding: 20px 0 20px 28px;
  border-left: 3px solid var(--flushfm-accent);
}
@media (max-width: 900px) {
  .flushfm-hero-inner { padding-bottom: 60px; }
  .flushfm-hero-text { margin-left: 0; max-width: 100%; padding-left: 20px; }
}

/* Display type */
.flushfm-display {
  font-size: clamp(40px, 6vw, 88px);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.flushfm-display-md {
  font-size: clamp(28px, 3.4vw, 48px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.015em;
}

/* Dark + blue section variants */
.flushfm-section-dark {
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  background: #0A0A0A;
  color: #FAFAFA;
  overflow: hidden;
}
.flushfm-section-dark > * { position: relative; z-index: 1; }

@keyframes flushfm-blue-drift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.flushfm-section-blue {
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  background: linear-gradient(135deg, #1E62D0 0%, #3A82E6 50%, #1A55BD 100%);
  background-size: 220% 220%;
  animation: flushfm-blue-drift 22s ease-in-out infinite;
  color: #FAFAFA;
}

/* Accent eyebrow */
[data-project="flushfm"] .eyebrow-accent {
  color: var(--flushfm-accent);
}

/* Pull quote bar */
.flushfm-pullquote {
  border-left: 3px solid var(--flushfm-accent);
  padding-left: 24px;
}

/* Numbered step circle */
.flushfm-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--flushfm-accent);
  color: #FAFAFA;
  font-size: 15px;
  font-weight: 600;
  flex-shrink: 0;
  transform: scale(0.55);
  transition: transform 600ms cubic-bezier(0.34, 1.56, 0.64, 1) 220ms;
}
.fade-up.visible .flushfm-step-num { transform: scale(1); }

/* Stage number for evolution */
.flushfm-stage-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--flushfm-accent);
  letter-spacing: 0.08em;
}

/* Red/blue swatch pair */
.flushfm-swatch {
  width: 96px;
  height: 96px;
  border-radius: 999px;
  display: inline-block;
}
.flushfm-swatch--red {
  background: #C8323A;
  animation: flushfm-red-pulse 1.54s ease-out infinite;
}
.flushfm-swatch--blue {
  background: var(--flushfm-accent);
  animation: flushfm-blue-pulse 3.4s ease-in-out infinite;
}
@keyframes flushfm-red-pulse {
  0% {
    box-shadow:
      0 0 0 0 rgba(200, 50, 58, 0.55),
      0 0 0 0 rgba(200, 50, 58, 0.30);
  }
  70%, 100% {
    box-shadow:
      0 0 0 26px rgba(200, 50, 58, 0),
      0 0 0 52px rgba(200, 50, 58, 0);
  }
}
@keyframes flushfm-blue-pulse {
  0%, 100% {
    box-shadow:
      0 0 0 5px rgba(30, 98, 208, 0.32),
      0 0 0 9px rgba(30, 98, 208, 0.14);
  }
  50% {
    box-shadow:
      0 0 0 5px rgba(30, 98, 208, 0.32),
      0 0 0 28px rgba(30, 98, 208, 0.04);
  }
}

/* Green pulse on $5 after counter finishes (§9 reveal) */
@keyframes flushfm-green-pulse {
  0%, 100% {
    text-shadow:
      0 0 0 rgba(74, 222, 128, 0),
      0 0 0 rgba(74, 222, 128, 0);
  }
  50% {
    text-shadow:
      0 0 22px rgba(74, 222, 128, 0.7),
      0 0 44px rgba(74, 222, 128, 0.35);
  }
}
.flushfm-counter.count-complete {
  animation: flushfm-green-pulse 1.8s ease-in-out infinite;
}

/* §4 iteration grid — weighted columns to show fidelity progression */
.flushfm-iteration-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  align-items: start;
}
@media (min-width: 768px) {
  .flushfm-iteration-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .flushfm-iteration-grid { grid-template-columns: 0.78fr 0.98fr 1.15fr 1.4fr; }
}

/* §11 reflection — editorial stacked quote-mark layout */
.flushfm-reflect-stack {
  max-width: 720px;
}
.flushfm-reflect-stack-item {
  position: relative;
  padding: 36px 0 36px 84px;
  border-top: 1px solid rgba(30, 98, 208, 0.18);
}
.flushfm-reflect-stack-item:first-child {
  border-top: 0;
  padding-top: 0;
}
.flushfm-reflect-stack-item::before {
  content: "\201C";
  position: absolute;
  left: 0;
  top: 16px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 96px;
  line-height: 1;
  color: var(--flushfm-accent);
  font-weight: 700;
}
.flushfm-reflect-stack-item:first-child::before { top: -10px; }
.flushfm-reflect-stack-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--flushfm-accent);
  margin-bottom: 14px;
}
.flushfm-reflect-stack-body {
  font-size: 17px;
  line-height: 1.65;
  color: #0A0A0A;
}
@media (max-width: 640px) {
  .flushfm-reflect-stack-item { padding-left: 56px; }
  .flushfm-reflect-stack-item::before { font-size: 72px; top: 12px; }
}

/* Scroll progress bar (fixed at top of viewport, per-project color) */
#scrollProgress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  z-index: 100;
  pointer-events: none;
}
#scrollProgress > span {
  display: block;
  height: 100%;
  width: 0;
  background-color: #0A0A0A;
  transition: width 80ms linear, background-color 320ms ease;
}
body[data-active-project="better-terp"] #scrollProgress > span { background-color: #C8323A; }
body[data-active-project="flushfm"] #scrollProgress > span { background-color: #1E62D0; }
body[data-active-project="seatmate"] #scrollProgress > span { background-color: #0A0A0A; }

/* Reflection card top accent */
.flushfm-reflect-card {
  background: #F3F4F6;
  border-top: 3px solid var(--flushfm-accent);
  border-radius: 0 0 16px 16px;
  padding: 28px;
  transition: transform 320ms ease, box-shadow 320ms ease, background 320ms ease;
}
.flushfm-reflect-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 32px -10px rgba(10, 37, 64, 0.12);
  background: #FFFFFF;
}

/* Generic FlushFM hover lift (apply via class) */
.flushfm-hover-lift {
  transition: transform 320ms ease, box-shadow 320ms ease, border-color 320ms ease;
}
.flushfm-hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 32px -10px rgba(10, 37, 64, 0.12);
}

/* System overview cards */
.flushfm-syscard {
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: transform 320ms ease, box-shadow 320ms ease, border-color 320ms ease;
}
.flushfm-syscard:hover {
  transform: translateY(-6px);
  box-shadow: 0 18px 36px -12px rgba(10, 37, 64, 0.16);
  border-color: var(--flushfm-accent);
}
.flushfm-syscard-tag {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--flushfm-accent);
}

/* Divider in accent */
.flushfm-divider {
  height: 2px;
  width: 64px;
  background: var(--flushfm-accent);
}

/* Word-by-word fade for display beats */
.tw-word {
  display: inline-block;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 380ms ease, transform 380ms ease;
}
.tw-word.tw-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Device-style frame around walkthrough screenshots */
.flushfm-frame {
  background: linear-gradient(180deg, #2A2A2E 0%, #14141A 100%);
  padding: 10px;
  border-radius: 22px;
  box-shadow: 0 18px 45px -12px rgba(0, 0, 0, 0.25), inset 0 0 0 1px rgba(255,255,255,0.04);
  position: relative;
}
.flushfm-frame img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  margin: 0;
}

@media (max-width: 767px) {
  .flushfm-hero { min-height: 72vh; }
  .flushfm-hero-inner { padding: 40px 20px 40px; }
}

/* ----------------------------------------------------------------------
   Better Terp section styles (scoped to [data-project="better-terp"] / .terp-*)
   SeatMate and FlushFM untouched.
   ---------------------------------------------------------------------- */

[data-project="better-terp"] { --terp-accent: #C8323A; }

/* Hero — split layout with warm gradient */
.terp-hero {
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  min-height: 88vh;
  background:
    radial-gradient(120% 100% at 0% 0%, #FFF6F3 0%, transparent 60%),
    linear-gradient(135deg, #FBE9E2 0%, #F8DDD3 50%, #F2C9BC 100%);
  display: flex;
  align-items: center;
  overflow: hidden;
}
.terp-hero-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 80px 24px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 48px;
  align-items: center;
}
@media (min-width: 900px) {
  .terp-hero-inner { grid-template-columns: 1.1fr 1fr; gap: 64px; }
}
.terp-hero-phone {
  transform: rotate(-2deg);
}

/* Cream beat — cursor-tracking soft red glow */
.terp-section-light {
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  background: linear-gradient(180deg, #FFF6F3 0%, #FBE9E2 100%);
  color: #0A0A0A;
  overflow: hidden;
}
.terp-section-light::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(
    45deg,
    transparent 0,
    transparent 22px,
    rgba(200, 50, 58, 0.07) 22px,
    rgba(200, 50, 58, 0.07) 24px
  );
  animation: terp-stripe-drift 22s linear infinite;
}
@keyframes terp-stripe-drift {
  0% { background-position: 0 0; }
  100% { background-position: 64px 64px; }
}
.terp-section-light > * { position: relative; z-index: 1; }

/* Red beat — gradient with slow drift */
@keyframes terp-red-drift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.terp-section-red {
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  background: linear-gradient(135deg, #C8323A 0%, #E2484A 50%, #A22A30 100%);
  background-size: 220% 220%;
  animation: terp-red-drift 22s ease-in-out infinite;
  color: #FFFFFF;
}

/* Display type for beats */
.terp-display {
  font-size: clamp(40px, 6vw, 88px);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.terp-display-md {
  font-size: clamp(28px, 3.4vw, 48px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.015em;
}

/* Stat hook — oversized numerics for §2 */
.terp-stat {
  font-size: clamp(80px, 11vw, 168px);
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: -0.045em;
  color: var(--terp-accent);
  display: block;
}

/* Iteration timeline (§7) */
.terp-timeline {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}
.terp-timeline-line {
  position: absolute;
  top: 8px;
  left: 10%;
  right: 10%;
  height: 2px;
  background: var(--terp-accent);
  z-index: 0;
  transform-origin: left center;
}
.terp-timeline-dot {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--terp-accent);
  position: relative;
  z-index: 1;
  margin: 0 auto 24px;
  transform: scale(0.5);
  transition: transform 600ms cubic-bezier(0.34, 1.56, 0.64, 1) 200ms;
  box-shadow: 0 0 0 6px #FAFAFA;
}
.fade-up.visible .terp-timeline-dot { transform: scale(1); }
.section-alt .terp-timeline-dot { box-shadow: 0 0 0 6px #EAEAEA; }

/* Decisions — big red numerals (§8) */
.terp-decision {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 32px;
  align-items: start;
  padding: 36px 0;
  border-bottom: 1px solid #E5E7EB;
}
.terp-decision:last-child { border-bottom: 0; }
.terp-decision-num {
  font-size: clamp(56px, 7vw, 104px);
  font-weight: 700;
  line-height: 0.85;
  color: var(--terp-accent);
  letter-spacing: -0.04em;
}

/* Reflection — vertical timeline (§11) */
.terp-reflect-list {
  position: relative;
  padding-left: 0;
}
.terp-reflect-line {
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 2px;
  background: var(--terp-accent);
  transform-origin: top;
}
.terp-reflect-row {
  position: relative;
  padding: 8px 0 28px 36px;
}
.terp-reflect-row:last-child { padding-bottom: 8px; }
.terp-reflect-row::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 14px;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--terp-accent);
  z-index: 1;
  transform: scale(0);
  transition: transform 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.terp-reflect-row.fade-up.visible::before { transform: scale(1); }

/* Phone frame — slightly different shadow from FlushFM */
.terp-frame {
  background: linear-gradient(180deg, #2B2024 0%, #1A1418 100%);
  padding: 10px;
  border-radius: 30px;
  box-shadow: 0 22px 50px -14px rgba(120, 30, 35, 0.22), inset 0 0 0 1px rgba(255,255,255,0.05);
}
.terp-frame img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 22px;
  margin: 0;
}

/* Final outcome — sticky-scroll storytelling (§10) */
.terp-final-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 48px;
}
@media (min-width: 900px) {
  .terp-final-grid {
    grid-template-columns: 1fr 1.3fr;
    gap: 96px;
    align-items: start;
  }
  .terp-final-sticky {
    position: sticky;
    top: 96px;
  }
}
.terp-final-scroll {
  display: flex;
  flex-direction: column;
  gap: 40px;
  background-color: #FBE9E2;
  border-radius: 28px;
  padding: 20px 32px 72px;
}
.terp-final-screen {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 360px;
  margin: 0 auto;
}
.terp-final-info {
  position: relative;
  background: #FFFFFF;
  border: 2px solid var(--terp-accent);
  border-radius: 16px;
  padding: 18px 20px;
}
.terp-screen-num {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--terp-accent);
}
@media (max-width: 899px) {
  .terp-final-screen { max-width: 100%; }
  .terp-final-scroll { gap: 28px; padding: 16px 20px 48px; border-radius: 20px; }
}

/* Generic Terp hover lift */
.terp-hover-lift {
  transition: transform 320ms ease, box-shadow 320ms ease, border-color 320ms ease;
}
.terp-hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 32px -10px rgba(120, 30, 35, 0.14);
  border-color: var(--terp-accent);
}

/* Accent helpers */
[data-project="better-terp"] .eyebrow-accent { color: var(--terp-accent); }
.terp-divider { height: 2px; width: 64px; background: var(--terp-accent); margin: 0 auto; }

/* Research themes (§4) — equal height cards with red outline */
.terp-theme-card {
  background: #FFFFFF;
  border: 2px solid var(--terp-accent);
  border-radius: 16px;
  padding: 28px;
  height: 100%;
}

@media (max-width: 767px) {
  .terp-hero { min-height: 72vh; }
  .terp-hero-inner { padding: 48px 20px; }
  .terp-timeline { grid-template-columns: 1fr; }
  .terp-timeline::before { display: none; }
  .terp-decision { grid-template-columns: 1fr; gap: 12px; }
  .terp-decision-num { font-size: 56px; }
  .terp-stat { font-size: 80px; }
}
