/* rad3x — handwritten styles. Typography-first, responsive, theme-aware. */

:root {
  --max-width: 720px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  --font-serif: Georgia, Cambria, "Times New Roman", Times, serif;
  --font-mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --radius: 12px;
  --transition: 160ms ease;
}

/* Light theme (default) */
:root,
[data-theme="light"] {
  --bg: #fcfcfb;
  --bg-soft: #f4f4f1;
  --surface: #ffffff;
  --border: #e6e6e0;
  --text: #1b1b1a;
  --text-soft: #5c5c57;
  --text-faint: #8a8a83;
  --accent: #b5482f;
  --accent-soft: rgba(181, 72, 47, 0.1);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] {
  --bg: #131312;
  --bg-soft: #1c1c1a;
  --surface: #1e1e1c;
  --border: #2e2e2b;
  --text: #ececea;
  --text-soft: #b3b3ad;
  --text-faint: #80807a;
  --accent: #e8765c;
  --accent-soft: rgba(232, 118, 92, 0.14);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 18px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background var(--transition), color var(--transition);
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
}

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

/* ---------- Nav ---------- */
.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 0;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.brand {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  letter-spacing: -0.01em;
}
.brand:hover {
  text-decoration: none;
  color: var(--accent);
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.nav-links a {
  color: var(--text-soft);
  font-size: 0.95rem;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  text-decoration: none;
}
.nav-links a.active {
  font-weight: 600;
}

#theme-toggle {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), border var(--transition);
}
#theme-toggle:hover {
  border-color: var(--accent);
}
.theme-icon-dark {
  display: none;
}
[data-theme="dark"] .theme-icon-light {
  display: none;
}
[data-theme="dark"] .theme-icon-dark {
  display: inline;
}

/* ---------- Hero / headers ---------- */
.hero {
  padding: 32px 0 8px;
}
.hero h1 {
  font-size: 2.6rem;
  letter-spacing: -0.03em;
  margin: 0 0 12px;
  line-height: 1.1;
}
.hero-tagline {
  font-size: 1.2rem;
  color: var(--text-soft);
  margin: 0;
  max-width: 36ch;
}

.page-header {
  padding: 16px 0 8px;
}
.page-header h1 {
  font-size: 2rem;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}
.page-blurb {
  color: var(--text-soft);
  margin: 0;
}

.section-heading {
  font-size: 1.4rem;
  letter-spacing: -0.01em;
  margin: 40px 0 16px;
}

/* ---------- Section cards on home ---------- */
.sections-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 36px;
}
.section-card {
  display: block;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform var(--transition), border var(--transition),
    box-shadow var(--transition);
}
.section-card:hover {
  text-decoration: none;
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}
.section-card h3 {
  margin: 0 0 6px;
  color: var(--text);
  font-size: 1.15rem;
}
.section-card p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.95rem;
}

/* ---------- Post cards / lists ---------- */
.card-list {
  display: flex;
  flex-direction: column;
}
.card {
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
}
.card:last-child {
  border-bottom: none;
}
.card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--text-faint);
  margin-bottom: 8px;
}
.card-title {
  font-size: 1.4rem;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
  line-height: 1.25;
}
.card-title a {
  color: var(--text);
}
.card-title a:hover {
  color: var(--accent);
  text-decoration: none;
}
.card-summary {
  margin: 0 0 10px;
  color: var(--text-soft);
}
.card-read {
  font-size: 0.9rem;
  font-weight: 500;
}

.tag {
  display: inline-block;
  font-size: 0.78rem;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  letter-spacing: 0.01em;
}
a.tag:hover {
  text-decoration: none;
  filter: brightness(0.95);
}

.empty {
  color: var(--text-faint);
  padding: 32px 0;
}

/* Small lock badge next to password-protected post titles. */
.lock-badge {
  font-size: 0.7em;
  vertical-align: middle;
  opacity: 0.75;
  margin-left: 0.15em;
}

/* Call-to-action button (used inside post bodies). */
.button {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  padding: 11px 20px;
  border-radius: 9px;
  transition: filter var(--transition);
}
.button:hover {
  text-decoration: none;
  filter: brightness(1.06);
}

/* ---------- Single post ---------- */
.post-header {
  padding: 16px 0 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}
.post-header h1 {
  font-size: 2.2rem;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 12px 0 12px;
}
.post-lede {
  font-size: 1.2rem;
  color: var(--text-soft);
  margin: 0 0 8px;
}
.post-body {
  font-family: var(--font-serif);
  font-size: 1.18rem;
  line-height: 1.75;
}
.post-body h2 {
  font-family: var(--font-sans);
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  margin: 40px 0 12px;
}
.post-body h3 {
  font-family: var(--font-sans);
  font-size: 1.2rem;
  margin: 32px 0 10px;
}
.post-body p {
  margin: 0 0 20px;
}
.post-body a {
  text-decoration: underline;
  text-underline-offset: 2px;
}
.post-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
}
.post-body blockquote {
  margin: 24px 0;
  padding: 4px 20px;
  border-left: 3px solid var(--accent);
  color: var(--text-soft);
  font-style: italic;
}
.post-body code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-soft);
  padding: 2px 6px;
  border-radius: 6px;
}
.post-body pre {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  overflow-x: auto;
  font-size: 0.92rem;
  line-height: 1.5;
}
.post-body pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}
.post-body ul,
.post-body ol {
  margin: 0 0 20px;
  padding-left: 24px;
}
.post-body li {
  margin-bottom: 6px;
}
.post-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 40px 0;
}
.post-body table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  margin: 0 0 20px;
}
.post-body th,
.post-body td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
}
.post-body th {
  background: var(--bg-soft);
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 36px 0 0;
}
.post-footer {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 0.95rem;
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 64px;
  padding: 28px 0 36px;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 0.9rem;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  margin-bottom: 8px;
}
.footer-links a {
  color: var(--text-soft);
}
.footer-links .dot {
  color: var(--text-faint);
  margin: 0 4px;
}

/* ---------- Responsive ---------- */
@media (max-width: 560px) {
  body {
    font-size: 17px;
  }
  .hero h1 {
    font-size: 2.1rem;
  }
  .sections-grid {
    grid-template-columns: 1fr;
  }
  .post-body {
    font-size: 1.1rem;
  }
  .site-nav {
    padding: 18px 0;
  }
}
