/* ============================================================
   CODEX — Narrative Portfolio Template
   CSS by Claude | ThemeForest Ready
   ============================================================ */

/* ── CSS VARIABLES ─────────────────────────────────────────── */
:root {
  --bg: #0a0a0c;
  --bg-2: #111114;
  --bg-3: #18181d;
  --surface: #1e1e25;
  --surface-2: #252530;
  --border: rgba(255, 255, 255, 0.07);
  --border-2: rgba(255, 255, 255, 0.12);

  --text: #f0ede8;
  --text-2: #a09e9a;
  --text-3: #6b6966;

  --accent: #e8c97a;
  --accent-2: #d4b355;
  --accent-rgb: 232, 201, 122;

  --red: #e87a7a;
  --green: #7ae8a8;
  --blue: #7aaee8;

  --font-display: 'Playfair Display', Georgia, serif;
  --font-mono: 'DM Mono', 'Courier New', monospace;
  --font-body: 'Instrument Sans', sans-serif;

  --nav-h: 72px;
  --radius: 12px;
  --radius-lg: 20px;
  --transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
  --glow: 0 0 30px rgba(var(--accent-rgb), 0.15);
}

/* LIGHT MODE */
[data-theme="light"] {
  --bg: #f5f2ed;
  --bg-2: #eeebe4;
  --bg-3: #e6e2d9;
  --surface: #ffffff;
  --surface-2: #f0ede8;
  --border: rgba(0, 0, 0, 0.08);
  --border-2: rgba(0, 0, 0, 0.14);
  --text: #1a1814;
  --text-2: #5c5a56;
  --text-3: #9a9890;
  --accent: #c4933a;
  --accent-2: #b07e28;
}

/* ── RESET & BASE ───────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-h);
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.7;
  overflow-x: hidden;
  cursor: none;
  transition: background var(--transition), color var(--transition);
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

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

a {
  text-decoration: none;
  color: inherit;
}

/* ── SCROLLBAR ──────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 2px;
}

/* ── CUSTOM CURSOR ──────────────────────────────────────────── */
.cursor-dot {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: transform 0.05s;
}

.cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9998;
  width: 32px;
  height: 32px;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: transform 0.12s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    width 0.2s, height 0.2s, opacity 0.2s;
  opacity: 0.6;
}

.cursor-ring.expand {
  width: 56px;
  height: 56px;
  opacity: 0.3;
}

@media (hover: none) {

  .cursor-dot,
  .cursor-ring {
    display: none;
  }

  body {
    cursor: auto;
  }
}

/* ── PRELOADER ──────────────────────────────────────────────── */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s, visibility 0.6s;
}

.preloader.done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.pre-inner {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.pre-count {
  font-family: var(--font-mono);
  font-size: clamp(3rem, 8vw, 6rem);
  color: var(--accent);
  line-height: 1;
  font-weight: 500;
}

.pre-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-3);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

/* ── NAVIGATION ─────────────────────────────────────────────── */
.codex-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(1.5rem, 4vw, 3rem);
  background: transparent;
  transition: background var(--transition), backdrop-filter var(--transition), border-color var(--transition);
  border-bottom: 1px solid transparent;
}

.codex-nav.scrolled {
  background: rgba(10, 10, 12, 0.85);
  backdrop-filter: blur(20px);
  border-bottom-color: var(--border);
}

[data-theme="light"] .codex-nav.scrolled {
  background: rgba(245, 242, 237, 0.88);
}

.nav-logo {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--text);
}

.logo-bracket {
  color: var(--accent);
}

.nav-chapters {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-ch {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  color: var(--text-3);
  letter-spacing: 0.05em;
  transition: color var(--transition), background var(--transition);
  position: relative;
}

.nav-ch::before {
  content: attr(data-chapter) " — ";
  opacity: 0.5;
  font-size: 0.65rem;
}

.nav-ch:hover,
.nav-ch.active {
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.08);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.theme-toggle {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-2);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  transition: all var(--transition);
  font-size: 1rem;
}

