/* ═══════════════════════════════════════════
   SHARED STYLES — m-session marketing site
   Base reset, variables, header, footer,
   buttons, scroll reveal, theme toggle
   ═══════════════════════════════════════════ */

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

/* Hide all scrollbars and prevent horizontal overflow */
html, body, * {
  scrollbar-width: none;
}
::-webkit-scrollbar {
  display: none;
}
html, body {
  overflow-x: hidden;
}

/* VARIABLES — Dark Mode (default) */
:root {
  --bg: #0a0a0c;
  --bg-elevated: #111114;
  --bg-surface: #17171b;
  --bg-hover: #1e1e23;
  --text-primary: #e8e6e1;
  --text-secondary: #8a8880;
  --text-tertiary: #55534e;
  --accent: #b8a9e8;
  --accent-dim: rgba(184, 169, 232, 0.12);
  --accent-glow: rgba(184, 169, 232, 0.25);
  --warm: #e8a87c;
  --border: rgba(255, 255, 255, 0.06);
  --border-accent: rgba(184, 169, 232, 0.15);
  --mono: "Azeret Mono", monospace;
  --serif: "DM Serif Text", serif;
  --phone-bg: #0e0e11;
  --phone-text: #e8e6e1;
  --phone-accent: #b8a9e8;
  --phone-secondary: #6a6860;
  --phone-border: rgba(255, 255, 255, 0.06);
  --phone-chip-sel-bg: rgba(184, 169, 232, 0.15);
  --phone-chip-sel-border: rgba(184, 169, 232, 0.3);
  --phone-chip-bg: rgba(255, 255, 255, 0.03);
  --phone-chip-border: rgba(255, 255, 255, 0.06);
  --phone-field-bg: rgba(255, 255, 255, 0.03);
  --phone-field-border: rgba(255, 255, 255, 0.06);
  --phone-line-grid: rgba(255, 255, 255, 0.06);
  --phone-away: #e8a87c;
  --noise-opacity: 0.03;
}

/* VARIABLES — Light Mode */
html.light {
  --bg: #f2f0eb;
  --bg-elevated: #e9e7e2;
  --bg-surface: #dfddd8;
  --bg-hover: #d6d4cf;
  --text-primary: #2a2a28;
  --text-secondary: #7a7870;
  --text-tertiary: #a5a39c;
  --accent: #d4946a;
  --accent-dim: rgba(212, 148, 106, 0.12);
  --accent-glow: rgba(212, 148, 106, 0.25);
  --warm: #b8a9e8;
  --border: rgba(0, 0, 0, 0.07);
  --border-accent: rgba(212, 148, 106, 0.2);
  --phone-bg: #f5f3ee;
  --phone-text: #2a2a28;
  --phone-accent: #d4946a;
  --phone-secondary: #9a9890;
  --phone-border: rgba(0, 0, 0, 0.08);
  --phone-chip-sel-bg: rgba(212, 148, 106, 0.12);
  --phone-chip-sel-border: rgba(212, 148, 106, 0.3);
  --phone-chip-bg: rgba(0, 0, 0, 0.03);
  --phone-chip-border: rgba(0, 0, 0, 0.08);
  --phone-field-bg: rgba(0, 0, 0, 0.03);
  --phone-field-border: rgba(0, 0, 0, 0.08);
  --phone-line-grid: rgba(0, 0, 0, 0.07);
  --phone-away: #8a7ec0;
  --noise-opacity: 0.025;
}

/* Light mode — shared component overrides */
html.light header {
  background: rgba(242, 240, 235, 0.8);
}
html.light .btn-primary {
  color: #f2f0eb;
}
html.light .btn-outline {
  border-color: rgba(0, 0, 0, 0.18);
  color: var(--text-primary);
}
html.light .btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}
html.light ::selection {
  background: var(--accent);
  color: #fff;
}
html.light .theme-toggle {
  border-color: var(--border);
}

/* Smooth transition on theme change */
html.theme-transitioning,
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
  transition: background 0.5s ease, color 0.4s ease,
    border-color 0.4s ease, box-shadow 0.5s ease, fill 0.4s ease,
    stroke 0.4s ease !important;
}

/* BASE */
html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: var(--mono);
  background: var(--bg);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.7;
  letter-spacing: 0.02em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Noise overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: var(--noise-opacity);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px;
}

::selection {
  background: var(--accent);
  color: var(--bg);
}
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 32px;
}

/* ═══════════════════════════════════════════
   SCROLL REVEAL
   ═══════════════════════════════════════════ */
