/* ---------------------------------------------------------------
   Design tokens
   Palette: warm paper, ink, one rust accent. Type: Newsreader
   (serif, for reading) + Inter (sans, for UI labels).
---------------------------------------------------------------- */
:root {
  --paper: #000000;
  --ink: #ffffff;
  --ink-soft: #ffffff;
  --line: #2c2c2c;
  --accent: #6d9eff;
  --accent-dark: #94b8ff;
  --chip-bg: #1a1a1a;

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --measure: 42rem;

  color-scheme: dark;
}

/* Light mode is opt-in through the theme toggle. */
html[data-theme="light"] {
  --paper: #ffffff;
  --ink: #000000;
  --ink-soft: #000000;
  --line: #e2e2e2;
  --accent: #1d4ed8;
  --accent-dark: #1e40af;
  --chip-bg: #f3f3f3;

  color-scheme: light;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.7;
  font-optical-sizing: auto;
  /* Sticky footer: main stretches so the footer always sits at the
     bottom of the viewport, even on short pages. */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ---------------------------------------------------------------
   Layout
---------------------------------------------------------------- */
.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1.25rem;
}

main {
  padding: 3rem 0 5rem;
  flex: 1;
}

/* ---------------------------------------------------------------
   Header / tabs
---------------------------------------------------------------- */
header {
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  padding-top: 1.75rem;
  padding-bottom: 1.25rem;
}

.site-name {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}

nav {
  display: flex;
  gap: 1.5rem;
}

nav a {
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-decoration: none;
  padding-bottom: 0.2rem;
  border-bottom: 2px solid transparent;
}

nav a:hover {
  color: var(--accent);
}

nav a[aria-current="page"] {
  border-bottom-color: var(--accent);
}

/* Night-mode toggle (top right) */
.theme-toggle {
  background: none;
  border: none;
  padding: 0.25rem;
  margin: 0;
  cursor: pointer;
  color: var(--ink);
  line-height: 0;
}

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

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

.theme-toggle .icon-sun {
  display: block;
}

html[data-theme="light"] .theme-toggle .icon-sun {
  display: none;
}

html[data-theme="light"] .theme-toggle .icon-moon {
  display: block;
}

/* ---------------------------------------------------------------
   Typography
---------------------------------------------------------------- */
h1 {
  font-size: 2.1rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.2;
  margin: 0 0 1rem;
}

h2 {
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 2.5rem 0 0.75rem;
}

p {
  margin: 0 0 1.25rem;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent-dark);
}

blockquote {
  margin: 1.5rem 0;
  padding-left: 1.25rem;
  border-left: 3px solid var(--line);
  color: var(--ink-soft);
  font-style: italic;
}

hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 2.5rem 0;
}

.lede {
  font-size: 1.25rem;
  color: var(--ink-soft);
}

/* Bio section on the About page */
.bio-intro {
  margin-bottom: 0.35rem;
}

.bio-list {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
}

.bio-list li {
  padding: 0.15rem 0;
}

/* About portrait: floats beside the intro text on wide screens */
.about-photo {
  float: right;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0.4rem 0 1rem 1.75rem;
}

/* ---------------------------------------------------------------
   Media embeds (YouTube, podcasts) — ready for future use.
   Usage:
     <div class="embed">
       <iframe src="https://www.youtube.com/embed/VIDEO_ID"
               title="..." allowfullscreen></iframe>
     </div>
---------------------------------------------------------------- */
.embed {
  position: relative;
  aspect-ratio: 16 / 9;
  margin: 2rem 0;
  border-radius: 6px;
  overflow: hidden;
  background: var(--chip-bg);
}

.embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Audio-only embeds (podcast players) don't need 16:9 */
.embed-audio {
  margin: 2rem 0;
}

.embed-audio iframe {
  width: 100%;
  border: 0;
  border-radius: 6px;
}

/* ---------------------------------------------------------------
   Contact: email line + social icon links
---------------------------------------------------------------- */
.email-line {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.email-line svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.social-row {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-top: 1rem;
}

.social-row a {
  color: var(--ink-soft);
}

.social-row a:hover {
  color: var(--accent);
}

.social-row svg {
  display: block;
  width: 26px;
  height: 26px;
}

/* ---------------------------------------------------------------
   Footer
---------------------------------------------------------------- */
footer {
  border-top: 1px solid var(--line);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-top: 1.5rem;
  padding-bottom: 2.5rem;
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--ink-soft);
}

/* ---------------------------------------------------------------
   Subscribe form
---------------------------------------------------------------- */
.subscribe-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1.5rem 0 1rem;
}

.subscribe-form input[type="email"] {
  flex: 1;
  min-width: 240px;
  font-family: var(--sans);
  font-size: 0.95rem;
  padding: 0.6rem 0.85rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.subscribe-form input[type="email"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}

.subscribe-form button {
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.6rem 1.2rem;
  color: var(--paper);
  background: var(--accent);
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.subscribe-form button:hover {
  background: var(--accent-dark);
}

.subscribe-form button:disabled {
  opacity: 0.6;
  cursor: default;
}

.form-msg {
  font-family: var(--sans);
  font-size: 0.9rem;
  margin: 0.5rem 0 0;
}

.form-msg.error {
  color: #ff8a80;
}

html[data-theme="light"] .form-msg.error {
  color: #c62828;
}

/* ---------------------------------------------------------------
   Small screens
---------------------------------------------------------------- */
@media (max-width: 480px) {
  body {
    font-size: 1.05rem;
  }

  h1 {
    font-size: 1.7rem;
  }

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