.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.nav-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: none;
  border: 1px solid var(--border-2);
  border-radius: 8px;
  cursor: pointer;
  padding: 8px;
}

.nav-burger span {
  display: block;
  height: 1.5px;
  background: var(--text-2);
  transition: all var(--transition);
}

.nav-burger.open span:nth-child(1) {
  transform: rotate(45deg) translate(4px, 4px);
}

.nav-burger.open span:nth-child(2) {
  opacity: 0;
}

.nav-burger.open span:nth-child(3) {
  transform: rotate(-45deg) translate(4px, -4px);
}

/* ── MOBILE MENU ────────────────────────────────────────────── */
.mobile-menu {
  position: fixed;
  top: var(--nav-h);
  left: 0;
  right: 0;
  z-index: 999;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  padding: 1.5rem 2rem;
  transform: translateY(-110%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu.open {
  transform: translateY(0);
}

.mobile-menu ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.mob-link {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-2);
  padding: 0.75rem 1rem;
  display: block;
  border-radius: 8px;
  transition: all var(--transition);
}

.mob-link:hover {
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.08);
}

/* ── STORY PROGRESS ─────────────────────────────────────────── */
.story-progress {
  position: fixed;
  top: var(--nav-h);
  left: 0;
  right: 0;
  z-index: 999;
  height: 2px;
  background: var(--border);
}

.sp-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.1s linear;
}

/* ── SECTIONS / CHAPTERS ────────────────────────────────────── */
.chapter {
  min-height: 100vh;
  padding: calc(var(--nav-h) + 5rem) 0 5rem;
  position: relative;
}

.chapter-tag {
  position: absolute;
  top: calc(var(--nav-h) + 2rem);
  left: clamp(1.5rem, 4vw, 3rem);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  pointer-events: none;
}

.ch-num {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--accent);
  letter-spacing: 0.15em;
  background: rgba(var(--accent-rgb), 0.1);
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  border: 1px solid rgba(var(--accent-rgb), 0.2);
}

.ch-title {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-3);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ── GRAIN OVERLAY ──────────────────────────────────────────── */
.grain-overlay {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  opacity: 0.4;
}

/* ── SECTION HEADER ─────────────────────────────────────────── */
.section-header {
  text-align: center;
  margin-bottom: 4rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  color: var(--text);
  margin-bottom: 1rem;
  line-height: 1.15;
}

.highlight-text {
  color: var(--accent);
  font-style: italic;
}

.section-sub {
  font-size: 1rem;
  color: var(--text-2);
  max-width: 480px;
  margin: 0 auto;
}

/* ── BUTTONS ────────────────────────────────────────────────── */
.btn-codex {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  padding: 0.9rem 2rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  font-weight: 500;
}

.btn-primary-codex {
  background: var(--accent);
  color: var(--bg);
}

.btn-primary-codex:hover {
  background: var(--accent-2);
  color: var(--bg);
  transform: translateY(-2px);
  box-shadow: var(--glow);
}

.btn-ghost-codex {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-2);
}

.btn-ghost-codex:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.06);
}

.btn-outline-codex {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border-2);
}

.btn-outline-codex:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ═══════════════════════════════════════
   HERO CHAPTER
