/* ============================================================
   StayOS — Base: reset, typography, layout, nav, buttons, motion
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background 0.6s var(--ease-out), color 0.6s var(--ease-out);
}

img, video, iframe { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
::selection { background: var(--ember); color: #fff; }

/* Fine film grain over the whole page for that print / magazine feel */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 9999; pointer-events: none;
  opacity: var(--grain-opacity); mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Typography ---------- */
.display {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.015em;
}
.eyebrow {
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.34em;
  color: var(--ink-mute);
  font-weight: 600;
}
.lede { font-size: var(--step-1); color: var(--ink-soft); line-height: 1.5; font-weight: 400; }

/* ---------- Layout ---------- */
.container { width: min(100% - 2.5rem, var(--container)); margin-inline: auto; }
.container-wide { width: min(100% - 2.5rem, var(--container-wide)); margin-inline: auto; }
section { position: relative; padding-block: var(--space-2xl); }
.section-head { max-width: 46rem; margin-bottom: var(--space-xl); }
.section-head .eyebrow { display: block; margin-bottom: var(--space-s); }
.section-head h2 { font-size: var(--step-3); }
.section-head p { margin-top: var(--space-m); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.6em;
  padding: 0.95em 1.7em; border-radius: var(--radius-pill);
  font-size: var(--step-0); font-weight: 550; letter-spacing: 0.01em;
  min-height: 44px;
  transition: transform 0.4s var(--ease-out), background 0.4s var(--ease-out),
              box-shadow 0.4s var(--ease-out), color 0.4s var(--ease-out);
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--ink); color: var(--bg); box-shadow: var(--shadow-m); }
.btn-primary:hover { background: var(--ember); color: #fff; box-shadow: var(--shadow-ember); transform: translateY(-2px); }
.btn-ghost { border: 1px solid var(--line-strong); color: var(--ink); backdrop-filter: blur(8px); }
.btn-ghost:hover { border-color: var(--ember); color: var(--ember); transform: translateY(-2px); }
.btn .arrow { transition: transform 0.4s var(--ease-out); }
.btn:hover .arrow { transform: translateX(4px); }

/* ---------- Top navigation (glass) ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem clamp(1.25rem, 4vw, 3rem);
  transition: background 0.5s var(--ease-out), backdrop-filter 0.5s var(--ease-out),
              border-color 0.5s var(--ease-out), padding 0.5s var(--ease-out);
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: var(--glass); backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid var(--glass-line); padding-block: 0.8rem;
}
.brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 600; letter-spacing: 0.02em; }
.brand .mark {
  width: 26px; height: 26px; border-radius: 8px; flex: none;
  background: linear-gradient(140deg, var(--ember), var(--twilight));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.25);
}
.brand .tm { font-size: 0.62em; vertical-align: super; opacity: 0.6; }
.nav-links { display: flex; align-items: center; gap: clamp(1rem, 2.4vw, 2.2rem); }
.nav-links a { font-size: var(--step--1); color: var(--ink-soft); letter-spacing: 0.02em; transition: color 0.3s; }
.nav-links a:hover { color: var(--ink); }
.nav-links .nav-hide { }
.theme-toggle {
  width: 42px; height: 42px; border-radius: var(--radius-pill);
  display: grid; place-items: center; border: 1px solid var(--line-strong);
  transition: transform 0.4s var(--ease-out), border-color 0.3s;
}
.theme-toggle:hover { border-color: var(--ember); transform: rotate(-18deg); }
.theme-toggle svg { width: 18px; height: 18px; }

/* Language switch (EN / RO) */
.lang-switch {
  display: inline-flex; border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill); overflow: hidden;
}
.lang-switch button {
  padding: 0.45rem 0.7rem; min-height: 38px; font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.08em; color: var(--ink-mute);
  transition: background 0.3s var(--ease-out), color 0.3s;
}
.lang-switch button.active { background: var(--ink); color: var(--bg); }
.lang-switch button:hover:not(.active) { color: var(--ink); }

/* --- Readable nav in both states ---
   Over the hero (bar transparent): white. Once scrolled (glass): near-black. */
.nav .brand { color: #fff; }
.nav-links a { color: rgba(255,255,255,0.9); }
.nav-links a:hover { color: #fff; }
.nav .theme-toggle { color: #fff; border-color: rgba(255,255,255,0.45); }
.nav .lang-switch { border-color: rgba(255,255,255,0.45); }
.nav .lang-switch button { color: rgba(255,255,255,0.75); }
.nav .lang-switch button.active { background: #fff; color: #1b1917; }
.nav .btn-ghost { color: #fff; border-color: rgba(255,255,255,0.55); }

.nav.scrolled .brand { color: var(--ink); }
.nav.scrolled .nav-links a { color: var(--ink); }
.nav.scrolled .nav-links a:hover { color: var(--ember); }
.nav.scrolled .theme-toggle { color: var(--ink); border-color: var(--line-strong); }
.nav.scrolled .lang-switch { border-color: var(--line-strong); }
.nav.scrolled .lang-switch button { color: var(--ink-mute); }
.nav.scrolled .lang-switch button.active { background: var(--ink); color: var(--bg); }
.nav.scrolled .btn-ghost { color: var(--ink); border-color: var(--line-strong); }

@media (max-width: 720px) { .nav-links .nav-hide { display: none; } }

/* ---------- Scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity 1s var(--ease-out), transform 1s var(--ease-out); }
.reveal.in { opacity: 1; transform: none; }
.reveal[data-delay="1"] { transition-delay: 0.08s; }
.reveal[data-delay="2"] { transition-delay: 0.16s; }
.reveal[data-delay="3"] { transition-delay: 0.24s; }
.reveal[data-delay="4"] { transition-delay: 0.32s; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1 !important; transform: none !important; transition: none; }
}

.divider { height: 1px; background: var(--line); border: 0; }
