/* ==========================================================================
   neometheus / Chris Diaz
   Warm paper & ink editorial stylesheet (zero build steps, pure CSS)
   ========================================================================== */

:root {
  /* Light theme: warm paper and charcoal ink (pairs cleanly with Substack) */
  --bg: #f8f5ef;
  --surface: #fdfbf7;
  --surface-subtle: #f1ece2;
  --ink: #1d1b18;
  --ink-muted: #5d574e;
  --ink-faint: #8c8478;
  --border: #e3dcd0;
  --border-strong: #cfc5b4;
  --accent: #b34a2f;
  --accent-soft: rgba(179, 74, 47, 0.1);
  --shadow-card: 0 8px 24px rgba(29, 27, 24, 0.05);

  /* Typography */
  --font-serif: "Newsreader", Georgia, "Times New Roman", serif;
  --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Layout */
  --max-w: 880px;
  --radius: 10px;
  --radius-sm: 6px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="dark"] {
  /* Dusk theme: warm charcoal ink and soft parchment */
  --bg: #161513;
  --surface: #1e1c19;
  --surface-subtle: #25221e;
  --ink: #efeae0;
  --ink-muted: #b1a89a;
  --ink-faint: #7b7367;
  --border: #2e2a25;
  --border-strong: #433d35;
  --accent: #df7759;
  --accent-soft: rgba(223, 119, 89, 0.14);
  --shadow-card: 0 10px 28px rgba(0, 0, 0, 0.28);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  transition: background-color 0.35s var(--ease), color 0.35s var(--ease);
}

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

a {
  color: inherit;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 0.22em;
  text-decoration-thickness: 1px;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

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

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--bg);
  padding: 0.6rem 1rem;
  z-index: 100;
  text-decoration: none;
}

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

.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.mono-tag {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.03em;
  color: var(--ink-muted);
}

.muted {
  color: var(--ink-faint);
}

.sep {
  color: var(--ink-faint);
  margin: 0 0.35rem;
}

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background-color: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.35s var(--ease), border-color 0.35s var(--ease);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 62px;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: color 0.35s var(--ease);
}

.brand:hover {
  color: var(--ink);
}

/* Constant, quiet breathing dot beside the handle */
.brand-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent);
  box-shadow: 0 0 0 0 var(--accent-soft);
  animation: quiet-breathe 5.5s ease-in-out infinite;
}

@keyframes quiet-breathe {
  0%, 100% {
    transform: scale(0.92);
    opacity: 0.78;
    box-shadow: 0 0 0 0 var(--accent-soft);
  }
  50% {
    transform: scale(1.08);
    opacity: 1;
    box-shadow: 0 0 0 6px rgba(179, 74, 47, 0);
  }
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.35rem;
  font-size: 0.92rem;
}

.site-nav a {
  text-decoration: none;
  color: var(--ink-muted);
  position: relative;
}

.site-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -3px;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s var(--ease);
}

.site-nav a:hover {
  color: var(--ink);
}

.site-nav a:hover::after {
  transform: scaleX(1);
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: 999px;
  box-shadow: 0 1px 4px rgba(29, 27, 24, 0.05);
}

.lang-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1;
  padding: 0.42rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.lang-btn:hover {
  color: var(--ink);
  background: var(--surface-subtle);
}

.lang-btn.is-active {
  background: var(--ink);
  color: var(--bg);
}

.lang-btn:focus-visible {
  border-radius: 999px;
}

.flag-icon {
  width: 18px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.lang-short {
  display: none;
}

.icon-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.34rem 0.65rem;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.icon-btn:hover {
  border-color: var(--border-strong);
  color: var(--ink);
}

.icon-btn:focus-visible {
  border-radius: 999px;
}

/* ==========================================================================
   Hero & Harmonic Canvas Stage
   ========================================================================== */
.hero {
  padding: 2.5rem 0 3.25rem;
}

.hero-stage {
  position: relative;
  width: 100%;
  height: 168px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
  margin-bottom: 2.25rem;
  cursor: crosshair;
  transition: border-color 0.3s ease, background-color 0.35s var(--ease);
}

.hero-stage:hover {
  border-color: var(--border-strong);
}

#harmonic-canvas {
  width: 100%;
  height: 100%;
}

.hero-stage-caption {
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: 0.7rem;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  opacity: 0.72;
}

