/* ============================================================
   SEKSE.IT — "EN REISE" — base tokens, reset, chrome
   Nordic Tech Noir, pushed: dark, editorial, warm orange
   ============================================================ */

/* ---------- Self-hosted fonts ---------- */
@font-face {
  font-family: 'Syne'; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url('/assets/fonts/syne-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Outfit'; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url('/assets/fonts/outfit-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Mono'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('/assets/fonts/spacemono-400-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Mono'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('/assets/fonts/spacemono-700-latin.woff2') format('woff2');
}

:root,
[data-theme='dark'] {
  --bg:            #0a0a0a;
  --bg-2:          #0c0b0a;
  --bg-card:       #111111;
  --bg-card-hover: #181614;
  --fg:            #f0ece4;
  --fg-muted:      #837c73;
  --fg-subtle:     #3a3730;
  --accent-h: 18; --accent-s: 100%; --accent-l: 56%;
  --accent:        hsl(var(--accent-h) var(--accent-s) var(--accent-l));
  --accent-hi:     hsl(var(--accent-h) 100% 70%);
  --accent-deep:   hsl(var(--accent-h) 90% 42%);
  --border:        rgba(240, 236, 228, 0.08);
  --border-hover:  rgba(240, 236, 228, 0.18);
  --grain:         0.05;
  color-scheme: dark;
}

[data-theme='light'] {
  --bg:            #f5f0e8;
  --bg-2:          #efe9df;
  --bg-card:       #ffffff;
  --bg-card-hover: #fbf7f0;
  --fg:            #15120e;
  --fg-muted:      #5a5349;
  --fg-subtle:     #b0a99e;
  --accent-l: 42%;
  --accent-deep:   hsl(var(--accent-h) 88% 34%);
  --border:        rgba(20, 16, 12, 0.12);
  --border-hover:  rgba(20, 16, 12, 0.24);
  --grain:         0.028;
  color-scheme: light;
}

:root {
  --accent-rgb: 255, 90, 31;
  --font-display: 'Syne', system-ui, sans-serif;
  --font-body:    'Outfit', system-ui, sans-serif;
  --font-mono:    'Space Mono', ui-monospace, monospace;
  --max:  1180px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-inout: cubic-bezier(0.65, 0, 0.35, 1);
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: hidden; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  position: relative;
  cursor: none;
  transition: background 0.6s var(--ease), color 0.4s var(--ease);
}
@media (hover: none) { body { cursor: auto; } }

::selection { background: rgba(var(--accent-rgb), 0.28); color: var(--fg); }

::-webkit-scrollbar { width: 0; height: 0; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--fg);
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ---------- Grain ---------- */
.grain {
  position: fixed; inset: 0; z-index: 9990; pointer-events: none;
  opacity: var(--grain); mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='260' height='260' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 260px 260px;
  transition: opacity 0.4s var(--ease);
}

/* ---------- Custom cursor ---------- */
.cursor-dot, .cursor-ring {
  position: fixed; top: 0; left: 0; z-index: 9999; pointer-events: none;
  border-radius: 50%; mix-blend-mode: screen;
  will-change: transform;
}
.cursor-dot {
  width: 6px; height: 6px; margin: -3px 0 0 -3px;
  background: var(--accent);
}
.cursor-ring {
  width: 34px; height: 34px; margin: -17px 0 0 -17px;
  border: 1px solid rgba(var(--accent-rgb), 0.5);
  transition: width 0.25s var(--ease), height 0.25s var(--ease),
              margin 0.25s var(--ease), background 0.25s, border-color 0.25s;
}
.cursor-ring.hot {
  width: 58px; height: 58px; margin: -29px 0 0 -29px;
  background: rgba(var(--accent-rgb), 0.10);
  border-color: rgba(var(--accent-rgb), 0.8);
}
[data-theme='light'] .cursor-dot,
[data-theme='light'] .cursor-ring { mix-blend-mode: multiply; }
@media (hover: none) { .cursor-dot, .cursor-ring { display: none; } }

/* ---------- Fixed atmosphere canvas ---------- */
#rain { position: fixed; inset: 0; z-index: 1; pointer-events: none; }
[data-theme='light'] #rain { mix-blend-mode: multiply; opacity: 1; }

/* Light mode: stronger accent-rgb for visibility */
[data-theme='light'] { --accent-rgb: 200, 60, 10; }

/* ---------- Header ---------- */
.hdr {
  position: fixed; top: 0; left: 0; right: 0; z-index: 500;
  height: 68px; display: flex; align-items: center; gap: 6px;
  padding: 0 clamp(18px, 4vw, 44px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.4s, background 0.4s;
}
.hdr.scrolled { border-bottom-color: var(--border); }
.logo {
  font-family: var(--font-display); font-size: 26px; font-weight: 800;
  letter-spacing: -0.045em; display: inline-flex; align-items: baseline;
}
.logo .dot { color: var(--accent); }
.hdr-spacer { flex: 1; }
.hdr-right { display: flex; align-items: center; gap: 10px; }

.chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 11px; border-radius: 99px;
  border: 1px solid var(--border); background: transparent;
  color: var(--fg-muted); cursor: none;
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
  transition: color 0.2s, border-color 0.2s, background 0.2s, box-shadow 0.25s;
}
.chip:hover { color: var(--accent); border-color: rgba(var(--accent-rgb), 0.45);
  background: rgba(var(--accent-rgb), 0.07); }
.chip svg { width: 14px; height: 14px; }
[data-theme='dark'] .chip.theme {
  border-color: rgba(var(--accent-rgb), 0.4); color: var(--accent);
  box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.18);
}
.chip .sun { display: none; } .chip .moon { display: block; }
[data-theme='dark'] .chip .sun { display: block; }
[data-theme='dark'] .chip .moon { display: none; }

/* ---------- Side progress rail ---------- */
.rail {
  position: fixed; top: 50%; right: 22px; z-index: 480;
  transform: translateY(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.rail-track {
  width: 2px; height: 180px; background: var(--border);
  border-radius: 2px; position: relative; overflow: hidden;
}
.rail-fill {
  position: absolute; top: 0; left: 0; width: 100%; height: 0%;
  background: linear-gradient(var(--accent), var(--accent-hi));
  box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.6);
}
.rail-dots { display: flex; flex-direction: column; gap: 13px; }
.rail-dot {
  width: 8px; height: 8px; border-radius: 50%;
  border: 1px solid var(--border-hover); background: transparent;
  cursor: none; transition: all 0.3s var(--ease); position: relative;
}
.rail-dot::after {
  content: attr(data-label);
  position: absolute; right: 18px; top: 50%; transform: translateY(-50%);
  font-family: var(--font-mono); font-size: 9px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--fg-muted);
  white-space: nowrap; opacity: 0; transition: opacity 0.25s;
  pointer-events: none;
}
.rail-dot:hover::after { opacity: 1; }
.rail-dot.active {
  background: var(--accent); border-color: var(--accent);
  box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.7); transform: scale(1.3);
}
.rail-dot.active::after { opacity: 1; color: var(--accent); }
@media (max-width: 920px) { .rail { display: none; } }

/* ---------- Section scaffolding ---------- */
.scene { position: relative; z-index: 2; }
.wrap { width: 100%; max-width: var(--max); margin-inline: auto;
  padding-inline: clamp(20px, 5vw, 48px); overflow: hidden; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--fg-muted);
}
.eyebrow .bar { width: 26px; height: 1.5px; background: var(--accent);
  box-shadow: 0 0 8px var(--accent); border-radius: 2px; }
