/* ==========================================================================
   christianrieger — firenamics.com
   Plain CSS, no build step. Assets under /css /js /img /fonts are served
   with a 1-year cache — rename files (e.g. main.2.css) when changing them.
   ========================================================================== */

/* ---- Fonts ---------------------------------------------------------------- */

@font-face {
  font-family: "Raleway";
  src: url("../fonts/Raleway-VariableFont_wght.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Nunito";
  src: url("../fonts/Nunito-VariableFont_wght.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ---- Design tokens --------------------------------------------------------- */

:root {
  --bg: #0c0a09;
  --bg-elevated: #151210;
  --surface: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.09);
  --text: #ece7e1;
  --text-muted: #a8a099;
  --ember-1: #ffc46b;
  --ember-2: #ff9a3c;
  --ember-3: #f4633a;
  --ember-4: #c92c2c;
  --accent: var(--ember-2);
  --gradient: linear-gradient(120deg, var(--ember-1), var(--ember-2) 40%, var(--ember-3) 75%, var(--ember-4));
  --btn-text: #1a120b;
  --card-hover-border: rgba(255, 154, 60, 0.35);
  --card-hover-glow: 0 8px 40px -12px rgba(255, 120, 50, 0.25);
  --dot-grid: rgba(255, 255, 255, 0.07);
  --spotlight: rgba(255, 140, 60, 0.06);
  --header-bg: rgba(12, 10, 9, 0.75);

  --font-heading: "Raleway", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Nunito", ui-sans-serif, system-ui, sans-serif;
  --font-mono: ui-monospace, "JetBrains Mono", "Cascadia Code", Consolas, monospace;

  --container: 72rem;
  --section-pad: clamp(4rem, 10vw, 7.5rem);

  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #faf6f1;
  --bg-elevated: #ffffff;
  --surface: rgba(0, 0, 0, 0.03);
  --border: rgba(0, 0, 0, 0.1);
  --text: #201a15;
  --text-muted: #6b625a;
  --accent: #b4530a;
  --btn-text: #1a120b;
  --card-hover-border: rgba(180, 83, 10, 0.4);
  --card-hover-glow: 0 8px 40px -12px rgba(200, 90, 20, 0.25);
  --dot-grid: rgba(0, 0, 0, 0.09);
  --spotlight: rgba(220, 120, 40, 0.07);
  --header-bg: rgba(250, 246, 241, 0.8);

  color-scheme: light;
}

/* ---- Reset / base ---------------------------------------------------------- */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

h1,
h2,
h3 {
  font-family: var(--font-heading);
  line-height: 1.15;
  margin: 0 0 1rem;
}

h1 {
  font-size: clamp(2.6rem, 7vw, 4.8rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 700;
}

h3 {
  font-size: 1.25rem;
  font-weight: 600;
}

p {
  margin: 0 0 1rem;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection {
  background: var(--ember-3);
  color: #fff;
}

.container {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 4vw, 2.5rem);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.skip-link:focus {
  top: 1rem;
}

/* ---- Header ---------------------------------------------------------------- */

.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  transition: background-color 0.3s, border-color 0.3s, backdrop-filter 0.3s;
  border-bottom: 1px solid transparent;
}

.site-header.scrolled {
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom-color: var(--border);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 4rem;
}

.monogram {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: -0.03em;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.monogram:hover {
  text-decoration: none;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 2.5vw, 1.75rem);
}

.site-nav a {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.25rem 0.1rem;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--text);
  border-bottom-color: var(--accent);
  text-decoration: none;
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  transition: color 0.2s, border-color 0.2s, transform 0.2s;
}

.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--card-hover-border);
  transform: rotate(15deg);
}

.theme-toggle .icon-sun {
  display: none;
}

.theme-toggle .icon-moon {
  display: block;
}

[data-theme="light"] .theme-toggle .icon-sun {
  display: block;
}

[data-theme="light"] .theme-toggle .icon-moon {
  display: none;
}

/* ---- Sections (shared) ------------------------------------------------------ */

section {
  padding-block: var(--section-pad);
}

.section-title {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
}

.section-title .index {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--accent);
}

.section-title h2::after {
  content: "";
  display: block;
  width: 3.5rem;
  height: 3px;
  margin-top: 0.6rem;
  border-radius: 2px;
  background: var(--gradient);
}

/* ---- Hero ------------------------------------------------------------------- */

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding-block: 6rem 3rem;
  isolation: isolate;
}

.hero-grid-bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image: radial-gradient(var(--dot-grid) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 30%, transparent 75%);
  mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 30%, transparent 75%);
}

.hero-spotlight {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(600px at var(--mx, 50%) var(--my, 40%), var(--spotlight), transparent 70%);
}

