@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --bg: #020617;
  --bg-elev: #0F172A;
  --bg-elev-2: #1E293B;
  --border: #1f2a3d;
  --border-strong: #2d3a52;
  --text: #F8FAFC;
  --text-dim: #94a3b8;
  --text-muted: #64748b;
  --accent: #22C55E;
  --accent-dim: #16a34a;
  --accent-glow: rgba(34, 197, 94, 0.22);
  --blue: #38bdf8;
  --blue-dim: #0ea5e9;
  --danger: #ef4444;
  --amber: #f59e0b;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255,255,255,0.03);
  --shadow-glow: 0 0 0 1px rgba(34, 197, 94, 0.2), 0 0 30px -6px rgba(34, 197, 94, 0.35);
  --z-nav: 50;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 800px 500px at 85% -10%, rgba(34, 197, 94, 0.08), transparent 60%),
    radial-gradient(ellipse 600px 400px at 10% 0%, rgba(56, 189, 248, 0.06), transparent 60%);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.55;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

::selection { background: var(--accent-glow); color: var(--text); }

/* ────────────── HEADER ────────────── */
header {
  position: sticky; top: 0; z-index: var(--z-nav);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  background: rgba(2, 6, 23, 0.75);
  border-bottom: 1px solid var(--border);
}
header .wrap {
  max-width: 1200px; margin: 0 auto; padding: 0.9rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap;
}
header h1 { font-size: 1.05rem; font-weight: 600; letter-spacing: -0.01em; }
header h1 a {
  color: var(--text); text-decoration: none;
  display: inline-flex; align-items: center; gap: 0.55rem;
}
header h1 a::before {
  content: ""; width: 22px; height: 22px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--blue) 100%);
  border-radius: 5px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08) inset, 0 0 12px var(--accent-glow);
}
header nav { display: flex; flex-wrap: wrap; gap: 0.25rem; }
header nav a {
  color: var(--text-dim); text-decoration: none; font-size: 0.86rem; font-weight: 500;
  padding: 0.4rem 0.75rem; border-radius: var(--radius-sm);
  transition: color .18s ease, background .18s ease;
}
header nav a:hover { color: var(--text); background: var(--bg-elev); }

/* ────────────── MAIN ────────────── */
main { max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }

/* ────────────── HERO ────────────── */
.hero {
  position: relative;
  margin-bottom: 2.5rem;
  padding: 3.5rem 2rem 3rem;
  text-align: center;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.7) 0%, rgba(2, 6, 23, 0.4) 100%);
}
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle 1px at 50% 50%, rgba(255,255,255,0.07) 1px, transparent 2px);
  background-size: 32px 32px;
  mask: radial-gradient(ellipse 70% 60% at 50% 40%, #000 30%, transparent 75%);
  pointer-events: none;
}
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.3rem 0.7rem 0.3rem 0.55rem;
  font-size: 0.75rem; font-weight: 500; letter-spacing: 0.03em;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.25);
  color: var(--accent);
  border-radius: 999px;
  margin-bottom: 1.25rem;
  position: relative;
}
.hero .eyebrow::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 8px var(--accent);
}
.hero h2 {
  font-size: clamp(1.8rem, 4.5vw, 2.75rem);
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.025em;
  margin-bottom: 0.85rem;
  position: relative;
}
.hero h2 .grad {
  background: linear-gradient(90deg, var(--accent) 0%, var(--blue) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p {
  color: var(--text-dim); max-width: 620px; margin: 0 auto;
  font-size: 1.02rem; position: relative;
}
.hero .stats {
  display: flex; justify-content: center; gap: 2.25rem; margin-top: 2rem; flex-wrap: wrap; position: relative;
}
.hero .stat { font-size: 0.85rem; color: var(--text-dim); }
.hero .stat strong { display: block; font-size: 1.35rem; color: var(--text); font-weight: 600; font-family: 'IBM Plex Mono', monospace; letter-spacing: -0.02em; }

/* ────────────── CATEGORY GRID ────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.category {
  position: relative;
  background: linear-gradient(180deg, var(--bg-elev) 0%, rgba(15, 23, 42, 0.7) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem 0.75rem;
  transition: border-color .2s ease, transform .2s ease;
}
.category:hover { border-color: var(--border-strong); }
.category h3 {
  display: flex; align-items: center; gap: 0.6rem;
  font-size: 0.92rem; font-weight: 600;
  color: var(--text);
  padding-bottom: 0.75rem; margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.01em;
}
.category h3 svg { width: 18px; height: 18px; color: var(--accent); flex-shrink: 0; }
.category ul { list-style: none; }
.category li { border-bottom: 1px solid transparent; }
.category a {
  display: flex; align-items: center; justify-content: space-between;
  color: var(--text-dim); text-decoration: none; font-size: 0.88rem;
  padding: 0.5rem 0.4rem; margin: 0 -0.4rem;
  border-radius: var(--radius-sm);
  transition: color .15s ease, background .15s ease, padding-left .15s ease;
}
.category a::after {
  content: "→"; opacity: 0; transition: opacity .15s ease, transform .15s ease;
  color: var(--accent); font-family: 'IBM Plex Mono', monospace;
}
.category a:hover { color: var(--text); background: var(--bg-elev-2); padding-left: 0.65rem; }
.category a:hover::after { opacity: 1; transform: translateX(2px); }

/* ────────────── CALCULATOR PAGE ────────────── */
.calc {
  background: linear-gradient(180deg, var(--bg-elev) 0%, rgba(15, 23, 42, 0.6) 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.calc::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(34, 197, 94, 0.6) 50%, transparent 100%);
}
.calc h2 {
  font-size: 1.6rem; font-weight: 600; letter-spacing: -0.02em;
  color: var(--text); margin-bottom: 0.4rem;
}
.calc .lead { color: var(--text-dim); margin-bottom: 1.75rem; font-size: 0.95rem; max-width: 70ch; }

.calc-body { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
@media (max-width: 760px) { .calc-body { grid-template-columns: 1fr; gap: 1.5rem; } }

.inputs, .outputs { display: flex; flex-direction: column; gap: 0.85rem; }
.inputs h3, .outputs h3 {
  font-size: 0.72rem; font-weight: 600;
  color: var(--text-dim); letter-spacing: 0.1em; text-transform: uppercase;
  padding-bottom: 0.65rem; margin-bottom: 0.15rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 0.5rem;
}
.inputs h3::before, .outputs h3::before {
  content: ""; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 6px var(--accent);
}
.outputs h3::before { background: var(--blue); box-shadow: 0 0 6px var(--blue); }

/* Form fields */
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field label {
  font-size: 0.82rem; color: var(--text-dim); font-weight: 500;
}
.field input, .field select {
  padding: 0.6rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.92rem;
  color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.field input::placeholder { color: var(--text-muted); }
.field input:hover, .field select:hover { border-color: var(--border-strong); }
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--bg-elev);
}
.field select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%2394a3b8' stroke-width='2' viewBox='0 0 24 24'><path d='M6 9l6 6 6-6'/></svg>"); background-repeat: no-repeat; background-position: right 0.7rem center; padding-right: 2rem; }

/* Result cards */
.result {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--blue);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  transition: border-color .2s ease, background .2s ease;
}
.result .label {
  font-size: 0.7rem; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600;
}
.result .value {
  font-size: 1.25rem; color: var(--text); font-weight: 500;
  font-family: 'IBM Plex Mono', monospace; letter-spacing: -0.01em;
  margin-top: 0.15rem;
}
.result.big {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.08) 0%, rgba(15, 23, 42, 0.4) 100%);
  border-color: rgba(34, 197, 94, 0.25);
  border-left-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.08) inset;
}
.result.big .value {
  font-size: 1.7rem; color: var(--accent); font-weight: 600;
  text-shadow: 0 0 16px rgba(34, 197, 94, 0.35);
}

