/* =====================================================================
   Frama Trading — shared stylesheet
   ===================================================================== */

:root {
  --bg: #050505;
  --bg-elevated: #0a0a0a;
  --fg: #f2efea;
  --fg-bright: #ffffff;
  --fg-dim: #8f8b85;
  --fg-muted: #555148;
  --line: rgba(242, 239, 234, 0.08);
  --line-strong: rgba(242, 239, 234, 0.2);
  --serif: 'Instrument Serif', 'Times New Roman', serif;
  --sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --pad-x: clamp(1.25rem, 4vw, 4rem);
  --pad-y: clamp(1rem, 2.5vw, 2rem);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--fg);
  font-weight: 300;
  line-height: 1.5;
  letter-spacing: -0.005em;
  overflow-x: hidden;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--fg);
  color: var(--bg);
}

/* ---------- Background layers ---------- */
.bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 20%, rgba(255, 255, 255, 0.025), transparent 55%),
    radial-gradient(ellipse at 80% 100%, rgba(255, 255, 255, 0.015), transparent 60%),
    var(--bg);
}

.bg-math {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.bg-math .eq {
  position: absolute;
  font-family: var(--serif);
  font-style: italic;
  color: var(--fg-bright);
  white-space: nowrap;
  user-select: none;
  will-change: transform;
}

.bg-math .eq.small { font-size: clamp(1.4rem, 2.4vw, 2.4rem); opacity: 0.018; }
.bg-math .eq.med   { font-size: clamp(2.2rem, 4.2vw, 4.6rem); opacity: 0.028; }
.bg-math .eq.large { font-size: clamp(3rem,   7vw,   8rem);   opacity: 0.04;  }

.bg-grain {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0.1;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/><feColorMatrix values='0 0 0 0 0.2  0 0 0 0 0.2  0 0 0 0 0.2  0 0 0 0.6 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* Subtle vignette at edges */
.bg-vignette {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.45) 100%);
}

/* ---------- Shell ---------- */
.shell {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Nav ---------- */
header.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--pad-y) var(--pad-x);
  background: linear-gradient(to bottom, rgba(5,5,5,0.85), rgba(5,5,5,0));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.brand {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg);
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
}

.brand-mark {
  width: 7px; height: 7px;
  background: var(--fg-bright);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(255,255,255,0.5);
  animation: pulse 3.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50%      { opacity: 1;    transform: scale(1.2); }
}

nav.links {
  display: flex;
  gap: clamp(1rem, 2.5vw, 2.2rem);
  align-items: center;
}

nav.links a {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--fg-dim);
  text-decoration: none;
  padding: 0.4rem 0;
  position: relative;
  transition: color 0.25s ease;
}

nav.links a::after {
  content: '';
  position: absolute;
  left: 0; right: 100%;
  bottom: -2px;
  height: 1px;
  background: var(--fg-bright);
  transition: right 0.35s cubic-bezier(0.2, 0.9, 0.3, 1);
}

nav.links a:hover,
nav.links a.active { color: var(--fg-bright); }
nav.links a:hover::after,
nav.links a.active::after { right: 0; }

main { flex: 1; }

/* ---------- Section base ---------- */
section {
  padding: clamp(7rem, 14vh, 10rem) var(--pad-x) clamp(4rem, 8vh, 6rem);
  position: relative;
}

