/*
   Flat Fable — Stylesheet
   Monochrome + Teal, Bebas Neue
*/

/* ==================== Variables ==================== */
:root {
  /* Light theme */
  --bg: #f5f5f5;
  --bg-alt: #eaeaea;
  --text: #1a1a1a;
  --text-muted: #555;
  --accent: #00a89d;
  --accent-hover: #008f86;
  --border: #ddd;

  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 2rem;
  --space-lg: 4rem;
  --space-xl: 6rem;

  /* Typography */
  --font-heading: 'Bebas Neue', sans-serif;
  --font-body: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Sizing */
  --max-width: 1100px;
  --max-width-narrow: 700px;

  /* Depth & Shadows - Layered system */
  --shadow-ambient: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-medium: 0 8px 24px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-elevated: 0 20px 40px rgba(0, 0, 0, 0.12), 0 8px 16px rgba(0, 0, 0, 0.06);
  --shadow-accent: 0 8px 24px rgba(0, 168, 157, 0.15);

  /* Noise texture (base64 tiny noise pattern) */
  --noise: 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.8' 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");
}

[data-theme="dark"] {
  --bg: #0f0f0f;
  --bg-alt: #1a1a1a;
  --text: #f0f0f0;
  --text-muted: #999;
  --accent: #2dd4c8;
  --accent-hover: #5eead4;
  --border: #333;

  /* Darker shadow system */
  --shadow-ambient: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-medium: 0 8px 24px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-elevated: 0 20px 40px rgba(0, 0, 0, 0.5), 0 8px 16px rgba(0, 0, 0, 0.3);
  --shadow-accent: 0 8px 24px rgba(45, 212, 200, 0.2);
}

/* ==================== Smooth Scrolling ==================== */
.smooth-scroll {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  .smooth-scroll {
    scroll-behavior: auto;
  }
}

/* ==================== Skip Link ==================== */
.skip-link {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 0 0 8px 8px;
  font-weight: 600;
  z-index: 9999;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 0;
  color: #fff;
}

/* ==================== Reset ==================== */
*, *::before, *::after {
  box-sizing: border-box;
}

/* ==================== Selection ==================== */
::selection {
  background: var(--accent);
  color: #fff;
}

::-moz-selection {
  background: var(--accent);
  color: #fff;
}

/* ==================== Scrollbar ==================== */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

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

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

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Firefox */
html {
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--bg);
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--step-0, 1.0625rem);
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  transition: background 0.2s ease, color 0.2s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-kerning: normal;
  font-feature-settings: "kern" 1, "liga" 1;
}

/* Optical margin alignment for prose */
.about-text,
.project-desc,
.pricing-note {
  hyphens: auto;
  hyphenate-limit-chars: 6 3 2;
  word-spacing: -0.02em;
}

/* First letter styling for about section - subtle editorial touch */
.about-text p:first-of-type::first-letter {
  font-family: var(--font-heading);
  font-size: 2.2em;
  float: left;
  line-height: 1;
  margin-right: 0.08em;
  margin-top: 0.1em;
  color: var(--accent);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 400;
  line-height: 1.1;
  margin: 0 0 var(--space-sm);
  letter-spacing: 0.02em;
  text-wrap: balance; /* Prevents orphans on headings */
  text-rendering: geometricPrecision;
}

/* Modular Type Scale - Perfect Fourth (1.333) */
:root {
  --step--2: clamp(0.70rem, 0.65rem + 0.25vw, 0.83rem);
  --step--1: clamp(0.875rem, 0.82rem + 0.28vw, 1rem);
  --step-0: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --step-1: clamp(1.25rem, 1.18rem + 0.35vw, 1.5rem);
  --step-2: clamp(1.56rem, 1.45rem + 0.55vw, 2rem);
  --step-3: clamp(1.95rem, 1.78rem + 0.85vw, 2.67rem);
  --step-4: clamp(2.44rem, 2.18rem + 1.3vw, 3.56rem);
  --step-5: clamp(3.05rem, 2.65rem + 2vw, 4.75rem);
}

p {
  margin: 0 0 var(--space-sm);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--accent-hover);
}

/* Refined link underlines with proper offset */
a:not(.btn):not(.project-link):not(.contact-email):not(.back-to-top):not(.skip-link) {
  text-decoration-skip-ink: auto;
  text-underline-offset: 0.15em;
}

