/* ===== FERRA CORP v2 — Premium Design System ===== */

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

/* Theme Variables */
html { scroll-behavior: smooth; }

:root {
  --fc-amber: #FFA600;
  --fc-red: #E51D2E;
  --fc-teal: #009CB6;
  --fc-white: #FFFFFF;
}

html[data-fc-theme="dark"] {
  --fc-bg: #0A0A0C;
  --fc-fg: #F0EDE7;
  --fc-muted: #A8A49C;
  --fc-dim: #706C64;
  --fc-faint: #504D47;
  --fc-line: rgba(240,237,231,.10);
  --fc-line-strong: rgba(240,237,231,.22);
  --fc-line-soft: rgba(240,237,231,.04);
  --fc-contrast-bg: #F0EDE7;
  --fc-contrast-fg: #111113;
  --fc-contrast-muted: #4A4740;
  --fc-contrast-hover: #E6E3DC;
  --fc-nav-bg: rgba(10,10,12,.72);
  --fc-input-bg: #F0EDE7;
  --fc-input-fg: #111113;
  --fc-input-border: #111113;
  --fc-input-placeholder: #8B8880;
  --fc-card-bg: rgba(255,255,255,.04);
  --fc-card-border: rgba(255,255,255,.08);
  --fc-glass: rgba(255,255,255,.06);
}

html[data-fc-theme="light"] {
  --fc-bg: #F0EDE7;
  --fc-fg: #111113;
  --fc-muted: #55524B;
  --fc-dim: #6E6A62;
  --fc-faint: #8B8880;
  --fc-line: rgba(17,17,19,.14);
  --fc-line-strong: rgba(17,17,19,.28);
  --fc-line-soft: rgba(17,17,19,.05);
  --fc-contrast-bg: #111113;
  --fc-contrast-fg: #F0EDE7;
  --fc-contrast-muted: #B9B5AC;
  --fc-contrast-hover: #1C1C1F;
  --fc-nav-bg: rgba(240,237,231,.78);
  --fc-input-bg: #1C1C1F;
  --fc-input-fg: #F0EDE7;
  --fc-input-border: #3A3B40;
  --fc-input-placeholder: #8B8880;
  --fc-card-bg: rgba(0,0,0,.03);
  --fc-card-border: rgba(0,0,0,.08);
  --fc-glass: rgba(0,0,0,.04);
}

/* Base */
body {
  margin: 0;
  background: var(--fc-bg);
  color: var(--fc-fg);
  font-family: 'Archivo', sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background .4s ease, color .4s ease;
  overflow-x: clip;
  --fc-accent: var(--fc-amber);
}

a { color: inherit; text-decoration: none; transition: color .2s ease; }
a:hover { color: var(--fc-teal); }
::selection { background: var(--fc-amber); color: #0A0A0C; }
input::placeholder, textarea::placeholder { color: var(--fc-input-placeholder); }

/* Theme icon visibility */
html[data-fc-theme="dark"] [data-fc-icon="moon"] { display: none; }
html[data-fc-theme="light"] [data-fc-icon="sun"] { display: none; }

/* ===== ANIMATIONS ===== */
@keyframes fc-marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes fc-glow { 0%,100% { opacity: .45; } 50% { opacity: .8; } }
@keyframes fc-float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes fc-pulse { 0%,100% { transform: scale(1); opacity: .6; } 50% { transform: scale(1.05); opacity: 1; } }
@keyframes fc-grain {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-5%, -10%); }
  30% { transform: translate(3%, -15%); }
  50% { transform: translate(12%, 9%); }
  70% { transform: translate(9%, 4%); }
  90% { transform: translate(-1%, 7%); }
}

