/* ============================================================
   PORTFOLIO STYLES — Dark Luxury Editorial
   ============================================================ */

/* ── Google Fonts ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400;1,600&family=DM+Sans:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── CSS Variables (from config.js via JS) ──────────────────── */
:root {
  --bg:         #080808;
  --surface:    #111111;
  --surface2:   #1A1A1A;
  --accent:     #C9A96E;
  --accent-rgb: 201, 169, 110;
  --text:       #F0EBE1;
  --muted:      #888880;
  --border:     #2A2A2A;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', monospace;
  --radius:     12px;
  --radius-lg:  20px;
  --transition: 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --max-width:  1180px;
  --gutter:     clamp(1.25rem, 5vw, 2.5rem);
}

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

html {
  scroll-behavior: smooth;
  /* Adjust '100px' to your preference. 
     Higher numbers create more space above the section. */
  scroll-padding-top: calc(40px + env(safe-area-inset-top)); 
  font-size: 16px;
  overflow-x: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.7;
  overflow-x: hidden;
  cursor: none; /* custom cursor */
  -webkit-font-smoothing: antialiased;
}

/* ── Custom Cursor ───────────────────────────────────────── */
#cursor {
  position: fixed;
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: width 0.2s, height 0.2s, opacity 0.2s;
  mix-blend-mode: normal;
}

#cursor-ring {
  position: fixed;
  width: 36px;
  height: 36px;
  border: 1.5px solid rgba(var(--accent-rgb), 0.4);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%, -50%);
  transition: width 0.4s var(--transition), height 0.4s var(--transition), border-color 0.3s;
}

body:not(:hover) #cursor,
body:not(:hover) #cursor-ring { opacity: 0; }

#cursor.hovering { width: 6px; height: 6px; }
#cursor-ring.hovering {
  width: 56px;
  height: 56px;
  border-color: rgba(var(--accent-rgb), 0.7);
}

@media (hover: none) {
  #cursor, #cursor-ring { display: none; }
  body { cursor: auto; }
}

/* ── Typography ──────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.15;
  color: var(--text);
}

h1 { font-size: clamp(2.6rem, 6vw, 5rem); font-weight: 700; }
h2 { font-size: clamp(2rem, 4vw, 3.2rem); font-weight: 600; }
h3 { font-size: clamp(1.2rem, 2.5vw, 1.6rem); font-weight: 600; }
h4 { font-size: 1.1rem; font-weight: 600; }

p { color: var(--muted); font-size: clamp(0.95rem, 1.5vw, 1.05rem); }

a { color: var(--accent); text-decoration: none; transition: opacity var(--transition); }
a:hover { opacity: 0.75; }

/* ── Layout Utilities ────────────────────────────────────── */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.section {
  padding: clamp(4rem, 10vw, 8rem) 0;
}

.label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.label::before {
  content: '';
  display: inline-block;
  width: 24px;
  height: 1px;
  background: var(--accent);
}

.section-header {
  margin-bottom: clamp(2.5rem, 6vw, 4rem);
}

.section-header p {
  max-width: 520px;
  margin-top: 0.75rem;
  font-size: 1.05rem;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.75rem;
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--accent);
  color: #0A0806;
  font-weight: 600;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.15);
  transform: translateX(-100%);
  transition: transform 0.4s var(--transition);
}

.btn-primary:hover::before { transform: translateX(0); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(var(--accent-rgb), 0.35); color: #0A0806; opacity: 1; }

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

.btn-ghost:hover {
  border-color: rgba(var(--accent-rgb), 0.5);
  color: var(--accent);
  opacity: 1;
  transform: translateY(-2px);
}

/* ── Noise Texture Overlay ───────────────────────────────── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  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)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9997;
  opacity: 0.4;
}

/* ── ─── NAVIGATION ─── ────────────────────────────────── */
#nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 1.25rem var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background var(--transition), padding var(--transition);
}

#nav.scrolled {
  background: var(--colorBg);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0.9rem var(--gutter);
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

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

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

.nav-links a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: color var(--transition);
  letter-spacing: 0.02em;
}

.nav-links a:hover { color: var(--text); opacity: 1; }
.nav-links a.active { color: var(--text) !important; }

