/* ===========================
   Reset & Base
   =========================== */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.65;
  color: var(--color-text);
  background-color: var(--color-bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv02', 'cv03', 'cv04';
  cursor: none;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; cursor: none; }
button { cursor: none; }
ul { list-style: none; }
mark { background: none; color: inherit; }

@media (hover: none) and (pointer: coarse) {
  body, a, button { cursor: auto; }
}

/* ===========================
   Design Tokens
   =========================== */

:root {
  --type-scale:      0.75;
  --color-bg:         #ffffff;
  --color-bg-warm:    #f8f8f8;
  --color-bg-card:    #ffffff;
  --color-text:       #201f1d;
  --color-accent:     #f2a49a;
  --color-green:      #b8e0b8;
  --color-link:       #0099ff;
  --color-border:     #201f1d33;
  --color-text-muted: #201f1daa;

  --font-body:        'Inter', system-ui, -apple-system, sans-serif;
  --font-display:     'Manrope', var(--font-body);
  --font-handwritten: 'Just Me Again Down Here', cursive;
  --font-hero-name:   'Playfair Display', Georgia, serif;

  /* Type scale */
  --text-xs:    calc(0.875rem * var(--type-scale));
  --text-sm:    calc(1rem * var(--type-scale));
  --text-base:  calc(1.0625rem * var(--type-scale));
  --text-lg:    calc(1.25rem * var(--type-scale));
  --text-xl:    calc(1.5rem * var(--type-scale));
  --text-2xl:   calc(2rem * var(--type-scale));
  --text-3xl:   calc(2.5rem * var(--type-scale));
  --text-4xl:   calc(3.5rem * var(--type-scale));
  --text-hero:  clamp(
    calc(3rem * var(--type-scale)),
    calc(7vw * var(--type-scale)),
    calc(5.5rem * var(--type-scale))
  );

  --space-xs:   8px;
  --space-sm:   16px;
  --space-md:   24px;
  --space-lg:   40px;
  --space-xl:   80px;
  --space-2xl:  120px;

  --max-width:       1200px;
  --content-padding: 16px;

  --ease-out:  cubic-bezier(0.16, 1, 0.3, 1);
  --duration:  0.6s;
}

@media (max-width: 767px) {
  :root {
    --text-xs:   calc(0.78rem * var(--type-scale));
    --text-sm:   calc(0.9rem * var(--type-scale));
    --text-base: calc(0.96rem * var(--type-scale));
    --text-lg:   calc(1.06rem * var(--type-scale));
    --text-xl:   calc(1.25rem * var(--type-scale));
    --text-2xl:  calc(1.65rem * var(--type-scale));
    --text-3xl:  calc(2rem * var(--type-scale));
    --text-4xl:  calc(2.75rem * var(--type-scale));
    --text-hero: clamp(
      calc(2.45rem * var(--type-scale)),
      calc(8.5vw * var(--type-scale)),
      calc(4.15rem * var(--type-scale))
    );
  }
}

@media (min-width: 768px)  { :root { --content-padding: 32px; } }
@media (min-width: 1024px) { :root { --content-padding: 40px; } }

/* ===========================
   Custom Cursor
   =========================== */

.cursor {
  position: fixed;
  top: 0; left: 0;
  width: 12px; height: 12px;
  background: var(--color-text);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: width 0.3s var(--ease-out), height 0.3s var(--ease-out),
              background 0.3s ease, opacity 0.3s ease;
  mix-blend-mode: difference;
  opacity: 0;
}

.cursor.is-visible { opacity: 1; }

.cursor.cursor--hover {
  width: 56px; height: 56px;
  background: #ffffff;
}

@media (hover: none) and (pointer: coarse) {
  .cursor { display: none; }
}

/* ===========================
   Grain Overlay
   =========================== */

.grain {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 998;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* ===========================
   Background Decorative Layer
   =========================== */

.bg-deco {
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none; overflow: hidden;
}
.bg-deco svg { width: 100%; height: 100%; }

/* ===========================
   Shared Utilities
   =========================== */

.section-label {
  display: block;
  font-family: var(--font-display);
  font-size: calc(2.5rem * var(--type-scale));
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.highlight {
  background: var(--color-accent);
  padding: 2px 6px;
  border-radius: 3px;
}

.highlight--question {
  display: inline;
  background: transparent;
  color: inherit;
  border: 1.5px solid var(--color-accent);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  padding: 2px 8px;
  border-radius: 6px;
}

/* ===========================
   Decorative Elements
   =========================== */

.deco-circle--hero {
  position: absolute; right: 5%; top: 20%;
  width: 120px; height: 120px;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  opacity: 0.15; pointer-events: none;
  animation: decoFloat 8s ease-in-out infinite;
}

.deco-plus--about {
  position: absolute; left: 8%; bottom: 15%;
  width: 30px; height: 30px;
  opacity: 0.12; pointer-events: none;
}
.deco-plus--about::before, .deco-plus--about::after {
  content: ''; position: absolute; background: var(--color-text);
}
.deco-plus--about::before { width: 1px; height: 100%; left: 50%; top: 0; }
.deco-plus--about::after  { width: 100%; height: 1px; top: 50%; left: 0; }

.deco-line--skills {
  position: absolute; right: 10%; top: 10%;
  width: 80px; height: 1px;
  background: var(--color-text);
  opacity: 0.1; transform: rotate(45deg);
  pointer-events: none;
}

@keyframes decoFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-15px) rotate(5deg); }
}

/* ===========================
   Scroll Animations
   =========================== */

[data-animate] {
  opacity: 0; transform: translateY(20px);
  transition: opacity var(--duration) var(--ease-out),
              transform var(--duration) var(--ease-out);
}
[data-animate].is-visible { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  [data-animate] { opacity: 1; transform: none; transition: none; }
  .deco-circle--hero { animation: none; }
  .marquee__track { animation: none !important; }
}

/* ===========================
   Header
   =========================== */

.header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease;
}

.header__nav-mobile { display: none; }

.header__inner {
  max-width: var(--max-width); margin: 0 auto;
  padding: 0 var(--content-padding);
  height: 72px;
  display: flex; align-items: center; justify-content: center;
  position: relative; gap: 48px;
}

.header__logo {
  font-family: var(--font-handwritten);
  font-size: calc(3.2rem * var(--type-scale)); font-weight: 400;
  letter-spacing: 0.01em;
  white-space: nowrap; flex-shrink: 0;
}

.header__nav { display: flex; }
.header__nav-list { display: flex; gap: 28px; }

.header__nav-link {
  font-family: var(--font-body);
  font-size: calc(1.5rem * var(--type-scale)); font-weight: 400;
  letter-spacing: 0.03em; position: relative;
  color: var(--color-text-muted);
  transition: color 0.3s ease;
}
.header__nav-link:hover { color: var(--color-text); }


.header__burger {
  display: none; flex-direction: column; justify-content: center;
  gap: 5px; width: 40px; height: 40px;
  background: none; border: none; padding: 8px;
}
.header__burger span {
  display: block; width: 100%; height: 1.5px;
  background: var(--color-text);
  transition: transform 0.3s ease, opacity 0.3s ease;
  transform-origin: center;
}
.header__burger.is-active span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.header__burger.is-active span:nth-child(2) { opacity: 0; }
.header__burger.is-active span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

@media (max-width: 767px) {
  .header__inner { justify-content: space-between; gap: 0; }
  .header__logo { font-size: calc(2.7rem * var(--type-scale)); }
  .header__burger { display: flex; }
  .header__nav { display: none; }
  .header__nav-mobile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 72px;
    left: 0;
    right: 0;
    bottom: 0;
    min-height: calc(100dvh - 72px);
    padding: 0 var(--content-padding) 24px;
    background: var(--color-bg);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-12px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    overflow-y: auto;
  }
  .header__nav-mobile.is-open {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
  }
  .header__nav-mobile .header__nav-list {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(28px, 8vw, 52px);
    width: min(100%, 520px);
    transform: translateY(-56px);
  }
  .header__nav-mobile .header__nav-link {
    font-size: clamp(
      calc(1.85rem * var(--type-scale)),
      calc(9vw * var(--type-scale)),
      calc(2.75rem * var(--type-scale))
    );
    font-family: var(--font-display); font-weight: 700;
    color: var(--color-text); letter-spacing: -0.02em;
    line-height: 1;
    transition: opacity 0.15s ease;
  }
  .header__nav-mobile .header__nav-link:hover { opacity: 0.4; }
}