/* Typography: Proper quotes and hanging punctuation */
blockquote,
.about-text,
.project-desc {
  hanging-punctuation: first last;
  quotes: """ """ "'" "'";
}

/* Font features for refined numerals */
.pricing-hint,
.price,
.footer-copy {
  font-variant-numeric: oldstyle-nums tabular-nums;
  font-feature-settings: "kern" 1, "liga" 1, "onum" 1;
}

/* Underline animation for inline links */
.about-text a,
.pricing-note a {
  background-image: linear-gradient(var(--accent), var(--accent));
  background-size: 0% 2px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.2s ease, color 0.15s ease;
}

.about-text a:hover,
.pricing-note a:hover {
  background-size: 100% 2px;
}

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

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* ==================== Focus States ==================== */
:focus {
  outline: none;
}

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

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ==================== Reduced Motion ==================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==================== Theme Toggle ==================== */
.theme-toggle {
  position: fixed;
  top: var(--space-sm);
  right: var(--space-sm);
  z-index: 100;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.theme-toggle:hover {
  background: rgba(0, 0, 0, 0.85);
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.theme-toggle:active {
  transform: scale(0.95);
}

[data-theme="dark"] .theme-toggle {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

[data-theme="dark"] .theme-toggle:hover {
  background: rgba(255, 255, 255, 0.25);
}

.icon-sun, .icon-moon {
  position: absolute;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Dark mode: show moon (click to go light) */
.icon-sun {
  opacity: 0;
  transform: rotate(90deg);
}

.icon-moon {
  opacity: 1;
  transform: rotate(0);
}

/* Light mode: show sun (click to go dark) */
[data-theme="light"] .icon-sun {
  opacity: 1;
  transform: rotate(0);
}

[data-theme="light"] .icon-moon {
  opacity: 0;
  transform: rotate(-90deg);
}

/* ==================== Layout ==================== */
.section {
  padding: var(--space-xl) var(--space-md);
  /* Performance: contain layout and paint for off-screen sections */
  contain: layout style;
}

/* Content-visibility for off-screen sections (major performance win) */
#services,
#about,
#contact {
  content-visibility: auto;
  contain-intrinsic-size: 0 500px;
}

.section-alt {
  background: var(--bg-alt);
  position: relative;
}

/* Subtle noise texture overlay */
.section-alt::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--noise);
  background-repeat: repeat;
  pointer-events: none;
  opacity: 0.5;
}

.section-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.section-narrow {
  max-width: var(--max-width-narrow);
}

.section h2 {
  font-size: var(--step-4, 3rem);
  margin-bottom: var(--space-lg);
  color: var(--text);
  letter-spacing: 0.03em;
  position: relative;
}

/* Subtle underline accent on section headings */
.section h2::after {
  content: '';
  position: absolute;
  bottom: -0.3em;
  left: 0;
  width: 1.5em;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.section:hover h2::after {
  width: 2.5em;
}

/* ==================== Hero ==================== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl) var(--space-md);
  position: relative;
  overflow: hidden;
  background: #0a0a0a;
  color: #fff;
  transition: background 0.3s ease;
}

[data-theme="light"] .hero {
  background: #1a1a1a;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 40%, rgba(0, 168, 157, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 60%, rgba(45, 212, 200, 0.1) 0%, transparent 50%),
    radial-gradient(ellipse 100% 100% at 50% 100%, rgba(0, 168, 157, 0.08) 0%, transparent 40%);
  animation: heroGlow 8s ease-in-out infinite alternate;
  will-change: transform, opacity;
}

@keyframes heroGlow {
  0% {
    opacity: 0.6;
    transform: scale(1) translateY(0);
  }
  100% {
    opacity: 1;
    transform: scale(1.05) translateY(-10px);
  }
}

/* Subtle grid pattern */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none;
}

/* Floating particles effect */
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(45, 212, 200, 0.3) 0%, transparent 2px),
    radial-gradient(circle at 80% 20%, rgba(45, 212, 200, 0.2) 0%, transparent 2px),
    radial-gradient(circle at 60% 70%, rgba(45, 212, 200, 0.25) 0%, transparent 2px),
    radial-gradient(circle at 30% 80%, rgba(45, 212, 200, 0.2) 0%, transparent 2px),
    radial-gradient(circle at 90% 60%, rgba(45, 212, 200, 0.15) 0%, transparent 2px);
  animation: particleFloat 12s ease-in-out infinite;
  pointer-events: none;
}