.nav-cta {
  padding: 0.55rem 1.25rem;
  background: transparent;
  border: 1px solid rgba(var(--accent-rgb), 0.5);
  color: var(--accent) !important;
  border-radius: 5px;
  font-size: 0.85rem !important;
  transition: all var(--transition) !important;
}

.nav-cta:hover {
  background: var(--accent);
  color: #0A0806 !important;
  border-color: var(--accent);
}

.nav-mobile-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
  background: none;
  border: none;
}

.nav-mobile-toggle span {
  display: block;
  width: 24px;
  height: 1.5px;
  background: var(--text);
  transition: all 0.3s;
}

@media (max-width: 768px) {
  .nav-links {
    /* Full-viewport overlay so it can never be clipped by the nav bar */
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--colorBg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    z-index: 999; /* just below the nav bar (z-index: 1000) */
    /* Hidden state — fade + slight slide */
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: opacity 0.28s ease, transform 0.28s ease;
    padding: 0;
  }

  .nav-links.open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
  }

  .nav-links li {
    width: 100%;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }

  .nav-links li:last-child {
    border-bottom: none;
    padding-top: 1.5rem;
  }

  .nav-links a {
    display: block;
    padding: 1.1rem 2rem;
    font-size: 1.4rem;
    color: var(--text) !important;
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.01em;
    transition: color 0.2s ease;
  }

  .nav-links a:hover,
  .nav-links a.active {
    color: var(--accent) !important;
    opacity: 1;
  }

  /* Re-style the CTA link inside the overlay */
  .nav-links .nav-cta {
    font-size: 1rem !important;
    font-family: var(--font-body) !important;
    font-weight: 600 !important;
    padding: 0.8rem 2.25rem !important;
    border: 1px solid rgba(var(--accent-rgb), 0.45) !important;
    border-radius: 6px !important;
    color: var(--accent) !important;
    display: inline-block !important;
    width: auto !important;
    margin: 0 auto !important;
    background: rgba(var(--accent-rgb), 0.07) !important;
  }

  .nav-links .nav-cta:hover {
    background: var(--accent) !important;
    color: #0A0806 !important;
    border-color: var(--accent) !important;
    opacity: 1;
  }

  .nav-mobile-toggle {
    display: flex;
    z-index: 1001; /* above the overlay */
  }
}

/* Hamburger → X animation */
.nav-mobile-toggle span {
  transition: transform 0.25s ease, opacity 0.2s ease;
}
.nav-mobile-toggle.is-open span:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
}
.nav-mobile-toggle.is-open span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.nav-mobile-toggle.is-open span:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
}

/* ── ─── HERO SECTION ─── ──────────────────────────────── */
#hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  padding-top: 6rem;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 70% 50%, rgba(var(--accent-rgb), 0.07) 0%, transparent 60%),
    radial-gradient(ellipse 50% 80% at 10% 80%, rgba(var(--accent-rgb), 0.04) 0%, transparent 50%);
}

.hero-grid-lines {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, black 0%, transparent 100%);
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 820px;
}

.hero-availability {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.9rem;
  background: rgba(var(--accent-rgb), 0.1);
  border: 1px solid rgba(var(--accent-rgb), 0.25);
  border-radius: 100px;
  font-size: 0.8rem;
  color: var(--accent);
  margin-bottom: 1.75rem;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
}

.hero-availability::before {
  content: '';
  width: 7px; height: 7px;
  background: #4CAF50;
  border-radius: 50%;
  box-shadow: 0 0 8px #4CAF50;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.hero-headline {
  margin-bottom: 1.25rem;
  letter-spacing: -0.03em;
}

.hero-headline em {
  font-style: italic;
  color: var(--accent);
}

.hero-sub {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--muted);
  max-width: 560px;
  margin-bottom: 2.5rem;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 3.5rem;
}

.hero-social-proof {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.hero-avatars {
  display: flex;
}

.hero-avatars .avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 2px solid var(--bg);
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--accent);
  margin-right: -10px;
  font-family: var(--font-mono);
}

.hero-social-text {
  font-size: 0.85rem;
  color: var(--muted);
}

.hero-social-text strong { color: var(--text); }

.hero-scroll-hint {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  animation: bounce 2.5s infinite;
}

