/* ============================================================
   PassBy — SHARED STYLES (index.html + contact.html)
   ============================================================ */

/* ── TOKENS ─────────────────────────────────────────────── */
:root {
  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease:        ease;

  --font-display: 'Unbounded', 'Inter', ui-sans-serif, sans-serif;
  --font-body:    'Inter', ui-sans-serif, system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, Menlo, monospace;

  --r-sm:   8px;
  --r-md:   11px;
  --r-lg:   16px;
  --r-xl:   24px;
  --r-pill: 999px;

  --sp-1:  8px;
  --sp-2:  16px;
  --sp-3:  24px;
  --sp-4:  32px;
  --sp-5:  40px;
  --sp-6:  48px;
  --sp-7:  64px;
  --sp-8:  80px;
  --sp-9:  96px;
  --sp-10: 140px;
}

/* ── THEMES ──────────────────────────────────────────────── */
[data-theme="dark"] {
  --canvas:     #040506;
  --surface-0:  #07080a;
  --surface-1:  #0d0e11;
  --surface-2:  #15161a;
  --surface-3:  #1d1e23;

  --border-soft:   rgba(255, 255, 255, 0.07);
  --border-med:    rgba(255, 255, 255, 0.13);
  --border-strong: rgba(255, 255, 255, 0.24);

  --text-primary:   #f5f6f7;
  --text-secondary: #9ba0a6;
  --text-tertiary:  #5a5e64;

  --accent:      #4d8dff;
  --accent-2:    #8ec2ff;
  --accent-soft: rgba(77, 141, 255, 0.14);
  --accent-line: rgba(77, 141, 255, 0.40);

  --signal-green: #54d49a;
  --signal-red:   #ff6363;

  --cta-bg:   #f2f3f5;
  --cta-text: #0b0c0e;

  --grid-line:     rgba(255, 255, 255, 0.05);
  --noise-opacity: 0.035;
}

[data-theme="light"] {
  --canvas:     #f0f1f4;
  --surface-0:  #ffffff;
  --surface-1:  #fbfbfd;
  --surface-2:  #eceef2;
  --surface-3:  #e1e3e9;

  --border-soft:   rgba(15, 18, 23, 0.08);
  --border-med:    rgba(15, 18, 23, 0.14);
  --border-strong: rgba(15, 18, 23, 0.26);

  --text-primary:   #0e1014;
  --text-secondary: #565a62;
  --text-tertiary:  #8b8f97;

  --accent:      #2f5fdc;
  --accent-2:    #1c41a8;
  --accent-soft: rgba(47, 95, 220, 0.10);
  --accent-line: rgba(47, 95, 220, 0.35);

  --signal-green: #1f9d6c;
  --signal-red:   #d9484e;

  --cta-bg:   #0e1014;
  --cta-text: #f5f6f7;

  --grid-line:     rgba(15, 18, 23, 0.05);
  --noise-opacity: 0.018;
}

/* ── RESET ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--canvas);
  color: var(--text-primary);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background .5s var(--ease), color .5s var(--ease);
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; background: none; border: none; color: inherit; }
ul { list-style: none; }
::selection { background: var(--accent); color: #fff; }

/* ── LAYOUT ──────────────────────────────────────────────── */
.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding-inline: 24px;
}
@media (max-width: 640px) { .wrap { padding-inline: 18px; } }

/* ── GRAIN OVERLAY ───────────────────────────────────────── */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  opacity: var(--noise-opacity);
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ── HEADER / NAV PILL ───────────────────────────────────── */
header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  justify-content: center;
  padding-top: 18px;
}

.nav-pill {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  background: color-mix(in srgb, var(--surface-2) 78%, transparent);
  backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-pill);
  padding: 9px 10px 9px 18px;
  box-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.5);
  transition: background .4s var(--ease), border-color .4s var(--ease);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.nav-logo svg { width: 14px; height: 16px; }