═══════════════════════════════════════ */
.hero-chapter {
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hero-container {
  text-align: center;
  position: relative;
  z-index: 2;
}

/* Floating glyphs */
.glyph-field {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.glyph {
  position: absolute;
  font-size: clamp(3rem, 6vw, 8rem);
  color: rgba(var(--accent-rgb), 0.04);
  animation: floatGlyph 12s ease-in-out infinite;
  font-family: var(--font-display);
  user-select: none;
}

.glyph:nth-child(1) {
  top: 10%;
  left: 5%;
  animation-delay: 0s;
}

.glyph:nth-child(2) {
  top: 20%;
  right: 8%;
  animation-delay: 2s;
}

.glyph:nth-child(3) {
  bottom: 25%;
  left: 10%;
  animation-delay: 4s;
}

.glyph:nth-child(4) {
  bottom: 15%;
  right: 5%;
  animation-delay: 6s;
}

.glyph:nth-child(5) {
  top: 50%;
  left: 2%;
  animation-delay: 8s;
}

@keyframes floatGlyph {

  0%,
  100% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }

  50% {
    transform: translateY(-20px) rotate(5deg);
    opacity: 0.6;
  }
}

/* Eyebrow */
.hero-eyebrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.eyebrow-line {
  display: block;
  width: 40px;
  height: 1px;
  background: var(--accent);
}

.eyebrow-text {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

/* Headline */
.hero-headline {
  font-family: var(--font-display);
  font-size: clamp(3rem, 8vw, 6.5rem);
  font-weight: 900;
  line-height: 1.05;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hl-line {
  display: block;
}

.hl-italic {
  font-style: italic;
  color: var(--accent);
  font-weight: 400;
}

/* Sub */
.hero-sub {
  font-size: clamp(1rem, 1.8vw, 1.15rem);
  color: var(--text-2);
  margin-bottom: 2.5rem;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

/* Actions */
.hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 4rem;
}

/* Stats */
.hero-stats {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.stat-pill {
  display: flex;
  align-items: baseline;
  gap: 0.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 0.7rem 1.6rem;
  transition: all var(--transition);
}

.stat-pill:hover {
  border-color: var(--accent);
  box-shadow: var(--glow);
}

.stat-num {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.stat-unit {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--accent);
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-left: 0.5rem;
}

/* Scroll hint */
.scroll-hint {
  position: absolute;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.scroll-line {
  width: 1px;
  height: 40px;
  background: linear-gradient(to bottom, transparent, var(--accent));
  animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {

  0%,
  100% {
    opacity: 1;
    transform: scaleY(1);
  }

  50% {
    opacity: 0.4;
    transform: scaleY(0.6);
  }
}

/* ═══════════════════════════════════════
   ABOUT CHAPTER
═══════════════════════════════════════ */
.about-chapter {
  background: var(--bg-2);
}

.author-image-frame {
  position: relative;
  max-width: 420px;
  margin: 0 auto;
}

.frame-deco {
  position: absolute;
  width: 60px;
  height: 60px;
  z-index: 2;
}

.frame-deco.top-left {
  top: -12px;
  left: -12px;
  border-top: 2px solid var(--accent);
  border-left: 2px solid var(--accent);
}

.frame-deco.bottom-right {
  bottom: 40px;
  right: -12px;
  border-bottom: 2px solid var(--accent);
  border-right: 2px solid var(--accent);
}

.author-img {
  width: 100%;
  aspect-ratio: 4/5;
  object-fit: cover;
  border-radius: var(--radius-lg);
  filter: grayscale(20%);
  transition: filter var(--transition);
}

.author-img:hover {
  filter: grayscale(0%);
}

.img-caption {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  justify-content: center;
  margin-top: 1rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-3);
}

.ic-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(122, 232, 168, 0.4);
  }

  50% {
    box-shadow: 0 0 0 5px rgba(122, 232, 168, 0);
  }
}

.float-badge {
  position: absolute;
  bottom: 70px;
  left: -20px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 50px;
  padding: 0.6rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  box-shadow: var(--shadow);
  animation: floatBadge 4s ease-in-out infinite;
}

@keyframes floatBadge {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }
}

.about-content {
  padding-left: 1rem;
}

.about-intro {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 1.8vw, 1.35rem);
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 1.2rem;
}

.about-intro em {
  color: var(--accent);
  font-style: italic;
}

.about-body {
  color: var(--text-2);
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

/* Philosophy cards */
.philosophy-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin: 2rem 0;
}

.philosophy-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  transition: all var(--transition);
}

.philosophy-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: var(--glow);
}

.philosophy-card i {
  font-size: 1.4rem;
  color: var(--accent);
}

.philosophy-card strong {
  font-size: 0.85rem;
  color: var(--text);
  display: block;
}

.philosophy-card span {
  font-size: 0.72rem;
  color: var(--text-3);
  font-family: var(--font-mono);
}