.hero-scroll-hint::after {
  content: '';
  width: 1px;
  height: 48px;
  background: linear-gradient(to bottom, var(--muted), transparent);
}

@keyframes bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(6px); }
}

/* ── ─── STATS BAR ─── ──────────────────────────────────── */
#stats {
  padding: 2.5rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.stat-item {
  text-align: center;
  padding: 1.25rem;
  position: relative;
}

.stat-item:not(:last-child)::after {
  content: '';
  position: absolute;
  right: 0; top: 25%; bottom: 25%;
  width: 1px;
  background: var(--border);
}

.stat-value {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 0.4rem;
}

.stat-label {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 400;
}

@media (max-width: 600px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── ─── PORTFOLIO ─── ──────────────────────────────────── */
#portfolio { background: var(--bg); }

.portfolio-filter {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 2.5rem;
}

.filter-btn {
  padding: 0.4rem 1rem;
  border-radius: 100px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  transition: all var(--transition);
  font-family: var(--font-body);
}

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

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.portfolio-grid .card:first-child,
.portfolio-grid .card:nth-child(2) {
  grid-column: span 1;
}

@media (max-width: 900px) {
  .portfolio-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 580px) {
  .portfolio-grid { grid-template-columns: 1fr; }
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  position: relative;
}

.project-card:hover {
  transform: translateY(-6px);
  border-color: rgba(var(--accent-rgb), 0.3);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(var(--accent-rgb), 0.1);
}

.project-preview {
  aspect-ratio: 16/9;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  font-size: 4rem;
}

.project-preview-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.preview-category-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.35rem 0.9rem;
  border-radius: 100px;
  border: 1px solid;
  position: relative;
  z-index: 2;
}

.project-preview .mock-browser {
  position: absolute;
  inset: 10px;
  background: rgba(0,0,0,0.25);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.08);
  overflow: hidden;
}

.mock-browser-bar {
  height: 28px;
  background: rgba(0,0,0,0.4);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  padding: 0 10px;
  gap: 5px;
}

.mock-browser-bar span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
}

.mock-browser-content {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mock-line {
  height: 6px;
  border-radius: 3px;
  background: rgba(255,255,255,0.1);
}

.mock-line.short { width: 40%; }
.mock-line.medium { width: 65%; }
.mock-line.accent-line { background: rgba(var(--accent-rgb), 0.3); width: 30%; }

.project-body {
  padding: 1.5rem;
}

.project-category {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.project-title {
  font-size: 1.25rem;
  margin-bottom: 0.6rem;
  font-family: var(--font-display);
  font-weight: 600;
}

.project-desc {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 1rem;
  line-height: 1.6;
}

.project-outcome {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #4CAF50;
  padding: 0.3rem 0.75rem;
  background: rgba(76, 175, 80, 0.1);
  border-radius: 100px;
  margin-bottom: 1rem;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
}

.project-tag {
  font-size: 0.75rem;
  color: var(--muted);
  padding: 0.25rem 0.65rem;
  border-radius: 4px;
  background: var(--surface2);
  border: 1px solid var(--border);
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  transition: gap var(--transition);
}

.project-link:hover { gap: 0.7rem; opacity: 1; }

/* ── ─── SERVICES ─── ────────────────────────────────────── */
#services {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

@media (max-width: 900px) {
  .services-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  .services-grid { grid-template-columns: 1fr; }
}

.service-card {
  background: var(--surface);
  padding: 2.25rem;
  transition: background var(--transition);
  position: relative;
  overflow: hidden;
}

.service-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(to right, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.service-card:hover { background: var(--surface2); }
.service-card:hover::before { opacity: 1; }

.service-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(var(--accent-rgb), 0.08);
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  border-radius: 10px;
  color: var(--accent);
  margin-bottom: 1.1rem;
  flex-shrink: 0;
}

.service-title {
  font-size: 1.1rem;
  margin-bottom: 0.6rem;
  font-family: var(--font-display);
}

.service-desc {
  font-size: 0.88rem;
  line-height: 1.65;
  margin-bottom: 1rem;
}

.service-highlight {
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: var(--accent);
  letter-spacing: 0.05em;
}

/* ── ─── PROCESS ─── ─────────────────────────────────────── */
#process { background: var(--bg); }

.process-list {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  position: relative;
}

.process-list::before {
  content: '';
  position: absolute;
  top: 28px;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--border), var(--border), transparent);
}