/* ===========================
   Hero
   =========================== */

.hero {
  min-height: 90vh;
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-2xl) var(--content-padding);
  padding-top: calc(var(--space-2xl) + 72px);
  position: relative; overflow: hidden;
  margin-bottom: 4rem;
  margin-top: 4rem;
}

.hero__inner {
  max-width: var(--max-width); width: 100%;
  text-align: center;
  display: flex; flex-direction: column; align-items: center;
  gap: var(--space-md);
  padding-bottom: 200px;
  position: relative;
  z-index: 1;
  margin-inline: auto;
}

.hero__badge-row {
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: center;
  animation: heroFadeIn 0.8s var(--ease-out) 0.1s both;
}

.hero__label {
  display: inline-block; font-family: var(--font-body);
  font-size: var(--text-xs); font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase;
  background: var(--color-accent);
  padding: 6px 16px; border-radius: 100px;
}
.hero__label--green { background: var(--color-green); }

.hero__title {
  font-family: var(--font-display);
  font-size: var(--text-hero); font-weight: 800;
  line-height: 1.0; letter-spacing: -0.04em;
  text-wrap: balance;
  animation: heroFadeIn 0.8s var(--ease-out) 0.25s both;
}

.hero__tagline {
  font-size: var(--text-xl); color: var(--color-text-muted);
  max-width: 640px; text-wrap: balance;
  animation: heroFadeIn 0.8s var(--ease-out) 0.4s both;
}

.hero__stats {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 48px; margin-top: var(--space-sm);
  animation: heroFadeIn 0.8s var(--ease-out) 0.55s both;
}
.hero__stat { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.hero__stat-number {
  font-family: var(--font-display);
  font-size: var(--text-2xl); font-weight: 700;
  letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
}
.hero__stat-label {
  font-size: var(--text-xs); text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--color-text-muted);
}

.hero__handwritten {
  font-family: var(--font-handwritten);
  font-size: calc(2.5rem * var(--type-scale)); color: var(--color-text-muted);
  transform: rotate(-3deg);
  animation: heroFadeIn 0.8s var(--ease-out) 0.65s both;
}

.hero__bottom {
  position: absolute;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  z-index: 1;
}

.deco-circle--hero {
  z-index: 1;
}

/* Hero doodles */
.hero-doodles {
  position: absolute; inset: 0;
  pointer-events: none; z-index: 0;
}
.hero-doodle {
  position: absolute;
  width: 150px; height: 150px;
  opacity: 0.82;
}

/* Scattered positions — left/right flanks + top/bottom clear of center text column */
/* Text column is roughly center 600px, so left flank < 18% and right flank > 82%,
   plus top corner and bottom corner where no text sits */
.hero-doodle--1 { top: 5%;   left: 3%;   transform: rotate(-6deg); }
.hero-doodle--2 { top: 3%;   right: 5%;  transform: rotate(5deg); }
.hero-doodle--3 { top: 38%;  left: 5%;   transform: rotate(-3deg); }
.hero-doodle--4 { top: 35%;  right: 4%;  transform: rotate(8deg); }
.hero-doodle--5 { bottom: 12%; left: 4%; transform: rotate(4deg); }
.hero-doodle--6 { bottom: 10%; right: 3%; transform: rotate(-7deg); }
@media (max-width: 1100px) {
  .hero-doodle { width: 110px; height: 110px; opacity: 0.7; }
  .hero-doodle--3, .hero-doodle--4 { display: none; }
}
@media (max-width: 767px) {
  .hero-doodles { display: none; }
}

.hero__scroll {
  animation: heroFadeIn 0.8s var(--ease-out) 0.75s both;
}
.hero__scroll-line {
  width: 1px; height: 60px;
  background: var(--color-border);
  position: relative; overflow: hidden;
}
.hero__scroll-line::after {
  content: ''; position: absolute; top: -60px; left: 0;
  width: 1px; height: 60px; background: var(--color-text);
  animation: scrollLine 2s ease-in-out infinite;
}

@keyframes heroFadeIn {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes scrollLine {
  0%   { transform: translateY(0); }
  100% { transform: translateY(120px); }
}

@media (max-width: 767px) {
  .hero {
    min-height: auto;
    align-items: flex-start;
    margin-top: 0;
    margin-bottom: 2rem;
    padding-top: calc(72px + 38px);
    padding-bottom: 86px;
    margin-top: 4rem;

  }
  .hero__inner {
    gap: 20px;
    padding-bottom: 104px;
  }
  .hero__badge-row { gap: 10px; }
  .hero__label {
    font-size: 0.74rem;
    padding: 5px 13px;
  }
  .hero__title { font-size: clamp(2.35rem, 10.8vw, 3.7rem); }
  .hero__tagline {
    font-size: 0.98rem;
  }
  .hero__handwritten {
    display: inline-block;
    font-size: clamp(1.5rem, 6vw, 1.8rem);
    text-align: center;
    white-space: nowrap;
    max-width: calc(100vw - 32px);
  }
  .hero__bottom {
    bottom: 34px;
    gap: 10px;
    width: 100%;
    padding-inline: 16px;
  }
  .hero__scroll { display: flex; justify-content: center; width: 100%; }
  .hero__stats { gap: 20px 28px; }
  .hero__stat-number { font-size: 1.55rem; }
  .hero__stat-label { font-size: 0.74rem; }
}

@media (prefers-reduced-motion: reduce) {
  .hero__badge-row, .hero__title, .hero__tagline,
  .hero__stats, .hero__handwritten, .hero__scroll {
    animation: none; opacity: 1;
  }
  .hero__scroll-line::after { animation: none; }
}

/* ===========================
   Marquee
   =========================== */

.marquee {
  padding: var(--space-lg) 0; overflow: hidden;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-warm);
}
.marquee__track {
  display: flex; width: max-content;
  animation: marqueeScroll 30s linear infinite;
}
.marquee__text {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.5rem);
  font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.02em; color: var(--color-text);
  opacity: 0.06; white-space: nowrap; flex-shrink: 0;
}
@keyframes marqueeScroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ===========================
   About
   =========================== */

.about {
  padding: var(--space-xl) var(--content-padding);
  border-top: 1px solid var(--color-border);
  position: relative; overflow: hidden;
}
.about__inner {
  max-width: var(--max-width); margin: 0 auto;
  display: grid; grid-template-columns: 1fr; gap: var(--space-lg);
  text-align: center;
  justify-items: center;
}
@media (min-width: 768px) {
  .about__inner { grid-template-columns: 1fr; }
}
.about__left {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  align-items: center;
}
.about__handwritten {
  font-family: var(--font-handwritten);
  font-size: calc(2.5rem * var(--type-scale)); color: var(--color-text-muted);
  transform: rotate(-2deg);
}
.about__right p {
  max-width: 80ch;
  margin-inline: auto;
  margin-bottom: var(--space-md);
  font-size: calc(1.2rem * var(--type-scale));
}
.about__right p:last-child { margin-bottom: 0; }
.about__standout-line {
  font-family: var(--font-display);
  font-size: calc(1.45rem * var(--type-scale));
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--color-text);
}
.about__standout-name {
  display: inline-block;
  background: var(--color-green);
  padding: 3px 10px;
  border-radius: 999px;
}

/* ===========================
   Experience
   =========================== */

