/* ==========================================================================
   F-DEV — landing page styles
   Dark & premium: near-black base, gold accent, system font stack.
   Order: tokens → base → header/nav → hero → services → contact → footer
          → reveal animations → responsive.
   ========================================================================== */

/* ---------- Design tokens & themes ----------
   Default (no data-theme attribute) follows the system: Gallery in light
   mode, Slate in dark mode. Force a theme with
   <html data-theme="slate" | "gallery" | "gold"> — "gallery" works by
   blocking the dark media query, so it has no block of its own.
   Every color flows through these tokens; a new color must be added to
   all four palettes (:root, media-dark, slate, gold). */

/* Gallery — cool light, cobalt accent, graphite logo (base + system light) */
:root {
  color-scheme: light;

  --bg: #fafbfc;
  --bg-rgb: 250 251 252; /* bare channels for glass/overlay alpha layers */
  --bg-raised: #ffffff;
  --surface: #f3f5f8;
  --border: #e2e6ec;
  --border-strong: #cdd4de;

  --text: #16181d;
  --text-muted: #565d6b;

  --accent: #2f4fc4;
  --accent-strong: #24409f;
  --accent-highlight: #6f8ce4;
  --accent-ink: #ffffff;
  --accent-glow: rgba(47, 79, 196, 0.12);
  --spotlight: rgba(47, 79, 196, 0.07);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;

  --radius: 14px;
  --radius-sm: 10px;
  --container: 1100px;
  --header-h: 68px;

  --shadow-card: 0 10px 30px rgba(22, 24, 29, 0.08);
}

/* Slate — cool dark, steel accent, platinum logo (system dark).
   Keep in sync with the [data-theme="slate"] block below. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;

    --bg: #0c0f14;
    --bg-rgb: 12 15 20;
    --bg-raised: #12161d;
    --surface: #161b24;
    --border: #262d3a;
    --border-strong: #333c4d;

    --text: #edf1f7;
    --text-muted: #9aa7bb;

    --accent: #9fc2ee;
    --accent-strong: #c6dcf8;
    --accent-highlight: #e6f1fc;
    --accent-ink: #0b1018;
    --accent-glow: rgba(159, 194, 238, 0.13);
    --spotlight: rgba(159, 194, 238, 0.1);

    --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.35);
  }
}

/* Slate, forced */
:root[data-theme="slate"] {
  color-scheme: dark;

  --bg: #0c0f14;
  --bg-rgb: 12 15 20;
  --bg-raised: #12161d;
  --surface: #161b24;
  --border: #262d3a;
  --border-strong: #333c4d;

  --text: #edf1f7;
  --text-muted: #9aa7bb;

  --accent: #9fc2ee;
  --accent-strong: #c6dcf8;
  --accent-highlight: #e6f1fc;
  --accent-ink: #0b1018;
  --accent-glow: rgba(159, 194, 238, 0.13);
  --spotlight: rgba(159, 194, 238, 0.1);

  --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.35);
}

/* Gold — the original dark & premium brand theme, forced only.
   Metallic bronze-gold sampled from the brand artwork; don't reintroduce
   the old bright yellow-gold (#e6b450). */
:root[data-theme="gold"] {
  color-scheme: dark;

  --bg: #0b0d12;
  --bg-rgb: 11 13 18;
  --bg-raised: #11141c;
  --surface: #151924;
  --border: #232937;
  --border-strong: #303849;

  --text: #f2f4f8;
  --text-muted: #a3adc2;

  --accent: #c2a87e;
  --accent-strong: #ddc59d;
  --accent-highlight: #f5e0b9;
  --accent-ink: #191204;
  --accent-glow: rgba(194, 168, 126, 0.16);
  --spotlight: rgba(213, 189, 147, 0.12);

  --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.35);
}

/* Themed logo artwork — same traced paths, recolored gradient. The mark
   (fd-mark-blue.svg) is theme-independent and never swaps; the wordmark and
   lockup keep the gold SVGs in markup (fallback for browsers without
   content:url() on img and for data-theme="gold") and swap per theme. */