@media (max-width: 900px) {
  .process-list {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .process-list::before { display: none; }
}

.process-step {
  text-align: center;
  padding: 0 1.25rem;
  position: relative;
}

@media (max-width: 900px) {
  .process-step {
    text-align: left;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1.25rem;
    align-items: start;
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border);
  }
  .process-step:last-child { border-bottom: none; }
  .process-step-content { padding: 0; }
}

.process-number {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  margin: 0 auto 1.5rem;
  position: relative;
  z-index: 1;
  transition: all var(--transition);
}

.process-step:hover .process-number {
  background: rgba(var(--accent-rgb), 0.1);
  border-color: rgba(var(--accent-rgb), 0.5);
  box-shadow: 0 0 20px rgba(var(--accent-rgb), 0.15);
}

@media (max-width: 900px) {
  .process-number { margin: 0; flex-shrink: 0; }
}

.process-title {
  font-size: 1rem;
  margin-bottom: 0.5rem;
  font-family: var(--font-display);
}

.process-desc {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.6;
}

/* ── ─── TESTIMONIALS ─── ────────────────────────────────── */
#testimonials {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.testimonials-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .testimonials-grid { grid-template-columns: 1fr; max-width: 520px; }
}

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

.testimonial-card:hover {
  transform: translateY(-4px);
  border-color: rgba(var(--accent-rgb), 0.25);
}

.testimonial-stars {
  display: flex;
  gap: 4px;
  margin-bottom: 1rem;
}

.testimonial-stars .star {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 1px;
  transform: rotate(45deg);
  flex-shrink: 0;
}

.testimonial-text {
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--text);
  margin-bottom: 1.5rem;
  font-style: italic;
  font-family: var(--font-display);
  font-weight: 400;
}

.testimonial-author {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.testimonial-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: rgba(var(--accent-rgb), 0.15);
  border: 1px solid rgba(var(--accent-rgb), 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
}

.testimonial-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

.testimonial-biz {
  font-size: 0.78rem;
  color: var(--muted);
}

/* ── ─── ABOUT ─── ───────────────────────────────────────── */
#about { background: var(--bg); }

.about-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2.5rem, 6vw, 5rem);
  align-items: center;
}

@media (max-width: 768px) {
  .about-layout { grid-template-columns: 1fr; }
}

.about-visual {
  position: relative;
}

.about-photo-frame {
  aspect-ratio: 3/4;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  max-width: 380px;
}

.about-photo-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
  background:
    radial-gradient(ellipse 60% 60% at 50% 40%, rgba(var(--accent-rgb), 0.08) 0%, transparent 70%);
}

.about-photo-placeholder .big-initials {
  font-family: var(--font-display);
  font-size: clamp(5rem, 12vw, 9rem);
  font-weight: 700;
  color: rgba(var(--accent-rgb), 0.15);
  line-height: 1;
  letter-spacing: -0.05em;
}

.about-card-float {
  position: absolute;
  bottom: -1rem;
  right: -1rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  width: 180px;
}

.about-card-float .value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.about-card-float .desc {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.about-text .section-header { margin-bottom: 1.5rem; }

.about-paragraphs {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}

.about-paragraphs p { font-size: 0.97rem; line-height: 1.75; }

.about-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.skill-pill {
  padding: 0.3rem 0.8rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.08);
  border: 1px solid rgba(var(--accent-rgb), 0.2);
}

/* ── ─── CTA SECTION ─── ─────────────────────────────────── */
#cta {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.cta-inner {
  max-width: 700px;
  margin: 0 auto;
  text-align: center;
}

.cta-inner h2 {
  margin-bottom: 1rem;
}

.cta-inner p {
  font-size: 1.1rem;
  margin-bottom: 2rem;
  max-width: none;
}

.cta-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.cta-footnote {
  font-size: 0.82rem;
  color: var(--muted);
  font-family: var(--font-mono);
}

/* ── ─── CONTACT ─── ─────────────────────────────────────── */
#contact { background: var(--bg); }