.experience {
  padding: var(--space-xl) var(--content-padding);
  border-top: 1px solid var(--color-border);
}
.experience__inner {
  max-width: var(--max-width); margin: 0 auto;
  display: grid; grid-template-columns: 1fr; gap: var(--space-lg);
}
@media (min-width: 768px) {
  .experience__inner { grid-template-columns: 1fr 1.5fr; gap: var(--space-xl); }
}
.experience__left { display: flex; flex-direction: column; gap: var(--space-sm); }
.experience__handwritten {
  font-family: var(--font-handwritten);
  font-size: calc(2.5rem * var(--type-scale)); color: var(--color-text-muted);
  transform: rotate(-2deg);
}
.experience__entry {
  margin-bottom: var(--space-lg);
  font-size: calc(1.2rem * var(--type-scale));
}
.experience__header {
  display: flex; flex-wrap: wrap; align-items: baseline;
  gap: 8px 16px; margin-bottom: 4px;
}
.experience__role {
  font-family: var(--font-display);
  font-size: var(--text-xl); font-weight: 600; letter-spacing: -0.01em;
}
.experience__company {
  font-family: var(--font-display);
  font-size: var(--text-base); font-weight: 500; color: var(--color-text-muted);
}
.experience__date {
  display: block; font-size: var(--text-sm);
  color: var(--color-text-muted); margin-bottom: var(--space-sm);
}
.experience__list {
  list-style: none; display: flex; flex-direction: column; gap: 10px;
}
.experience__list li {
  font-size: calc(1.2rem * var(--type-scale)); color: var(--color-text-muted);
  padding-left: 16px; position: relative; line-height: 1.65;
}
.experience__list li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 14px;
  width: 6px;
  height: 6px;
  background: var(--color-text);
  border-radius: 50%;
  opacity: 0.4;
}
.experience__detail {
  font-size: calc(1.2rem * var(--type-scale));
  color: var(--color-text-muted);
}
.experience__divider {
  height: 1px; background: var(--color-border); margin-bottom: var(--space-lg);
}

/* ===========================
   Work / Projects
   =========================== */

.work {
  background: var(--color-bg-warm);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-xl) var(--content-padding);
}
.work__inner { max-width: var(--max-width); margin: 0 auto; }
.work__heading {
  font-family: var(--font-display);
  font-size: var(--text-4xl); font-weight: 700;
  line-height: 1.15; letter-spacing: -0.02em;
}
@media (max-width: 767px) { .work__heading { font-size: var(--text-3xl); } }

.work__divider {
  height: 1px; background: var(--color-border);
  margin: var(--space-md) 0 var(--space-lg);
}

.work__grid {
  display: grid; grid-template-columns: 1fr; gap: var(--space-lg);
  align-items: stretch;
}
@media (min-width: 768px) {
  .work__grid { grid-template-columns: repeat(12, 1fr); gap: var(--space-lg); }
  .project-card--large { grid-column: span 7; }
  .project-card--small { grid-column: span 5; }
  .project-card--full { grid-column: span 12; }
}

/* Project Card */
.project-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  min-height: 0;
}
.project-card--small::after {
  content: '';
  flex: 1;
  min-height: 96px;
  margin: 18px 0 0;
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 520 92' fill='none'%3E%3Cpath d='M30 26C71 25 112 24 150 20C190 16 233 13 279 14C321 15 366 22 405 27C438 31 468 32 490 25' stroke='%23201f1d' stroke-opacity='0.28' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M34 68C74 67 113 66 151 63C191 59 234 58 279 59C320 60 364 66 404 70C438 73 468 73 486 68' stroke='%23201f1d' stroke-opacity='0.28' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center top / 74% 92px no-repeat;
}
.project-card__surface {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
  transition: transform var(--duration) var(--ease-out),
              box-shadow var(--duration) var(--ease-out);
}
.project-card:hover .project-card__surface {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px #201f1d0d;
}

.project-card__image {
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
  background: #f5f0e8;
  aspect-ratio: 16 / 9;
}
.project-card__image img {
  width: 100%; height: 100%; display: block;
  object-fit: cover; object-position: center top;
}
.project-card[data-project="crime"] .project-card__image {
  aspect-ratio: 16 / 7;
  background: #ffffff;
}
.project-card[data-project="crime"] .project-card__image img {
  object-fit: contain;
  padding: 8px;
}

/* SVG pattern fallback for Silent Patterns */
.project-card__image--pattern2 { background-color: #d3dde8; color: #475a6b; }
.project-card__pattern {
  position: absolute; inset: 0; width: 100%; height: 100%;
}
.project-card__image-label {
  font-family: var(--font-display);
  font-size: clamp(
    calc(3rem * var(--type-scale)),
    calc(5vw * var(--type-scale)),
    calc(5rem * var(--type-scale))
  ); font-weight: 800;
  color: inherit; opacity: 0.08; user-select: none;
  position: relative; z-index: 1;
}

.project-card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: var(--space-md) var(--space-md) var(--space-lg);
}
.project-card__title {
  font-family: var(--font-display);
  font-size: var(--text-2xl); font-weight: 600;
  line-height: 1.25; letter-spacing: -0.01em;
  margin-bottom: var(--space-xs);
}
@media (max-width: 767px) { .project-card__title { font-size: var(--text-xl); } }

.project-card__desc {
  font-size: var(--text-sm); color: var(--color-text-muted);
  margin-bottom: var(--space-sm); line-height: 1.65;
}

.project-card__tags {
  display: flex; flex-wrap: wrap; gap: var(--space-xs);
  margin-bottom: var(--space-sm);
}
.tag {
  display: inline-block; font-size: var(--text-xs); font-weight: 500;
  background: var(--color-accent);
  padding: 4px 14px; border-radius: 100px; letter-spacing: 0.01em;
}

.project-card__links {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
  margin-top: auto;
}
.project-card__links a {
  font-size: var(--text-xs); font-weight: 500;
  color: var(--color-text-muted); transition: color 0.3s ease;
}
.project-card__links a:hover {
  color: var(--color-link);
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
}

/* Full-width card: horizontal layout on desktop */
@media (min-width: 768px) {
  .project-card--full .project-card__surface {
    flex-direction: row;
  }
  .project-card--full .project-card__image {
    flex: 0 0 52%;
    aspect-ratio: auto;
    min-height: 340px;
  }
  .project-card--full .project-card__body {
    flex: 1;
    justify-content: center;
  }
}

@media (max-width: 767px) {
  .project-card--small::after {
    display: none;
  }
}

/* ===========================
   Skills (bigger)
   =========================== */

.skills {
  padding: calc(var(--space-xl) + 24px) var(--content-padding) calc(var(--space-xl) + 40px);
  position: relative; overflow: hidden;
}
.skills__inner { max-width: var(--max-width); margin: 0 auto; }
.skills__heading {
  font-family: var(--font-display);
  font-size: var(--text-4xl); font-weight: 700;
  line-height: 1.15; letter-spacing: -0.02em;
}
@media (max-width: 767px) { .skills__heading { font-size: var(--text-3xl); } }
.skills__divider {
  height: 1px; background: var(--color-border);
  margin: var(--space-md) 0 var(--space-lg);
}

.skills__grid {
  display: grid; grid-template-columns: 1fr; gap: 24px;
}
@media (min-width: 600px) { .skills__grid { grid-template-columns: repeat(2, 1fr); gap: 20px; } }