/* Scroll reveal system */
.fc-reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.fc-reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
.fc-reveal-left {
  opacity: 0;
  transform: translateX(-60px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.fc-reveal-left.visible {
  opacity: 1;
  transform: translateX(0);
}
.fc-reveal-right {
  opacity: 0;
  transform: translateX(60px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.fc-reveal-right.visible {
  opacity: 1;
  transform: translateX(0);
}
.fc-reveal-scale {
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.fc-reveal-scale.visible {
  opacity: 1;
  transform: scale(1);
}

/* Stagger children */
.fc-stagger > * { transition-delay: calc(var(--i, 0) * 0.1s); }

/* Film grain overlay */
.fc-grain::before {
  content: '';
  position: fixed;
  inset: -100%;
  width: 300%;
  height: 300%;
  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: 9999;
  animation: fc-grain 8s steps(10) infinite;
  opacity: 0.4;
}

/* ===== NAV ===== */
.fc-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 48px;
  background: var(--fc-nav-bg);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  border-bottom: 1px solid var(--fc-line);
  transition: padding .3s ease, background .3s ease;
}

.fc-nav.scrolled {
  padding: 10px 48px;
  border-bottom-color: var(--fc-line-strong);
}

.fc-nav__logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 900;
  font-size: 20px;
  letter-spacing: .08em;
}

.fc-nav__logo img {
  height: 32px;
  width: auto;
}

.fc-nav__links {
  display: flex;
  align-items: center;
  gap: 36px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.fc-nav__links a {
  position: relative;
  padding: 4px 0;
}

.fc-nav__links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--fc-amber);
  transition: width .3s cubic-bezier(0.16, 1, 0.3, 1);
}

.fc-nav__links a:hover::after,
.fc-nav__links a.active::after {
  width: 100%;
}

.fc-nav__links a.active { color: var(--fc-amber); }

.fc-nav__actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.fc-theme-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: none;
  border: 1px solid var(--fc-line);
  border-radius: 50%;
  color: var(--fc-fg);
  cursor: pointer;
  transition: all .3s ease;
}
.fc-theme-btn:hover {
  border-color: var(--fc-amber);
  color: var(--fc-amber);
  transform: rotate(30deg);
}

.fc-btn-primary {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  letter-spacing: .08em;
  padding: 12px 24px;
  background: var(--fc-amber);
  color: #0A0A0C;
  font-weight: 600;
  border-radius: 4px;
  transition: all .3s ease;
}
.fc-btn-primary:hover {
  background: var(--fc-fg);
  color: var(--fc-bg);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(255,166,0,.3);
}

/* CTA buttons */
.fc-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 18px 36px;
  font-weight: 700;
  font-size: 16px;
  border-radius: 4px;
  transition: all .3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}
.fc-cta--amber { background: var(--fc-amber); color: #0A0A0C; }
.fc-cta--amber:hover {
  color: #0A0A0C;
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(255,166,0,.35);
}
.fc-cta--outline { border: 1px solid var(--fc-line-strong); }
.fc-cta--outline:hover {
  border-color: var(--fc-amber);
  color: var(--fc-amber);
  transform: translateY(-2px);
}
.fc-cta--red { background: var(--fc-red); color: #fff; }
.fc-cta--red:hover {
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(229,29,46,.35);
}

/* ===== GRID BACKGROUNDS ===== */
.fc-grid-bg {
  background-image:
    repeating-linear-gradient(90deg, var(--fc-line-soft) 0 1px, transparent 1px 120px),
    repeating-linear-gradient(0deg, var(--fc-line-soft) 0 1px, transparent 1px 120px);
}
.fc-grid-bg-v {
  background-image: repeating-linear-gradient(90deg, var(--fc-line-soft) 0 1px, transparent 1px 120px);
}

/* ===== GLASS CARDS ===== */
.fc-glass {
  background: var(--fc-glass);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid var(--fc-card-border);
  border-radius: 12px;
}

/* ===== SERVICE CARDS ===== */
.fc-card {
  background: var(--fc-card-bg);
  border: 1px solid var(--fc-card-border);
  padding: 40px 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  transition: all .4s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.fc-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,166,0,.08) 0%, transparent 50%);
  opacity: 0;
  transition: opacity .4s ease;
}

.fc-card:hover {
  border-color: rgba(255,166,0,.3);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,.15);
}

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

/* Contrast sections */
.fc-contrast {
  background: var(--fc-contrast-bg);
  color: var(--fc-contrast-fg);
}

/* Mono label */
.fc-mono { font-family: 'IBM Plex Mono', monospace; }

/* ===== STAT COUNTER ===== */
.fc-stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 28px 32px;
  background: var(--fc-bg);
  position: relative;
}

