/* ============================================
   RAMBERT.CO — DESIGN SYSTEM v2
   Direction: Editorial Dark — warm, confident, editorial
   Fonts: Playfair Display (display) + DM Sans (body)
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

:root {
  /* Palette */
  --bg-primary: #050505;
  --bg-secondary: #0c0b0d;
  --bg-card: #131215;
  --bg-elevated: #1a181d;
  --text-primary: #F1DFDC;
  --text-secondary: #a89e9c;
  --text-muted: #5e5654;
  --accent: #F57E67;
  --accent-hover: #f99580;
  --accent-subtle: rgba(245, 126, 103, 0.12);
  --accent-secondary: #C06FD6;
  --accent-secondary-subtle: rgba(192, 111, 214, 0.12);
  --border: rgba(241, 223, 220, 0.08);
  --border-hover: rgba(241, 223, 220, 0.16);

  /* Typography scale */
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'DM Sans', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Fluid type */
  --text-xs: clamp(0.75rem, 0.7rem + 0.2vw, 0.8125rem);
  --text-sm: clamp(0.8125rem, 0.75rem + 0.3vw, 0.9375rem);
  --text-base: clamp(0.9375rem, 0.875rem + 0.3vw, 1.0625rem);
  --text-lg: clamp(1.0625rem, 0.95rem + 0.5vw, 1.25rem);
  --text-xl: clamp(1.25rem, 1.05rem + 0.9vw, 1.75rem);
  --text-2xl: clamp(1.5rem, 1.15rem + 1.5vw, 2.5rem);
  --text-3xl: clamp(2rem, 1.4rem + 2.5vw, 3.5rem);
  --text-4xl: clamp(2.5rem, 1.5rem + 4vw, 5rem);
  --text-hero: clamp(3rem, 1.5rem + 6vw, 7rem);

  /* Spacing */
  --space-xs: clamp(0.25rem, 0.2rem + 0.2vw, 0.5rem);
  --space-sm: clamp(0.5rem, 0.4rem + 0.4vw, 0.75rem);
  --space-md: clamp(1rem, 0.8rem + 0.8vw, 1.5rem);
  --space-lg: clamp(1.5rem, 1rem + 2vw, 3rem);
  --space-xl: clamp(2rem, 1rem + 4vw, 5rem);
  --space-2xl: clamp(3rem, 1rem + 6vw, 8rem);
  --space-section: clamp(4rem, 2rem + 8vw, 10rem);

  /* Layout */
  --max-width: 1280px;
  --max-width-narrow: 800px;
  --gutter: clamp(1.25rem, 1rem + 2vw, 3rem);

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --duration-fast: 150ms;
  --duration-base: 250ms;
  --duration-slow: 500ms;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
}

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

/* --- Body --- */
body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.65;
  color: var(--text-primary);
  background: var(--bg-primary);
  overflow-x: hidden;
}

/* --- Selection --- */
::selection {
  background: var(--accent-secondary);
  color: var(--bg-primary);
}

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

/* --- Links --- */
a {
  color: inherit;
  text-decoration: none;
  transition: color var(--duration-base) var(--ease-out);
}

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

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

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

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

h1 { font-size: var(--text-hero); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-3xl); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl); }
h6 {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
}

p {
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--text-secondary);
}

p + p { margin-top: 1.25em; }

.lead {
  font-size: var(--text-lg);
  line-height: 1.65;
  color: var(--text-secondary);
}

strong { color: var(--text-primary); font-weight: 600; }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.03em;
  padding: 0.875rem 1.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--duration-base) var(--ease-out);
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: translateY(101%);
  transition: transform var(--duration-slow) var(--ease-out);
  z-index: 0;
}

.btn:hover::after {
  transform: translateY(0);
}

.btn span, .btn svg {
  position: relative;
  z-index: 1;
}

.btn:hover {
  border-color: var(--accent);
  color: var(--bg-primary);
}

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

.btn--primary::after {
  background: var(--bg-primary);
}

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

.btn-arrow {
  width: 14px;
  height: 14px;
  transition: transform var(--duration-base) var(--ease-out);
}

.btn:hover .btn-arrow {
  transform: translateX(4px);
}

/* --- Nav --- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: var(--space-md) 0;
  transition: background var(--duration-slow) var(--ease-out),
              padding var(--duration-slow) var(--ease-out);
}

.nav--scrolled {
  background: rgba(5, 5, 5, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav__logo {
  font-family: var(--font-body);
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  text-decoration: none;
}

.nav__logo-accent {
  background-image: linear-gradient(108deg, var(--accent-secondary) 8%, var(--accent) 50%, #ffa84b 91%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  padding-right: 2px;
  display: inline;
}

/* Gradient text utility */
.text-gradient {
  background-image: linear-gradient(108deg, var(--accent-secondary) 8%, var(--accent) 50%, #ffa84b 91%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.text-gradient--reverse {
  background-image: linear-gradient(108deg, #ffa84b 8%, var(--accent) 50%, var(--accent-secondary) 91%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.nav__link {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--duration-base) var(--ease-out);
  position: relative;
}

.nav__link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width var(--duration-base) var(--ease-out);
}

.nav__link:hover {
  color: var(--text-primary);
}

.nav__link:hover::after {
  width: 100%;
}

.nav__cta {
  font-size: var(--text-sm);
  font-weight: 500;
  padding: 0.625rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  transition: all var(--duration-base) var(--ease-out);
}

.nav__cta:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--bg-primary);
}