.skill-cat {
  position: relative;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 28px 24px 24px;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.skill-cat:hover {
  box-shadow: 0 8px 32px rgba(32,31,29,0.07);
  transform: translateY(-2px);
}
.skill-cat__header {
  display: flex; align-items: baseline; gap: 10px;
  margin-bottom: 6px;
}
.skill-cat__number {
  font-family: var(--font-display);
  font-size: calc(0.75rem * var(--type-scale)); font-weight: 700;
  color: var(--color-text-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: block;
}
.skill-cat__title {
  font-family: var(--font-display);
  font-size: calc(1.1rem * var(--type-scale)); font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin-bottom: 20px;
  color: var(--color-text);
}
.skill-cat__divider {
  height: 1px;
  background: var(--color-border);
  margin-bottom: 20px;
}
.skill-cat__pills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  align-items: start;
}

.skill-pill {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px;
  padding: 16px 10px 12px;
  border-radius: 12px;
  background: transparent;
  border: none;
  transition: background 0.18s ease, transform 0.18s ease;
  cursor: default;
}
.skill-pill:hover {
  background: rgba(32,31,29,0.05);
  transform: translateY(-3px);
}
.skill-pill img,
.skill-pill svg {
  width: 56px; height: 56px;
  display: block; flex-shrink: 0;
}
.skill-pill__label {
  font-size: calc(0.62rem * var(--type-scale));
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  text-align: center;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 72px;
}

@media (max-width: 767px) {
  .skills__grid { gap: 16px; }
  .skill-cat { padding: 22px 18px 18px; }
}

/* Mobile centering for all sections */
@media (max-width: 767px) {
  /* About */
  .section-label { font-size: calc(1.9rem * var(--type-scale)); }
  .about__inner { text-align: center; }
  .about__left { align-items: center; }
  .about__handwritten { font-size: calc(1.8rem * var(--type-scale)); }
  .about__right p { max-width: 100%; margin-inline: auto; }
  .about__right p { font-size: calc(1.06rem * var(--type-scale)); line-height: 1.7; }
  .about__standout-line { font-size: calc(1.2rem * var(--type-scale)); }

  /* Work */
  .work__heading { text-align: center; }
  .work__grid { grid-template-columns: 1fr; }
  .project-card__desc { font-size: calc(0.92rem * var(--type-scale)); }

  /* Experience */
  .experience__inner { text-align: center; }
  .experience__left { align-items: center; }
  .experience__handwritten { font-size: calc(1.8rem * var(--type-scale)); }
  .experience__header {
    justify-content: center;
    flex-direction: column;
    align-items: center;
    gap: 6px;
  }
  .experience__role {
    font-size: clamp(
      calc(1.55rem * var(--type-scale)),
      calc(5.7vw * var(--type-scale)),
      calc(1.85rem * var(--type-scale))
    );
    line-height: 1.2;
  }
  .experience__company {
    font-size: calc(1.02rem * var(--type-scale));
    line-height: 1.3;
  }
  .experience__entry { font-size: calc(1.06rem * var(--type-scale)); }
  .experience__list { align-items: center; width: 100%; }
  .experience__list li {
    text-align: left;
    width: 100%;
    font-size: calc(1.06rem * var(--type-scale));
    line-height: 1.65;
  }
  .experience__detail {
    text-align: center;
    font-size: calc(1.02rem * var(--type-scale));
    line-height: 1.6;
  }
  .experience__date {
    text-align: center;
    display: block;
    font-size: calc(0.92rem * var(--type-scale));
  }

  /* Skills */
  .skills__inner { text-align: center; }
  .skills__heading { text-align: center; }
  .skill-cat__title { font-size: calc(1rem * var(--type-scale)); }
  .skill-pill__label { font-size: calc(0.58rem * var(--type-scale)); }

  /* Contact */
  .contact__handwritten { font-size: calc(1.8rem * var(--type-scale)); }
}

/* ===========================
   Contact
   =========================== */

.contact {
  background: var(--color-text); color: var(--color-bg);
  padding: var(--space-2xl) var(--content-padding);
  text-align: center;
  margin-bottom: -200px;
}
.contact__inner {
  max-width: var(--max-width); margin: 0 auto;
  display: flex; flex-direction: column; align-items: center;
  gap: var(--space-md);
}
.contact__handwritten {
  font-family: var(--font-handwritten);
  font-size: calc(2.5rem * var(--type-scale)); opacity: 0.5;
  transform: rotate(-2deg);
}
.contact__heading {
  font-family: var(--font-display);
  font-size: calc(55px * var(--type-scale)); font-weight: 800;
  line-height: 1.05; letter-spacing: -0.03em;
}
.contact__email {
  font-size: calc(25px * var(--type-scale)); color: var(--color-accent);
  text-decoration: underline; text-underline-offset: 6px;
  text-decoration-thickness: 1.5px;
  transition: color 0.3s ease; word-break: break-all;
}
.contact__email:hover { color: var(--color-link); }
.contact__socials { display: flex; gap: 32px; margin-top: var(--space-sm); }
.contact__socials a {
  font-size: var(--text-sm); font-weight: 500;
  opacity: 0.6; transition: opacity 0.3s ease;
}
.contact__socials a:hover {
  opacity: 1; text-decoration: underline;
  text-underline-offset: 4px; text-decoration-thickness: 1px;
}

@media (max-width: 767px) {
  .contact__heading { font-size: var(--text-3xl); }
  .contact__email { font-size: var(--text-lg); }
}

/* ===========================
   Footer
   =========================== */

.footer {
  background: var(--color-text); color: var(--color-bg);
  padding: var(--space-2xl) var(--content-padding) var(--space-lg);
}
.footer__inner {
  max-width: var(--max-width); margin: 0 auto;
  display: flex; flex-direction: column; align-items: center;
  gap: var(--space-lg);
}

.footer__name {
  font-family: var(--font-handwritten);
  font-size: clamp(
    calc(3rem * var(--type-scale)),
    calc(8vw * var(--type-scale)),
    calc(6rem * var(--type-scale))
  );
  font-weight: 400; line-height: 1;
  opacity: 0.9; text-align: center;
}

.footer__tagline {
  font-size: var(--text-sm); opacity: 0.4;
  letter-spacing: 0.05em; text-transform: uppercase;
  text-align: center; margin-top: -8px;
}

.footer__socials {
  display: flex; gap: 32px;
}
.footer__socials a {
  font-size: var(--text-sm); font-weight: 500;
  opacity: 0.5; transition: opacity 0.3s ease;
  letter-spacing: 0.02em;
}
.footer__socials a:hover { opacity: 1; }

.footer__divider {
  width: 100%; height: 1px; background: #ffffff15;
}

.footer__bottom {
  width: 100%;
  display: flex; justify-content: space-between; align-items: center;
  font-size: var(--text-xs); opacity: 0.35;
}
.footer__nav {
  display: flex; gap: 24px;
}
.footer__nav a { transition: opacity 0.3s ease; }
.footer__nav a:hover { opacity: 0.7; }
.footer__top-link { transition: opacity 0.3s ease; }
.footer__top-link:hover { opacity: 0.7; }

@media (max-width: 767px) {
  .footer__bottom { flex-direction: column; gap: 12px; text-align: center; }
  .footer__nav { justify-content: center; flex-wrap: wrap; }
  .footer__socials { gap: 24px; }
}

@media (min-width: 768px) {
  .section-label {
    font-size: calc(2.15rem * var(--type-scale));
  }
  .header__logo {
    font-size: calc(2.95rem * var(--type-scale));
  }
  .header__nav-link {
    font-size: calc(1.35rem * var(--type-scale));
  }
  .hero__title {
    font-size: clamp(
      calc(2.75rem * var(--type-scale)),
      calc(6.1vw * var(--type-scale)),
      calc(5rem * var(--type-scale))
    );
  }
  .hero__tagline {
    font-size: calc(1.36rem * var(--type-scale));
  }
  .hero__stat-number {
    font-size: calc(1.8rem * var(--type-scale));
  }
  .hero__handwritten,
  .about__handwritten,
  .experience__handwritten,
  .contact__handwritten {
    font-size: calc(2.2rem * var(--type-scale));
  }
  .about__right p,
  .experience__entry,
  .experience__list li,
  .experience__detail {
    font-size: calc(1.1rem * var(--type-scale));
  }
  .about__standout-line {
    font-size: calc(1.32rem * var(--type-scale));
  }
  .experience__role {
    font-size: calc(1.38rem * var(--type-scale));
  }
  .experience__company {
    font-size: calc(1rem * var(--type-scale));
  }
  .work__heading,
  .skills__heading {
    font-size: clamp(
      calc(2.9rem * var(--type-scale)),
      calc(4.5vw * var(--type-scale)),
      calc(3.2rem * var(--type-scale))
    );
  }
  .project-card__title {
    font-size: calc(1.82rem * var(--type-scale));
  }
  .project-card__desc {
    font-size: calc(0.96rem * var(--type-scale));
  }
  .skill-cat__title {
    font-size: calc(1.03rem * var(--type-scale));
  }
  .contact__heading {
    font-size: calc(50px * var(--type-scale));
  }
  .contact__email {
    font-size: calc(23px * var(--type-scale));
  }
  .footer__name {
    font-size: clamp(
      calc(2.7rem * var(--type-scale)),
      calc(6.8vw * var(--type-scale)),
      calc(5.2rem * var(--type-scale))
    );
  }
}

/* ===========================
   Project Detail Modal
   =========================== */

.modal {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.35s ease;
}
.modal.is-open { opacity: 1; pointer-events: all; }

.modal__overlay {
  position: absolute; inset: 0;
  background: rgba(32, 31, 29, 0.6);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}

.modal__content {
  position: relative; z-index: 1;
  background: var(--color-bg); color: var(--color-text);
  border-radius: 12px; overflow: hidden;
  max-width: 820px; width: calc(100% - 32px);
  max-height: 90vh; overflow-y: auto;
  transform: scale(0.96) translateY(12px);
  transition: transform 0.35s var(--ease-out);
}
.modal.is-open .modal__content {
  transform: scale(1) translateY(0);
}

.modal__close {
  position: sticky; top: 16px; float: right;
  margin: 16px 16px 0 0;
  width: 40px; height: 40px;
  background: var(--color-bg); border: 1px solid var(--color-border);
  border-radius: 50%; font-size: 1.5rem;
  display: flex; align-items: center; justify-content: center;
  z-index: 2; transition: background 0.2s ease;
  font-family: var(--font-body); color: var(--color-text);
  line-height: 1;
}
.modal__close:hover { background: var(--color-accent); }

.modal__image-wrap {
  width: 100%; max-height: 400px; overflow: hidden;
  background: #f0ebe4;
}
.modal__image-wrap img {
  width: 100%; height: 100%; object-fit: contain;
  max-height: 400px;
}

.modal__body { padding: var(--space-lg); }

.modal__title {
  font-family: var(--font-display);
  font-size: var(--text-3xl); font-weight: 700;
  letter-spacing: -0.02em; line-height: 1.15;
  margin-bottom: var(--space-md);
}

.modal__desc {
  font-size: var(--text-sm); line-height: 1.7;
  color: var(--color-text-muted);
  margin-bottom: var(--space-md);
}
.modal__desc p { margin-bottom: var(--space-sm); }
.modal__desc p:last-child { margin-bottom: 0; }
.modal__desc strong { color: var(--color-text); font-weight: 600; }

.modal__tags {
  display: flex; flex-wrap: wrap; gap: var(--space-xs);
  margin-bottom: var(--space-md);
}

.modal__links { display: flex; gap: 24px; }
.modal__links a {
  font-size: var(--text-sm); font-weight: 600;
  color: var(--color-link);
  text-decoration: underline; text-underline-offset: 4px;
  text-decoration-thickness: 1.5px;
  transition: opacity 0.3s ease;
}
.modal__links a:hover { opacity: 0.7; }

@media (max-width: 767px) {
  .modal__content { width: calc(100% - 16px); max-height: 95vh; }
  .modal__title { font-size: var(--text-2xl); }
  .modal__body { padding: var(--space-md); }
}

/* ===========================
   Project Detail Page
   =========================== */

/* Push main content below fixed header */
.proj-page-wrapper {
  padding-top: 72px;
}

/* Back bar */
.proj-back-bar {
  padding: 28px var(--content-padding) 24px;
  border-bottom: 1px solid var(--color-border);
}
.proj-back-bar__inner {
  max-width: var(--max-width); margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
}
.proj-back-link {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-body);
  font-size: var(--text-sm); font-weight: 600;
  letter-spacing: 0.01em; color: var(--color-text);
  background: var(--color-bg-card);
  border: 1.5px solid var(--color-border);
  border-radius: 100px;
  padding: 10px 20px 10px 16px;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.15s ease;
}
.proj-back-link svg {
  width: 18px; height: 18px;
  flex-shrink: 0;
  transition: transform 0.18s ease;
}
.proj-back-link:hover {
  background: var(--color-accent);
  border-color: var(--color-accent);
  transform: translateX(-2px);
}
.proj-back-link:hover svg {
  transform: translateX(-3px);
}
.proj-back-bar__label {
  font-size: var(--text-sm); color: var(--color-text-muted);
  font-weight: 500;
}
.proj-back-bar__label::before { content: '→'; margin-right: 8px; opacity: 0.4; }