.fc-stat__number {
  font-size: 42px;
  font-weight: 900;
  line-height: 1;
  background: linear-gradient(135deg, var(--fc-fg) 0%, var(--fc-muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== SECTION SPACING ===== */
.fc-section {
  padding: 120px 48px;
  position: relative;
}

.fc-section--tight { padding: 80px 48px; }

/* ===== FOOTER ===== */
.fc-footer {
  border-top: 1px solid var(--fc-line);
  padding: 48px 48px 32px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.fc-footer__grid {
  display: grid;
  grid-template-columns: minmax(200px, 1.4fr) repeat(3, minmax(120px, 1fr));
  gap: 32px;
  align-items: start;
}

.fc-footer__col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  letter-spacing: .08em;
}

.fc-footer__col a { transition: color .2s ease, transform .2s ease; display: inline-block; }
.fc-footer__col a:hover { color: var(--fc-amber); transform: translateX(4px); }

.fc-footer__col-label {
  color: var(--fc-dim);
  font-size: 11px;
  letter-spacing: .18em;
  margin-bottom: 2px;
}

.fc-footer__bottom {
  border-top: 1px solid var(--fc-line);
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: .1em;
  color: var(--fc-dim);
}

.fc-social {
  display: flex;
  gap: 10px;
}

.fc-social a {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--fc-line-strong);
  border-radius: 50%;
  transition: all .3s ease;
}
.fc-social a:hover {
  border-color: var(--fc-amber);
  color: var(--fc-amber);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(255,166,0,.2);
}

/* ===== PROCESS TIMELINE ===== */
.fc-process {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 48px;
  position: relative;
}

.fc-process::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(to right, var(--fc-amber), var(--fc-red), var(--fc-teal), var(--fc-amber));
  opacity: .2;
}

.fc-process__step {
  position: relative;
  padding-top: 20px;
}

.fc-process__dot {
  position: absolute;
  top: -7px;
  left: 24px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--dot-color, var(--fc-amber));
  border: 3px solid var(--fc-bg);
  box-shadow: 0 0 0 2px var(--dot-color, var(--fc-amber)), 0 0 12px color-mix(in srgb, var(--dot-color, var(--fc-amber)) 40%, transparent);
  z-index: 2;
}

/* ===== DEVICE MOCKUP ===== */
.fc-device {
  position: relative;
  background: #1a1a1e;
  border-radius: 16px;
  padding: 12px;
  box-shadow: 0 24px 80px rgba(0,0,0,.4), 0 0 0 1px rgba(255,255,255,.08);
}

.fc-device::before {
  content: '';
  display: block;
  height: 28px;
  margin-bottom: 8px;
  background: #111113;
  border-radius: 8px 8px 0 0;
  position: relative;
}

.fc-device::after {
  content: '';
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 4px;
  background: rgba(255,255,255,.06);
  border-radius: 2px;
}

.fc-device img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  display: block;
}

/* ===== MOBILE HAMBURGER ===== */
.fc-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  background: none;
  border: 1px solid var(--fc-line);
  border-radius: 8px;
  cursor: pointer;
  z-index: 110;
}

.fc-hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--fc-fg);
  border-radius: 2px;
  transition: all .3s ease;
}

.fc-hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.fc-hamburger.active span:nth-child(2) { opacity: 0; }
.fc-hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

.fc-mobile-menu {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99;
  background: var(--fc-bg);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  opacity: 0;
  transition: opacity .3s ease;
}

.fc-mobile-menu.open {
  display: flex;
  opacity: 1;
}

.fc-mobile-menu a {
  font-family: 'Archivo', sans-serif;
  font-size: 28px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .fc-section { padding: 80px 32px; }
  .fc-nav { padding: 14px 24px; }
}