/* ═══════════════════════════════════════
   SKILLS CHAPTER
═══════════════════════════════════════ */
.skills-chapter {
  background: var(--bg);
}

/* Terminal */
.terminal-window {
  background: #0d1117;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 3rem;
  box-shadow: var(--shadow);
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}

.terminal-bar {
  background: #161b22;
  padding: 0.85rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.tb-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.tb-dot.red {
  background: #ff5f57;
}

.tb-dot.yellow {
  background: #febc2e;
}

.tb-dot.green {
  background: #28c840;
}

.tb-title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.35);
  margin-left: 0.5rem;
}

.terminal-body {
  padding: 1.5rem;
  min-height: 120px;
}

.term-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  margin-bottom: 1rem;
}

.term-prompt {
  color: #28c840;
}

.term-cmd {
  color: #f0ede8;
}

.term-cursor {
  color: #e8c97a;
  animation: blink 1s step-end infinite;
}

@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }
}

.term-output {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: rgba(240, 237, 232, 0.7);
  line-height: 1.8;
}

.term-output .to-green {
  color: #28c840;
}

.term-output .to-blue {
  color: #79b8ff;
}

.term-output .to-gold {
  color: #e8c97a;
}

/* Skills grid */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.skill-category {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  transition: border-color var(--transition), transform var(--transition);
}

.skill-category:hover {
  border-color: var(--border-2);
  transform: translateY(-3px);
}

.sc-title {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.stag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.3rem 0.75rem;
  border-radius: 5px;
  border: 1px solid var(--border-2);
  color: var(--text-2);
  background: var(--bg);
  transition: all var(--transition);
  cursor: default;
}

.stag:hover,
.stag.active {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.08);
}

/* ═══════════════════════════════════════
   WORK CHAPTER
═══════════════════════════════════════ */
.work-chapter {
  background: var(--bg-2);
}

/* Filter buttons */
.work-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 3rem;
}

.wf-btn {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.5rem 1.25rem;
  border-radius: 50px;
  border: 1px solid var(--border-2);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.05em;
}

.wf-btn:hover,
.wf-btn.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

/* Projects grid */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.project-card.large-card {
  grid-column: span 2;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
}

.project-card:hover {
  border-color: var(--border-2);
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

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

.pc-image {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16/9;
}

.large-card .pc-image {
  aspect-ratio: 16/8;
}

.pc-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.project-card:hover .pc-image img {
  transform: scale(1.06);
}

.pc-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition);
}

.project-card:hover .pc-overlay {
  opacity: 1;
}

.pc-open {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: var(--bg);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(0.8);
  transition: transform var(--transition);
}

.project-card:hover .pc-open {
  transform: scale(1);
}

.pc-category-badge {
  position: absolute;
  top: 1rem;
  left: 1rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  padding: 0.3rem 0.75rem;
  background: rgba(0, 0, 0, 0.7);
  color: var(--accent);
  border-radius: 4px;
  letter-spacing: 0.08em;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(var(--accent-rgb), 0.2);
}

.pc-info {
  padding: 1.5rem;
}

.pc-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-3);
}

.pc-meta::before {
  content: "";
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.pc-title {
  font-family: var(--font-display);
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  color: var(--text);
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.pc-desc {
  font-size: 0.85rem;
  color: var(--text-2);
  margin-bottom: 1rem;
}

.pc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.pc-tags span {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  padding: 0.2rem 0.6rem;
  background: var(--bg);
  border-radius: 4px;
  color: var(--text-3);
  border: 1px solid var(--border);
}

.work-more {
  text-align: center;
}

/* ═══════════════════════════════════════
   PROJECT MODAL
═══════════════════════════════════════ */
.project-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s;
}

.project-modal.open {
  pointer-events: all;
  opacity: 1;
}

.pm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
}

.pm-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -45%) scale(0.95);
  width: min(90vw, 820px);
  max-height: 85vh;
  overflow-y: auto;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  scrollbar-width: thin;
}

.project-modal.open .pm-panel {
  transform: translate(-50%, -50%) scale(1);
}