.hero .container {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 4rem);
  width: 100%;
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.25rem;
}

.hero h1 {
  margin-bottom: 1.25rem;
  background: var(--gradient);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gradient-shimmer 30s ease-in-out infinite;
}

@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  .hero h1 {
    background: none;
    color: var(--ember-2);
  }
}

@keyframes gradient-shimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.hero-sub {
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  color: var(--text-muted);
  max-width: 34em;
  margin-bottom: 1.5rem;
}

.terminal-line {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  min-height: 1.8em;
  margin-bottom: 2.25rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.terminal-line .prompt {
  color: var(--accent);
}

.terminal-line .typed {
  color: var(--text);
}

.terminal-line .cursor {
  display: inline-block;
  width: 0.6em;
  height: 1.15em;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: cursor-blink 1.1s steps(1) infinite;
}

@keyframes cursor-blink {
  50% { opacity: 0; }
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.75rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1rem;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s, filter 0.2s;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-2px);
}

.btn-primary {
  background: var(--gradient);
  color: var(--btn-text);
}

.btn-primary:hover {
  filter: brightness(1.08);
  box-shadow: var(--card-hover-glow);
}

.btn-ghost {
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-ghost:hover {
  border-color: var(--card-hover-border);
}

/* Portrait with ember glow + conic ring */

.hero-portrait {
  position: relative;
  justify-self: center;
  width: min(100%, 380px);
  aspect-ratio: 1;
}

.hero-portrait::before {
  content: "";
  position: absolute;
  inset: -12%;
  z-index: -1;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--ember-1), var(--ember-3), var(--ember-4), var(--ember-2), var(--ember-1));
  filter: blur(70px);
  opacity: 0.55;
  animation: glow-spin 18s linear infinite;
}

@keyframes glow-spin {
  0% { transform: rotate(0deg) scale(1); opacity: 0.45; }
  50% { transform: rotate(180deg) scale(1.06); opacity: 0.6; }
  100% { transform: rotate(360deg) scale(1); opacity: 0.45; }
}

.hero-portrait .ring {
  display: block;
  border-radius: 50%;
  padding: 4px;
  background: conic-gradient(from 210deg, var(--ember-1), var(--ember-2), var(--ember-3), var(--ember-4), var(--ember-1));
}

.hero-portrait img {
  width: 100%;
  border-radius: 50%;
  border: 4px solid var(--bg);
}

.scroll-hint {
  position: absolute;
  left: 50%;
  bottom: 1.5rem;
  translate: -50% 0;
  color: var(--text-muted);
  animation: hint-bounce 2.2s ease-in-out infinite;
}

@keyframes hint-bounce {
  0%, 100% { transform: translateY(0); opacity: 0.5; }
  50% { transform: translateY(8px); opacity: 1; }
}

/* ---- About ------------------------------------------------------------------ */

.motto {
  margin: 0 0 2.5rem;
  padding-left: 1.5rem;
  border-left: 4px solid transparent;
  border-image: var(--gradient) 1;
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 3.5vw, 2.2rem);
  font-weight: 700;
  line-height: 1.3;
}

.motto cite {
  display: block;
  margin-top: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-style: normal;
  font-weight: 400;
  color: var(--text-muted);
}

.about-prose {
  max-width: 65ch;
}

.about-prose p + p {
  margin-top: 1.25rem;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 2.25rem;
  padding: 0;
  list-style: none;
}

.chip {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: border-color 0.2s, color 0.2s;
}

.chip:hover {
  border-color: var(--card-hover-border);
  color: var(--text);
}

/* ---- Cards (Now / Writing) ---------------------------------------------------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: clamp(1rem, 2.5vw, 1.75rem);
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: clamp(1.25rem, 3vw, 2rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--card-hover-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), var(--card-hover-glow);
}

.card h3 {
  margin: 0;
}

.card .meta {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.card p {
  margin: 0.25rem 0 0;
  color: var(--text-muted);
  font-size: 0.98rem;
}

.card .card-link {
  margin-top: auto;
  padding-top: 1rem;
  font-weight: 700;
  font-size: 0.95rem;
}

.card .card-link::after {
  content: " →";
}

/* stretched-link: whole card clickable */
.card .card-link::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 16px;
}

.section-more {
  margin-top: 2.5rem;
  font-weight: 700;
}

/* ---- Timeline ----------------------------------------------------------------- */

.timeline {
  position: relative;
  max-width: 46rem;
  margin: 0;
  padding: 0 0 0 2rem;
  list-style: none;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--border);
}

.timeline::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--gradient);
  transform-origin: top;
  transform: scaleY(var(--progress, 0));
}

.timeline li {
  position: relative;
  padding-bottom: 2.25rem;
}

