/* ─── Tokens ─────────────────────────────────────────────────────────────── */

:root {
  --font-sans:  'Inter', system-ui, sans-serif;
  --font-voice: 'Lora', Georgia, serif;
  --font-mono:  'JetBrains Mono', monospace;
  --radius: 8px;
  --max-w: 860px;

  --bg:            #ffffff;
  --bg-subtle:     #f7f6f3;
  --bg-card:       #f7f6f3;
  --border:        rgba(0, 0, 0, 0.09);
  --border-strong: rgba(0, 0, 0, 0.18);

  --text-primary:   #1a1a18;
  --text-secondary: #5c5c58;
  --text-muted:     #9a9992;

  --accent:        var(--text-muted);
  --toggle-bg:     #e8e7e3;
  --toggle-color:  #5c5c58;
}

[data-theme="dark"] {
  --bg:            #14120e;
  --bg-subtle:     #1c1914;
  --bg-card:       #201d17;
  --border:        rgba(255, 220, 160, 0.08);
  --border-strong: rgba(255, 220, 160, 0.18);

  --text-primary:   #f2ede3;
  --text-secondary: #9e9888;
  --text-muted:     #5a5549;

  --accent:        #c8a96e;
  --toggle-bg:     #201d17;
  --toggle-color:  #c8a96e;
}

/* ─── Reset ──────────────────────────────────────────────────────────────── */

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

html {
  background: var(--bg);
  color: var(--text-primary);
  transition: background 0.2s, color 0.2s;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

a { color: inherit; }

/* ─── Nav ────────────────────────────────────────────────────────────────── */

.nav {
  border-bottom: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 52px;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  font-family: var(--font-voice);
  font-size: 17px;
  font-weight: 400;
  color: var(--text-primary);
  text-decoration: none;
  display: flex;
  align-items: baseline;
  gap: 2px;
  flex-shrink: 0;
}

.nav-brand em {
  font-style: italic;
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  list-style: none;
  height: 100%;
}

.nav-links li {
  height: 100%;
  display: flex;
  align-items: center;
}

.nav-links a {
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0 0.8rem;
  height: 100%;
  display: flex;
  align-items: center;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--text-primary);
  border-bottom-color: var(--border-strong);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.coord {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  font-family: var(--font-mono);
}

.theme-toggle {
  background: var(--toggle-bg);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--toggle-color);
  cursor: pointer;
  font-size: 14px;
  width: 30px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  line-height: 1;
}

.theme-toggle:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

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

.nav-cta {
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.3rem 0.7rem;
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s;
}

.nav-cta:hover {
  border-color: var(--border-strong);
  color: var(--text-secondary);
}

/* ─── Footer ─────────────────────────────────────────────────────────────── */

footer { border-top: 0.5px solid var(--border); }

.footer-strip {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2rem;
  display: flex;
  gap: 2rem;
}

.footer-col-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
  font-family: var(--font-mono);
}

.footer-item {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.9;
}

.footer-item a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s;
}

.footer-item a:hover { color: var(--text-primary); }

.copyright {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  padding: 1.25rem 2rem;
  border-top: 0.5px solid var(--border);
}

/* ─── Shared inner page shell ─────────────────────────────────────────────── */

.inner-page {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 3rem 2rem 4rem;
}

.page-header {
  border-bottom: 0.5px solid var(--border);
  padding-bottom: 2rem;
  margin-bottom: 2.5rem;
}

.back-link {
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-family: var(--font-mono);
  display: inline-block;
  margin-bottom: 1.25rem;
  transition: color 0.15s;
}

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

.page-title {
  font-family: var(--font-voice);
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 0.6rem;
}

.page-title em { font-style: italic; color: var(--accent); }

.page-desc {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-top: 0.5rem;
}

/* ─── Home: hero ─────────────────────────────────────────────────────────── */

.hero {
  padding: 4rem 2rem 3rem;
  border-bottom: 0.5px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 3rem;
  align-items: start;
  max-width: var(--max-w);
  margin: 0 auto;
}

.hero-sub {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 1rem;
  font-family: var(--font-mono);
}

.hero-name {
  font-family: var(--font-voice);
  font-size: clamp(36px, 6vw, 52px);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
}

.hero-name em {
  font-style: italic;
  color: var(--accent);
}

.hero-bio {
  font-size: 15px;
  line-height: 1.75;
  color: var(--text-secondary);
}

.hero-bio strong {
  color: var(--text-primary);
  font-weight: 500;
}

.hero-ctas {
  display: flex;
  gap: 0.625rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.cta-primary {
  font-size: 13px;
  color: var(--text-primary);
  text-decoration: none;
  padding: 0.45rem 1rem;
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius);
  transition: background 0.15s;
}

.cta-primary:hover { background: var(--bg-subtle); }

.cta-secondary {
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.45rem 1rem;
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s, color 0.15s;
}

.cta-secondary:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

/* ─── Home: latest card ───────────────────────────────────────────────────── */

.latest-card {
  background: var(--bg-card);
  border: 0.5px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
}

