/* bitztedder — pure vanilla CSS, zero frameworks */

/* ── ET Book (self-hosted) ───────────────────────────────── */

@font-face {
  font-family: "et-book";
  src: url("/fonts/et-book-roman.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "et-book";
  src: url("/fonts/et-book-italic.woff") format("woff");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "et-book";
  src: url("/fonts/et-book-semibold.woff") format("woff");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "et-book";
  src: url("/fonts/et-book-bold.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ── variables ───────────────────────────────────────────── */

:root {
  --bg:       #fafaf8;
  --text:     #111110;
  --muted:    #777570;
  --link:     #b00000;
  --link-vis: #7a0000;
  --border:   #dedad2;
  --subtle:   #f2f1ee;
  --code-bg:  #eeecea;

  --serif: "et-book", "AppleMyungjo", "Batang", Georgia, serif;
  --ui:    system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono:  "Menlo", "Consolas", "Monaco", "Courier New", monospace;

  --content-w: 780px;
  --side-pad:  2.4rem;
}

/* ── reset ───────────────────────────────────────────────── */

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

/* ── base ────────────────────────────────────────────────── */

html {
  font-size: 19px;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.95;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ── links ───────────────────────────────────────────────── */

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:visited { color: var(--link-vis); }

/* ── nav ─────────────────────────────────────────────────── */

nav {
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 1.4rem var(--side-pad) 0;
  display: flex;
  align-items: baseline;
  gap: 0;
}

nav .brand {
  font-size: 2.2rem;
  line-height: 1;
  color: var(--text);
  text-decoration: none;
  margin-right: 1.8rem;
  letter-spacing: -0.01em;
}

nav .brand:hover { color: var(--link); text-decoration: none; }

nav ul {
  list-style: none;
  display: flex;
  align-items: baseline;
  gap: 0;
  flex-wrap: wrap;
}

nav ul li::after {
  content: "·";
  color: var(--muted);
  margin: 0 0.4rem;
  font-size: 0.85rem;
}

nav ul li:last-child::after { content: ""; }

nav ul a {
  font-family: var(--serif);
  font-size: 0.88rem;
  font-variant-caps: small-caps;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-decoration: none;
}

nav ul a:hover { color: var(--link); text-decoration: none; }

/* ── page rule below nav ─────────────────────────────────── */

.nav-rule {
  max-width: var(--content-w);
  margin: 0.9rem auto 0;
  padding: 0 var(--side-pad);
}

.nav-rule hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0;
  width: 100%;
}

/* ── main layout ─────────────────────────────────────────── */

main {
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 2.8rem var(--side-pad) 6rem;
}

/* ── article ─────────────────────────────────────────────── */

article header {
  margin-bottom: 2.2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.post-title {
  font-size: 1.9rem;
  font-weight: 400;
  font-variant-caps: small-caps;
  letter-spacing: 0.03em;
  line-height: 1.2;
  margin-bottom: 0.4rem;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
  margin-top: 0.4rem;
}

.post-meta time {
  font-family: var(--ui);
  font-size: 0.78rem;
  color: var(--muted);
}

article header .post-desc {
  font-style: italic;
  color: var(--muted);
  margin-top: 0.5rem;
  font-size: 1.05rem;
  line-height: 1.6;
}

/* ── typography ──────────────────────────────────────────── */

article h2 {
  font-size: 1.3rem;
  font-weight: 400;
  font-variant-caps: small-caps;
  letter-spacing: 0.05em;
  margin: 2.8rem 0 0.6rem;
  padding-bottom: 0.2rem;
  border-bottom: 1px solid var(--border);
}

article h3 {
  font-size: 1.05rem;
  font-style: italic;
  font-weight: 400;
  margin: 2rem 0 0.4rem;
}

article h4 {
  font-size: 1rem;
  font-weight: 600;
  margin: 1.6rem 0 0.3rem;
}

article p {
  margin-top: 0;
  margin-bottom: 0;
  text-align: justify;
  hyphens: auto;
  word-break: keep-all;
}

article p + p { text-indent: 1.5em; }

article h2 + p,
article h3 + p,
article h4 + p { text-indent: 0; }

article > p:first-child,
article section > p:first-child { text-indent: 0; }

article ul, article ol {
  margin: 0.8em 0 0.8em 1.6em;
}

article li { margin: 0.25em 0; }
article li > p { text-indent: 0 !important; }

article strong { font-weight: 600; }
article em     { font-style: italic; }

/* ── blockquote ──────────────────────────────────────────── */

blockquote {
  margin: 1.8rem 0;
  padding: 0 0 0 1.4rem;
  border-left: 2px solid var(--border);
  color: var(--muted);
  font-style: italic;
}

blockquote p { text-align: left !important; text-indent: 0 !important; }

/* ── footnote-style sidenotes placeholder ────────────────── */

.marginnote {
  float: right;
  clear: right;
  margin-right: -40%;
  width: 35%;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--muted);
  font-style: italic;
}

/* ── table ───────────────────────────────────────────────── */

table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--ui);
  font-size: 0.85rem;
  margin: 1.6rem 0;
}

thead { border-bottom: 2px solid var(--text); }

th {
  padding: 0.4rem 0.9rem;
  text-align: left;
  font-weight: 600;
  font-variant-caps: small-caps;
  letter-spacing: 0.04em;
}

td {
  padding: 0.35rem 0.9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

/* ── code ────────────────────────────────────────────────── */

code {
  font-family: var(--mono);
  font-size: 0.81em;
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 2px;
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1rem 1.3rem;
  overflow-x: auto;
  margin: 1.6rem 0;
  line-height: 1.52;
}

pre code { background: none; padding: 0; font-size: 0.82rem; }

/* ── math (MathML — no JS needed) ───────────────────────── */

math { font-size: 1.05em; }

math[display="block"] {
  display: block;
  overflow-x: auto;
  margin: 1.6rem 0;
  text-align: center;
}

/* ── horizontal rule ─────────────────────────────────────── */

hr {
  border: none;
  border-top: 1px solid var(--border);
  width: 50%;
  margin: 3rem auto;
}

/* ── categories / tags ───────────────────────────────────── */

.cats { display: flex; flex-wrap: wrap; gap: 0.3rem; }

.cat {
  font-family: var(--ui);
  font-size: 0.67rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 0.12rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--muted);
}

/* ── listing page ────────────────────────────────────────── */

.listing-head {
  margin-bottom: 2.5rem;
}

.listing-head h1 {
  font-size: 2rem;
  font-weight: 400;
  font-variant-caps: small-caps;
  letter-spacing: 0.03em;
  line-height: 1.1;
  margin-bottom: 0.2rem;
}

.listing-sub {
  font-style: italic;
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 0.2rem;
}

.post-list { list-style: none; }

.post-item {
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border);
}

