/* ---------------------------------------------------
   self-hosted webfonts
   --------------------------------------------------- */

@font-face { font-family: "Lora"; src: url("fonts/lora-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Lora"; src: url("fonts/lora-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Lora"; src: url("fonts/lora-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Lora"; src: url("fonts/lora-latin-700-italic.woff2") format("woff2"); font-weight: 700; font-style: italic; font-display: swap; }

:root,
:root[data-theme="light"] {
  --bg:      #fdfcf8;
  --fg:      #1a1611;
  --dim:     #6e6659;
  --rule:    #c9c2b1;
  --accent:  #7e3220;

  --type: "Lora", "Source Serif 4", "Iowan Old Style", "Charter",
          "Noto Serif", "Liberation Serif",
          Georgia, "Times New Roman", serif;
}

:root[data-theme="dark"] {
  --bg:      #111317;
  --fg:      #e8e1d3;
  --dim:     #8d8473;
  --rule:    #2c2e35;
  --accent:  #d99774;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

::selection { background: var(--accent); color: var(--bg); }

html, body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--type);
  font-size: 17px;
  line-height: 1.55;
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 400ms ease, color 400ms ease;
}

body {
  min-height: 100vh;
  padding: 56px 24px 80px;
}

main {
  max-width: 32rem;
  margin: 0 auto;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 400ms ease;
  -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) {
  a:hover { text-decoration: none; }
}

/* ---------- theme toggle ---------- */

.theme-toggle {
  align-self: center;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0 0 6px 0;
  cursor: pointer;
  color: var(--dim);
  font-family: inherit;
  font-size: 1rem;
  line-height: 1;
  position: relative;
  width: 1.4em;
  height: 1.4em;
  transition: color 400ms ease;
}
@media (hover: hover) {
  .theme-toggle:hover { color: var(--accent); }
}
.theme-toggle { -webkit-tap-highlight-color: transparent; }

.theme-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 400ms ease, transform 400ms ease;
}

:root[data-theme="light"] .theme-icon-sun  { opacity: 1; transform: rotate(0deg) scale(1); }
:root[data-theme="light"] .theme-icon-moon { opacity: 0; transform: rotate(-45deg) scale(0.7); }
:root[data-theme="dark"]  .theme-icon-sun  { opacity: 0; transform: rotate(45deg) scale(0.7); }
:root[data-theme="dark"]  .theme-icon-moon { opacity: 1; transform: rotate(0deg) scale(1); }

/* ---------- masthead ---------- */

header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  margin-bottom: 0;
}

header > * { margin: 0; }

h1 {
  font-size: 2rem;
  font-weight: normal;
  font-style: italic;
  letter-spacing: 0.5px;
  line-height: 1.1;
}

.tagline {
  color: var(--dim);
  font-style: italic;
  font-size: 0.9rem;
  line-height: 1.3;
  text-align: center;
  transition: color 400ms ease;
}

/* ---------- intro ---------- */

.intro {
  color: var(--dim);
  font-style: italic;
  font-size: 0.88rem;
  line-height: 1.45;
  text-align: center;
  margin: 6px 0 0 0;
  max-width: 28rem;
  transition: color 400ms ease;
}

.intro::before {
  content: "";
  display: block;
  width: 24px;
  height: 1px;
  background: var(--rule);
  margin: 4px auto 12px;
  transition: background-color 400ms ease;
}

/* ---------- articles ---------- */

section { margin: 0; }

article + article { margin-top: 0; }

section::before,
article + article::before {
  content: "\2042";
  display: block;
  text-align: center;
  color: var(--accent);
  font-size: 1.3rem;
  line-height: 1;
  margin: 28px 0 28px 0;
  transition: color 400ms ease;
}

section::before { margin-top: 30px; }

.date {
  text-align: center;
  font-style: italic;
  font-size: 0.82rem;
  letter-spacing: 0.5px;
  color: var(--dim);
  margin: 0 0 2px 0;
  transition: color 400ms ease;
}

h3 {
  font-size: 1.3rem;
  font-weight: normal;
  font-style: italic;
  letter-spacing: 0.3px;
  text-align: center;
  margin: 0 0 12px 0;
}

h3 a {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

h3::after {
  content: "";
  display: block;
  width: 24px;
  height: 1px;
  background: var(--rule);
  margin: 6px auto 0;
  transition: background-color 400ms ease;
}

:target {
  scroll-margin-top: 24px;
}

/* ---------- body ---------- */

p {
  margin: 0 0 8px 0;
  text-align: left;
  hyphens: auto;
}

p:last-child { margin-bottom: 0; }

.mark {
  color: var(--accent);
  font-style: italic;
  transition: color 400ms ease;
}

.footnote {
  color: var(--dim);
  font-style: italic;
  font-size: 0.82rem;
  line-height: 1.4;
  margin: 6px 0 0 0;
  transition: color 400ms ease;
}

.footnote::before {
  content: "";
  display: block;
  width: 25%;
  height: 1px;
  background: var(--rule);
  margin: 0 0 4px 0;
  transition: background-color 400ms ease;
}

/* ---------- footer ---------- */

footer {
  margin-top: 0;
  text-align: center;
}

footer::before {
  content: "\2042";
  display: block;
  text-align: center;
  color: var(--accent);
  font-size: 1.3rem;
  line-height: 1;
  margin: 28px 0 28px 0;
  transition: color 400ms ease;
}

footer p {
  color: var(--dim);
  font-style: italic;
  font-size: 0.85rem;
  line-height: 1.4;
  text-align: center;
  margin: 0;
  transition: color 400ms ease;
}

/* ---------- 404 ---------- */

main.lost {
  min-height: calc(100vh - 136px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 18px;
}

.lost-mark {
  color: var(--accent);
  font-size: 2rem;
  line-height: 1;
  margin: 0;
  transition: color 400ms ease;
}

.lost-text {
  color: var(--fg);
  font-style: italic;
  font-size: 1rem;
  margin: 0;
  text-align: center;
  transition: color 400ms ease;
}

.lost-back {
  margin: 0;
  font-style: italic;
  font-size: 0.85rem;
  text-align: center;
}

.lost-back a {
  color: var(--dim);
  -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) {
  .lost-back a:hover { color: var(--accent); }
}

/* ---------- mobile ---------- */

@media (max-width: 540px) {
  html, body { font-size: 15.5px; }
  body       { padding: 36px 18px 56px; }
  section::before,
  article + article::before,
  footer::before { margin: 22px 0 22px 0; }
}