.latest-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
  font-family: var(--font-mono);
}

.latest-title {
  font-family: var(--font-voice);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text-primary);
  text-decoration: none;
  display: block;
  margin-bottom: 0.5rem;
}

.latest-title:hover { text-decoration: underline; }

.latest-date {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  font-family: var(--font-mono);
}

.latest-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.latest-link {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
}

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

/* ─── Home: projects grid ─────────────────────────────────────────────────── */

.section {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2.5rem 2rem;
}

.section-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.5rem;
  font-family: var(--font-mono);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  border: 0.5px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.project-item {
  padding: 1.25rem;
  background: var(--bg);
  border-right: 0.5px solid var(--border);
  border-bottom: 0.5px solid var(--border);
  text-decoration: none;
  display: block;
  transition: background 0.15s;
}

.project-item:hover { background: var(--bg-subtle); }

.project-num {
  font-size: 11px;
  color: var(--accent);
  font-family: var(--font-mono);
  margin-bottom: 0.5rem;
}

.project-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
  line-height: 1.3;
}

.project-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

.project-tags { display: flex; gap: 4px; flex-wrap: wrap; }

.tag {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-subtle);
  color: var(--text-muted);
  border: 0.5px solid var(--border);
}

/* ─── Writing index ───────────────────────────────────────────────────────── */

.post-list {
  display: flex;
  flex-direction: column;
}

.post-item {
  display: grid;
  grid-template-columns: 72px 1fr 24px;
  gap: 1rem;
  align-items: start;
  padding: 1.25rem 0;
  border-bottom: 0.5px solid var(--border);
  text-decoration: none;
  transition: background 0.15s;
  border-radius: 4px;
}

.post-item:first-child { border-top: 0.5px solid var(--border); }

.post-item:hover { background: var(--bg-subtle); padding-left: 0.5rem; padding-right: 0.5rem; margin: 0 -0.5rem; }

.post-date {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  padding-top: 3px;
  white-space: nowrap;
}

.post-body {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.post-title {
  font-family: var(--font-voice);
  font-size: 16px;
  color: var(--text-primary);
  line-height: 1.35;
}

.post-excerpt {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
}

.post-arrow {
  font-size: 14px;
  color: var(--text-muted);
  padding-top: 4px;
  transition: color 0.15s;
}

.post-item:hover .post-arrow { color: var(--accent); }

/* ─── CV ─────────────────────────────────────────────────────────────────── */

.inner-page--cv .cv-body {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.cv-section {
  padding: 1.5rem 0;
  border-bottom: 0.5px solid var(--border);
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 2rem;
  align-items: start;
}

.cv-section-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  font-family: var(--font-mono);
  padding-top: 3px;
}

.cv-text {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.cv-text strong {
  color: var(--text-primary);
  font-weight: 500;
}

.cv-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.cv-list li {
  font-size: 15px;
  color: var(--text-secondary);
  padding-left: 1rem;
  position: relative;
}

.cv-list li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-family: var(--font-mono);
}

.cv-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.cv-links a {
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s;
}

.cv-links a:hover { color: var(--text-primary); }

/* ─── Post / article ─────────────────────────────────────────────────────── */

.inner-page--post .page-header {
  margin-bottom: 3rem;
}

.post-meta-date {
  font-size: 11px;
  color: var(--accent);
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.post-heading {
  font-family: var(--font-voice);
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.post-lede {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.65;
}

.post-content {
  font-size: 16px;
  line-height: 1.8;
  color: var(--text-secondary);
  max-width: 680px;
}

.post-content h2 {
  font-family: var(--font-voice);
  font-size: 22px;
  font-weight: 400;
  color: var(--text-primary);
  margin: 2.5rem 0 0.75rem;
}

.post-content h3 {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  margin: 2rem 0 0.5rem;
}

.post-content p { margin-bottom: 1.25rem; }

.post-content a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.post-content a:hover { color: var(--text-primary); }

.post-content strong {
  color: var(--text-primary);
  font-weight: 500;
}

.post-content blockquote {
  border-left: 2px solid var(--accent);
  margin: 2rem 0;
  padding: 0.5rem 0 0.5rem 1.5rem;
  border-radius: 0;
}

.post-content blockquote p {
  font-family: var(--font-voice);
  font-style: italic;
  font-size: 17px;
  color: var(--text-secondary);
  margin: 0;
}

.post-content pre {
  background: var(--bg-card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.post-content code {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-primary);
}

.post-content p code {
  background: var(--bg-card);
  border: 0.5px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}

.post-content ul, .post-content ol {
  padding-left: 1.5rem;
  margin-bottom: 1.25rem;
}

.post-content li { margin-bottom: 0.4rem; }

/* ─── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 680px) {
  .nav-links { display: none; }
  .coord { display: none; }

  .hero {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 2.5rem 1.25rem 2rem;
  }

  .section { padding: 2rem 1.25rem; }
  .projects-grid { grid-template-columns: 1fr; }
  .project-item { border-right: none; }

  .inner-page { padding: 2rem 1.25rem 3rem; }

  .cv-section { grid-template-columns: 1fr; gap: 0.5rem; }

  .post-item {
    grid-template-columns: 60px 1fr 20px;
    gap: 0.75rem;
  }

  .footer-strip { padding: 1.5rem 1.25rem; }
}

/* ─── Resources page ─────────────────────────────────────────────────────── */

.resource-body {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.resource-cat-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  font-family: var(--font-mono);
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 0.5px solid var(--border);
}

.resource-list {
  display: flex;
  flex-direction: column;
}

.resource-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.85rem 0;
  border-bottom: 0.5px solid var(--border);
  text-decoration: none;
  transition: background 0.15s, padding 0.1s;
  border-radius: 4px;
}

.resource-item:hover {
  background: var(--bg-subtle);
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  margin: 0 -0.5rem;
}

.resource-num {
  font-size: 11px;
  color: var(--accent);
  font-family: var(--font-mono);
  opacity: 0.7;
  padding-top: 2px;
}

.resource-content {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.resource-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.3;
}

.resource-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.resource-tag {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--bg-card);
  color: var(--text-muted);
  border: 0.5px solid var(--border);
  white-space: nowrap;
  align-self: start;
  margin-top: 2px;
}

/* ─── Search bar ─────────────────────────────────────────────────────────── */

.search-bar-wrap {
  margin-bottom: 1.75rem;
}

.search-bar {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.9rem;
  outline: none;
  transition: border-color 0.15s;
  -webkit-appearance: none;
}

.search-bar::placeholder { color: var(--text-muted); }

.search-bar:focus { border-color: var(--border-strong); }

.search-empty {
  font-size: 14px;
  color: var(--text-muted);
  padding: 1.5rem 0;
  font-family: var(--font-mono);
}

/* ─── Resource / writing card grid ───────────────────────────────────────── */

.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1px;
  border: 0.5px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.rcard {
  background: var(--bg);
  padding: 1.25rem;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  border-right: 0.5px solid var(--border);
  border-bottom: 0.5px solid var(--border);
  transition: background 0.15s;
  min-height: 110px;
}

.rcard:hover { background: var(--bg-subtle); }

.rcard-tag {
  font-size: 10px;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--bg-card);
  color: var(--accent);
  border: 0.5px solid var(--border);
  align-self: flex-start;
  font-family: var(--font-mono);
  margin-bottom: 0.15rem;
}

.rcard-date {
  color: var(--text-muted);
}

.rcard-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.35;
}