.timeline li:last-child {
  padding-bottom: 0;
}

.timeline li::before {
  content: "";
  position: absolute;
  z-index: 1;
  left: calc(-2rem + 1px);
  top: 0.45em;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 2px solid var(--text-muted);
  transition: border-color 0.4s, box-shadow 0.4s, background 0.4s;
}

.timeline li.in::before {
  background: var(--ember-2);
  border-color: var(--ember-2);
  box-shadow: 0 0 14px rgba(255, 154, 60, 0.55);
}

.timeline .date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.timeline h3 {
  margin: 0.15rem 0 0.25rem;
}

.timeline p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.98rem;
}

/* ---- Contact -------------------------------------------------------------------- */

.contact-lead {
  font-size: clamp(1.2rem, 2.5vw, 1.5rem);
  max-width: 30em;
}

.contact-email {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin: 2rem 0;
}

.contact-email a {
  font-family: var(--font-heading);
  font-size: clamp(1.3rem, 4vw, 2rem);
  font-weight: 700;
  color: var(--text);
  overflow-wrap: anywhere;
}

.contact-email a:hover {
  color: var(--accent);
  text-decoration: none;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  transition: border-color 0.2s, color 0.2s;
}

.copy-btn:hover {
  border-color: var(--card-hover-border);
  color: var(--text);
}

.copy-btn.copied {
  color: var(--accent);
  border-color: var(--card-hover-border);
}

.gpg-block {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.gpg-block .label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  color: var(--accent);
}

.gpg-block code {
  font-size: 0.85rem;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.social-row {
  display: flex;
  gap: 1rem;
}

.social-row a {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  transition: color 0.2s, border-color 0.2s, transform 0.2s;
}

.social-row a:hover {
  color: var(--accent);
  border-color: var(--card-hover-border);
  transform: translateY(-2px);
}

/* ---- Footer ------------------------------------------------------------------------ */

.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 2.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
}

.footer-links a {
  color: var(--text-muted);
}

.footer-links a:hover {
  color: var(--accent);
}

.footer-note {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  margin-top: 0.5rem;
}

/* ---- Legal / prose pages -------------------------------------------------------------- */

.prose-page {
  padding-top: 7rem;
  max-width: 46rem;
}

.prose-page h1 {
  font-size: clamp(2rem, 5vw, 3rem);
}

.prose-page h2 {
  font-size: 1.4rem;
  margin-top: 2.5rem;
}

.prose-page ul {
  padding-left: 1.25rem;
}

/* ---- 404 -------------------------------------------------------------------------------- */

.error-page {
  min-height: 100svh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 2rem;
}

.error-page .code {
  font-family: var(--font-mono);
  font-size: clamp(4rem, 15vw, 8rem);
  font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1;
  margin-bottom: 1rem;
}

/* ---- Scroll reveal ------------------------------------------------------------------------ */

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s cubic-bezier(0.2, 0.7, 0.2, 1), transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
  transition-delay: calc(var(--d, 0) * 80ms);
}

.reveal.in,
.no-js .reveal {
  opacity: 1;
  transform: none;
}

.no-js .timeline {
  --progress: 1;
}

.no-js .timeline li::before {
  background: var(--ember-2);
  border-color: var(--ember-2);
}

/* ---- Responsive ------------------------------------------------------------------------------ */

@media (max-width: 820px) {
  .hero .container {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hero {
    padding-top: 7rem;
  }

  .hero-portrait {
    order: -1;
    width: min(60vw, 260px);
  }

  .hero-sub {
    margin-inline: auto;
  }

  .hero-ctas {
    justify-content: center;
  }

  .terminal-line {
    text-align: left;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin-inline: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    min-height: 3.6em; /* reserve two lines so wrapping doesn't shift the layout */
  }

  .motto {
    font-size: clamp(1.3rem, 5vw, 1.8rem);
  }
}

@media (max-width: 480px) {
  .site-nav {
    gap: 0.7rem;
  }

  .site-nav a {
    font-size: 0.85rem;
  }

  .scroll-hint {
    display: none;
  }
}

/* ---- Reduced motion ---------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .hero h1 {
    animation: none;
  }

  .hero-portrait::before {
    animation: none;
  }

  .terminal-line .cursor {
    animation: none;
  }

  .scroll-hint {
    animation: none;
  }

  .reveal {
    transform: none;
    transition: opacity 0.2s;
    transition-delay: 0s;
  }

  .btn,
  .card,
  .theme-toggle,
  .social-row a {
    transition: none;
  }

  .card:hover,
  .btn:hover,
  .social-row a:hover,
  .theme-toggle:hover {
    transform: none;
  }

  .timeline {
    --progress: 1 !important;
  }
}