/* Buttons */
button.calc-btn {
  padding: 0.65rem 1.2rem;
  background: var(--accent); color: #052e16; border: none;
  border-radius: var(--radius-sm);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.9rem; font-weight: 600; cursor: pointer;
  transition: background .15s ease, box-shadow .15s ease, transform .08s ease;
}
button.calc-btn:hover { background: #4ade80; box-shadow: 0 0 0 4px var(--accent-glow); }
button.calc-btn:active { transform: translateY(1px); }

/* Table */
table.schedule {
  width: 100%; border-collapse: collapse; margin-top: 1.5rem; font-size: 0.85rem;
  font-family: 'IBM Plex Mono', monospace;
}
table.schedule th, table.schedule td {
  padding: 0.5rem 0.7rem; text-align: right; border-bottom: 1px solid var(--border);
}
table.schedule th { background: var(--bg-elev-2); color: var(--text-dim); font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; font-size: 0.72rem; }
table.schedule th:first-child, table.schedule td:first-child { text-align: left; }
table.schedule tr:hover td { background: var(--bg-elev); }

/* Back link */
.back {
  display: inline-flex; align-items: center; gap: 0.4rem;
  margin-bottom: 1.25rem;
  color: var(--text-dim); text-decoration: none; font-size: 0.86rem; font-weight: 500;
  transition: color .15s ease, gap .15s ease;
}
.back:hover { color: var(--accent); gap: 0.55rem; }
.back::before { content: "←"; font-family: 'IBM Plex Mono', monospace; }

/* Footer */
footer {
  max-width: 1200px; margin: 3rem auto 2rem; padding: 2rem 1.5rem 0;
  color: var(--text-muted); font-size: 0.82rem; text-align: center;
  border-top: 1px solid var(--border);
}
footer a { color: var(--text-dim); text-decoration: none; font-weight: 500; }
footer a:hover { color: var(--accent); }

/* Notes */
.notes {
  background: rgba(245, 158, 11, 0.05);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-left: 3px solid var(--amber);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  margin-top: 1.5rem;
  font-size: 0.85rem; color: #fbbf24;
  display: flex; gap: 0.6rem; align-items: flex-start;
}
.notes::before { content: "!"; flex-shrink: 0; width: 18px; height: 18px; border-radius: 50%; background: var(--amber); color: #1f1300; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.7rem; margin-top: 1px; }

/* Focus rings */
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* Mobile polish */
@media (max-width: 640px) {
  main { padding: 1.25rem 1rem 3rem; }
  .calc { padding: 1.25rem; }
  .hero { padding: 2.25rem 1.25rem; }
  header nav { gap: 0; }
  header nav a { padding: 0.35rem 0.5rem; font-size: 0.8rem; }
}