/* Mobile nav */
.nav__hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav__hamburger-line {
  width: 24px;
  height: 1.5px;
  background: var(--text-primary);
  transition: all var(--duration-base) var(--ease-out);
}

.nav__hamburger.is-open .nav__hamburger-line:nth-child(1) {
  transform: rotate(45deg) translate(4px, 5px);
}
.nav__hamburger.is-open .nav__hamburger-line:nth-child(2) {
  opacity: 0;
}
.nav__hamburger.is-open .nav__hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translate(4px, -5px);
}

.nav__mobile-menu {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  z-index: 99;
  padding: 6rem var(--gutter) var(--gutter);
  flex-direction: column;
  gap: var(--space-lg);
}

.nav__mobile-menu.is-open {
  display: flex;
}

.nav__mobile-link {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  color: var(--text-primary);
  text-decoration: none;
  display: block;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border);
}

@media (max-width: 768px) {
  .nav__links { display: none; }
  .nav__hamburger { display: flex; }
}

/* --- Footer --- */
.footer {
  padding: var(--space-section) 0 var(--space-lg);
  border-top: 1px solid var(--border);
}

.footer__cta {
  margin-bottom: var(--space-2xl);
  max-width: 700px;
}

.footer__cta-heading {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  margin-bottom: var(--space-lg);
  line-height: 1.15;
}

.footer__cta-link {
  font-size: var(--text-lg);
  color: var(--accent);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--accent);
  transition: gap var(--duration-base) var(--ease-out);
}

.footer__cta-link:hover {
  gap: 1rem;
}

.footer__bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.footer__brand {
  max-width: 300px;
}

.footer__brand-name {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.footer__brand-tagline {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.5;
}

.footer__email {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-md);
  transition: color var(--duration-base) var(--ease-out);
}

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

.footer__nav {
  display: flex;
  gap: var(--space-xl);
}

.footer__nav-group h6 {
  margin-bottom: var(--space-md);
}

.footer__nav-link {
  display: block;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  padding: var(--space-xs) 0;
  transition: color var(--duration-base) var(--ease-out);
}

.footer__nav-link:hover {
  color: var(--text-primary);
}

.footer__copyright {
  width: 100%;
  text-align: center;
  font-size: var(--text-xs);
  color: var(--text-muted);
  padding-top: var(--space-xl);
  margin-top: var(--space-xl);
  border-top: 1px solid var(--border);
}

@media (max-width: 768px) {
  .footer__bottom {
    flex-direction: column;
  }
  .footer__nav {
    width: 100%;
    justify-content: space-between;
  }
}

/* --- Sections --- */
.section {
  padding: var(--space-section) 0;
}

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

.section__label {
  margin-bottom: var(--space-sm);
}

.section__heading {
  margin-bottom: var(--space-lg);
}

/* --- Divider --- */
.divider {
  width: 100%;
  height: 1px;
  background: var(--border);
}

/* --- Animations --- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
}

.animate-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children */
.stagger > .animate-on-scroll:nth-child(1) { transition-delay: 0ms; }
.stagger > .animate-on-scroll:nth-child(2) { transition-delay: 80ms; }
.stagger > .animate-on-scroll:nth-child(3) { transition-delay: 160ms; }
.stagger > .animate-on-scroll:nth-child(4) { transition-delay: 240ms; }
.stagger > .animate-on-scroll:nth-child(5) { transition-delay: 320ms; }

/* --- Utility --- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

/* ============================================
   LIGHT MODE
   ============================================ */
[data-theme="light"] {
  --bg-primary: #faf8f7;
  --bg-secondary: #f2eeec;
  --bg-card: #ffffff;
  --bg-elevated: #ffffff;
  --text-primary: #1a1017;
  --text-secondary: #4a3f3c;
  --text-muted: #8a7e7b;
  --accent: #d45a44;
  --accent-hover: #c04a35;
  --accent-subtle: rgba(212, 90, 68, 0.1);
  --accent-secondary: #9b4daf;
  --accent-secondary-subtle: rgba(155, 77, 175, 0.1);
  --border: rgba(26, 16, 23, 0.1);
  --border-hover: rgba(26, 16, 23, 0.2);
}

[data-theme="light"] .nav--scrolled {
  background: rgba(250, 248, 247, 0.92);
}

/* Keep gradients vibrant on light backgrounds */
[data-theme="light"] .text-gradient,
[data-theme="light"] .nav__logo-accent {
  background-image: linear-gradient(108deg, #9333b0 8%, #c93a22 50%, #d97706 91%);
}

[data-theme="light"] .text-gradient--reverse {
  background-image: linear-gradient(108deg, #d97706 8%, #c93a22 50%, #9333b0 91%);
}

[data-theme="light"] .nav__mobile-menu {
  background: var(--bg-primary);
}

[data-theme="light"] ::selection {
  background: var(--accent-secondary);
  color: #fff;
}

/* --- Theme toggle --- */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  transition: color var(--duration-base) var(--ease-out),
              border-color var(--duration-base) var(--ease-out);
}

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

.theme-toggle__icon--sun { display: none; }
.theme-toggle__icon--moon { display: block; }

[data-theme="light"] .theme-toggle__icon--sun { display: block; }
[data-theme="light"] .theme-toggle__icon--moon { display: none; }

/* Smooth theme transition */
html.theme-transitioning,
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease !important;
}