.contact-layout {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: clamp(2.5rem, 6vw, 5rem);
  align-items: start;
}

@media (max-width: 768px) {
  .contact-layout { grid-template-columns: 1fr; }
}

.contact-info-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
}

.contact-info-item:last-child { border-bottom: none; }

.contact-info-icon {
  width: 40px; height: 40px;
  background: rgba(var(--accent-rgb), 0.08);
  border: 1px solid rgba(var(--accent-rgb), 0.15);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--accent);
}

.contact-info-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.2rem;
}

.contact-info-value {
  font-size: 0.95rem;
  color: var(--text);
  font-weight: 500;
}

.contact-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 480px) {
  .form-row { grid-template-columns: 1fr; }
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.5rem;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  -webkit-appearance: none;
}

.form-group select option { background: var(--surface); }

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: rgba(var(--accent-rgb), 0.5);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.1);
}

.form-group textarea {
  min-height: 120px;
  resize: vertical;
}

.form-submit {
  width: 100%;
  padding: 1rem;
  font-size: 1rem;
}

.form-success {
  display: none;
  text-align: center;
  padding: 2.5rem 2rem;
  color: #4CAF50;
}

.form-success.show { display: block; }

.form-success-icon {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: rgba(76, 175, 80, 0.12);
  border: 1px solid rgba(76, 175, 80, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

/* ── ─── FOOTER ─── ──────────────────────────────────────── */
#footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 3rem 0 2rem;
}

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

.footer-logo {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}

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

.footer-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
  flex-wrap: wrap;
}

.footer-links a {
  font-size: 0.85rem;
  color: var(--muted);
  transition: color var(--transition);
}

.footer-links a:hover { color: var(--text); opacity: 1; }

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

.footer-social a {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--muted);
  transition: all var(--transition);
}

.footer-social a:hover {
  border-color: rgba(var(--accent-rgb), 0.5);
  color: var(--accent);
  opacity: 1;
}

.footer-copy {
  width: 100%;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  margin-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-copy p {
  font-size: 0.8rem;
  color: var(--muted);
}

/* ── ─── SCROLL ANIMATIONS ─── ───────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }
.reveal-delay-5 { transition-delay: 0.5s; }

/* ── ─── BACK TO TOP ─── ─────────────────────────────────── */
#back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(var(--accent-rgb), 0.15);
  border: 1px solid rgba(var(--accent-rgb), 0.3);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 100;
  transition: all var(--transition);
  opacity: 0;
  transform: translateY(10px);
  font-size: 1rem;
}

#back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
}

#back-to-top:hover {
  background: var(--accent);
  color: #0A0806;
}

/* ── ─── MOBILE IMPROVEMENTS ─── ─────────────────────────── */

/* Reduce reveal animation distance on mobile (less jarring) */
@media (max-width: 768px) {
  .reveal { transform: translateY(18px); }
  /* Disable transition delays on mobile — stagger looks broken in small viewports */
  .reveal-delay-1,
  .reveal-delay-2,
  .reveal-delay-3,
  .reveal-delay-4,
  .reveal-delay-5 { transition-delay: 0s; }
}

/* ── Navigation mobile ───────────────────────────────────── */
@media (max-width: 768px) {
  #nav {
    padding: 1rem var(--gutter);
  }

  #nav.scrolled {
    padding: 0.8rem var(--gutter);
  }

  .nav-logo {
    font-size: 1.15rem;
  }
}

/* ── Hero mobile ─────────────────────────────────────────── */
@media (max-width: 768px) {
  #hero {
    padding-top: 5rem;
    min-height: 100svh; /* use small viewport height on mobile */
    align-items: flex-start;
    padding-bottom: 5rem;
  }

  .hero-content {
    max-width: 100%;
  }

  .hero-availability {
    font-size: 0.73rem;
    padding: 0.35rem 0.8rem;
    margin-bottom: 1.4rem;
  }

  .hero-headline {
    letter-spacing: -0.025em;
    margin-bottom: 1rem;
  }

  .hero-sub {
    font-size: 0.98rem;
    margin-bottom: 2rem;
  }

  .hero-actions {
    gap: 0.75rem;
    margin-bottom: 2.5rem;
  }

  .btn {
    padding: 0.8rem 1.4rem;
    font-size: 0.92rem;
  }

  .hero-social-proof {
    gap: 0.75rem;
  }

  .hero-scroll-hint {
    display: none; /* unnecessary on mobile */
  }
}