html:not([data-theme]) .logo-wordmark,
html[data-theme="gallery"] .logo-wordmark {
  content: url("../assets/fd-wordmark-gallery.svg");
}
html:not([data-theme]) .contact-lockup,
html[data-theme="gallery"] .contact-lockup {
  content: url("../assets/fd-lockup-gallery.svg");
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme]) .logo-wordmark {
    content: url("../assets/fd-wordmark-slate.svg");
  }
  html:not([data-theme]) .contact-lockup {
    content: url("../assets/fd-lockup-slate.svg");
  }
}

html[data-theme="slate"] .logo-wordmark {
  content: url("../assets/fd-wordmark-slate.svg");
}
html[data-theme="slate"] .contact-lockup {
  content: url("../assets/fd-lockup-slate.svg");
}

/* ---------- Base ---------- */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  line-height: 1.15;
  margin: 0 0 0.5em;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(2.4rem, 5.5vw, 4rem);
}

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

h3 {
  font-size: 1.125rem;
}

p {
  margin: 0 0 1em;
}

a {
  color: var(--accent);
  text-decoration: none;
}

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

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

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 24px;
}

.eyebrow {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.9em;
}

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

@media (prefers-reduced-motion: no-preference) {
  .accent {
    background: linear-gradient(
      110deg,
      var(--accent) 0%,
      var(--accent) 42%,
      var(--accent-highlight) 50%,
      var(--accent) 58%,
      var(--accent) 100%
    );
    background-size: 250% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    padding-right: 0.01em;
    animation: shimmer 3.5s ease-in-out infinite;
  }

  @keyframes shimmer {
    from {
      background-position: 125% 0;
    }
    to {
      background-position: -25% 0;
    }
  }
}

/* ---------- Scroll progress bar ---------- */

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 200;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  transform: scaleX(var(--scroll-progress, 0));
  transform-origin: 0 0;
  pointer-events: none;
}

.section-lead {
  color: var(--text-muted);
  font-size: 1.0625rem;
  max-width: 40rem;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease,
    background-color 0.15s ease, border-color 0.15s ease;
}

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

.btn-primary:hover {
  background-color: var(--accent-strong);
  color: var(--accent-ink);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px var(--accent-glow);
}

.btn-ghost {
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.btn-lg {
  padding: 0.95rem 2.2rem;
  font-size: 1.05rem;
}

/* ---------- Header / nav ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgb(var(--bg-rgb) / 0.72);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.site-header.is-scrolled {
  background-color: rgb(var(--bg-rgb) / 0.88);
  border-bottom-color: var(--border);
}

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-h);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.logo-mark {
  display: block;
  height: 40px;
  width: auto;
  flex-shrink: 0;
}

.logo-wordmark {
  display: block;
  height: 34px;
  width: auto;
}

.site-nav ul {
  display: flex;
  align-items: center;
  gap: 28px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
}

.site-nav a:hover {
  color: var(--text);
}

.site-nav .nav-cta {
  color: var(--accent);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.5rem 1.1rem;
  transition: border-color 0.15s ease;
}

.site-nav .nav-cta:hover {
  color: var(--accent-strong);
  border-color: var(--accent);
}

/* Hamburger (hidden on desktop) */

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  background: none;
  border: 0;
  cursor: pointer;
}

.nav-toggle-bar {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background-color: var(--text);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(6rem, 14vh, 9rem) 0 clamp(5rem, 12vh, 8rem);
  border-bottom: 1px solid var(--border);
  background-image: linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 56px 56px;
  /* JS drives the parallax vars; defaults keep the page static without JS. */
  background-position: 0 var(--parallax-grid, 0);
}

.hero-glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(60% 55% at 50% 0%, var(--accent-glow), transparent 70%),
    radial-gradient(90% 80% at 50% 100%, var(--bg) 45%, transparent 100%),
    linear-gradient(rgb(var(--bg-rgb) / 0.55), rgb(var(--bg-rgb) / 0.55));
  transform: translateY(var(--parallax-slow, 0px));
  pointer-events: none;
}

.hero-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hero-particles span {
  position: absolute;
  left: var(--x, 50%);
  top: var(--y, 50%);
  width: var(--size, 3px);
  height: var(--size, 3px);
  border-radius: 50%;
  background-color: var(--accent);
  opacity: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .hero-particles span {
    animation: particle-float var(--duration, 10s) ease-in-out var(--delay, 0s)
      infinite;
  }

  @keyframes particle-float {
    0%,
    100% {
      transform: translateY(0);
      opacity: 0;
    }
    25%,
    75% {
      opacity: var(--max-opacity, 0.4);
    }
    50% {
      transform: translateY(-28px);
      opacity: var(--max-opacity, 0.4);
    }
  }
}