.section-meta {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 2.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.section-meta::before {
  content: '';
  width: 28px; height: 1px;
  background: var(--fg-muted);
}

/* ---------- Hero (home) ---------- */
.hero { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; }

.hero h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(3rem, 10vw, 9.5rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  max-width: 20ch;
  margin-bottom: 2rem;
  color: var(--fg);
}

.hero h1 em {
  font-style: italic;
  color: var(--fg-bright);
  font-weight: 400;
}

.hero .lede {
  font-size: clamp(1.1rem, 1.5vw, 1.35rem);
  max-width: 52ch;
  color: var(--fg);
  line-height: 1.55;
  font-weight: 300;
}

/* ---------- Approach / body prose (home) ---------- */
.approach {
  border-top: 1px solid var(--line);
  padding-top: clamp(4rem, 8vh, 6rem);
}

.approach .prose {
  max-width: 62ch;
  font-size: clamp(1.02rem, 1.2vw, 1.12rem);
  color: var(--fg-dim);
  line-height: 1.75;
  font-weight: 300;
}

.approach .prose p + p { margin-top: 1.4rem; }

.approach .prose em {
  color: var(--fg);
  font-style: italic;
  font-family: var(--serif);
  font-size: 1.12em;
}

/* ---------- Stats ---------- */
.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(1.5rem, 4vw, 4rem);
  margin-top: clamp(3rem, 6vh, 5rem);
  padding-top: 2rem;
  border-top: 1px solid var(--line);
  max-width: 820px;
}

.stat .num {
  font-family: var(--serif);
  font-size: clamp(2rem, 3.2vw, 2.8rem);
  line-height: 1;
  color: var(--fg-bright);
  margin-bottom: 0.4rem;
}

.stat .label {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

/* ---------- Careers page ---------- */
.careers-page {
  min-height: calc(100vh - 140px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 1100px;
}

.careers-page h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(3rem, 10vw, 9rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  margin-bottom: 2.5rem;
  color: var(--fg);
}

.careers-page h1 em {
  font-style: italic;
  color: var(--fg-bright);
}

.careers-page .prose {
  font-size: clamp(1.1rem, 1.5vw, 1.35rem);
  max-width: 48ch;
  color: var(--fg);
  line-height: 1.55;
  font-weight: 300;
  margin-bottom: 3rem;
}

.big-email {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.8rem, 4.5vw, 3.5rem);
  color: var(--fg-bright);
  text-decoration: none;
  display: inline-block;
  line-height: 1.2;
  position: relative;
  transition: letter-spacing 0.4s ease;
  word-break: break-word;
  letter-spacing: -0.01em;
}

.big-email::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  bottom: -2px;
  height: 1px;
  background: var(--fg-bright);
  transform: scaleX(1);
  transform-origin: left;
  transition: transform 0.5s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.big-email:hover::after { transform: scaleX(0.3); }

.careers-note {
  margin-top: 3rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--fg-muted);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.careers-note::before {
  content: '';
  width: 28px; height: 1px;
  background: var(--fg-muted);
}

/* ---------- Footer ---------- */
footer {
  position: relative;
  z-index: 10;
  padding: 3rem var(--pad-x);
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--fg-dim);
}

footer .col { display: flex; flex-direction: column; gap: 0.5rem; }

footer .label {
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 0.3rem;
}

footer a {
  color: var(--fg-dim);
  text-decoration: none;
  transition: color 0.2s ease;
}

footer a:hover { color: var(--fg-bright); }

footer .social {
  display: flex;
  gap: 1.2rem;
}

/* ---------- Corner annotations ---------- */
.corner {
  position: fixed;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  color: var(--fg-muted);
  z-index: 50;
  pointer-events: none;
  text-transform: uppercase;
}

.corner.tl {
  top: 50%;
  left: 1rem;
  transform: rotate(-90deg) translateX(50%);
  transform-origin: left center;
}

@media (max-width: 820px) {
  .corner.tl { display: none; }
  nav.links a { font-size: 0.62rem; letter-spacing: 0.15em; }
  .brand { font-size: 0.64rem; }
}

/* ---------- Entrance animations ---------- */
.fade-up {
  opacity: 0;
  transform: translateY(22px);
  animation: fadeUp 1.1s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
.fade-up.d1 { animation-delay: 0.1s; }
.fade-up.d2 { animation-delay: 0.25s; }
.fade-up.d3 { animation-delay: 0.45s; }
.fade-up.d4 { animation-delay: 0.65s; }
.fade-up.d5 { animation-delay: 0.85s; }

@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.001ms !important;
  }
  .fade-up { opacity: 1; transform: none; }
}