@media (max-width: 400px) {
  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-actions .btn {
    text-align: center;
    justify-content: center;
  }
}

/* ── Stats bar mobile ────────────────────────────────────── */
@media (max-width: 600px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0;
  }

  .stat-item {
    padding: 1.25rem 0.75rem;
    border-bottom: 1px solid var(--border);
  }

  /* Remove right border on every-other (last in row) */
  .stat-item:nth-child(2n)::after { display: none; }

  /* Last two items don't need bottom border */
  .stat-item:nth-child(3),
  .stat-item:nth-child(4) { border-bottom: none; }

  .stat-value { font-size: 1.9rem; }
  .stat-label { font-size: 0.78rem; }
}

/* ── Portfolio mobile ────────────────────────────────────── */
@media (max-width: 768px) {
  .portfolio-filter {
    gap: 0.4rem;
    margin-bottom: 2rem;
    /* Horizontally scrollable on small screens */
    overflow-x: auto;
    padding-bottom: 0.5rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .portfolio-filter::-webkit-scrollbar { display: none; }

  .filter-btn {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 0.4rem 0.9rem;
  }
}

@media (max-width: 580px) {
  .portfolio-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .project-preview {
    aspect-ratio: 16/8;
  }

  .project-body {
    padding: 1.25rem;
  }

  .project-title { font-size: 1.1rem; }

  .project-tags {
    margin-bottom: 1rem;
  }
}

/* ── Services mobile ─────────────────────────────────────── */
@media (max-width: 900px) {
  .services-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .services-grid {
    grid-template-columns: 1fr;
  }

  .service-card {
    padding: 1.75rem 1.5rem;
  }
}

/* ── Process mobile ──────────────────────────────────────── */
@media (max-width: 900px) {
  .process-list {
    grid-template-columns: 1fr;
    max-width: 520px;
  }

  .process-step {
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 1.25rem;
    align-items: start;
    text-align: left;
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border);
  }

  .process-step:last-child { border-bottom: none; }

  .process-number {
    margin: 0;
    flex-shrink: 0;
  }
}

/* ── Testimonials mobile ─────────────────────────────────── */
@media (max-width: 900px) {
  .testimonials-grid {
    grid-template-columns: 1fr;
    max-width: 520px;
  }
}

@media (max-width: 580px) {
  .testimonial-card {
    padding: 1.5rem;
  }

  .testimonial-text {
    font-size: 0.9rem;
  }
}

/* ── About mobile ────────────────────────────────────────── */
@media (max-width: 768px) {
  .about-layout {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .about-photo-frame {
    max-width: 100%;
    aspect-ratio: 4/3; /* landscape on mobile to save vertical space */
  }

  .about-card-float {
    right: 0;
    bottom: -0.75rem;
  }
}

@media (max-width: 480px) {
  .about-photo-frame {
    aspect-ratio: 3/2;
  }

  .about-card-float {
    width: 150px;
    padding: 0.75rem 1rem;
  }

  .about-card-float .value { font-size: 1.6rem; }
}

/* ── CTA section mobile ──────────────────────────────────── */
@media (max-width: 580px) {
  .cta-inner h2 {
    font-size: clamp(1.6rem, 6vw, 2.2rem);
  }

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

  .cta-actions .btn {
    width: 100%;
    max-width: 320px;
    justify-content: center;
  }
}

/* ── Contact mobile ──────────────────────────────────────── */
@media (max-width: 768px) {
  .contact-layout {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }
}

@media (max-width: 480px) {
  .contact-form {
    padding: 1.5rem;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 16px; /* prevent iOS zoom on focus */
  }
}

/* ── Footer mobile ───────────────────────────────────────── */
@media (max-width: 640px) {
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
  }

  .footer-links {
    gap: 1rem;
  }

  .footer-copy {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}

/* ── Back to top mobile ──────────────────────────────────── */
@media (max-width: 768px) {
  #back-to-top {
    bottom: 1.25rem;
    right: 1.25rem;
    width: 40px;
    height: 40px;
  }
}