@keyframes particleFloat {
  0%, 100% {
    transform: translateY(0) translateX(0);
  }
  33% {
    transform: translateY(-20px) translateX(10px);
  }
  66% {
    transform: translateY(10px) translateX(-10px);
  }
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 1000px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
}

.hero-content {
  flex: 1;
}

.hero-mascot {
  flex: 0 0 auto;
  width: 280px;
  animation: mascotFloat 4s ease-in-out infinite;
  will-change: transform;
}

@keyframes mascotFloat {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-15px);
  }
}

.hero-mascot img {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 20px 40px rgba(0, 168, 157, 0.3));
}

/* Scroll Indicator */
.scroll-indicator {
  position: absolute;
  bottom: var(--space-md);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: rgba(255, 255, 255, 0.5);
  animation: scrollBounce 2s ease-in-out infinite;
}

.scroll-text {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-weight: 500;
}

.scroll-arrow {
  opacity: 0.6;
}

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

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

.site-title {
  font-size: clamp(4rem, 12vw, 8rem);
  margin-bottom: var(--space-xs);
  line-height: 0.9;
  background: linear-gradient(135deg, #fff 0%, #2dd4c8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  font-size: var(--step-2, 1.5rem);
  font-weight: 400;
  color: #fff;
  margin-bottom: var(--space-xs);
  letter-spacing: -0.01em; /* Tighter for display text */
}

.tagline-sub {
  font-size: var(--step-0, 1.125rem);
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: var(--space-lg);
  letter-spacing: 0.02em;
  font-weight: 300;
}

.hero-ctas {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

/* ==================== Buttons ==================== */
.btn {
  display: inline-block;
  padding: 0.875rem 1.75rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 4px;
  border: 2px solid transparent;
  transition: all 0.15s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: var(--shadow-ambient), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  position: relative;
  overflow: hidden;
}

/* Subtle gradient overlay for depth */
.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
  pointer-events: none;
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium), var(--shadow-accent);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-ambient);
}

.btn-secondary {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
  position: relative;
}

.btn-secondary:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft), var(--shadow-accent);
}

.btn-secondary:active {
  transform: translateY(0);
}

.link-button {
  background: none;
  border: none;
  color: var(--accent);
  font-size: inherit;
  padding: 0;
  text-decoration: underline;
}

.link-button:hover {
  color: var(--accent-hover);
}

/* ==================== Projects ==================== */
.projects {
  display: grid;
  gap: var(--space-lg);
}

.project {
  display: grid;
  gap: var(--space-md);
  align-items: start;
}

@media (min-width: 768px) {
  .project {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
  }

  .project:nth-child(even) .project-image {
    order: 2;
  }
}

.project-image {
  background: var(--bg-alt);
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
  box-shadow: var(--shadow-soft);
  position: relative;
}

/* Subtle inner shadow for depth */
.project-image::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 8px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
  pointer-events: none;
}

.project:hover .project-image {
  transform: translateY(-6px) scale(1.01);
  box-shadow: var(--shadow-elevated), var(--shadow-accent);
}

[data-theme="dark"] .project:hover .project-image {
  box-shadow: var(--shadow-elevated), var(--shadow-accent);
}

.project-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
  /* Performance: GPU acceleration for transforms */
  transform: translateZ(0);
  backface-visibility: hidden;
}

.project:hover .project-image img {
  transform: scale(1.02);
}

.project-content {
  padding: var(--space-sm) 0;
}

.project h3 {
  font-size: var(--step-3, 2rem);
  margin-bottom: var(--space-xs);
  letter-spacing: 0.02em;
}

.project-meta {
  font-size: var(--step--1, 0.875rem);
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-weight: 500;
}

.project-desc {
  color: var(--text);
  margin-bottom: var(--space-sm);
}