.post-item:first-child { border-top: 1px solid var(--border); }

.post-item-inner {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  flex-wrap: wrap;
}

.post-item .post-date {
  font-family: var(--ui);
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 5.8rem;
}

.post-link {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-variant-caps: small-caps;
  letter-spacing: 0.03em;
  color: var(--link);
  text-decoration: none;
  line-height: 1.3;
}

.post-link:visited { color: var(--link-vis); }
.post-link:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }

.post-desc {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 0.25rem;
  font-style: italic;
}

.empty { color: var(--muted); font-style: italic; padding: 1.5rem 0; }

/* ── WIP elements ────────────────────────────────────────── */

.wip-badge {
  display: inline-block;
  font-family: var(--ui);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: 2px;
  background: #fef8e6;
  border: 1px solid #e0c96a;
  color: #7a5c00;
  margin-bottom: 1.2rem;
}

.wip-progress {
  font-family: var(--ui);
  font-size: 0.78rem;
  color: var(--muted);
  margin: 1rem 0 1.5rem;
}

.wip-progress-bar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 0.4rem;
  overflow: hidden;
}

.wip-progress-fill { height: 100%; background: var(--link); }

.wip-outline {
  font-family: var(--ui);
  font-size: 0.85rem;
  background: var(--subtle);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1rem 1.3rem;
  margin: 1.5rem 0;
  color: var(--muted);
}

.wip-outline ul { margin: 0.4rem 0 0 1.2rem; }
.wip-outline li { margin: 0.2rem 0; }
.wip-outline .done { text-decoration: line-through; opacity: 0.5; }

/* ── footer ──────────────────────────────────────────────── */

footer {
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 1.2rem var(--side-pad) 2rem;
  border-top: 1px solid var(--border);
  font-family: var(--ui);
  font-size: 0.75rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ── responsive ──────────────────────────────────────────── */

@media (max-width: 680px) {
  html { font-size: 17px; }
  :root { --side-pad: 1.3rem; }
  main { padding-bottom: 4rem; }

  nav { padding-top: 1rem; }

  .post-item-inner { flex-direction: column; gap: 0.2rem; }
  .post-item .post-date { min-width: auto; }

  .marginnote { display: none; }

  article p { text-align: left; hyphens: none; }
}