/* Loading state */
.proj-loading {
  min-height: 60vh; display: flex;
  align-items: center; justify-content: center;
  font-size: var(--text-lg); color: var(--color-text-muted);
}

/* Hero */
.proj-hero {
  padding: var(--space-xl) var(--content-padding);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-warm);
}
.proj-hero__inner {
  max-width: var(--max-width); margin: 0 auto;
  display: grid; grid-template-columns: 1fr; gap: var(--space-xl);
  align-items: start;
  
}
@media (min-width: 900px) {
  .proj-hero__inner { grid-template-columns: 1fr 1fr; }
}

.proj-hero__meta { display: flex; flex-direction: column; gap: var(--space-md); }
.proj-hero__tags { display: flex; flex-wrap: wrap; gap: 8px; }

.proj-hero__title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800; line-height: 1.1; letter-spacing: -0.03em;
}

.proj-hero__subtitle {
  font-size: var(--text-lg); color: var(--color-text-muted);
  line-height: 1.55; max-width: 46ch;
}

.proj-hero__stats {
  display: flex; flex-wrap: wrap; gap: 32px;
  padding: var(--space-md) 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}
.proj-hero-stat { display: flex; flex-direction: column; gap: 2px; }
.proj-hero-stat__value {
  font-family: var(--font-display);
  font-size: var(--text-2xl); font-weight: 700;
  letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
}
.proj-hero-stat__label {
  font-size: var(--text-xs); text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--color-text-muted);
}

.proj-hero__links { display: flex; gap: 20px; flex-wrap: wrap; }
.proj-link {
  display: inline-block;
  font-size: var(--text-sm); font-weight: 600;
  color: var(--color-link);
  text-decoration: underline; text-underline-offset: 4px;
  text-decoration-thickness: 1.5px;
  transition: opacity 0.2s ease;
}
.proj-link:hover { opacity: 0.7; }

.proj-hero-image {
  border-radius: 8px; overflow: hidden;
  border: 1px solid var(--color-border);
  background: #f0ebe4;
  max-height: 480px; display: flex; align-items: center;
}
.proj-hero-image img {
  width: 100%; height: 100%; object-fit: contain;
  max-height: 480px; display: block;
}

/* Sections */
.proj-sections { padding: var(--space-xl) var(--content-padding); }
.proj-sections__inner {
  max-width: var(--max-width); margin: 0 auto;
  display: flex; flex-direction: column; gap: var(--space-xl);
}

.proj-section {
  display: grid; grid-template-columns: 1fr; gap: var(--space-lg);
}
@media (min-width: 768px) {
  .proj-section { grid-template-columns: 220px 1fr; gap: var(--space-xl); }
}

.proj-section--accent {
  background: var(--color-bg-warm);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: var(--space-lg);
}
@media (min-width: 768px) {
  .proj-section--accent { grid-template-columns: 220px 1fr; }
}