.rv {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}
.rv.visible {
  opacity: 1;
  transform: translateY(0);
}
.rv-d1 {
  transition-delay: 0.08s;
}
.rv-d2 {
  transition-delay: 0.16s;
}
.rv-d3 {
  transition-delay: 0.24s;
}
.rv-d4 {
  transition-delay: 0.32s;
}
.rv-d5 {
  transition-delay: 0.4s;
}

/* ═══════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════ */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 18px 0;
  background: rgba(10, 10, 12, 0.8);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
}
header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.header-nav {
  display: flex;
  gap: 14px;
  align-items: center;
}
.header-nav a {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
  transition: color 0.3s;
}
.header-nav a:hover {
  color: var(--text-primary);
  text-decoration: none;
}
.header-nav a.active {
  color: var(--text-primary);
}

/* Logo */
.logo {
  font-family: "JetBrains Mono", monospace;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: baseline;
  white-space: nowrap;
  overflow: hidden;
  color: var(--text);
  text-decoration: none;
}
.logo:hover {
  text-decoration: none;
}
.logo-m {
  color: var(--accent);
}
.logo-collapse {
  display: inline-flex;
  overflow: hidden;
  max-width: 3.6ch;
  opacity: 1;
  color: var(--text);
  transition: max-width 0.8s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.6s ease;
}
.logo-collapse.collapsed {
  max-width: 0;
  opacity: 0;
}
.logo-hyphen {
  display: inline-block;
  overflow: hidden;
  max-width: 0;
  opacity: 0;
  color: var(--text);
  transform-origin: 50% 52%;
  transition: max-width 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.1s,
    opacity 0.5s ease 0.15s;
}
.logo-hyphen.visible {
  max-width: 1ch;
  opacity: 1;
  animation: hyphen-spin 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.8s both;
}
@keyframes hyphen-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(180deg); }
}
.logo-session {
  color: var(--accent);
}

/* ═══════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 28px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: none;
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  position: relative;
  overflow: hidden;
}
.btn-primary {
  background: var(--accent);
  color: var(--bg);
}
.btn-primary:hover {
  filter: brightness(1.15);
  box-shadow: 0 0 32px var(--accent-glow);
  text-decoration: none;
  transform: translateY(-1px);
}
.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
  transform: translateY(-1px);
}

/* ═══════════════════════════════════════════
   SECTION BASICS
   ═══════════════════════════════════════════ */
section {
  padding: 140px 0;
}
.section-label {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
}
.section-title {
  font-family: var(--serif);
  font-size: clamp(30px, 3.5vw, 46px);
  font-weight: 400;
  line-height: 1.2;
  margin-bottom: 24px;
  letter-spacing: -0.01em;
}
.section-body {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.85;
  max-width: 560px;
}

/* ═══════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════ */
footer {
  padding: 48px 0;
  border-top: 1px solid var(--border);
}
footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.footer-text {
  font-size: 10px;
  color: var(--text-tertiary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.footer-links {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
}
.footer-links a {
  font-size: 10px;
  color: var(--text-tertiary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: color 0.3s;
}
.footer-links a:hover {
  color: var(--text-primary);
}

/* ═══════════════════════════════════════════
   THEME TOGGLE — vertical pill
   ═══════════════════════════════════════════ */
.theme-toggle {
  width: 18px;
  height: 36px;
  border-radius: 9px;
  background: none;
  border: 1px solid var(--border);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: border-color 0.4s ease;
}
.theme-toggle-thumb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 3px;
  transition: top 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    background 0.3s ease, box-shadow 0.3s ease;
  background: var(--text-tertiary);
}
/* Light state: thumb at bottom */
html.light .theme-toggle-thumb {
  top: 21px;
  background: var(--accent);
  box-shadow: none;
}

/* ═══════════════════════════════════════════
   HAMBURGER MENU TOGGLE
   ═══════════════════════════════════════════ */
.menu-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.menu-toggle-line {
  display: block;
  height: 1.5px;
  background: var(--text-secondary);
  border-radius: 1px;
  transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1),
              opacity 0.3s ease,
              width 0.3s cubic-bezier(0.23, 1, 0.32, 1);
  transform-origin: center;
}
.menu-toggle-line:nth-child(1) { width: 20px; }
.menu-toggle-line:nth-child(2) { width: 14px; }
.menu-toggle-line:nth-child(3) { width: 20px; }

/* Morph to X */
body.menu-open .menu-toggle-line:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
  width: 20px;
}
body.menu-open .menu-toggle-line:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
body.menu-open .menu-toggle-line:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
  width: 20px;
}

/* ═══════════════════════════════════════════
   MENU OVERLAY
   ═══════════════════════════════════════════ */