.pm-close {
  position: sticky;
  top: 1rem;
  float: right;
  margin: 1rem 1rem 0 0;
  width: 40px;
  height: 40px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 50%;
  color: var(--text-2);
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  z-index: 10;
}

.pm-close:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.pm-body {
  padding: 2.5rem;
  clear: both;
}

.pm-img {
  width: 100%;
  border-radius: var(--radius);
  margin-bottom: 2rem;
  aspect-ratio: 16/8;
  object-fit: cover;
}

.pm-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  margin-bottom: 0.5rem;
}

.pm-type {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent);
  letter-spacing: 0.1em;
  margin-bottom: 1.5rem;
}

.pm-text {
  color: var(--text-2);
  font-size: 0.95rem;
  line-height: 1.8;
  margin-bottom: 1.5rem;
}

.pm-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.pm-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}

.pm-stat strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--accent);
}

.pm-stat span {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.pm-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.pm-stack span {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.35rem 0.85rem;
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--accent);
  border-radius: 6px;
  border: 1px solid rgba(var(--accent-rgb), 0.2);
}

/* ═══════════════════════════════════════
   PROCESS CHAPTER
═══════════════════════════════════════ */
.process-chapter {
  background: var(--bg);
}

.process-timeline {
  position: relative;
  max-width: 760px;
  margin: 0 auto;
}

.pt-step {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 2rem;
  margin-bottom: 3rem;
  position: relative;
}

.pt-step.right {
  grid-template-columns: 1fr 60px;
  text-align: right;
}

.pt-step.right .pts-content {
  order: -1;
}

.pt-step.right .pts-number {
  order: 1;
}

.pts-number {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.1);
  border: 1px solid rgba(var(--accent-rgb), 0.2);
  border-radius: 8px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.1em;
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 0.5rem;
}

.pts-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  position: relative;
  transition: border-color var(--transition), transform var(--transition);
}

.pts-content:hover {
  border-color: var(--accent);
  transform: translateX(4px);
}

.pt-step.right .pts-content:hover {
  transform: translateX(-4px);
}

.pts-icon {
  width: 44px;
  height: 44px;
  background: rgba(var(--accent-rgb), 0.1);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--accent);
  margin-bottom: 1rem;
}

.pt-step.right .pts-icon {
  margin-left: auto;
}

.pts-content h3 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.pts-content p {
  color: var(--text-2);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.pts-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.pts-list li {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-3);
  padding-left: 1.2rem;
  position: relative;
}

.pts-list li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.pt-step.right .pts-list {
  align-items: flex-end;
}

.pt-step.right .pts-list li {
  padding-left: 0;
  padding-right: 1.2rem;
}

.pt-step.right .pts-list li::before {
  left: auto;
  right: 0;
  content: "←";
}

/* ═══════════════════════════════════════
   TESTIMONIALS
═══════════════════════════════════════ */
.testimonials-chapter {
  padding: 5rem 0;
  background: var(--bg-2);
}

.testimonial-swiper {
  padding-bottom: 3rem !important;
}

.testi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  transition: border-color var(--transition);
}

.testi-card:hover {
  border-color: var(--border-2);
}

.tc-stars {
  color: var(--accent);
  font-size: 1rem;
  letter-spacing: 0.1em;
  margin-bottom: 1.2rem;
}

.tc-quote {
  font-family: var(--font-display);
  font-size: clamp(0.95rem, 1.5vw, 1.1rem);
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 1.5rem;
  font-style: italic;
}

.tc-author {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.tc-author img {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-2);
}

.tc-author strong {
  display: block;
  font-size: 0.85rem;
  color: var(--text);
  font-family: var(--font-body);
}

.tc-author span {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-3);
}

/* Swiper pagination */
.testimonial-swiper .swiper-pagination-bullet {
  background: var(--border-2);
  opacity: 1;
}

.testimonial-swiper .swiper-pagination-bullet-active {
  background: var(--accent);
}

.ts-prev,
.ts-next {
  color: var(--accent) !important;
}

.ts-prev::after,
.ts-next::after {
  font-size: 1rem !important;
}