.eyebrow .idx { color: var(--accent); }

/* generic reveal */
.rv { opacity: 0; transform: translateY(30px) scale(0.98);
  transition: opacity 0.85s var(--ease), transform 0.85s var(--ease); }
.rv.in { opacity: 1; transform: none; }
.rv.d1 { transition-delay: 0.08s; }
.rv.d2 { transition-delay: 0.16s; }
.rv.d3 { transition-delay: 0.24s; }
.rv.d4 { transition-delay: 0.32s; }
@media (prefers-reduced-motion: reduce) {
  .rv { opacity: 1; transform: none; transition: none; }
}

/* magnetic button */
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-body); font-size: 15px; font-weight: 600;
  height: 50px; padding: 0 26px; border-radius: 8px; cursor: none;
  background: var(--accent); color: #fff; border: 1.5px solid var(--accent);
  will-change: transform;
  transition: background 0.2s, box-shadow 0.3s, border-color 0.2s, transform 0.1s;
}
.btn:hover { background: var(--accent-hi); border-color: var(--accent-hi);
  box-shadow: 0 8px 36px rgba(var(--accent-rgb), 0.45); }
.btn:active { transform: scale(0.96) !important; transition-duration: 0.06s !important; }
.btn svg { width: 16px; height: 16px; }
.btn.ghost { background: transparent; color: var(--fg); border-color: var(--border-hover); }
.btn.ghost:hover { background: rgba(var(--accent-rgb), 0.06); border-color: var(--accent);
  color: var(--fg); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.1); }

.chip { transition: color 0.2s, border-color 0.2s, background 0.2s, box-shadow 0.25s, transform 0.1s; }
.chip:active { transform: scale(0.93) !important; transition-duration: 0.06s !important; }

/* ---------- Perf-lite mode (auto-applied when long tasks detected) ---------- */
.perf-lite .hdr,
.perf-lite .profile-card,
.perf-lite .mnav,
.perf-lite .pf-pop,
.perf-lite .search-ov,
.perf-lite .search-panel,
.perf-lite .post,
.perf-lite .const-panel {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.perf-lite .hdr { background: color-mix(in srgb, var(--bg) 94%, transparent); }
.perf-lite .profile-card,
.perf-lite .search-panel { background: var(--bg-card); }
.perf-lite .mnav { background: color-mix(in srgb, var(--bg) 96%, transparent); }
.perf-lite .cursor-ring { mix-blend-mode: normal; border-color: rgba(var(--accent-rgb), 0.7); }
.perf-lite .grain { display: none; }