.proj-section__heading {
  font-family: var(--font-display);
  font-size: var(--text-xs); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--color-text-muted);
  padding-top: 4px;
}

.proj-section__body { font-size: var(--text-lg); line-height: 1.8; }
.proj-section__body p { margin-bottom: var(--space-sm); color: var(--color-text-muted); }
.proj-section__body p:last-child { margin-bottom: 0; }
.proj-section__body strong { color: var(--color-text); font-weight: 600; }
.proj-section__body em { font-style: italic; }

/* Shared list */
.proj-list {
  list-style: none; display: flex; flex-direction: column;
  gap: 10px; margin: var(--space-sm) 0;
}
.proj-list li {
  padding-left: 20px; position: relative;
  font-size: var(--text-lg); color: var(--color-text-muted); line-height: 1.75;
}
.proj-list li::before {
  content: ''; position: absolute; left: 0; top: 11px;
  width: 8px; height: 1px; background: var(--color-text); opacity: 0.4;
}

/* Urgency badges */
.proj-badge {
  display: inline-block; width: 22px; height: 22px; line-height: 22px;
  text-align: center; border-radius: 4px;
  font-size: 11px; font-weight: 700; font-family: var(--font-display);
  margin-right: 8px; vertical-align: middle;
}
.proj-badge--0 { background: var(--color-green); color: #2a5c2a; }
.proj-badge--1 { background: #fff3b0; color: #7a6200; }
.proj-badge--2 { background: #ffd9b0; color: #7a3a00; }
.proj-badge--3 { background: #ffc0c0; color: #7a0000; }

/* Formula block */
.proj-formula {
  background: var(--color-text); color: var(--color-bg);
  border-radius: 6px; padding: var(--space-md);
  margin: var(--space-sm) 0;
  display: flex; flex-direction: column; gap: 8px;
}
.proj-formula code {
  font-family: 'Courier New', monospace;
  font-size: 0.85rem; letter-spacing: 0.01em;
}

/* Feature grid */
.proj-feature-grid {
  display: grid; grid-template-columns: 1fr; gap: var(--space-sm);
  margin-top: var(--space-sm);
}
@media (min-width: 600px) { .proj-feature-grid { grid-template-columns: 1fr 1fr; } }

.proj-feature-block {
  border: 1px solid var(--color-border); border-radius: 6px;
  padding: var(--space-md);
}
.proj-feature-block h4 {
  font-family: var(--font-display); font-size: var(--text-lg);
  font-weight: 600; margin-bottom: 8px; color: var(--color-text);
}
.proj-feature-block p { font-size: var(--text-lg); color: var(--color-text-muted); line-height: 1.7; margin: 0; }

/* Compare block */
.proj-compare {
  display: grid; grid-template-columns: 1fr; gap: var(--space-sm);
  margin: var(--space-sm) 0;
}
@media (min-width: 600px) { .proj-compare { grid-template-columns: 1fr 1fr; } }

.proj-compare__bad, .proj-compare__good, .proj-compare__item {
  border-radius: 6px; padding: var(--space-md);
}
.proj-compare__bad { background: #fff0f0; border: 1px solid #ffc0c0; }
.proj-compare__good { background: #f0fff0; border: 1px solid var(--color-green); }
.proj-compare__item { border: 1px solid var(--color-border); }
.proj-compare__bad p, .proj-compare__good p, .proj-compare__item p {
  font-size: var(--text-lg); color: var(--color-text-muted); line-height: 1.7; margin: 0;
}

.proj-compare__label {
  display: inline-block; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  padding: 3px 10px; border-radius: 100px; margin-bottom: 8px;
}
.proj-compare__label--bad { background: #ffc0c0; color: #7a0000; }
.proj-compare__label--good { background: var(--color-green); color: #2a5c2a; }
.proj-compare__label--neutral { background: var(--color-accent); color: var(--color-text); }

@media (max-width: 767px) {
  .proj-compare__item:only-child {
    grid-column: 1 / -1;
    width: 100%;
  }
}

/* Algorithm comparison table */
.proj-algo-table {
  border: 1px solid var(--color-border); border-radius: 6px;
  overflow: hidden; margin-top: var(--space-sm);
}
.proj-algo-row {
  display: grid; grid-template-columns: 1fr 1fr 1.5fr;
  padding: 14px 18px; font-size: var(--text-sm);
  border-bottom: 1px solid var(--color-border);
  gap: 8px; align-items: center;
}
.proj-algo-row:last-child { border-bottom: none; }
.proj-algo-row--header {
  font-weight: 600; font-family: var(--font-display);
  letter-spacing: 0.05em; text-transform: uppercase;
  background: var(--color-bg-warm);
}
.proj-algo-row--fail { color: var(--color-text-muted); }
.proj-algo-row--ok { color: var(--color-text-muted); background: #fffef0; }
.proj-algo-row--win { background: var(--color-green); color: #1a3d1a; font-weight: 600; }

/* Two-phase diagram */
.proj-phases {
  display: grid; grid-template-columns: 1fr; gap: var(--space-sm);
  margin: var(--space-sm) 0;
}
@media (min-width: 600px) { .proj-phases { grid-template-columns: 1fr 1fr; } }

.proj-phase {
  border: 1px solid var(--color-border); border-radius: 6px;
  padding: var(--space-md);
}
.proj-phase__num {
  display: inline-block; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  background: var(--color-accent); padding: 3px 10px;
  border-radius: 100px; margin-bottom: 8px;
}
.proj-phase h4 {
  font-family: var(--font-display); font-size: var(--text-lg);
  font-weight: 600; margin-bottom: 8px; color: var(--color-text);
}
.proj-phase p { font-size: var(--text-lg); color: var(--color-text-muted); line-height: 1.7; margin: 0; }

/* Stat blocks */
.proj-stat-grid {
  display: flex; flex-wrap: wrap; gap: var(--space-sm); margin-top: var(--space-sm);
}
.proj-stat-block {
  border: 1px solid var(--color-border); border-radius: 6px;
  padding: var(--space-sm) var(--space-md);
  display: flex; flex-direction: column; gap: 2px;
}
.proj-stat-block__value {
  font-family: var(--font-display); font-size: var(--text-xl);
  font-weight: 700; letter-spacing: -0.02em;
}
.proj-stat-block__label {
  font-size: var(--text-xs); color: var(--color-text-muted); letter-spacing: 0.02em;
}

/* Scoring tracks */
.proj-scoring-grid {
  display: grid; grid-template-columns: 1fr; gap: var(--space-sm);
  margin-top: var(--space-sm);
}
@media (min-width: 600px) { .proj-scoring-grid { grid-template-columns: repeat(3, 1fr); } }

.proj-scoring-track {
  border-radius: 6px; padding: var(--space-md);
  border: 1px solid var(--color-border);
}
.proj-scoring-track--solar { background: #fffde7; border-color: #ffe082; }
.proj-scoring-track--wind { background: #e8f4fd; border-color: #90caf9; }
.proj-scoring-track--hydro { background: #e3f2fd; border-color: #64b5f6; }

.proj-scoring-track__header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
}
.proj-scoring-icon { font-size: 1.4rem; }
.proj-scoring-track__header h4 {
  font-family: var(--font-display); font-size: var(--text-lg); font-weight: 700; color: var(--color-text);
}
.proj-scoring-max {
  font-size: var(--text-xs); font-weight: 500; color: var(--color-text-muted); margin-left: 4px;
}
.proj-scoring-rules {
  list-style: none; display: flex; flex-direction: column; gap: 8px;
}
.proj-scoring-rules li { font-size: var(--text-base); color: var(--color-text-muted); line-height: 1.65; }
.proj-scoring-rules li::before { display: none; }

/* Confidence grid */
.proj-confidence-grid {
  display: grid; grid-template-columns: 1fr; gap: var(--space-sm);
  margin: var(--space-sm) 0;
}
@media (min-width: 600px) { .proj-confidence-grid { grid-template-columns: repeat(3, 1fr); } }

.proj-confidence-block {
  border-radius: 6px; padding: var(--space-md);
  display: flex; flex-direction: column; gap: 6px;
}
.proj-confidence-block--high { background: #e8f5e9; border: 1px solid #a5d6a7; }
.proj-confidence-block--mid { background: #fffde7; border: 1px solid #ffe082; }
.proj-confidence-block--low { background: #fce4ec; border: 1px solid #f48fb1; }

.proj-confidence-range {
  font-family: var(--font-display); font-size: var(--text-lg); font-weight: 700;
}
.proj-confidence-label {
  font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
}
.proj-confidence-desc { font-size: var(--text-base); color: var(--color-text-muted); }

/* Preset pills */
.proj-preset-grid {
  display: flex; flex-wrap: wrap; gap: 10px; margin-top: var(--space-sm);
}
.proj-preset {
  display: inline-block; font-size: var(--text-xs); font-weight: 500;
  border: 1px solid var(--color-border); border-radius: 100px;
  padding: 6px 16px; background: var(--color-bg-card);
  transition: background 0.2s ease, border-color 0.2s ease;
}
.proj-preset:hover { background: var(--color-accent); border-color: transparent; }

/* Tables */
.proj-table-wrap {
  overflow-x: auto; margin: var(--space-sm) 0;
  border: 1px solid var(--color-border); border-radius: 6px;
  -webkit-overflow-scrolling: touch;
}
.proj-table {
  width: 100%; border-collapse: collapse;
  font-size: var(--text-base); line-height: 1.65;
}
.proj-table th {
  background: var(--color-bg-warm);
  font-family: var(--font-display); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  font-size: var(--text-xs); padding: 12px 16px; text-align: left;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
.proj-table td {
  padding: 14px 16px; color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}
.proj-table tr:last-child td { border-bottom: none; }
.proj-table td strong { color: var(--color-text); }
.proj-table td code {
  font-family: 'Courier New', monospace; font-size: 0.8rem;
  background: var(--color-bg-warm); padding: 2px 6px; border-radius: 3px;
}
.proj-table-highlight td {
  background: var(--color-green); color: #1a3d1a; font-weight: 600;
}
.proj-table-highlight td { color: #1a3d1a; }

/* Code blocks */
.proj-codeblock {
  background: var(--color-text); color: var(--color-bg);
  border-radius: 6px; padding: var(--space-md);
  margin: var(--space-sm) 0; overflow-x: auto;
}
.proj-codeblock pre { margin: 0; }
.proj-codeblock code {
  font-family: 'Courier New', monospace;
  font-size: 0.8rem; line-height: 1.7;
  white-space: pre;
}

/* Urgency grid */
.proj-urgency-grid {
  display: flex; flex-direction: column; gap: 8px;
  margin: var(--space-sm) 0;
}
.proj-urgency-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--color-border); border-radius: 6px;
  background: var(--color-bg-card);
}
.proj-urgency-row div { display: flex; flex-direction: column; gap: 2px; }
.proj-urgency-row strong { font-size: var(--text-base); color: var(--color-text); }
.proj-urgency-pct {
  font-size: var(--text-sm); color: var(--color-text-muted);
  letter-spacing: 0.04em;
}

/* Pipeline steps */
.proj-pipeline-step {
  padding: var(--space-md);
  border: 1px solid var(--color-border); border-radius: 6px;
  margin-bottom: var(--space-sm);
  position: relative; padding-left: calc(var(--space-md) + 48px);
}
.proj-pipeline-step__num {
  position: absolute; left: var(--space-md); top: var(--space-md);
  font-family: var(--font-display); font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  background: var(--color-accent); padding: 3px 8px; border-radius: 4px;
  white-space: nowrap;
}
.proj-pipeline-step h4 {
  font-family: var(--font-display); font-size: var(--text-lg);
  font-weight: 600; margin-bottom: 8px; color: var(--color-text);
}
.proj-pipeline-step p {
  font-size: var(--text-lg); color: var(--color-text-muted);
  line-height: 1.7; margin: 0;
}

/* Blockquote */
.proj-quote {
  border-left: 3px solid var(--color-accent);
  padding: var(--space-sm) var(--space-md);
  margin: var(--space-sm) 0;
  font-size: var(--text-lg); line-height: 1.55;
  color: var(--color-text); font-style: italic;
  background: var(--color-bg-warm); border-radius: 0 6px 6px 0;
}

@media (max-width: 767px) {
  .proj-pipeline-step { padding-left: var(--space-md); padding-top: calc(var(--space-md) + 32px); }
  .proj-pipeline-step__num { top: var(--space-sm); left: var(--space-sm); }
  .proj-algo-table .proj-algo-row { grid-template-columns: 1fr 1fr; }
  .proj-algo-row--header span:last-child,
  .proj-algo-row span:last-child { display: none; }
}

/* ===========================
   Journey (chapter progression)
   =========================== */

.proj-journey {
  display: flex; flex-direction: column;
  gap: 0; margin: var(--space-sm) 0;
}

.proj-journey__step {
  display: flex; gap: 16px; align-items: flex-start;
  padding: var(--space-md);
  border: 1px solid var(--color-border); border-radius: 6px;
  background: var(--color-bg-card);
}
.proj-journey__step--fail { background: var(--color-bg-card); border-color: var(--color-border); }
.proj-journey__step--ok   { background: var(--color-bg-card); border-color: var(--color-border); }
.proj-journey__step--win  { background: var(--color-bg-card); border-color: var(--color-border); }

.proj-journey__badge {
  flex-shrink: 0;
  font-family: var(--font-display); font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  background: var(--color-bg-warm);
  border: 1px solid var(--color-border);
  padding: 4px 10px; border-radius: 100px;
  white-space: nowrap; margin-top: 3px;
}
.proj-journey__badge--fail { background: var(--color-bg); color: var(--color-text-muted); border-color: var(--color-border); }
.proj-journey__badge--ok   { background: var(--color-bg); color: var(--color-text-muted); border-color: var(--color-border); }
.proj-journey__badge--win  { background: var(--color-text); color: var(--color-bg); border-color: var(--color-text); }

.proj-journey__body { flex: 1; }
.proj-journey__body h4 {
  font-family: var(--font-display); font-size: var(--text-base);
  font-weight: 600; margin-bottom: 6px; color: var(--color-text);
}
.proj-journey__body p {
  font-size: var(--text-base); color: var(--color-text-muted);
  line-height: 1.65; margin: 0 0 6px;
}
.proj-journey__time {
  font-size: var(--text-xs); font-weight: 600; color: var(--color-text-muted);
  text-transform: uppercase; letter-spacing: 0.06em;
  opacity: 0.6;
}

.proj-journey__arrow {
  text-align: center; font-size: var(--text-sm);
  color: var(--color-text-muted); opacity: 0.4;
  padding: 4px 0;
  letter-spacing: 0.04em; font-size: var(--text-xs);
}

/* ===========================
   Mindmap / Flow diagram
   =========================== */

.proj-mindmap {
  margin: var(--space-md) 0;
  display: flex; flex-direction: column; align-items: center; gap: 20px;
}

.proj-mindmap__center {
  background: var(--color-text); color: var(--color-bg);
  border-radius: 8px; padding: 12px 28px;
  text-align: center; font-family: var(--font-display);
  font-size: var(--text-sm); font-weight: 700;
  line-height: 1.4;
}
.proj-mindmap__center small { font-size: 10px; font-weight: 400; opacity: 0.85; }

.proj-mindmap__branches {
  display: flex; align-items: stretch; gap: 0;
  flex-wrap: nowrap; justify-content: center;
  width: 100%;
}

.proj-mindmap__branch {
  border-radius: 8px; padding: 14px 20px;
  text-align: center; flex: 1; min-width: 0;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
}
.proj-mindmap__branch--phase1 { background: #fef9e7; border-color: #f7dc6f; }
.proj-mindmap__branch--g1     { background: #fef5ec; border-color: #f0a500; }
.proj-mindmap__branch--solved { background: #eafaf1; border-color: #82d9a2; }

.proj-mindmap__label {
  font-family: var(--font-display); font-size: var(--text-sm);
  font-weight: 700; margin-bottom: 6px; color: var(--color-text);
}
.proj-mindmap__desc {
  font-size: var(--text-sm); color: var(--color-text-muted); line-height: 1.5;
}

.proj-mindmap__connector {
  font-size: var(--text-base); color: var(--color-text-muted);
  opacity: 0.5; flex-shrink: 0;
  display: flex; align-items: center; padding: 0 8px;
}

@media (max-width: 600px) {
  .proj-mindmap__branches { flex-direction: column; align-items: center; }
  .proj-mindmap__connector { transform: rotate(90deg); padding: 4px 0; }
  .proj-mindmap__branch { width: 100%; }
}

@media (max-width: 767px) {
  .proj-back-bar {
    padding: 14px var(--content-padding) 12px;
  }
  .proj-back-bar__inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .proj-back-link {
    padding: 8px 14px 8px 12px;
  }
  .proj-back-bar__label {
    font-size: 0.78rem;
    line-height: 1.4;
  }

  .proj-hero {
    padding: 26px var(--content-padding) 24px;
  }
  .proj-hero__inner {
    gap: 20px;
  }
  .proj-hero__meta {
    gap: 14px;
  }
  .proj-hero__tags {
    gap: 6px;
  }
  .proj-hero__title {
    font-size: clamp(1.75rem, 8vw, 2.35rem);
    line-height: 1.08;
    
  }
  .proj-hero__subtitle {
    font-size: 0.98rem;
    line-height: 1.65;
    max-width: none;
  }
  .proj-hero__stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 16px;
    padding: 14px 0;
  }
  .proj-hero-stat__value {
    font-size: 1.45rem;
  }
  .proj-hero-stat__label {
    font-size: 0.72rem;
    line-height: 1.35;
  }
  .proj-hero__links {
    gap: 10px 14px;
  }
  .proj-link {
    font-size: 0.9rem;
  }
  .proj-hero-image,
  .proj-hero-image img {
    max-height: 248px;
  }

  .proj-sections {
    padding: 26px var(--content-padding) 30px;
  }
  .proj-sections__inner {
    gap: 22px;
  }
  .proj-section {
    gap: 10px;
  }
  .proj-section--accent {
    padding: 16px 14px;
  }
  .proj-section__heading {
    padding-top: 0;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
  }
  .proj-section__body {
    font-size: 1rem;
    line-height: 1.68;
  }
  .proj-section__body > * {
    margin-top: 0;
  }
  .proj-section__body > * + * {
    margin-top: 12px;
  }
  .proj-section__body p {
    margin-bottom: 0;
  }
  .proj-list,
  .proj-feature-grid,
  .proj-compare,
  .proj-phases,
  .proj-stat-grid,
  .proj-scoring-grid,
  .proj-confidence-grid,
  .proj-preset-grid,
  .proj-urgency-grid,
  .proj-journey,
  .proj-mindmap,
  .proj-table-wrap,
  .proj-codeblock,
  .proj-formula,
  .proj-quote,
  .proj-algo-table {
    margin: 0;
  }
  .proj-feature-grid,
  .proj-compare,
  .proj-phases,
  .proj-stat-grid,
  .proj-scoring-grid,
  .proj-confidence-grid,
  .proj-preset-grid,
  .proj-urgency-grid,
  .proj-journey {
    gap: 10px;
  }
  .proj-list {
    gap: 8px;
    margin: 0;
  }
  .proj-list li {
    padding-left: 15px;
    font-size: 1rem;
    line-height: 1.66;
  }
  .proj-list li::before {
    top: 12px;
    width: 6px;
  }
  .proj-formula,
  .proj-feature-block,
  .proj-compare__bad,
  .proj-compare__good,
  .proj-compare__item,
  .proj-phase,
  .proj-stat-block,
  .proj-scoring-track,
  .proj-confidence-block,
  .proj-codeblock,
  .proj-urgency-row,
  .proj-journey__step,
  .proj-mindmap__center,
  .proj-mindmap__branch {
    padding: 12px;
  }
  .proj-formula code,
  .proj-codeblock code {
    font-size: 0.74rem;
    overflow-wrap: anywhere;
  }
  .proj-feature-block h4,
  .proj-phase h4,
  .proj-pipeline-step h4,
  .proj-scoring-track__header h4 {
    font-size: var(--text-base);
  }
  .proj-feature-block p,
  .proj-compare__bad p,
  .proj-compare__good p,
  .proj-compare__item p,
  .proj-phase p,
  .proj-pipeline-step p {
    font-size: 1rem;
    line-height: 1.65;
  }
  .proj-stat-block__value {
    font-size: 1.15rem;
  }
  .proj-scoring-rules li,
  .proj-confidence-desc,
  .proj-urgency-pct {
    font-size: 0.94rem;
  }
  .proj-scoring-track__header {
    margin-bottom: 10px;
  }
  .proj-scoring-rules {
    gap: 6px;
  }
  .proj-confidence-block {
    gap: 5px;
  }
  .proj-preset {
    padding: 5px 13px;
  }
  .proj-table-wrap {
    border-radius: 8px;
  }
  .proj-table {
    font-size: 0.88rem;
  }
  .proj-table th {
    padding: 9px 10px;
  }
  .proj-table td {
    padding: 10px;
  }
  .proj-algo-row {
    padding: 12px 14px;
    gap: 6px;
  }
  .proj-urgency-row {
    align-items: flex-start;
    gap: 9px;
  }
  .proj-urgency-row strong {
    font-size: 0.98rem;
  }
  .proj-pipeline-step {
    margin-bottom: 0;
    padding: 12px;
    padding-top: 40px;
  }
  .proj-pipeline-step__num {
    top: 10px;
    left: 12px;
  }
  .proj-quote {
    padding: 14px 16px;
    font-size: 0.98rem;
    line-height: 1.6;
  }
  .proj-table--climate thead {
    display: none;
  }
  .proj-table--climate tr:first-child {
    display: none;
  }
  .proj-table--climate,
  .proj-table--climate tbody,
  .proj-table--climate tr,
  .proj-table--climate td {
    display: block;
    width: 100%;
  }
  .proj-table--climate tr {
    padding: 12px 10px;
    border-bottom: 1px solid var(--color-border);
  }
  .proj-table--climate tr:last-child {
    border-bottom: none;
  }
  .proj-table--climate td {
    padding: 0;
    margin-bottom: 8px;
    border-bottom: none;
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
  }
  .proj-table--climate td:last-child {
    margin-bottom: 0;
  }
  .proj-table--climate td::before {
    font-family: var(--font-display);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text);
    opacity: 0.8;
  }
  .proj-table--climate td:nth-child(1)::before { content: 'Input'; }
  .proj-table--climate td:nth-child(2)::before { content: 'Unit'; }
  .proj-table--climate td:nth-child(3)::before { content: 'Why'; }
  .proj-table--climate td:nth-child(4)::before { content: 'Controls'; }
  .proj-journey__step {
    flex-direction: column;
    gap: 10px;
  }
  .proj-journey__badge {
    margin-top: 0;
  }
  .proj-journey__arrow {
    padding: 2px 0;
  }
  .proj-journey__body h4 {
    font-size: 0.98rem;
  }
  .proj-journey__body p {
    font-size: 0.94rem;
  }
  .proj-mindmap {
    gap: 14px;
  }
  .proj-mindmap__center {
    font-size: 0.88rem;
    padding: 10px 18px;
  }
  .proj-mindmap__label {
    font-size: 0.92rem;
  }
  .proj-mindmap__desc {
    font-size: 0.84rem;
    line-height: 1.45;
  }
}