.hero-inner {
  position: relative;
  max-width: 46rem;
  text-align: center;
}

.hero-lead {
  color: var(--text-muted);
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  max-width: 38rem;
  margin-inline: auto;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-top: 2.2rem;
}

/* ---------- Services ---------- */

.services {
  padding: clamp(4.5rem, 10vh, 7rem) 0;
}

.section-head {
  max-width: 40rem;
  margin-bottom: 3rem;
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.card {
  position: relative;
  isolation: isolate;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 24px;
  /* Hover lift and JS tilt compose through custom properties instead of
     overwriting each other's transform. */
  transform: perspective(800px) translateY(var(--lift, 0px))
    rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.2s ease, border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.card:hover {
  --lift: -4px;
  border-color: var(--border-strong);
  box-shadow: var(--shadow-card), 0 0 0 1px var(--accent-glow),
    0 8px 40px var(--accent-glow);
}

/* Cursor spotlight — mouse-driven, so only on fine pointers */
@media (hover: hover) and (pointer: fine) {
  .card::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    background: radial-gradient(
      220px circle at var(--mx, 50%) var(--my, 50%),
      var(--spotlight),
      transparent 70%
    );
    opacity: 0;
    transition: opacity 0.25s ease;
  }

  .card:hover::before {
    opacity: 1;
  }
}

.card-icon {
  color: var(--accent);
  margin-bottom: 16px;
}

.card h3 {
  margin-bottom: 0.4em;
}

.card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0;
}

/* ---------- Contact ---------- */

.contact {
  padding: clamp(4.5rem, 10vh, 7rem) 0;
  border-top: 1px solid var(--border);
  background:
    radial-gradient(50% 60% at 50% 100%, var(--accent-glow), transparent 70%),
    var(--bg-raised);
}

.contact-inner {
  max-width: 42rem;
  text-align: center;
}

.contact-lockup {
  display: block;
  width: min(200px, 50%);
  height: auto;
  margin: 0 auto 2rem;
}

.contact-inner .section-lead {
  margin-inline: auto;
  margin-bottom: 2.2rem;
}

.contact-email {
  margin-top: 1.6rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.footer-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-wrap p {
  margin: 0;
}

.site-footer ul {
  display: flex;
  gap: 22px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-footer a {
  color: var(--text-muted);
}

.site-footer a:hover {
  color: var(--text);
}

/* ---------- Reveal animations ----------
   Elements are only hidden when JS is running (html.js) and the user
   hasn't requested reduced motion — content stays visible otherwise. */

@media (prefers-reduced-motion: no-preference) {
  html.js [data-reveal] {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.6s ease, transform 0.6s ease;
  }

  html.js [data-reveal].is-visible {
    opacity: 1;
    transform: none;
  }

  /* Staggered entrance for the service cards. JS removes data-reveal after
     the transition ends, so these delays never affect hover effects. */
  html.js .services-grid > [data-reveal]:nth-child(2) {
    transition-delay: 0.07s;
  }
  html.js .services-grid > [data-reveal]:nth-child(3) {
    transition-delay: 0.14s;
  }
  html.js .services-grid > [data-reveal]:nth-child(4) {
    transition-delay: 0.21s;
  }
  html.js .services-grid > [data-reveal]:nth-child(5) {
    transition-delay: 0.28s;
  }
  html.js .services-grid > [data-reveal]:nth-child(6) {
    transition-delay: 0.35s;
  }
}

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

  .btn,
  .card {
    transition: none;
  }
}

/* ---------- Responsive ---------- */

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

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

  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    background-color: rgb(var(--bg-rgb) / 0.97);
    border-bottom: 1px solid var(--border);
    padding: 8px 24px 20px;
  }

  .site-nav.is-open {
    display: block;
  }

  .site-nav ul {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }

  .site-nav a {
    display: block;
    padding: 12px 4px;
    font-size: 1.05rem;
  }

  .site-nav .nav-cta {
    margin-top: 10px;
    text-align: center;
  }
}

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

  .hero-actions .btn {
    flex: 1 1 100%;
    text-align: center;
  }

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