.rcard--post .rcard-title {
  font-family: var(--font-voice);
  font-size: 15px;
  font-weight: 400;
}

.rcard-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-top: auto;
  padding-top: 0.4rem;
}

.rcard--feature {
  cursor: default;
}

.rcard--feature:hover { background: var(--bg); }

/* ─── CV ─────────────────────────────────────────────────────────────────── */

.cv-body {
  display: flex;
  flex-direction: column;
}

.cv-section {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 2rem;
  align-items: start;
  padding: 1.5rem 0;
  border-bottom: 0.5px solid var(--border);
}

.cv-section-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  font-family: var(--font-mono);
  padding-top: 3px;
}

.cv-text {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.cv-text strong {
  color: var(--text-primary);
  font-weight: 500;
}

.cv-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cv-pill {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 4px;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 0.5px solid var(--border);
}

.cv-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.cv-list li {
  font-size: 15px;
  color: var(--text-secondary);
  padding-left: 1.25rem;
  position: relative;
  line-height: 1.5;
}

.cv-list li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
}

.cv-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.cv-links a {
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s;
}

.cv-links a:hover { color: var(--text-primary); }

/* ─── Planner page ───────────────────────────────────────────────────────── */

.planner-lede {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.75;
  max-width: 580px;
  margin-bottom: 1.75rem;
}

.planner-ctas {
  display: flex;
  gap: 0.625rem;
  margin-bottom: 3rem;
  flex-wrap: wrap;
}

.planner-sections {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.planner-section-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  font-family: var(--font-mono);
  margin-bottom: 1rem;
}

.planner-get-list {
  display: flex;
  flex-direction: column;
  border: 0.5px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.planner-get-item {
  display: flex;
  align-items: start;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  border-bottom: 0.5px solid var(--border);
  text-decoration: none;
  background: var(--bg);
  transition: background 0.15s;
}

.planner-get-item:last-child { border-bottom: none; }
.planner-get-item:hover { background: var(--bg-subtle); }

.planner-get-arrow {
  font-size: 14px;
  color: var(--accent);
  padding-top: 1px;
  flex-shrink: 0;
  font-family: var(--font-mono);
}

.planner-get-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.planner-get-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.planner-get-desc {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ─── Responsive additions ───────────────────────────────────────────────── */

@media (max-width: 680px) {
  .resource-grid { grid-template-columns: 1fr; }
  .cv-section { grid-template-columns: 1fr; gap: 0.5rem; }
}
