/* haydenblake.com — light/dark theme, light-blue primary */
:root {
  --accent: #4aa8e0;
  --accent-strong: #2b8fd0;
  --accent-soft: #dceefb;
  --bg: #fbfcfe;
  --bg-alt: #f1f6fa;
  --panel: #ffffff;
  --text: #1c2733;
  --text-muted: #5a6b7c;
  --border: #dde6ee;
  --code-bg: #f2f6fa;
  --shadow: 0 1px 3px rgba(30, 60, 90, 0.08);
}

[data-theme="dark"] {
  --accent: #7cc4ee;
  --accent-strong: #a3d6f5;
  --accent-soft: #17303f;
  --bg: #0f1720;
  --bg-alt: #131e29;
  --panel: #16222e;
  --text: #e4edf4;
  --text-muted: #93a6b7;
  --border: #24333f;
  --code-bg: #101b25;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --accent: #7cc4ee;
    --accent-strong: #a3d6f5;
    --accent-soft: #17303f;
    --bg: #0f1720;
    --bg-alt: #131e29;
    --panel: #16222e;
    --text: #e4edf4;
    --text-muted: #93a6b7;
    --border: #24333f;
    --code-bg: #101b25;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  transition: background 0.2s ease, color 0.2s ease;
}

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

.container {
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 3.6rem;
}
.site-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  letter-spacing: -0.01em;
}
.site-title:hover { text-decoration: none; color: var(--accent-strong); }
.site-nav { display: flex; align-items: center; gap: 1.4rem; }
.site-nav a { color: var(--text-muted); font-size: 0.95rem; }
.site-nav a:hover { color: var(--accent-strong); text-decoration: none; }
.site-nav a.active { color: var(--text); font-weight: 600; }

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.3rem 0.55rem;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent-strong); }

/* Hero */
.hero { padding: 4.5rem 0 3.5rem; }
.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.15;
  margin: 0 0 1rem;
  letter-spacing: -0.02em;
}
.hero h1 .accent { color: var(--accent-strong); }
.hero p.lede {
  font-size: 1.2rem;
  color: var(--text-muted);
  max-width: 46rem;
  margin: 0 0 1.8rem;
}
.hero-actions { display: flex; gap: 0.9rem; flex-wrap: wrap; }

.btn {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  border: 1px solid transparent;
}
.btn-primary { background: var(--accent-strong); color: #fff; }
.btn-primary:hover { background: var(--accent); text-decoration: none; }
[data-theme="dark"] .btn-primary { color: #0f1720; }
.btn-ghost { border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-strong); text-decoration: none; }

/* Sections */
.section { padding: 2.6rem 0; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1.4rem;
}
.section-head h2 { margin: 0; font-size: 1.4rem; letter-spacing: -0.01em; }
.section-head a { font-size: 0.9rem; color: var(--text-muted); }
.section-head a:hover { color: var(--accent-strong); }

/* Project cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.1rem;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.3rem 1.4rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card h3 { margin: 0 0 0.4rem; font-size: 1.08rem; }
.card h3 a { color: var(--text); }
.card h3 a:hover { color: var(--accent-strong); text-decoration: none; }
.card p { margin: 0 0 0.9rem; color: var(--text-muted); font-size: 0.93rem; flex-grow: 1; }
.tag-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tag {
  font-size: 0.75rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 600;
}

/* Writing list */
.post-list { list-style: none; margin: 0; padding: 0; }
.post-list li {
  display: flex;
  align-items: baseline;
  gap: 1.2rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}
.post-list li:last-child { border-bottom: none; }
.post-list time {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 6.5rem;
}
.post-list a { color: var(--text); font-weight: 500; }
.post-list a:hover { color: var(--accent-strong); }
.post-list .summary { color: var(--text-muted); font-size: 0.9rem; display: block; }

/* Article / prose */
.prose { max-width: 44rem; margin: 0 auto; padding: 3rem 0 4rem; }
.prose header h1 {
  font-size: clamp(1.7rem, 4vw, 2.3rem);
  line-height: 1.2;
  margin: 0 0 0.6rem;
  letter-spacing: -0.02em;
}
.prose .meta {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 2.2rem;
  display: flex;
  gap: 0.8rem;
  align-items: center;
  flex-wrap: wrap;
}
.prose h2 { margin-top: 2.2rem; font-size: 1.35rem; letter-spacing: -0.01em; }
.prose h3 { margin-top: 1.8rem; font-size: 1.1rem; }
.prose img { max-width: 100%; border-radius: 10px; }
.prose blockquote {
  margin: 1.5rem 0;
  padding: 0.2rem 1.2rem;
  border-left: 3px solid var(--accent);
  color: var(--text-muted);
  background: var(--bg-alt);
  border-radius: 0 8px 8px 0;
}
.prose code {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.1rem 0.35rem;
  font-size: 0.88em;
}
.prose pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.2rem;
  overflow-x: auto;
  font-size: 0.88rem;
  line-height: 1.55;
}
.prose pre code { background: none; border: none; padding: 0; }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }
.prose table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
.prose th, .prose td { border: 1px solid var(--border); padding: 0.5rem 0.8rem; text-align: left; }
.prose th { background: var(--bg-alt); }