/* ── Prevent horizontal overflow site-wide ───────────────── */
section, footer {
  max-width: 100vw;
  overflow-x: hidden;
}
/* NOTE: nav intentionally excluded — overflow:hidden clips the mobile dropdown */

/* ── Touch-friendly tap targets ──────────────────────────── */
@media (hover: none) {
  .btn, .filter-btn, .nav-links a, .project-link {
    min-height: 44px;
  }

  /* Disable hover transforms on touch devices */
  .project-card:hover,
  .testimonial-card:hover,
  .service-card:hover {
    transform: none;
  }

  .btn-primary:hover {
    transform: none;
    box-shadow: none;
  }
}

/* ── Section spacing tighten on small screens ────────────── */
@media (max-width: 480px) {
  .section {
    padding: clamp(3rem, 8vw, 5rem) 0;
  }

  h2 {
    font-size: clamp(1.7rem, 7vw, 2.4rem);
  }

  .section-header {
    margin-bottom: 2rem;
  }
}

/* ── ─── THEME PICKER ─── ────────────────────────────────── */

#theme-picker {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  z-index: 1005;
}

@media (max-width: 768px) {
  #theme-picker {
    bottom: 1.25rem;
    left: 1.25rem;
  }
}

/* ── Trigger button ──────────────────────────────────────── */
#theme-trigger {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  position: relative;
  overflow: hidden;
}

#theme-trigger::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(
    hsl(0,80%,60%), hsl(45,80%,60%), hsl(90,80%,60%),
    hsl(135,80%,60%), hsl(180,80%,60%), hsl(225,80%,60%),
    hsl(270,80%,60%), hsl(315,80%,60%), hsl(360,80%,60%)
  );
  opacity: 0;
  transition: opacity var(--transition);
}

#theme-trigger:hover {
  transform: scale(1.08);
  border-color: rgba(255,255,255,0.15);
}

#theme-trigger:hover::before { opacity: 0.25; }

#theme-trigger[aria-expanded="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.2), 0 4px 20px rgba(0,0,0,0.4);
}

#theme-trigger[aria-expanded="true"]::before { opacity: 0.2; }

#theme-trigger.pulse {
  animation: tp-pulse 0.6s ease;
}

@keyframes tp-pulse {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.18); }
  100% { transform: scale(1); }
}

/* ── Panel ───────────────────────────────────────────────── */
#theme-panel {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 0;
  width: 220px;
  background: #141414;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.04);
  padding: 0 0 1.25rem;
  overflow: hidden;
  transform-origin: bottom left;

  /* Hidden state */
  opacity: 0;
  transform: scale(0.9) translateY(8px);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#theme-panel.open {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: all;
}

/* ── Theme Picker Mobile Overrides ── */
@media (max-width: 768px) {
  #theme-panel {
    width: 185px; /* Super compact for mobile */
    padding-bottom: 0.75rem;
  }
  
  .tp-header {
    padding: 0.75rem 0.85rem 0.5rem;
  }
  
  .tp-wheel-wrap {
    width: 105px;
    height: 105px;
    margin: 0.75rem auto 0.5rem;
  }
  
  .tp-presets {
    display: 4px;
  }

  .tp-presets-wrap {
    display: none;
  }
  
  .tp-preset {
    width: 20px;
    height: 20px;
  }
  
  #tp-hex-input {
    font-size: 0.75rem;
    padding: 0.35rem 0.5rem;
  }
  
  #tp-apply-btn {
    font-size: 0.7rem;
    padding: 0.35rem 0.6rem;
  }
}

/* ── Panel header ────────────────────────────────────────── */
.tp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.1rem 0.75rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}

.tp-title {
  font-size: 0.78rem;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.tp-close {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
}

.tp-close:hover { color: var(--text); border-color: rgba(255,255,255,0.2); }

/* ── Color wheel ─────────────────────────────────────────── */
.tp-wheel-wrap {
  position: relative;
  width: 130px;
  height: 130px;
  margin: 1.25rem auto 0.75rem;
  cursor: crosshair;
  flex-shrink: 0;
}

#tp-wheel {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: block;
  user-select: none;
  -webkit-user-select: none;
}

