/* ============================================================
   Ryan Lail -- custom theme
   Warm, minimal, editorial.
   Light = pale yellow paper / Dark = warm near-black.
   Serif headings + body, clean sans-serif labels, amber accent.
   ============================================================ */

:root {
  /* Typography */
  --font-serif: Charter, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --font-ui: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SFMono-Regular", "JetBrains Mono", "Fira Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --measure: 44rem;        /* readable line length for prose */
  --wrap: 52rem;           /* page container */
  --radius: 6px;
  --border-w: 1.5px;
}

/* ---- Light theme: pale yellow paper ---- */
:root,
[data-theme="light"] {
  --bg:        #f7f1dc;   /* pale yellow paper */
  --bg-soft:   #f1e9cc;   /* slightly deeper paper for boxes */
  --ink:       #1c1a14;   /* near-black warm ink */
  --ink-soft:  #4f4a3a;   /* muted text */
  --rule:      #2a2620;   /* borders / boxes */
  --accent:    #b8730a;   /* amber, readable on paper */
  --accent-2:  #d98a12;   /* brighter amber for hover */
  --code-bg:   #efe6c6;
  --selection: #e7c873;
}

/* ---- Dark theme: warm near-black ---- */
[data-theme="dark"] {
  --bg:        #0e0e0c;
  --bg-soft:   #161613;
  --ink:       #ece3c8;   /* warm off-white */
  --ink-soft:  #9b937c;
  --rule:      #3a382f;
  --accent:    #f0a52a;   /* amber */
  --accent-2:  #ffc15a;
  --code-bg:   #1b1a16;
  --selection: #5a4a1e;
}

/* ============================================================
   Base
   ============================================================ */

* { box-sizing: border-box; }

html {
  font-size: 18px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-serif);
  line-height: 1.65;
  transition: background-color 0.2s ease, color 0.2s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

::selection { background: var(--selection); }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 1.25rem;
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.12s ease, border-color 0.12s ease;
}
a:hover {
  color: var(--accent-2);
  border-bottom-color: var(--accent-2);
}

/* ============================================================
   Header
   ============================================================ */

.site-header {
  border-bottom: var(--border-w) solid var(--rule);
  background: var(--bg-soft);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.site-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  border-bottom: none;
}
.site-title:hover { color: var(--accent); }

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  font-family: var(--font-ui);
  font-size: 0.9rem;
}
.site-nav__link {
  color: var(--ink-soft);
  border-bottom: none;
}
.site-nav__link:hover { color: var(--accent); }
.site-nav__icon {
  display: inline-flex;
  align-items: center;
  color: var(--ink-soft);
  border-bottom: none;
}
.site-nav__icon:hover { color: var(--accent); }
.site-nav__icon svg { width: 1.15rem; height: 1.15rem; display: block; }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  background: transparent;
  color: var(--ink-soft);
  border: none;
  padding: 0;
  cursor: pointer;
  line-height: 1;
  transition: color 0.12s ease;
}
.theme-toggle:hover { color: var(--accent); }
.theme-toggle__icon { display: inline-flex; align-items: center; }
.theme-toggle__icon svg { width: 1.15rem; height: 1.15rem; display: block; }
/* Show only the icon for the *other* mode (what you'll switch to) */
[data-theme="light"] .theme-toggle__icon[data-theme-light] { display: none; }
[data-theme="dark"]  .theme-toggle__icon[data-theme-dark]  { display: none; }

/* ============================================================
   Layout / main
   ============================================================ */

.page-content {
  flex: 1 0 auto;
  padding: 2.5rem 0 3.5rem;
}

/* ============================================================
   Home
   ============================================================ */

.intro {
  max-width: var(--measure);
  font-size: 1.12rem;
  margin-bottom: 2.75rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--rule);
}
.intro p:first-child { margin-top: 0; }

.section-heading {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin: 0 0 1.25rem;
}