body.menu-open {
  overflow: hidden;
}
body.menu-open header {
  z-index: 200;
}
/* Keep header elevated during close animation */
body.menu-closing header {
  z-index: 200;
}

.menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  pointer-events: none;
  visibility: hidden;
  transition: visibility 0s linear 0.5s;
}
body.menu-open .menu-overlay {
  pointer-events: auto;
  visibility: visible;
  transition: visibility 0s linear 0s;
}
body.menu-closing .menu-overlay {
  visibility: visible;
  pointer-events: none;
}

/* Backdrop */
.menu-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 12, 0.7);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  opacity: 0;
  transition: opacity 0.4s ease;
}
body.menu-open .menu-overlay-backdrop {
  opacity: 1;
}
body.menu-closing .menu-overlay-backdrop {
  opacity: 0;
  transition: opacity 0.35s ease 0.25s;
}
html.light .menu-overlay-backdrop {
  background: rgba(242, 240, 235, 0.8);
}

/* Panel — clip-path circle reveal from top-right */
.menu-overlay-panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 120px 32px 60px;
  clip-path: circle(0% at calc(100% - 40px) 28px);
  transition: clip-path 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
body.menu-open .menu-overlay-panel {
  clip-path: circle(150% at calc(100% - 40px) 28px);
}
body.menu-closing .menu-overlay-panel {
  clip-path: circle(0% at calc(100% - 40px) 28px);
  transition: clip-path 0.45s cubic-bezier(0.4, 0, 0.6, 1) 0.2s;
}

/* Links */
.menu-overlay-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}
.menu-link {
  font-family: var(--serif);
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 14px 0;
  position: relative;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease,
              transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              color 0.3s ease;
  transition-delay: 0s;
}
.menu-link:hover {
  color: var(--text-primary);
  text-decoration: none;
}
.menu-link:focus {
  outline: none;
}
.menu-link {
  -webkit-tap-highlight-color: transparent;
}

/* Active page */
.menu-link.active {
  color: var(--accent);
}
.menu-link.active::after {
  content: '';
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

/* Staggered reveal on open */
body.menu-open .menu-link {
  opacity: 1;
  transform: translateY(0);
}
body.menu-open .menu-link:nth-child(1) { transition-delay: 0.15s; }
body.menu-open .menu-link:nth-child(2) { transition-delay: 0.20s; }
body.menu-open .menu-link:nth-child(3) { transition-delay: 0.25s; }
body.menu-open .menu-link:nth-child(4) { transition-delay: 0.30s; }
body.menu-open .menu-link:nth-child(5) { transition-delay: 0.35s; }

/* Close — fade out with reverse stagger */
body.menu-closing .menu-link {
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity 0.2s ease, transform 0.25s ease;
}
body.menu-closing .menu-link:nth-child(5) { transition-delay: 0s; }
body.menu-closing .menu-link:nth-child(4) { transition-delay: 0.03s; }
body.menu-closing .menu-link:nth-child(3) { transition-delay: 0.06s; }
body.menu-closing .menu-link:nth-child(2) { transition-delay: 0.09s; }
body.menu-closing .menu-link:nth-child(1) { transition-delay: 0.12s; }

/* Footer */
.menu-overlay-footer {
  margin-top: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease,
              transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: 0s;
}
body.menu-open .menu-overlay-footer {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.38s;
}
body.menu-closing .menu-overlay-footer {
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.15s ease, transform 0.2s ease;
  transition-delay: 0s;
}

/* ═══════════════════════════════════════════
   PAGE TRANSITIONS
   ═══════════════════════════════════════════ */

.page-transition-wrap {
  animation: pageEnter 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.08s both;
}
@keyframes pageEnter {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
body.page-leaving .page-transition-wrap {
  animation: pageLeave 0.3s cubic-bezier(0.4, 0, 1, 1) both;
}
@keyframes pageLeave {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}

/* ═══════════════════════════════════════════
   RESPONSIVE — shared elements
   ═══════════════════════════════════════════ */
@media (max-width: 900px) {
  .container {
    padding: 0 24px;
  }
  section {
    padding: 80px 0;
  }
  .header-nav {
    gap: 10px;
  }
  .header-nav .btn {
    padding: 7px 16px !important;
    font-size: 10px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 20px;
  }
  section {
    padding: 64px 0;
  }
  .header-nav {
    gap: 8px;
  }
  .header-nav .btn {
    padding: 6px 14px !important;
    font-size: 10px;
  }
  footer .container {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }
  .menu-overlay-panel {
    padding: 100px 20px 40px;
  }
  .menu-link {
    font-size: clamp(24px, 6vw, 32px);
    padding: 12px 0;
  }
}