/* Cursor dot on the wheel */
#tp-wheel-cursor {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.4), 0 2px 8px rgba(0,0,0,0.5);
  transform: translate(-50%, -50%);
  pointer-events: none;
  transition: left 0.08s ease, top 0.08s ease;
  z-index: 2;
  background: transparent;
}

/* Center preview swatch */
.tp-wheel-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.12);
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
  pointer-events: none;
  z-index: 1;
}

#tp-preview-swatch {
  width: 100%;
  height: 100%;
  transition: background 0.15s ease;
}

/* ── Brightness slider ───────────────────────────────────── */
.tp-brightness-wrap {
  padding: 0 1.1rem 0;
  margin-bottom: 1.1rem;
}

.tp-label {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-bottom: 0.55rem;
}

.tp-brightness-track {
  position: relative;
  height: 10px;
  border-radius: 5px;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.08);
  user-select: none;
}

#tp-brightness-thumb {
  position: absolute;
  top: 50%;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(0,0,0,0.3);
  box-shadow: 0 1px 6px rgba(0,0,0,0.5);
  transform: translate(-50%, -50%);
  transition: left 0.08s ease;
  pointer-events: none;
}

/* ── Presets ─────────────────────────────────────────────── */
.tp-presets-wrap {
  padding: 0 1.1rem;
  margin-bottom: 1.1rem;
}

.tp-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tp-preset {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  padding: 0;
  flex-shrink: 0;
}

.tp-preset:hover {
  transform: scale(1.18);
  box-shadow: 0 3px 10px rgba(0,0,0,0.4);
}

.tp-preset.active {
  border-color: #fff;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.4), 0 3px 10px rgba(0,0,0,0.4);
  transform: scale(1.1);
}

/* ── Hex input ───────────────────────────────────────────── */
.tp-hex-wrap {
  padding: 0 1.1rem 0;
}

.tp-hex-row {
  display: flex;
  gap: 0.5rem;
}

#tp-hex-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  padding: 0.5rem 0.75rem;
  outline: none;
  min-width: 0;
  transition: border-color var(--transition);
  letter-spacing: 0.05em;
}

#tp-hex-input:focus {
  border-color: rgba(var(--accent-rgb), 0.5);
}

#tp-apply-btn {
  padding: 0.5rem 0.85rem;
  background: rgba(var(--accent-rgb), 0.12);
  border: 1px solid rgba(var(--accent-rgb), 0.3);
  border-radius: 7px;
  color: var(--accent);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

#tp-apply-btn:hover {
  background: var(--accent);
  color: #0A0806;
  border-color: var(--accent);
}

/* ── Fix for mobile nav getting trapped by the scrolled backdrop-filter ── */
@media (max-width: 768px) {
  /* Use :has() to detect if the child menu is open, and remove the trap */
  #nav:has(.nav-links.open) {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: transparent !important;
    border-bottom-color: transparent !important;
  }
}

/* ── Safe Area Mobile Fixes ────────────────────────────── */
@media (max-width: 768px) {
  
  /* 1. Force the fixed nav bar to start at the absolute physical top of the screen */
  #nav {
    top: 0 !important;
    /* Use a higher opacity color mix (75% theme background) so text underneath is well obscured */
    background: color-mix(in srgb, var(--bg) 75%, transparent) !important;
    backdrop-filter: blur(24px) !important;
    -webkit-backdrop-filter: blur(24px) !important;
    
    /* Pad the internal content of the nav down so it clears the status bar/notch */
    padding-top: calc(1.2rem + env(safe-area-inset-top, 0px)) !important;
    z-index: 9999 !important; /* Ensure it stays over all scrolling body elements */
  }

  #nav.scrolled {
    padding-top: calc(0.8rem + env(safe-area-inset-top, 0px)) !important;
  }

  /* 2. Bottom Safe Area Frost Shield (Remains independent at the bottom edge) */
  .safe-area-blur-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: env(safe-area-inset-bottom, 0px);
    background: color-mix(in srgb, var(--bg) 75%, transparent);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    z-index: 9999;
    pointer-events: none;
    border-top: 1px solid color-mix(in srgb, var(--border) 15%, transparent);
  }
}