.post-list { list-style: none; margin: 0; padding: 0; }
.post-list__item {
  border: var(--border-w) solid var(--rule);
  border-radius: var(--radius);
  background: var(--bg-soft);
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
  transition: border-color 0.12s ease, transform 0.12s ease;
}
.post-list__item:hover { border-color: var(--accent); transform: translateX(2px); }

.post-list__link {
  display: flex;
  align-items: baseline;
  gap: 0.85rem;
  flex-wrap: wrap;
  color: var(--ink);
  border-bottom: none;
}
.post-list__date {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  color: var(--accent);
  white-space: nowrap;
}
.post-list__title { font-family: var(--font-serif); font-weight: 700; font-size: 1.15rem; }
.post-list__link:hover .post-list__title { color: var(--accent); }
.post-list__excerpt {
  margin: 0.5rem 0 0;
  color: var(--ink-soft);
  font-size: 0.97rem;
}

/* ============================================================
   Post / page
   ============================================================ */

.post, .page-doc { max-width: var(--measure); }

.post-header {
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: var(--border-w) solid var(--rule);
}
.post-header__meta {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--ink-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 0.75rem;
}
.post-header__meta time { color: var(--accent); }

.post-title {
  font-family: var(--font-serif);
  font-size: 2.1rem;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}

/* Prose */
.post-content { font-size: 1.06rem; }
.post-content h2,
.post-content h3,
.post-content h4 {
  font-family: var(--font-serif);
  line-height: 1.25;
  margin: 2.25rem 0 0.85rem;
}
.post-content h2 {
  font-size: 1.45rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--rule);
}
.post-content h3 { font-size: 1.2rem; }
.post-content h4 { font-size: 1.02rem; color: var(--ink-soft); }

.post-content p { margin: 0 0 1.15rem; }

.post-content hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 2.5rem 0;
}

.post-content ul, .post-content ol { padding-left: 1.4rem; margin: 0 0 1.15rem; }
.post-content li { margin-bottom: 0.4rem; }

.post-content blockquote {
  margin: 1.5rem 0;
  padding: 0.6rem 1.1rem;
  border-left: 3px solid var(--accent);
  background: var(--bg-soft);
  color: var(--ink-soft);
}
.post-content blockquote p:last-child { margin-bottom: 0; }

/* Inline + block code (monospace, as code should be) */
code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--code-bg);
  padding: 0.12em 0.35em;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
}
pre {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: var(--code-bg);
  border: var(--border-w) solid var(--rule);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  overflow-x: auto;
  line-height: 1.5;
}
pre code { background: none; border: none; padding: 0; font-size: inherit; }

/* Tables */
.post-content table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  margin: 1.5rem 0;
  border: var(--border-w) solid var(--rule);
}
.post-content th, .post-content td {
  border: 1px solid var(--rule);
  padding: 0.5rem 0.7rem;
  text-align: left;
}
.post-content thead th {
  background: var(--bg-soft);
  color: var(--accent);
  font-weight: 700;
}
.post-content tbody tr:nth-child(even) { background: var(--bg-soft); }

.post-content img {
  max-width: 100%;
  height: auto;
  border: var(--border-w) solid var(--rule);
  border-radius: var(--radius);
}

/* Post footer */
.post-footer {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: var(--border-w) solid var(--rule);
}
.back-link { font-family: var(--font-ui); font-size: 0.9rem; }

/* ============================================================
   Site footer
   ============================================================ */

.site-footer {
  flex-shrink: 0;
  border-top: var(--border-w) solid var(--rule);
  background: var(--bg-soft);
  font-family: var(--font-ui);
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.site-footer__inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding-top: 1.1rem;
  padding-bottom: 1.1rem;
}
.site-footer a { color: var(--ink-soft); }
.site-footer a:hover { color: var(--accent); }

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 600px) {
  html { font-size: 17px; }
  .post-title { font-size: 1.7rem; }
  .site-header__inner { flex-direction: column; align-items: flex-start; }
}

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