/* About / CV */
.cv-section { margin-top: 2.4rem; }
.cv-entry {
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: 1.4rem;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--border);
}
.cv-entry:last-child { border-bottom: none; }
.cv-entry .period { color: var(--text-muted); font-size: 0.88rem; font-variant-numeric: tabular-nums; }
.cv-entry h3 { margin: 0 0 0.2rem; font-size: 1.02rem; }
.cv-entry .org { color: var(--accent-strong); font-size: 0.92rem; font-weight: 600; }
.cv-entry p { margin: 0.45rem 0 0; color: var(--text-muted); font-size: 0.93rem; }
.skill-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.8rem; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  margin-top: 3rem;
  color: var(--text-muted);
  font-size: 0.88rem;
}
.site-footer .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.8rem; }

@media (max-width: 640px) {
  .cv-entry { grid-template-columns: 1fr; gap: 0.2rem; }
  .post-list li { flex-direction: column; gap: 0.15rem; }
  .site-nav { gap: 0.9rem; }
}

/* ---- admin ---- */
.admin-narrow { max-width: 26rem; }
.admin-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.admin-form label { display: block; margin-bottom: 1rem; font-weight: 600; font-size: 0.92rem; }
.admin-form input[type="text"], .admin-form input[type="password"], .admin-form input[type="date"],
.admin-form input[type="number"], .admin-form textarea {
  display: block; width: 100%; margin-top: 0.3rem; padding: 0.5rem 0.7rem;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--panel); color: var(--text); font: inherit;
}
.admin-form textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.88rem; line-height: 1.5; }
.admin-form input:focus, .admin-form textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 1.2rem; }
.hint { font-weight: 400; color: var(--text-muted); font-size: 0.8rem; }
.form-error { color: #d64545; font-weight: 600; }
.editor-actions { display: flex; align-items: center; gap: 0.8rem; margin: 1rem 0 2rem; flex-wrap: wrap; }
.editor-actions .checkbox { display: flex; align-items: center; gap: 0.4rem; margin: 0; }
.btn-sm { padding: 0.3rem 0.8rem; font-size: 0.85rem; }
.admin-row { display: flex; align-items: baseline; gap: 0.7rem; flex-wrap: wrap; }
.admin-actions { display: flex; gap: 0.7rem; font-size: 0.85rem; }
.admin-actions form { display: inline; }
.link-danger { background: none; border: none; padding: 0; color: #d64545; cursor: pointer; font: inherit; font-size: 0.85rem; }
.link-danger:hover { text-decoration: underline; }
.tag-muted { background: var(--bg-alt); color: var(--text-muted); }
.preview-pane { border: 1px dashed var(--border); border-radius: 10px; padding: 1rem 1.5rem; margin-bottom: 3rem; }

/* ---- chroma syntax highlighting (class-based) ---- */
.chroma .k, .chroma .kd, .chroma .kn { color: #cf222e; }
[data-theme="dark"] .chroma .k, [data-theme="dark"] .chroma .kd, [data-theme="dark"] .chroma .kn { color: #ff7b72; }
.chroma .s, .chroma .s1, .chroma .s2 { color: #0a3069; }
[data-theme="dark"] .chroma .s, [data-theme="dark"] .chroma .s1, [data-theme="dark"] .chroma .s2 { color: #a5d6ff; }
.chroma .c, .chroma .c1, .chroma .cm { color: var(--text-muted); font-style: italic; }
.chroma .nf, .chroma .nx { color: #6639ba; }
[data-theme="dark"] .chroma .nf, [data-theme="dark"] .chroma .nx { color: #d2a8ff; }
.chroma .m, .chroma .mi, .chroma .mf { color: #0550ae; }
[data-theme="dark"] .chroma .m, [data-theme="dark"] .chroma .mi, [data-theme="dark"] .chroma .mf { color: #79c0ff; }