/* ═══════════════════════════════════════
   CONTACT CHAPTER
═══════════════════════════════════════ */
.contact-chapter {
  background: var(--bg);
  overflow: hidden;
}

.contact-inner {
  text-align: center;
  margin-bottom: 3rem;
}

.contact-headline {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1.1;
  margin-bottom: 1.2rem;
}

.contact-sub {
  color: var(--text-2);
  max-width: 460px;
  margin: 0 auto 2.5rem;
  font-size: 0.95rem;
}

/* Form */
.contact-form {
  text-align: left;
}

.cf-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.cf-field label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.cf-field input,
.cf-field select,
.cf-field textarea {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 10px;
  padding: 0.85rem 1.1rem;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  resize: none;
  -webkit-appearance: none;
}

.cf-field select option {
  background: var(--bg-2);
}

.cf-field input:focus,
.cf-field select:focus,
.cf-field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
}

.cf-field input::placeholder,
.cf-field textarea::placeholder {
  color: var(--text-3);
}

/* Contact strip */
.contact-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2rem;
  border-top: 1px solid var(--border);
  padding-top: 2.5rem;
  margin-top: 1rem;
}

.cs-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-3);
  transition: color var(--transition);
}

.cs-item:hover {
  color: var(--accent);
}

.cs-item i {
  color: var(--accent);
}

/* ═══════════════════════════════════════
   FOOTER
═══════════════════════════════════════ */
.codex-footer {
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  padding: 3rem 0 2rem;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-logo {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.1em;
}

.footer-logo p {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--text-3);
  letter-spacing: normal;
  margin-top: 0.3rem;
}

.footer-socials {
  display: flex;
  gap: 0.75rem;
}

.footer-socials a {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border-2);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  font-size: 1rem;
  transition: all var(--transition);
}

.footer-socials a:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.08);
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-3);
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}

/* ═══════════════════════════════════════
   BACK TO TOP
═══════════════════════════════════════ */
.back-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 500;
  width: 44px;
  height: 44px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 10px;
  color: var(--accent);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
}

.back-top.visible {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.back-top:hover {
  background: var(--accent);
  color: var(--bg);
  transform: translateY(-3px);
}

/* ═══════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════ */
@media (max-width: 1024px) {
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .project-card.large-card {
    grid-column: span 2;
  }
}

@media (max-width: 768px) {
  .nav-chapters {
    display: none;
  }

  .nav-burger {
    display: flex;
  }

  .chapter {
    padding-top: calc(var(--nav-h) + 3rem);
  }

  .hero-headline {
    font-size: clamp(2.5rem, 8vw, 4rem);
  }

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

  .project-card.large-card {
    grid-column: span 1;
  }

  .philosophy-row {
    grid-template-columns: 1fr;
  }

  .pt-step,
  .pt-step.right {
    grid-template-columns: 50px 1fr;
    text-align: left;
  }

  /* .pt-step.right .pts-content { order: 1; } */
  .pt-step.right .pts-number {
    order: -1;
  }

  .pt-step.right .pts-content:hover {
    transform: translateX(4px);
  }

  .pt-step.right .pts-icon {
    margin-left: 0;
  }

  .pt-step.right .pts-list {
    align-items: flex-start;
  }

  .pt-step.right .pts-list li {
    padding-left: 1.2rem;
    padding-right: 0;
  }

  .pt-step.right .pts-list li::before {
    left: 0;
    right: auto;
    content: "→";
  }

  .pm-stats-row {
    grid-template-columns: 1fr;
  }

  .float-badge {
    left: 0;
  }

  .contact-headline {
    font-size: clamp(2rem, 7vw, 3rem);
  }
}

@media (max-width: 480px) {
  .hero-stats {
    flex-direction: column;
    align-items: center;
  }

  .hero-actions {
    flex-direction: column;
    align-items: center;
  }

  .contact-strip {
    flex-direction: column;
    align-items: center;
  }

  .footer-inner {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

/* ─── AOS tweaks ─────────────────────────────────────────────── */
[data-aos] {
  backface-visibility: hidden;
}