.project-link {
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.project-link span {
  transition: transform 0.2s ease;
}

.project-link:hover span {
  transform: translateX(4px);
}

/* ==================== Services ==================== */
.services {
  display: grid;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

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

.services li {
  padding: var(--space-md);
  background: var(--bg);
  border-radius: 8px;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  box-shadow: var(--shadow-ambient);
  border: 1px solid transparent;
  position: relative;
}

.services li:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-medium);
  border-color: rgba(0, 168, 157, 0.2);
}

/* Gradient border glow on hover */
.services li::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 9px;
  background: linear-gradient(135deg, rgba(0, 168, 157, 0.3), transparent 50%);
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: -1;
}

.services li:hover::before {
  opacity: 1;
}

[data-theme="dark"] .services li {
  background: var(--bg-alt);
}

[data-theme="dark"] .services li:hover {
  box-shadow: var(--shadow-medium);
  border-color: rgba(45, 212, 200, 0.2);
}

.services strong {
  display: block;
  font-family: var(--font-heading);
  font-size: var(--step-2, 1.5rem);
  margin-bottom: var(--space-xs);
  letter-spacing: 0.02em;
}

.services span {
  color: var(--text-muted);
  font-size: var(--step--1, 0.9375rem);
  line-height: 1.55;
}

.pricing-hint {
  text-align: center;
  padding: var(--space-md);
  background: var(--bg);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(0, 168, 157, 0.1);
  position: relative;
}

/* Subtle top border gradient */
.pricing-hint::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  border-radius: 1px;
}

[data-theme="dark"] .pricing-hint {
  background: var(--bg-alt);
  border-color: rgba(45, 212, 200, 0.1);
}

.pricing-hint p {
  margin-bottom: var(--space-xs);
}

.pricing-hint strong {
  color: var(--accent);
}

