/* ==============================
   thoreschwemann.com
   Warm paper × Swiss grotesque
   Syne (headlines/UI) + Lora (body)
   ============================== */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;700;800&family=Lora:ital,wght@0,400;0,500;1,400&display=swap');

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ---- Tokens: Light (warm paper) ---- */
:root {
  --bg: #ece7de;
  --text: #1c1916;
  --muted: #8a8278;
  --link: #1c1916;
  --link-hover: #4a4540;
  --border: #d4ccbf;
  --accent-line: #c8603a;
  --tag: #e2dbd0;
  --tag-text: #6a6258;
  --max: 640px;
}

/* ---- Dark (warm dark) ---- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #110f0d;
    --text: #e4ddd3;
    --muted: #665e58;
    --link: #e4ddd3;
    --link-hover: #b8b0a6;
    --border: #26211d;
    --accent-line: #c8603a;
    --tag: #1c1915;
    --tag-text: #7a726a;
  }
}

:root[data-theme="dark"] {
  --bg: #110f0d;
  --text: #e4ddd3;
  --muted: #665e58;
  --link: #e4ddd3;
  --link-hover: #b8b0a6;
  --border: #26211d;
  --accent-line: #c8603a;
  --tag: #1c1915;
  --tag-text: #7a726a;
}

/* ---- Base ---- */
html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Syne', system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  padding: 0 20px;
  transition: background 0.2s, color 0.2s;
}

/* ---- Layout ---- */
.site {
  max-width: var(--max);
  margin: 0 auto;
  padding: 56px 0 80px;
}

/* ---- Theme toggle — always inverted ---- */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--text);
  color: var(--bg);
  border: none;
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 0.72rem;
  font-family: 'Syne', sans-serif;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.15s;
  z-index: 100;
}

.theme-toggle:hover {
  opacity: 0.75;
}

/* ---- Header ---- */
.site-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 28px;
  letter-spacing: -0.01em;
  border-left: 3px solid var(--accent-line);
  padding-left: 10px;
}

.bio {
  color: var(--muted);
  font-family: 'Lora', Georgia, serif;
  font-size: 0.97rem;
  line-height: 1.7;
  max-width: 520px;
  margin-bottom: 48px;
}

.bio strong {
  color: var(--text);
  font-weight: 500;
}

/* ---- Section ---- */
.section {
  margin-bottom: 40px;
}

.section-title {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
  font-weight: 500;
}

/* ---- Link list ---- */
.link-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.link-list li {
  font-size: 0.97rem;
  font-weight: 500;
}

.link-list a {
  color: var(--link);
  text-decoration: none;
  position: relative;
  padding-bottom: 2px;
}

.link-list a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent-line);
  transition: width 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.link-list a:hover {
  color: var(--link-hover);
}

.link-list a:hover::after {
  width: 100%;
}

.link-list .meta {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 400;
  margin-left: 6px;
}

/* ---- Signup form ---- */
.signup-form {
  display: flex;
  gap: 8px;
  max-width: 360px;
  margin-bottom: 8px;
}

.signup-form input[type="email"] {
  flex: 1;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 8px 12px;
  font-family: 'Syne', sans-serif;
  font-size: 0.875rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

.signup-form input[type="email"]::placeholder {
  color: var(--muted);
}

.signup-form input[type="email"]:focus {
  border-color: var(--text);
}

.signup-form button {
  background: var(--text);
  color: var(--bg);
  border: none;
  border-radius: 3px;
  padding: 8px 16px;
  font-family: 'Syne', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}

.signup-form button:hover {
  opacity: 0.75;
}

.signup-note {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.01em;
}

/* ---- Footer ---- */
.site-footer {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.site-footer span,
.site-footer a {
  color: var(--muted);
  font-size: 0.78rem;
  text-decoration: none;
  letter-spacing: 0.02em;
}

.site-footer a:hover {
  color: var(--text);
}

/* ---- Essay page ---- */
.back-link {
  display: inline-block;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  margin-bottom: 40px;
  transition: color 0.15s;
}

.back-link:hover {
  color: var(--text);
}

.essay-title-block {
  margin-bottom: 48px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.essay-label {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
  display: block;
  font-weight: 500;
}

.essay-title-block h1 {
  font-family: 'Syne', sans-serif;
  font-size: clamp(1.7rem, 5vw, 2.4rem);
  font-weight: 800;
  line-height: 1.1;
  color: var(--text);
  letter-spacing: -0.03em;
}

/* ---- Essay body ---- */
.essay-body {
  font-family: 'Lora', Georgia, serif;
  font-size: 1rem;
  line-height: 1.78;
  color: var(--text);
  counter-reset: section;
}

.essay-body p {
  margin-bottom: 1.4em;
}

.essay-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.2em 0;
}

.essay-body h2 {
  font-family: 'Syne', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 2.4em 0 0.8em;
  counter-increment: section;
}

.essay-body h2::before {
  content: counter(section, decimal-leading-zero) ". ";
  color: var(--muted);
  font-family: 'Syne', sans-serif;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  margin-right: 4px;
  vertical-align: 2px;
}

.essay-body strong {
  font-weight: 600;
}

.essay-body em {
  font-style: italic;
}

.essay-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.8em 0;
  font-family: 'Syne', sans-serif;
  font-size: 0.85rem;
  display: block;
  overflow-x: auto;
}

.essay-body th {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.essay-body td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.essay-body tr:last-child td {
  border-bottom: none;
}

.essay-body blockquote {
  border-left: 2px solid var(--border);
  padding-left: 16px;
  margin: 1.8em 0;
  color: var(--muted);
}

/* ---- Video embed ---- */
.video-embed {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  height: 0;
  margin: 1.8em 0;
  border-radius: 3px;
  overflow: hidden;
  background: var(--tag);
}

.video-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ---- Disclaimer & nav ---- */
.essay-disclaimer {
  border-top: 1px solid var(--border);
  padding-top: 1.4em;
  margin-top: 2em;
  color: var(--muted);
  font-size: 0.82rem;
  font-style: italic;
  font-family: 'Syne', sans-serif;
}

.essay-nav-bar {
  display: flex;
  justify-content: space-between;
  margin-top: 56px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.essay-nav-bar a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  transition: color 0.15s;
}

.essay-nav-bar a:hover {
  color: var(--text);
}

/* ---- Newsletter note ---- */
.newsletter-note {
  background: var(--tag);
  border-radius: 3px;
  padding: 16px 20px;
  margin-top: 40px;
  font-size: 0.875rem;
  color: var(--tag-text);
  font-family: 'Syne', sans-serif;
}

/* ---- Mobile ---- */
@media (max-width: 480px) {
  .site {
    padding: 40px 0 64px;
  }

  .theme-toggle {
    top: 16px;
    right: 16px;
  }

  .essay-title-block h1 {
    letter-spacing: -0.02em;
  }
}