.nav-logo svg path { fill: var(--text-primary); transition: fill .4s var(--ease); }

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: 14px;
  color: var(--text-secondary);
}
.nav-links a {
  position: relative;
  transition: color .2s var(--ease);
  white-space: nowrap;
}
.nav-links a::after {
  content: '';
  position: absolute;
  left: 0; bottom: -4px;
  width: 0; height: 1px;
  background: var(--accent-2);
  transition: width .25s var(--ease-out);
}
.nav-links a:hover { color: var(--text-primary); }
.nav-links a:hover::after { width: 100%; }
@media (max-width: 760px) { .nav-links { display: none; } }

/* ── NAV ACTIONS (theme toggle + support + cta grouped) ─── */
.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

/* ── NAV BURGER (mobile menu trigger, hidden on desktop) ── */
.nav-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 38px;
  height: 38px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-med);
  background: var(--surface-2);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0 9px;
  transition: background .2s var(--ease), border-color .2s var(--ease);
}
.nav-burger span {
  display: block;
  height: 1.6px;
  background: var(--text-primary);
  border-radius: 1px;
  transition: transform .3s var(--ease-spring), opacity .2s var(--ease);
}
.nav-burger:hover { background: var(--surface-3); border-color: var(--border-strong); }
.nav-burger.open span:nth-child(1) { transform: translateY(6.6px) rotate(45deg); }
.nav-burger.open span:nth-child(2) { opacity: 0; }
.nav-burger.open span:nth-child(3) { transform: translateY(-6.6px) rotate(-45deg); }

/* ── MOBILE DROPDOWN MENU ───────────────────────────────── */
.nav-mobile-menu {
  position: fixed;
  top: 70px;
  left: 12px;
  right: 12px;
  z-index: 49;
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
  background: color-mix(in srgb, var(--surface-2) 92%, transparent);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--border-med);
  border-radius: var(--r-lg);
  box-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity .25s var(--ease-out), transform .25s var(--ease-out);
  pointer-events: none;
}
.nav-mobile-menu.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.nav-mobile-menu a,
.nav-mobile-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.nav-mobile-menu a:hover,
.nav-mobile-menu button:hover {
  background: var(--surface-3);
  color: var(--text-primary);
}
.nav-mobile-menu button svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav-mobile-cta {
  margin-top: 6px;
  background: var(--cta-bg) !important;
  color: var(--cta-text) !important;
  justify-content: center !important;
  font-weight: 600 !important;
}
.nav-mobile-cta:hover { opacity: 0.88; }

/* ── Responsive navbar breakdown ────────────────────────── */
@media (max-width: 760px) {
  .nav-pill { gap: var(--sp-2); padding: 9px 12px; }
  /* Show burger + mobile menu, hide desktop nav-links */
  .nav-burger { display: flex; }
  .nav-mobile-menu { display: flex; }
  /* On medium-narrow: keep theme-toggle + cta in pill, hide support label */
  .nav-contact-label { display: none; }
  .nav-contact { padding: 9px 10px; }
  .nav-actions { gap: 8px; }
}

@media (max-width: 540px) {
  /* On very narrow: hide everything except logo + theme + burger */
  .nav-actions .nav-contact,
  .nav-actions .nav-cta { display: none; }
}

/* ── THEME TOGGLE ────────────────────────────────────────── */
.theme-toggle {
  position: relative;
  width: 52px; height: 30px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  border: 1px solid var(--border-soft);
  flex-shrink: 0;
}
.theme-toggle .knob {
  position: absolute;
  top: 2px; left: 2px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--cta-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .4s var(--ease-spring);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}
[data-theme="light"] .theme-toggle .knob { transform: translateX(22px); }
.theme-toggle .knob svg { width: 13px; height: 13px; }
.theme-toggle .moon-ico path { fill: var(--cta-text); stroke: none; }
.theme-toggle .sun-ico path,
.theme-toggle .sun-ico circle,
.theme-toggle .sun-ico line { stroke: var(--cta-text); fill: none; }