.pricing-note {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ==================== About ==================== */
.about-content {
  display: grid;
  gap: var(--space-md);
  align-items: center;
}

@media (min-width: 600px) {
  .about-content {
    grid-template-columns: 200px 1fr;
    gap: var(--space-lg);
  }
}

.about-image {
  width: 200px;
  margin: 0 auto;
}

.about-image img {
  border-radius: 8px;
}

.about-text p:last-child {
  margin-bottom: 0;
}

/* ==================== Contact ==================== */
.section-contact {
  text-align: center;
  background: var(--accent);
  color: #fff;
}

.section-contact h2 {
  color: #fff;
}

.section-contact p {
  opacity: 0.9;
}

.contact-email {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: var(--step-3, 2rem);
  color: #fff;
  padding: var(--space-sm) var(--space-md);
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 4px;
  margin-top: var(--space-sm);
  transition: border-color 0.15s ease, background 0.15s ease;
  letter-spacing: 0.02em;
}

.contact-email:hover {
  border-color: #fff;
  background: rgba(255,255,255,0.1);
  color: #fff;
}

/* ==================== Footer ==================== */
.footer {
  padding: var(--space-md) var(--space-md) var(--space-lg);
  font-size: 0.875rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.footer-main {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.footer-mark {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  color: var(--text);
}

.footer-secondary {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.footer-copy {
  font-size: 0.8125rem;
}

.back-to-top {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--bg-alt);
  border-radius: 50%;
  color: var(--text-muted);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.back-to-top:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-2px);
}

@media (max-width: 600px) {
  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
}

/* ==================== Modal ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  z-index: 1000;
  opacity: 1;
  transition: opacity 0.2s ease;
  /* Performance: isolate stacking context */
  isolation: isolate;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-overlay:not([hidden]) {
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal {
  background: var(--bg);
  border-radius: 12px;
  max-width: 500px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  padding: var(--space-lg) var(--space-md);
  animation: slideUp 0.3s ease;
  box-shadow: var(--shadow-elevated), 0 0 0 1px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .modal {
  border-color: rgba(255, 255, 255, 0.05);
  background: linear-gradient(180deg, var(--bg-alt) 0%, var(--bg) 100%);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-close {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.15s ease;
}

.modal-close:hover {
  background: var(--bg-alt);
  color: var(--text);
}

/* ==================== Flowchart ==================== */
.flowchart {
  text-align: center;
}

.flowchart h3 {
  font-size: var(--step-2, 1.75rem);
  margin-bottom: var(--space-md);
  letter-spacing: 0.02em;
}

.flowchart-question {
  font-size: 1.125rem;
  margin-bottom: var(--space-md);
  color: var(--text);
}

.flowchart-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.flowchart-option {
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-alt);
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  color: var(--text);
  text-align: left;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.flowchart-option::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
  transform: scaleY(0);
  transition: transform 0.2s ease;
}

.flowchart-option:hover {
  border-color: var(--accent);
  background: var(--bg);
  transform: translateX(4px);
  box-shadow: var(--shadow-soft);
}

.flowchart-option:hover::before {
  transform: scaleY(1);
}

.flowchart-option:active {
  transform: translateX(2px);
}

.flowchart-result {
  padding: var(--space-md);
  background: var(--bg-alt);
  border-radius: 8px;
  margin-bottom: var(--space-md);
}

.flowchart-result h4 {
  font-size: var(--step-3, 2rem);
  color: var(--accent);
  margin-bottom: var(--space-xs);
  letter-spacing: 0.02em;
}

.flowchart-result p {
  margin-bottom: var(--space-xs);
}

.flowchart-result .price {
  font-family: var(--font-heading);
  font-size: 1.5rem;
}

.flowchart-cta {
  margin-top: var(--space-md);
}

.flowchart-restart {
  margin-top: var(--space-sm);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  text-decoration: underline;
}

.flowchart-restart:hover {
  color: var(--text);
}

.flowchart-progress {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: var(--space-md);
}

.progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.2s ease;
}

.progress-dot.active {
  background: var(--accent);
}

.progress-dot.completed {
  background: var(--text-muted);
}

/* ==================== Section Reveal ==================== */
.section {
  animation: revealUp 0.6s ease both;
}

.section:nth-child(1) { animation-delay: 0s; }
.section:nth-child(2) { animation-delay: 0.1s; }
.section:nth-child(3) { animation-delay: 0.15s; }
.section:nth-child(4) { animation-delay: 0.2s; }

@keyframes revealUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .section {
    animation: none;
  }
}

/* ==================== Responsive ==================== */
@media (max-width: 768px) {
  .hero-inner {
    flex-direction: column-reverse;
    text-align: center;
  }

  .hero-mascot {
    width: 200px;
  }

  .hero-ctas {
    justify-content: center;
  }

  .site-title {
    font-size: clamp(3rem, 15vw, 5rem);
  }
}

/* ==================== Image Loading ==================== */
.project-image img {
  background: var(--bg-alt);
}

img[loading="lazy"] {
  opacity: 0;
  transition: opacity 0.3s ease;
}

img[loading="lazy"].loaded,
img[loading="lazy"]:not([src=""]) {
  opacity: 1;
}

/* ==================== Scroll Progress Indicator ==================== */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  z-index: 9999;
  width: 0%;
  transition: width 0.1s linear;
  box-shadow: 0 0 10px var(--accent);
}

/* ==================== Scroll Reveal Animations ==================== */
.reveal-item {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  transition-delay: var(--reveal-delay, 0s);
}

.reveal-item.revealed {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal-item {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ==================== Hero Cursor Glow ==================== */
.hero-cursor-glow {
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(45, 212, 200, 0.15) 0%, transparent 70%);
  pointer-events: none;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 0;
}

/* ==================== Service Card Stagger ==================== */
.services li {
  --stagger-index: 0;
}

/* ==================== Print Styles ==================== */
@media print {
  .theme-toggle,
  .scroll-indicator,
  .scroll-progress,
  .hero-cursor-glow,
  .back-to-top,
  .hero-bg,
  .hero::before,
  .hero::after {
    display: none !important;
  }

  .reveal-item {
    opacity: 1 !important;
    transform: none !important;
  }

  .hero {
    min-height: auto;
    background: #fff !important;
    color: #000 !important;
    padding: 2rem;
  }

  .site-title {
    background: none !important;
    -webkit-text-fill-color: #000 !important;
    color: #000 !important;
  }

  .section {
    break-inside: avoid;
    animation: none !important;
  }

  .section-contact {
    background: #eee !important;
    color: #000 !important;
  }

  .section-contact h2 {
    color: #000 !important;
  }

  a {
    color: #000 !important;
    text-decoration: underline;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }

  .contact-email::after {
    content: none;
  }
}
