/* ---------- Self-hosted fonts ---------- */
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/fraunces-700.woff2') format('woff2');
}
@font-face {
  font-family: 'Caveat Brush';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/caveat-brush-regular.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/jetbrains-mono-regular.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/jetbrains-mono-600.woff2') format('woff2');
}

/* ---------- Theme tokens ---------- */
:root {
  --bg: #fdfdfb;
  --bg-elev: #ffffff;
  --text: #1a2940;
  --muted: #6b7280;
  --strike: #9ca3af;
  --accent: #5EE8B6;
  --accent-2: #3DBFA8;
  --border: #e5e7eb;
  --max-w: 680px;
  --line: 1.75;
}

[data-theme="dark"] {
  --bg: #0e1218;
  --bg-elev: #161b25;
  --text: #e8eef4;
  --muted: #94a3b8;
  --strike: #475569;
  --accent: #5EE8B6;
  --accent-2: #2dd4bf;
  --border: #1f2937;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: clamp(14px, 1.45vw, 16px);
  line-height: var(--line);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(2rem, 6vw, 4.5rem) 1.25rem clamp(2rem, 4vw, 3rem);
  transition: background 0.5s ease, color 0.5s ease;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main {
  width: 100%;
  max-width: var(--max-w);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: clamp(1.5rem, 2.5vw, 2.25rem);
}

/* ---------- Headline ---------- */
header {
  margin-bottom: clamp(0.5rem, 2vw, 1.5rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1em;
}

h1.hello {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 700;
  font-size: clamp(2.6rem, 8vw, 4.75rem);
  font-variation-settings: "opsz" 144, "SOFT" 50;
  line-height: 1;
  letter-spacing: -0.025em;
}

.brush {
  font-family: 'Caveat Brush', 'Permanent Marker', cursive;
  font-weight: 400;
  font-size: clamp(2.9rem, 9vw, 5.25rem);
  line-height: 1;
  letter-spacing: 0.005em;
  display: inline-block;
  transform-origin: center;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: default;
}
.brush:hover {
  transform: rotate(-2deg) scale(1.03);
}

/* ---------- Prompt line ---------- */
.prompt {
  color: var(--muted);
}
.cursor {
  display: inline-block;
  width: 0.55ch;
  margin-left: 0.1ch;
  background: var(--accent);
  height: 1em;
  vertical-align: -0.15em;
  animation: blink 1.05s steps(1) infinite;
  border-radius: 1px;
}
@keyframes blink {
  50% { opacity: 0; }
}

/* ---------- Bio ---------- */
.bio {
  display: flex;
  flex-direction: column;
  gap: clamp(1.25rem, 2.5vw, 1.75rem);
}
.bio p { margin: 0; }
.bio strong {
  font-weight: 600;
  color: var(--text);
}
.bio s {
  color: var(--strike);
  text-decoration-color: currentColor;
  text-decoration-thickness: 1.5px;
}

/* ---------- Highlight links ---------- */
.hl {
  position: relative;
  color: inherit;
  text-decoration: none;
  font-weight: 600;
  background-image: linear-gradient(
    transparent 62%,
    var(--accent) 62%,
    var(--accent-2) 92%,
    transparent 92%
  );
  background-size: 0% 100%;
  background-repeat: no-repeat;
  background-position: 0 0;
  transition: background-size 0.55s cubic-bezier(0.65, 0, 0.35, 1);
  padding: 0 0.05em;
}
.hl.in-view { background-size: 100% 100%; }
.hl:hover {
  background-image: linear-gradient(
    transparent 55%,
    var(--accent) 55%,
    var(--accent-2) 95%,
    transparent 95%
  );
  background-size: 100% 100%;
}

/* ---------- Contact ---------- */
.contact {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  margin-top: clamp(1rem, 2.5vw, 1.5rem);
}
.contact .email {
  font-size: 1.05em;
  font-weight: 600;
}
.quiet {
  color: var(--muted);
  font-size: 0.88em;
}

/* ---------- Legal nav ---------- */
.legal-nav {
  margin-top: clamp(2rem, 5vw, 3.5rem);
  display: flex;
  gap: 0.6rem;
  align-items: center;
  justify-content: center;
  font-size: 0.8em;
  color: var(--muted);
}
.legal-nav a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
}
.legal-nav a:hover {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.legal-nav .dot { opacity: 0.5; }

/* ---------- Theme toggle ---------- */
.theme-toggle {
  position: fixed;
  top: 1.1rem;
  right: 1.1rem;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s, border-color 0.25s, background 0.5s, opacity 0.25s;
  z-index: 100;
  opacity: 0.6;
}
.theme-toggle:hover {
  opacity: 1;
  transform: scale(1.06);
  border-color: var(--accent);
}
.theme-toggle svg {
  width: 1.05rem;
  height: 1.05rem;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.theme-toggle .sun { display: none; }
.theme-toggle .moon { display: block; }
[data-theme="dark"] .theme-toggle .sun { display: block; }
[data-theme="dark"] .theme-toggle .moon { display: none; }

/* ---------- Legal pages ---------- */
.legal-page main {
  text-align: left;
  gap: clamp(1rem, 2vw, 1.25rem);
}
.legal-page .back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85em;
  margin-bottom: 0.5rem;
  width: fit-content;
  transition: color 0.2s, gap 0.2s;
}
.legal-page .back:hover { color: var(--text); gap: 0.6rem; }
.legal-page h1 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 2.75rem);
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}
.legal-page h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: clamp(1.15rem, 2vw, 1.35rem);
  font-weight: 700;
  margin: 1.5rem 0 0.25rem;
  letter-spacing: -0.01em;
}
.legal-page p { line-height: 1.7; }
.legal-page a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
  text-decoration-thickness: 2px;
}
.legal-page a:hover { text-decoration-color: var(--accent-2); }
.legal-page .meta {
  font-size: 0.85em;
  color: var(--muted);
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.legal-jump {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  font-size: 0.85em;
  color: var(--muted);
  margin-bottom: 0.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.legal-jump a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
  transition: color 0.2s, border-color 0.2s;
}
.legal-jump a:hover {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.legal-jump .dot { opacity: 0.5; }

.legal-page section + section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.legal-page section { scroll-margin-top: 1.5rem; }

/* ---------- Reveal animations ---------- */
.reveal {
  opacity: 0;
  transform: translateY(10px);
  animation: rise 0.85s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.reveal-1 { animation-delay: 0.05s; }
.reveal-2 { animation-delay: 0.18s; }
.reveal-3 { animation-delay: 0.32s; }
.reveal-4 { animation-delay: 0.44s; }
.reveal-5 { animation-delay: 0.56s; }
.reveal-6 { animation-delay: 0.66s; }
.reveal-7 { animation-delay: 0.76s; }
.reveal-8 { animation-delay: 0.86s; }
.reveal-9 { animation-delay: 0.96s; }
.reveal-10 { animation-delay: 1.06s; }

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

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .cursor { animation: none; opacity: 1; }
  .hl { background-size: 100% 100% !important; }
}

/* ---------- Mobile ---------- */
@media (max-width: 480px) {
  body { padding: 2.5rem 1.1rem 2rem; }
  main { gap: 1.5rem; }
  .bio { gap: 1.25rem; }
  .theme-toggle { top: 0.75rem; right: 0.75rem; }
}
