/* ---------- Theme tokens ---------- */

:root {
  --bg: #12101c;
  --surface: #1e1a2e;
  --surface-2: #261f3f;
  --border: rgba(139, 127, 232, 0.22);
  --text-primary: #f3f1fa;
  --text-secondary: #b6afd6;
  --text-muted: #7a7396;
  --primary: #8b7fe8;
  --accent: #3fe0d0;
  --accent-2: #ff4fa0;
  --on-primary: #14101c;

  --font-display: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --font-body: "Manrope", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Menlo, monospace;

  --max-width: 1080px;
  --radius: 6px;
  --transition: 200ms ease;
}

[data-theme="twilight"] {
  --bg: #0d1321;
  --surface: #182238;
  --surface-2: #1f2c48;
  --border: rgba(111, 79, 201, 0.24);
  --text-primary: #f1eef8;
  --text-secondary: #aeb9d4;
  --text-muted: #707c99;
  --primary: #6f4fc9;
  --accent: #2ec4b6;
  --accent-2: #e9c46a;
  --on-primary: #0d1321;
}

[data-theme="parchment"] {
  --bg: #f4efe3;
  --surface: #ffffff;
  --surface-2: #ece1cb;
  --border: rgba(107, 74, 153, 0.22);
  --text-primary: #241f33;
  --text-secondary: #5c5470;
  --text-muted: #8b839c;
  --primary: #6b4a99;
  --accent: #1f8f7f;
  --accent-2: #b8542f;
  --on-primary: #f4efe3;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

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

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
}

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

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

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

/* ---------- Typography ---------- */

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.5em;
  color: var(--text-primary);
}

h1 { font-size: clamp(2.6rem, 5vw, 4rem); }
h2 { font-size: clamp(1.7rem, 3vw, 2.3rem); }
h3 { font-size: 1.35rem; font-weight: 600; }

p {
  margin: 0 0 1.1em;
  max-width: 62ch;
  color: var(--text-secondary);
}

.lede {
  font-size: 1.15rem;
  color: var(--text-secondary);
}

.tag-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 0.75em 0 0;
}

.tag-list li {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 12px;
}

.status {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 12px;
  display: inline-block;
  margin-bottom: 0.75em;
}

/* ---------- Layout ---------- */

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

section {
  padding: 64px 0;
}

section + section {
  border-top: 1px solid var(--border);
}

/* ---------- Nav ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  padding-bottom: 16px;
}

.wordmark {
  font-family: var(--font-display);
  font-size: 2.8rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  text-decoration: none;
}
.wordmark:hover { text-decoration: none; color: var(--primary); }

.wordmark span {
  background-image: linear-gradient(90deg, var(--accent), var(--accent-2), var(--primary), var(--accent));
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 6s linear infinite;
}

@keyframes shimmer {
  0% { background-position: 0% 0; }
  100% { background-position: 300% 0; }
}

nav.main-nav {
  display: flex;
  align-items: center;
  gap: 28px;
}

nav.main-nav a {
  color: var(--text-secondary);
  font-size: 0.95rem;
}
nav.main-nav a:hover { color: var(--text-primary); text-decoration: none; }
nav.main-nav a[aria-current="page"] { color: var(--text-primary); }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  padding: 6px 10px;
  font-size: 1rem;
}

/* Theme switch */

.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 10px 5px 12px;
  background: var(--surface);
}

.theme-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  white-space: nowrap;
}

.theme-dot {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  padding: 0;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition);
}

.theme-dot:hover { transform: scale(1.12); }

.theme-dot[aria-pressed="true"] {
  border-color: var(--text-primary);
}

.dot-arcane { background: linear-gradient(135deg, #12101c 50%, #8b7fe8 50%); }
.dot-twilight { background: linear-gradient(135deg, #0d1321 50%, #6f4fc9 50%); }
.dot-parchment { background: linear-gradient(135deg, #f4efe3 50%, #6b4a99 50%); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  border: 1px solid var(--primary);
  color: var(--text-primary);
  padding: 11px 22px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  transition: background var(--transition), border-color var(--transition);
}
.btn:hover {
  background: color-mix(in srgb, var(--primary) 16%, transparent);
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}
.btn-primary:hover {
  background: color-mix(in srgb, var(--primary) 82%, black);
}

.btn-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 1.5em;
}

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

.hero {
  position: relative;
  padding: 96px 0 72px;
  overflow: hidden;
}

.hero .container { position: relative; z-index: 1; }

.sigil {
  position: absolute;
  top: -60px;
  right: -80px;
  width: 480px;
  height: 480px;
  color: var(--primary);
  opacity: 0.16;
  pointer-events: none;
}

.hero h1 { max-width: 14ch; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.6em;
}

/* ---------- Cards ---------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 28px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 26px;
  display: flex;
  flex-direction: column;
}

.card h3 { margin-bottom: 0.4em; }
.card p { margin-bottom: 0.9em; }

.card-link {
  margin-top: auto;
  font-size: 0.9rem;
  padding-top: 12px;
}

.screenshot-placeholder {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
  text-align: center;
  padding: 32px 16px;
  margin: 14px 0;
}

.screenshot-gallery {
  display: flex;
  gap: 14px;
  margin: 16px 0 4px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.screenshot-gallery figure {
  margin: 0;
}

.screenshot-gallery img {
  width: 128px;
  flex: 0 0 auto;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.screenshot-gallery figcaption {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 6px;
  text-align: center;
  width: 128px;
}

.section-intro {
  max-width: 60ch;
}

.group-label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 40px 0 4px;
}

.group-label:first-of-type { margin-top: 0; }

/* ---------- Portrait / about media ---------- */

.about-media {
  float: right;
  width: 220px;
  margin: 0 0 20px 32px;
  border-radius: 10px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.about-media img { border-radius: 9px; }

.about-media figcaption {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 8px 10px;
}

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

.contact-block {
  text-align: left;
}

.email-btn {
  font-family: var(--font-mono);
  font-size: 1.05rem;
}

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

.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.site-footer .container {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

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

@media (max-width: 720px) {
  .sigil { width: 320px; height: 320px; top: -40px; right: -100px; }
  .about-media { float: none; width: 100%; margin: 0 0 20px; }

  nav.main-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 24px 24px;
    gap: 16px;
    display: none;
  }
  nav.main-nav.open { display: flex; }
  .nav-toggle { display: inline-block; }
}