/* ── NAV CTA ─────────────────────────────────────────────── */
.nav-cta {
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--r-pill);
  background: var(--cta-bg);
  color: var(--cta-text);
  white-space: nowrap;
  transition: transform .2s var(--ease), opacity .2s var(--ease);
}
.nav-cta:hover { opacity: 0.88; }
.nav-cta:active { transform: scale(0.96); }

/* Contact button in nav */
.nav-contact {
  font-size: 13.5px;
  font-weight: 500;
  padding: 9px 16px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-med);
  color: var(--text-secondary);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: color .2s var(--ease), border-color .2s var(--ease), background .2s var(--ease);
}
.nav-contact:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: var(--surface-1);
}
.nav-contact svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Back link variant (contact page) */
.nav-back {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: var(--r-pill);
  transition: color .2s;
  border: 1px solid var(--border-soft);
}
.nav-back:hover { color: var(--text-primary); border-color: var(--border-med); }
.nav-back svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ── FOOTER ──────────────────────────────────────────────── */
footer {
  padding: var(--sp-6) 0 var(--sp-5);
  border-top: 1px solid var(--border-soft);
}
.footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-3);
}
.footer-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
}
.footer-logo svg { width: 12px; height: 14px; }
.footer-logo svg path { fill: var(--text-secondary); }
.footer-links {
  display: flex;
  flex-wrap: wrap;  /* allow links to wrap to next line on narrow screens */
  gap: var(--sp-2) var(--sp-3);  /* smaller horizontal gap when wrapping */
  font-size: 13.5px;
  color: var(--text-tertiary);
}
.footer-links a,
.footer-links .footer-link-btn {
  white-space: nowrap;  /* never break a link in the middle */
}
.footer-links a:hover { color: var(--text-secondary); }
.footer-note {
  font-size: 12.5px;
  color: var(--text-tertiary);
  margin-top: var(--sp-3);
  font-family: var(--font-mono);
}
/* On narrow screens, stack logo above links and left-align everything */
@media (max-width: 640px) {
  .footer-row {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sp-3);
  }
  .footer-links {
    width: 100%;
    justify-content: flex-start;
  }
}

/* ── UTILITIES ───────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .7s var(--ease-out), transform .7s var(--ease-out);
}
.reveal.in { opacity: 1; transform: translateY(0); }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0   rgba(84, 212, 154, 0.55); }
  70%  { box-shadow: 0 0 0 7px rgba(84, 212, 154, 0); }
  100% { box-shadow: 0 0 0 0   rgba(84, 212, 154, 0); }
}

/* ── SECTION GENERIC ─────────────────────────────────────── */
section { position: relative; padding: var(--sp-9) 0; }
.section-head { max-width: 680px; margin: 0 auto var(--sp-7); }
.section-head.center { text-align: center; }
.section-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 14px;
  display: block;
}
.section-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.section-sub {
  margin-top: 14px;
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1.65;
  max-width: 520px;
}

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: var(--cta-bg);
  color: var(--cta-text);
  font-size: 15px;
  font-weight: 600;
  padding: 14px 26px;
  border-radius: var(--r-pill);
  transition: transform .25s var(--ease-spring);
}
.btn-primary:hover  { transform: translateY(-2px) scale(1.02); }
.btn-primary:active { transform: translateY(0) scale(0.96); }
.btn-primary svg { width: 16px; height: 16px; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  padding: 14px 22px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-med);
  transition: border-color .25s var(--ease), background .25s var(--ease);
}
.btn-ghost:hover { background: var(--surface-1); border-color: var(--border-strong); }

/* ── REDUCED MOTION ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   PassBy — SUPPORT MODAL
   Reuses existing design tokens (--surface-*, --border-*,
   --accent, --r-xl, --r-pill, --font-display, --ease-*).
   ============================================================ */

/* Footer button styled like a footer link, but as <button> */
.footer-link-btn {
  font: inherit;
  font-size: 13.5px;
  color: var(--text-tertiary);
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  transition: color .2s var(--ease);
}
.footer-link-btn:hover { color: var(--text-secondary); }

