@charset "UTF-8";

/* Cormorant Garamond — local variable webfont (CatharsisFonts, v4.002) */
@font-face {
  font-family: "Cormorant";
  src: url("/themes/logik/static/fonts/Cormorant[wght].woff2") format("woff2 supports variations"),
       url("/themes/logik/static/fonts/Cormorant[wght].woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Cormorant";
  src: url("/themes/logik/static/fonts/Cormorant-Italic[wght].woff2") format("woff2 supports variations"),
       url("/themes/logik/static/fonts/Cormorant-Italic[wght].woff2") format("woff2");
  font-weight: 300 700;
  font-style: italic;
  font-display: swap;
}

/* ── Colour tokens ────────────────────────────────────────────────────────── */

:root {
  --bg:          #fffff8;
  --fg:          #111111;
  --border:      #cccccc;
  --muted:       #666666;
  --subtle:      #888888;
  --rule:        #e8e8de;
  --code-bg:     #f4f4ec;
  --th-bg:       #f4f4ec;
}

/* Dark — system preference, unless user forced light */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:      #151515;
    --fg:      #dddddd;
    --border:  #444444;
    --muted:   #999999;
    --subtle:  #777777;
    --rule:    #2e2e2e;
    --code-bg: #1e1e1e;
    --th-bg:   #1e1e1e;
  }
}

/* Dark — user explicitly chose dark */
[data-theme="dark"] {
  --bg:      #151515;
  --fg:      #dddddd;
  --border:  #444444;
  --muted:   #999999;
  --subtle:  #777777;
  --rule:    #2e2e2e;
  --code-bg: #1e1e1e;
  --th-bg:   #1e1e1e;
}

/* Light — user explicitly chose light (overrides system dark) */
[data-theme="light"] {
  --bg:      #fffff8;
  --fg:      #111111;
  --border:  #cccccc;
  --muted:   #666666;
  --subtle:  #888888;
  --rule:    #e8e8de;
  --code-bg: #f4f4ec;
  --th-bg:   #f4f4ec;
}

/* ── Reset ────────────────────────────────────────────────────────────────── */

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

/* ── Base — Tufte-inspired layout ────────────────────────────────────────── */

html {
  font-size: 16px;
}

body {
  width: 87.5%;
  margin-left: auto;
  margin-right: auto;
  padding-left: 12.5%;
  font-family: "Cormorant", Palatino, "Palatino Linotype", "Book Antiqua", Georgia, serif;
  background-color: var(--bg);
  color: var(--fg);
  max-width: 1400px;
  transition: background-color 0.2s, color 0.2s;
}

/* ── Site header ─────────────────────────────────────────────────────────── */

.site-header {
  padding: 2rem 0 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 2rem;
  flex-wrap: wrap;
}

.site-header__name {
  font-size: 2.2rem;
  font-weight: 400;
  text-transform: none;
  margin: 0;
  flex-shrink: 0;
}

.site-header__name a {
  text-decoration: none;
  color: inherit;
}

/* ── Theme toggle ────────────────────────────────────────────────────────── */

.theme-toggle {
  margin-left: auto;
  flex-shrink: 0;
  background: none;
  border: none;
  outline: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 2.4rem;
  padding: 0;
  line-height: 1;
  transition: color 0.15s;
}

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

/* Light mode: show moon (click → go dark) */
.theme-toggle::before { content: "☽"; }

/* Dark mode: show sun (click → go light) */
[data-theme="dark"] .theme-toggle::before { content: "☀"; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle::before { content: "☀"; }
}

/* ── Breadcrumbs ─────────────────────────────────────────────────────────── */

.breadcrumbs {
  display: block;
  font-size: 1rem;
  color: var(--subtle);
  margin: 1.5rem 0 0;
}

.breadcrumbs a {
  color: inherit;
  text-decoration: none;
}

.breadcrumbs a:hover {
  text-decoration: underline;
}

.breadcrumbs__sep {
  margin: 0 0.3rem;
  opacity: 0.5;
}

/* ── Main ────────────────────────────────────────────────────────────────── */

main {
  min-height: 60vh;
}

/* ── Article ─────────────────────────────────────────────────────────────── */