.stage-hint {
  transition: opacity 0.3s ease;
}

.hero-copy {
  max-width: 660px;
}

.eyebrow {
  margin: 0 0 0.85rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.hero-title {
  margin: 0 0 1.25rem;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(2.15rem, 4.4vw, 3.05rem);
  line-height: 1.14;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.bio {
  color: var(--ink-muted);
  font-size: 1.02rem;
  line-height: 1.72;
}

.bio p {
  margin: 0 0 1rem;
}

.bio p:last-child {
  margin-bottom: 0;
}

.bio a {
  color: var(--ink);
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.62rem 1.15rem;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform 0.2s var(--ease), background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--ink);
  color: var(--bg);
}

.btn-primary:hover {
  background: var(--accent);
  color: #fffdf9;
}

.btn-ghost {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border);
}

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

/* ==========================================================================
   Sections
   ========================================================================== */
.section {
  padding: 3rem 0;
  border-top: 1px solid var(--border);
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.section-kicker {
  margin: 0 0 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.72rem;
}

.section h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(1.55rem, 2.8vw, 1.95rem);
  line-height: 1.2;
  letter-spacing: -0.015em;
}

.text-link {
  font-size: 0.9rem;
  color: var(--ink-muted);
  text-decoration: none;
}

.text-link:hover {
  color: var(--accent);
}

/* ==========================================================================
   Projects Grid & Category Filters (Ready for Visual Cards)
   ========================================================================== */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.filter-pill {
  appearance: none;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.34rem 0.72rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.filter-pill:hover {
  border-color: var(--border-strong);
  color: var(--ink);
}

.filter-pill.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(265px, 1fr));
  gap: 1.25rem;
}

.project-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  transition: transform 0.28s var(--ease), border-color 0.25s ease, box-shadow 0.28s var(--ease);
}

.project-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-card);
  color: inherit;
}

.project-thumb {
  aspect-ratio: 16 / 10;
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.project-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s var(--ease);
}

.project-card:hover .project-thumb img {
  transform: scale(1.03);
}

.project-thumb-fallback {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
}

.project-body {
  padding: 1.1rem 1.2rem 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.project-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.project-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.16rem 0.5rem;
  border-radius: 999px;
}

.project-title {
  margin: 0 0 0.45rem;
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 1.22rem;
  line-height: 1.28;
  color: var(--ink);
}

.project-summary {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.58;
  color: var(--ink-muted);
}

/* Intentional Empty / Workbench State */
.workbench-empty {
  display: grid;
  gap: 1.75rem;
}

.workbench-note {
  max-width: 600px;
}

.workbench-lead {
  margin: 0 0 0.45rem;
  font-family: var(--font-serif);
  font-size: 1.22rem;
  color: var(--ink);
}

.workbench-desc {
  margin: 0;
  font-size: 0.95rem;
  color: var(--ink-muted);
}

.blueprint-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.blueprint-card {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 1rem;
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  opacity: 0.78;
  transition: opacity 0.25s ease, border-color 0.25s ease;
}

.blueprint-card:hover {
  opacity: 0.96;
  border-color: var(--ink-faint);
}

.blueprint-thumb {
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.9rem;
  color: var(--ink-faint);
}

.blueprint-glyph {
  width: 112px;
  height: auto;
  animation: gentle-float 7s ease-in-out infinite;
}

.blueprint-card:nth-child(2) .blueprint-glyph {
  animation-delay: -3.5s;
}

@keyframes gentle-float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

.blueprint-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}

.blueprint-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.08rem;
  color: var(--ink-muted);
}

/* ==========================================================================
   On X Panel
   ========================================================================== */
.x-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 2rem;
  align-items: stretch;
}

.x-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.x-lead {
  margin: 0 0 0.6rem;
  font-family: var(--font-serif);
  font-size: 1.32rem;
  line-height: 1.3;
  color: var(--ink);
}

.x-copy p {
  margin: 0 0 1.2rem;
  font-size: 0.96rem;
  color: var(--ink-muted);
}

.topic-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.topic-chip {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--ink-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.24rem 0.62rem;
  border-radius: 999px;
}

.x-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.45rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: transform 0.26s var(--ease), border-color 0.25s ease, box-shadow 0.26s var(--ease);
}

.x-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-card);
  color: inherit;
}

