/* ── Tokens ──────────────────────────────────────────── */
:root {
  --bg:       #ffffff;
  --fg:       #0f0f0f;
  --muted:    #6b7280;
  --border:   #e5e7eb;
  --tag-bg:   #f3f4f6;
  --tag-fg:   #374151;
  --max-w:    860px;
  --pad:      1.5rem;
}

html.dark {
  --bg:       #111111;
  --fg:       #efefef;
  --muted:    #8b949e;
  --border:   #2a2a2a;
  --tag-bg:   #1e1e1e;
  --tag-fg:   #c9d1d9;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 0.9375rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
p  { margin: 0; }
a  { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
button { cursor: pointer; font-family: inherit; }

/* ── Layout ──────────────────────────────────────────── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--pad);
}

/* ── Header ──────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

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

.site-name {
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.site-nav {
  display: flex;
  gap: 1.5rem;
}

.site-nav a {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.15s;
}

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

.theme-toggle {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1;
  transition: color 0.15s;
}

.theme-toggle:hover { color: var(--fg); }

/* ── Hero ────────────────────────────────────────────── */
.hero {
  padding: 3rem 0 2.5rem;
}

.hero-line {
  font-size: 0.9375rem;
  line-height: 1.7;
  max-width: 54ch;
  margin-bottom: 1.25rem;
  color: var(--fg);
  font-weight: 400;
}

.hero-accent   { font-weight: 600; }

.hero-underline {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.hero-line em {
  font-style: italic;
  font-weight: 500;
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 1rem;
  border-radius: 5px;
  font-size: 0.8125rem;
  font-weight: 500;
  background: var(--fg);
  color: var(--bg);
  border: 1px solid var(--fg);
  transition: opacity 0.15s;
  text-decoration: none;
}

.btn:hover { opacity: 0.75; }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}

.btn-ghost:hover { color: var(--fg); border-color: var(--fg); opacity: 1; }

.btn-sm {
  padding: 0.3rem 0.75rem;
  font-size: 0.8125rem;
}

/* ── Work section ────────────────────────────────────── */
.work {
  padding: 2rem 0 4rem;
  border-top: 1px solid var(--border);
}

.work-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 3rem;
  row-gap: 0;
}

.work-cols.section-gap { margin-top: 2rem; }

.work-col.full-width { grid-column: 1 / -1; }

.col-heading {
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

/* ── Entry row (flat, no card) ───────────────────────── */
.entry {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

.entry:last-child { border-bottom: none; }

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

.entry-title {
  font-size: 0.875rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.entry-logo {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
  object-fit: contain;
  display: block;
}

.research-list {
  margin: 0.25rem 0 0.4rem 0;
  padding-left: 1.1rem;
  list-style: disc;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.research-list li {
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.55;
}

.entry-title a {
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s;
}

.entry-title a:hover { text-decoration-color: var(--fg); }

.entry-date {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

.entry-role {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.entry-desc {
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 0.4rem;
}

/* ── Tags ────────────────────────────────────────────── */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.tag {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  background: var(--tag-bg);
  color: var(--tag-fg);
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1.6;
}

/* ── Footer ──────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
}

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

.footer-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.footer-links a {
  font-size: 0.8125rem;
  color: var(--muted);
  transition: color 0.15s;
}

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

/* ── Journal gate ────────────────────────────────────── */
.gate-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 53px - 57px);
  padding: 2rem var(--pad);
}

.gate-box {
  width: 100%;
  max-width: 300px;
  text-align: center;
}

.gate-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
}

.gate-input {
  display: block;
  width: 100%;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 0.9375rem;
  font-family: inherit;
  color: var(--fg);
  background: var(--bg);
  outline: none;
  transition: border-color 0.15s;
  text-align: center;
  letter-spacing: 0.1em;
}

.gate-input:focus { border-color: var(--fg); }

.gate-error {
  font-size: 0.8125rem;
  color: #ef4444;
  margin-top: 0.5rem;
}

/* ── Journal main ────────────────────────────────────── */
.journal-main { padding-bottom: 4rem; }

.journal-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-top: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.journal-header h1 { font-size: 1.25rem; }

/* ── Compose ─────────────────────────────────────────── */
.journal-compose {
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.compose-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.compose-date {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--fg);
}

.compose-hint {
  font-size: 0.8125rem;
  color: var(--muted);
}

.compose-area {
  display: block;
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--fg);
  background: var(--bg);
  resize: vertical;
  outline: none;
  line-height: 1.7;
  transition: border-color 0.15s;
  margin-bottom: 0.6rem;
}

.compose-area:focus { border-color: var(--fg); }

.compose-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.save-msg {
  font-size: 0.8125rem;
  color: var(--muted);
}

/* ── Journal entries list ────────────────────────────── */
.entries-list {
  padding-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.journal-entry {
  border-bottom: 1px solid var(--border);
  padding-bottom: 1.25rem;
}

.journal-entry:last-child { border-bottom: none; }

.journal-entry-date {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.journal-entry-body {
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--fg);
  white-space: pre-wrap;
}

.entry-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.4rem;
}

.entry-action-btn {
  font-size: 0.75rem;
  color: var(--muted);
  background: none;
  border: none;
  padding: 0;
  transition: color 0.15s;
}

.entry-action-btn:hover { color: var(--fg); }
.entry-action-btn.delete:hover { color: #ef4444; }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 640px) {
  .work-cols {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .hero { padding: 2rem 0 1.75rem; }

  .footer-inner { flex-direction: column; align-items: flex-start; }
}