/* Overlay layer
   — No opacity/visibility on the parent: those create a group opacity that
     prevents backdrop-filter on children from being computed during the
     transition (the blur would snap in at the end). Instead we keep the
     parent always rendered and control visibility via pointer-events +
   per-child opacity. */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  pointer-events: none;
}
.modal.open {
  pointer-events: auto;
}

/* Backdrop: blur is CONSTANT — only opacity fades. This is the only
   combination that Chromium animates smoothly; transitioning the blur()
   function itself snaps at the end of the timeline. */
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--canvas) 70%, transparent);
  -webkit-backdrop-filter: blur(12px) saturate(120%);
  backdrop-filter: blur(12px) saturate(120%);
  opacity: 0;
  transition: opacity .45s var(--ease-out);
  will-change: opacity;
}
.modal.open .modal-backdrop { opacity: 1; }
/* Safari fallback when backdrop-filter is unsupported */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .modal-backdrop { background: color-mix(in srgb, var(--canvas) 88%, transparent); }
}

.modal-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  background: var(--surface-1);
  border: 1px solid var(--border-med);
  border-radius: var(--r-xl);
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
  box-shadow: 0 32px 80px -24px rgba(0, 0, 0, 0.65);
  transform: translateY(16px) scale(0.97);
  opacity: 0;
  pointer-events: none;
  transition: transform .45s var(--ease-spring), opacity .35s var(--ease-out);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  will-change: transform, opacity;
}
.modal.open .modal-card {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}
.modal-card::-webkit-scrollbar { width: 8px; }
.modal-card::-webkit-scrollbar-thumb { background: var(--border-med); border-radius: 4px; }

/* Close button (top-right) */
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-soft);
  background: var(--surface-2);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .2s var(--ease), border-color .2s var(--ease), background .2s var(--ease), transform .2s var(--ease-spring);
}
.modal-close svg { width: 16px; height: 16px; }
.modal-close:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: var(--surface-3);
  transform: rotate(90deg);
}
.modal-close:active { transform: rotate(90deg) scale(0.94); }

/* Header block */
.modal-head { margin-bottom: var(--sp-4); padding-right: 44px; }
.modal-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent-2);
  display: block;
  margin-bottom: 12px;
}
.modal-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 8px;
}
.modal-sub {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* Body — contact rows */
.modal-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: var(--sp-4);
}
.support-row {
  display: grid;
  grid-template-columns: 44px 1fr 18px;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  background: var(--surface-0);
  transition: border-color .25s var(--ease), background .25s var(--ease), transform .25s var(--ease-out);
}
.support-row:hover {
  border-color: var(--accent-line);
  background: var(--surface-2);
  transform: translateY(-1px);
}
.support-row:active { transform: translateY(0) scale(0.997); }

.support-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.support-icon svg { width: 20px; height: 20px; }
.support-icon--tg {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: var(--accent-2);
}
.support-icon--mail {
  background: var(--surface-3);
  color: var(--text-secondary);
}
.support-row:hover .support-icon--mail { color: var(--text-primary); }

.support-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.support-text b {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.005em;
}
.support-handle {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--accent-2);
  word-break: break-all;
}
.support-hint {
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.4;
  margin-top: 2px;
}

.support-arrow {
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  transition: color .2s var(--ease), transform .25s var(--ease-out);
}
.support-arrow svg { width: 18px; height: 18px; }
.support-row:hover .support-arrow {
  color: var(--text-primary);
  transform: translateX(3px);
}

/* Footer — status indicator only */
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border-soft);
}
.modal-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}
.modal-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--signal-green);
  flex-shrink: 0;
  animation: pulse 2.2s infinite;
}

/* Mobile tweaks */
@media (max-width: 480px) {
  .modal { padding: 16px; }
  .modal-card { padding: var(--sp-4) var(--sp-4) var(--sp-3); }
  .modal-title { font-size: 21px; }
  .support-row { padding: 12px 14px; gap: 12px; }
  .support-icon { width: 40px; height: 40px; }
  .support-hint { display: none; }
}

/* When modal is open — lock page scroll */
body.modal-open { overflow: hidden; }