.x-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.x-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 500;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.x-card:hover .x-mark {
  background: var(--accent);
  color: #fffdf9;
}

.x-card-id {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.x-card-name {
  font-family: var(--font-serif);
  font-size: 1.24rem;
  color: var(--ink);
}

.x-card-note {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--ink-muted);
}

.x-card-cta {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  padding-top: 0.4rem;
  border-top: 1px solid var(--border);
}

/* ==========================================================================
   Substack Panel
   ========================================================================== */
.substack-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 440px);
  gap: 2rem;
  align-items: center;
  padding: 1.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.substack-lead {
  margin: 0 0 0.55rem;
  font-family: var(--font-serif);
  font-size: 1.28rem;
  color: var(--ink);
}

.substack-copy p {
  margin: 0 0 0.85rem;
  font-size: 0.95rem;
  color: var(--ink-muted);
}

.substack-copy .substack-direct {
  margin-bottom: 0;
  font-size: 0.88rem;
}

.substack-embed-wrap {
  width: 100%;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #ffffff;
}

.substack-embed-wrap iframe {
  display: block;
  width: 100%;
  min-height: 165px;
  border: 0;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0 2.75rem;
  font-size: 0.88rem;
  color: var(--ink-muted);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-colophon {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.footer-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.2rem;
}

.footer-links a {
  text-decoration: none;
}

.text-btn {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-faint);
  cursor: pointer;
  transition: color 0.2s ease;
}

.text-btn:hover {
  color: var(--ink);
}

.footer-personal-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  text-decoration: none;
}

.lock-icon-xs {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
}

/* ==========================================================================
   First-Visit Language Picker Modal
   ========================================================================== */
.lang-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(29, 27, 24, 0.38);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.25s var(--ease);
}

.lang-modal.is-open {
  opacity: 1;
}

.lang-modal[hidden] {
  display: none;
}

.lang-modal-card {
  width: 100%;
  max-width: 420px;
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(29, 27, 24, 0.18);
  transform: translateY(8px) scale(0.985);
  transition: transform 0.28s var(--ease);
}

.lang-modal.is-open .lang-modal-card {
  transform: translateY(0) scale(1);
}

.lang-modal-eyebrow {
  margin: 0 0 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.lang-modal-title {
  margin: 0 0 0.3rem;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 1.75rem;
  line-height: 1.2;
  color: var(--ink);
}

.lang-modal-sub {
  margin: 0 0 1.45rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.lang-modal-options {
  display: grid;
  gap: 0.65rem;
}

.lang-option {
  appearance: none;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.05rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.2s var(--ease), border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.lang-option:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  background: var(--surface);
}

.lang-option-left {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.flag-icon-lg {
  width: 24px;
  height: 16px;
  border-radius: 2.5px;
}

.lang-option-arrow {
  color: var(--ink-faint);
  transition: transform 0.2s var(--ease), color 0.2s ease;
}

.lang-option:hover .lang-option-arrow {
  color: var(--accent);
  transform: translateX(3px);
}

body.modal-open {
  overflow: hidden;
}

/* ==========================================================================
   Subtle Entrance Reveal & Motion Preferences
   ========================================================================== */
.reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

body.motion-paused .brand-pulse,
body.motion-paused .blueprint-glyph {
  animation-play-state: paused;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .brand-pulse,
  .blueprint-glyph {
    animation: none;
  }
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 760px) {
  .hero {
    padding-top: 1.75rem;
  }

  .hero-stage {
    height: 132px;
    margin-bottom: 1.75rem;
  }

  .blueprint-grid,
  .x-panel {
    grid-template-columns: 1fr;
  }

  .substack-panel {
    grid-template-columns: 1fr;
    padding: 1.35rem;
    gap: 1.35rem;
  }
}

@media (max-width: 720px) {
  .lang-full {
    display: none;
  }

  .lang-short {
    display: inline;
    font-family: var(--font-mono);
    font-size: 0.74rem;
  }

  .lang-btn {
    padding: 0.36rem 0.52rem;
    gap: 0.32rem;
  }
}

@media (max-width: 560px) {
  .site-nav {
    gap: 0.65rem;
    font-size: 0.84rem;
  }

  .icon-btn {
    padding: 0.28rem 0.52rem;
    font-size: 0.7rem;
  }

  .container {
    padding: 0 1.15rem;
  }
}