article {
  padding: 3rem 0 6rem;
  max-width: 680px;
}

h1 {
  font-weight: 400;
  margin-top: 2rem;
  margin-bottom: 1.5rem;
  font-size: 3.2rem;
  line-height: 1.1;
}

h2 {
  font-style: italic;
  font-weight: 400;
  margin-top: 2.1rem;
  margin-bottom: 1.4rem;
  font-size: 2.2rem;
  line-height: 1;
}

h3 {
  font-style: italic;
  font-weight: 400;
  font-size: 1.7rem;
  margin-top: 2rem;
  margin-bottom: 1.4rem;
  line-height: 1;
}

p {
  font-size: 1.5rem;
  line-height: 2.2rem;
  margin-top: 1.4rem;
  margin-bottom: 1.4rem;
  vertical-align: baseline;
}

ol, ul {
  font-size: 1.5rem;
  line-height: 2.2rem;
}

li:not(:first-child) {
  margin-top: 0.25rem;
}

hr {
  display: block;
  height: 1px;
  width: 55%;
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
  padding: 0;
}

/* ── Links ───────────────────────────────────────────────────────────────── */

a {
  color: inherit;
  text-underline-offset: 0.1em;
  text-decoration-thickness: 0.05em;
}

/* ── Code ────────────────────────────────────────────────────────────────── */

code, pre > code {
  font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
  font-size: 1.2rem;
  line-height: 1.42;
}

pre > code {
  display: block;
  overflow-x: auto;
  padding: 0.75rem 1rem;
  background: var(--code-bg);
  border-left: 3px solid var(--border);
}

/* ── Tables ──────────────────────────────────────────────────────────────── */

table {
  border-collapse: collapse;
  font-size: 1.35rem;
}

th, td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.75rem;
  text-align: left;
}

th {
  font-weight: 600;
  background: var(--th-bg);
}

/* ── Blockquote ──────────────────────────────────────────────────────────── */

blockquote {
  font-size: 1.5rem;
  margin: 1.5rem 0 1.5rem 1.5rem;
  padding-left: 1.5rem;
  border-left: 3px solid var(--border);
  font-style: italic;
}

/* ── Book cover margin figure ────────────────────────────────────────────── */

figure.book-cover {
  float: right;
  clear: right;
  width: 200px;
  /* Pull into the right margin beyond the 680px text column */
  margin-right: -240px;
  margin-left: 2rem;
  margin-top: 0.5rem;
  margin-bottom: 1rem;
  padding: 0;
  border: 0;
}

figure.book-cover img {
  width: 100%;
  height: auto;
  display: block;
}

@media (max-width: 960px) {
  /* Not enough room for margin figure — float in-column */
  figure.book-cover {
    margin-right: 0;
    width: 130px;
  }
}

@media (max-width: 760px) {
  figure.book-cover {
    width: 110px;
    margin-left: 1.5rem;
  }
}

/* ── Child page list ─────────────────────────────────────────────────────── */

ul.child-list {
  list-style: none;
  padding: 0;
  margin: 2rem 0;
  font-size: 1.5rem;
}

ul.child-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--rule);
  margin-top: 0;
}

ul.child-list li:first-child {
  border-top: 1px solid var(--rule);
}

ul.child-list a {
  text-decoration: none;
}

ul.child-list a:hover {
  text-decoration: underline;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */

footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  margin-top: 2rem;
  color: var(--subtle);
}

footer p {
  font-size: 1.1rem;
  margin: 0.2rem 0;
  line-height: 1.6;
}

footer a {
  color: inherit;
}

.footer-sites {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-top: 0.6rem;
  font-size: 1.1rem;
}

.footer-sites a {
  color: var(--subtle);
  text-decoration: none;
}

.footer-sites a:hover {
  color: var(--fg);
}

.footer-copy {
  font-size: 1.0rem;
  margin: 0.4rem 0 0;
  color: var(--subtle);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 760px) {
  body {
    width: 84%;
    padding-left: 8%;
    padding-right: 8%;
  }

  h1 { font-size: 2.4rem; }
  h2 { font-size: 1.8rem; }
  h3 { font-size: 1.4rem; }

  article { padding: 2rem 0 4rem; }
}