@media (max-width: 900px) {
  .fc-nav { padding: 10px 16px; }
  .fc-nav.scrolled { padding: 10px 16px; }
  .fc-nav__links { display: none; }
  .fc-hamburger { display: flex; }
  .fc-footer__grid { grid-template-columns: 1fr 1fr; gap: 24px; }
  .fc-section { padding: 64px 20px; }
  .fc-section[style*="grid-template-columns"] { display: flex !important; flex-direction: column !important; }
  .fc-process::before { display: none; }
  .fc-process__dot { display: none; }
  .fc-process__step { padding-top: 0; }
  .fc-hero { min-height: auto !important; }
  .fc-hero__content { padding: 120px 20px 60px !important; }
  .fc-hero__bg { display: none !important; }
  .fc-hero__overlay-bottom {
    background: linear-gradient(160deg, #0A0A0C 0%, #12121a 50%, #0f0f12 100%) !important;
  }
  .fc-hero-glow { opacity: .7 !important; }
  .fc-pos-grid { grid-template-columns: 1fr !important; gap: 40px !important; }
}

@media (max-width: 600px) {
  .fc-footer__grid { grid-template-columns: 1fr 1fr; }
  .fc-section { padding: 48px 16px; }
  .fc-hero__content { padding: 100px 16px 48px !important; }
  .fc-hero__stats { grid-template-columns: repeat(2, 1fr) !important; }
}

/* ===== LIGHT MODE OVERRIDES ===== */

/* Hero: swap dark overlays to light so text is readable */
html[data-fc-theme="light"] .fc-hero__img {
  filter: brightness(1.2) saturate(.85);
}

html[data-fc-theme="light"] .fc-hero h1 {
  color: #111113 !important;
  text-shadow: none !important;
}

html[data-fc-theme="light"] .fc-hero h1 span {
  background: linear-gradient(135deg, #c47800 0%, #b8161f 100%) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
}

html[data-fc-theme="light"] .fc-hero .fc-hero__overlay-bottom {
  background: linear-gradient(to bottom, rgba(240,237,231,.7) 0%, rgba(240,237,231,.4) 30%, rgba(240,237,231,.85) 65%, rgba(240,237,231,1) 100%) !important;
}

html[data-fc-theme="light"] .fc-hero .fc-hero__overlay-side {
  background: linear-gradient(to right, rgba(240,237,231,.95) 0%, rgba(240,237,231,.4) 50%, transparent 70%) !important;
}

html[data-fc-theme="light"] .fc-hero__stats {
  background: rgba(255,255,255,.6) !important;
  border-color: rgba(0,0,0,.1) !important;
  backdrop-filter: blur(20px) saturate(1.4);
}

html[data-fc-theme="light"] .fc-hero__stats > div {
  border-color: rgba(0,0,0,.08) !important;
}

/* Hero glow: make amber more subtle */
html[data-fc-theme="light"] .fc-hero-glow {
  opacity: .3;
}

/* Device mockup frame */
html[data-fc-theme="light"] .fc-device {
  background: #e8e5df;
  box-shadow: 0 24px 80px rgba(0,0,0,.1), 0 0 0 1px rgba(0,0,0,.06);
}

html[data-fc-theme="light"] .fc-device::before {
  background: #d9d6d0;
}

html[data-fc-theme="light"] .fc-device::after {
  background: rgba(0,0,0,.08);
}

/* Service cards */
html[data-fc-theme="light"] .fc-card {
  background: rgba(255,255,255,.75);
  border-color: rgba(0,0,0,.08);
}

html[data-fc-theme="light"] .fc-card:hover {
  border-color: rgba(255,166,0,.4);
  box-shadow: 0 12px 40px rgba(0,0,0,.06);
}

/* Contrast sections: cards inside dark bg in light mode */
html[data-fc-theme="light"] .fc-contrast .fc-card {
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.1);
}

html[data-fc-theme="light"] .fc-contrast .fc-card:hover {
  border-color: rgba(255,166,0,.4);
  box-shadow: 0 12px 40px rgba(0,0,0,.3);
}

/* Stats */
html[data-fc-theme="light"] .fc-stat {
  background: var(--fc-bg);
}

/* Nav */
html[data-fc-theme="light"] .fc-nav {
  border-bottom-color: rgba(0,0,0,.08);
}

/* CTA outline buttons: ensure visible in light */
html[data-fc-theme="light"] .fc-cta--outline {
  border-color: var(--fc-line-strong);
  color: var(--fc-fg);
}

/* Process timeline line */
html[data-fc-theme="light"] .fc-process::before {
  opacity: .35;
}

/* Process dot border matches light bg */
html[data-fc-theme="light"] .fc-process__dot {
  border-color: var(--fc-bg);
}

/* Reduce grain in light mode */
html[data-fc-theme="light"] .fc-grain::before {
  opacity: 0.12;
}

/* CTA glow at bottom of pages */
html[data-fc-theme="light"] .fc-section .fc-cta--outline {
  border-color: var(--fc-line-strong);
  color: var(--fc-fg);
}

/* Footer links */
html[data-fc-theme="light"] .fc-footer {
  border-top-color: rgba(0,0,0,.08);
}

/* Mobile menu */
html[data-fc-theme="light"] .fc-mobile-menu {
  background: var(--fc-bg);
}
