/* =============================
   steventhate.dev
   Instrument Serif + DM Mono
   ============================= */

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

:root {
  --mono: 'DM Mono', monospace;
  --serif: 'Instrument Serif', Georgia, serif;

  /* Light = warm silver/cream on muted sage desktop */
  --desktop: #7a8a7e;
  --desktop-dot: rgba(255, 255, 255, 0.06);
  --bg: #ECE6D7;          /* page panel — warm cream-gray */
  --heading: #1f1b14;     /* warm off-black for titles */
  --text: #44403a;        /* lighter, warmer body text */
  --text-muted: #6e665a;
  --accent: #000080;
  --accent-hover: #c00000;
  --rule: #8a7f6e;
  --panel-bg: #d8d0bd;     /* code blocks / lab cards */
  --panel-light: #ffffff;
  --panel-dark: #6e6555;
  --titlebar-bg: #000080;
  --titlebar-text: #ffffff;
}

[data-theme="dark"] {
  /* Dark = charcoal panel on near-black desktop */
  --desktop: #14161c;
  --desktop-dot: rgba(255, 255, 255, 0.04);
  --bg: #2b2b2b;
  --heading: #f2f0eb;
  --text: #b8b3a8;
  --text-muted: #807a70;
  --accent: #6ab0ff;
  --accent-hover: #ffb86b;
  --rule: #1a1a1a;
  --panel-bg: #1e1e1e;
  --panel-light: #404040;
  --panel-dark: #0e0e0e;
  --titlebar-bg: #3a4a6b;
  --titlebar-text: #e8e8e8;
}

html {
  font-size: 17px;
  background-color: var(--desktop);
  background-image: radial-gradient(var(--desktop-dot) 1px, transparent 1px);
  background-size: 4px 4px;
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
}

body {
  font-family: var(--mono);
  color: var(--text);
  background: var(--bg);
  font-size: 1rem;
  line-height: 1.75;
  max-width: 720px;
  margin: 2.5rem auto;
  padding: 0;
  border: 1px solid var(--rule);
  box-shadow:
    inset 1px 1px 0 var(--panel-light),
    inset -1px -1px 0 var(--panel-dark),
    0 0 0 1px rgba(0, 0, 0, 0.15),
    0 8px 24px rgba(0, 0, 0, 0.25);
  hanging-punctuation: first last;
}

/* --- Title bar (window chrome) --- */
.titlebar {
  background: var(--titlebar-bg);
  color: var(--titlebar-text);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.35rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--panel-dark);
}

.titlebar-text {
  user-select: none;
  color: var(--titlebar-text);
  text-decoration: none;
}

.titlebar-text:hover {
  color: var(--titlebar-text);
  opacity: 0.85;
  text-decoration: none;
}

.titlebar-path {
  font-size: 0.72rem;
  font-weight: 400;
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* Header sits inside body, beneath title bar */
body > header {
  padding: 1.75rem 2rem 0;
}

body > main {
  padding: 0 2rem;
}

body > footer {
  padding: 0 2rem 1.75rem;
}

/* --- Typography --- */

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.15;
  color: var(--heading);
  text-wrap: balance;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 3rem;
  margin-bottom: 1.25rem;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.75rem;
  margin-top: 2.75rem;
  margin-bottom: 1rem;
}

h3 {
  font-size: 1.25rem;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
  letter-spacing: 0;
}

p {
  margin-bottom: 1.25rem;
  text-wrap: pretty;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
  transition: color 120ms ease, text-decoration-color 120ms ease;
}

a:hover {
  color: var(--accent-hover);
  text-decoration-color: currentColor;
}

/* --- Header / Nav --- */

body > header {
  margin-bottom: 3.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--rule);
}

body > header nav {
  display: flex;
  align-items: baseline;
  gap: 1.75rem;
}

nav .nav-link {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.15rem 0.1rem;
  border-bottom: 2px solid transparent;
  letter-spacing: 0.01em;
  transition: color 120ms ease, border-color 120ms ease;
}

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

nav .nav-link.active {
  color: var(--heading);
  border-bottom-color: var(--accent);
}

.theme-toggle {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.75rem;
  background: var(--panel-bg);
  color: var(--text);
  border: 1px solid var(--rule);
  padding: 0.15rem 0.5rem;
  cursor: pointer;
  box-shadow:
    inset 1px 1px 0 var(--panel-light),
    inset -1px -1px 0 var(--panel-dark);
  letter-spacing: 0.02em;
}

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

.theme-toggle:active {
  box-shadow:
    inset 1px 1px 0 var(--panel-dark),
    inset -1px -1px 0 var(--panel-light);
}

/* --- Main content --- */

main {
  min-height: 60vh;
}

.intro {
  padding: 2rem 0 4rem;
}

.intro-body h1 {
  font-size: 4rem;
  line-height: 1;
  margin-bottom: 1.75rem;
  letter-spacing: -0.025em;
  font-style: italic;
}

.intro-body p {
  font-size: 1.1rem;
  line-height: 1.55;
  max-width: 42ch;
  color: var(--text);
  margin-bottom: 1.25rem;
}

.intro-body p:first-of-type {
  position: relative;
  padding-left: 1rem;
  border-left: 2px solid var(--accent);
  color: var(--heading);
}

/* --- Post list --- */

.post-list {
  list-style: none;
  margin-top: 1.5rem;
}

.post-list li {
  margin-bottom: 1.25rem;
}

.post-list a {
  font-family: var(--serif);
  font-size: 1.4rem;
  text-decoration: none;
  display: block;
  line-height: 1.3;
}

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

.post-list time {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* --- Article --- */

.article {
  padding: 1rem 0 0;
}

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

.article-head h1 {
  margin: 0;
}

.kicker {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
  font-variant-numeric: tabular-nums lining-nums;
}

.kicker time {
  font-variant-numeric: tabular-nums lining-nums;
}

/* Classic drop cap on first paragraph of articles */
.article-body > p:first-of-type::first-letter {
  font-family: var(--serif);
  float: left;
  font-size: 3.6em;
  line-height: 0.85;
  padding: 0.08em 0.12em 0 0;
  color: var(--heading);
  font-weight: 400;
}

.article-body h2 {
  position: relative;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
}

.article-body h2:first-child {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}

.article-body ul,
.article-body ol {
  margin-bottom: 1.25rem;
  padding-left: 0;
  list-style: none;
}

.article-body ul li,
.article-body ol li {
  position: relative;
  padding-left: 1.75rem;
  margin-bottom: 0.5rem;
}

.article-body ul li::before {
  content: "—";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--text-muted);
  font-weight: 400;
}

.article-body ol {
  counter-reset: article-ol;
}

.article-body ol li {
  counter-increment: article-ol;
}

.article-body ol li::before {
  content: counter(article-ol, lower-roman) ".";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.85em;
  letter-spacing: 0.05em;
}

.article-body strong {
  font-weight: 500;
  color: var(--heading);
}

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

.end-mark {
  font-family: var(--serif);
  text-align: center;
  font-size: 1.4rem;
  color: var(--text-muted);
  margin: 3.5rem 0 0;
  letter-spacing: 0.5em;
  line-height: 1;
}

/* Inline code + code blocks — panel chrome */
code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--panel-bg);
  color: var(--text);
  padding: 0.05rem 0.35rem;
  border: 1px solid var(--panel-dark);
  box-shadow:
    inset 1px 1px 0 var(--panel-light),
    inset -1px -1px 0 var(--panel-dark);
}

pre {
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.5;
  background: var(--panel-bg);
  color: var(--text);
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  border: 1px solid var(--panel-dark);
  box-shadow:
    inset 1px 1px 0 var(--panel-dark),
    inset -1px -1px 0 var(--panel-light);
  overflow-x: auto;
}

pre code {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  font-size: inherit;
}

blockquote {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  background: var(--panel-bg);
  border-left: 3px solid var(--accent);
  box-shadow:
    inset 1px 1px 0 var(--panel-light),
    inset -1px -1px 0 var(--panel-dark);
  font-style: italic;
}

/* --- Footer --- */

body > footer {
  margin-top: 4.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

body > footer p {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums lining-nums;
}

body > footer p:last-child::before {
  content: "";
}

body > footer::after {
  content: "§";
  font-family: var(--serif);
  font-size: 0.95rem;
  color: var(--text-muted);
  letter-spacing: 0;
  transform: translateY(-0.05em);
}

/* --- Font Lab --- */

.lab-title {
  margin-bottom: 0.25rem;
}

.lab-sub {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 2rem;
}

.font-grid {
  display: grid;
  gap: 2rem;
}

.font-card {
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 1.75rem 2rem 2rem;
  background: var(--panel-bg);
  box-shadow:
    inset 1px 1px 0 var(--panel-light),
    inset -1px -1px 0 var(--panel-dark);
}

.font-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px dashed var(--rule);
}

.font-card-titles {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.font-card-head h2 {
  font-size: 1.6rem;
  margin: 0;
}

.font-card-head .kind {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.lab-current {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.font-reset {
  font-family: var(--mono);
  font-size: inherit;
}

.apply-pairing {
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 0.8rem;
  background: var(--panel-bg);
  color: var(--text);
  border: 1px solid var(--rule);
  padding: 0.3rem 0.8rem;
  cursor: pointer;
  box-shadow:
    inset 1px 1px 0 var(--panel-light),
    inset -1px -1px 0 var(--panel-dark);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.apply-pairing:hover {
  color: var(--accent);
}

.apply-pairing:active {
  box-shadow:
    inset 1px 1px 0 var(--panel-dark),
    inset -1px -1px 0 var(--panel-light);
}

.pair-note {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 1.5rem;
}

.sample {
  margin-bottom: 1rem;
}

.sample-hero {
  font-size: 2.4rem;
  line-height: 1.15;
  margin-bottom: 1rem;
}

.sample-post {
  font-size: 1.5rem;
  line-height: 1.25;
  color: var(--accent);
  margin-bottom: 1rem;
}

.sample-body {
  font-size: 1rem;
  line-height: 1.65;
  margin-bottom: 0.75rem;
}

.sample-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0;
}

/* --- Post grid (Writing list) --- */

.post-grid {
  display: grid;
  gap: 2rem;
  margin-top: 2rem;
}

.post-card {
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 1.75rem 2rem;
  background: var(--panel-bg);
  box-shadow:
    inset 1px 1px 0 var(--panel-light),
    inset -1px -1px 0 var(--panel-dark);
}

.post-card-head {
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px dashed var(--rule);
}

.post-card-titles {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.post-card-titles h2 {
  font-size: 1.5rem;
  margin: 0;
  line-height: 1.2;
}

.post-card-titles h2 a {
  color: var(--text);
  text-decoration: none;
}

.post-card-titles h2 a:hover {
  color: var(--accent);
}

.post-card-titles .kind {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.post-summary {
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--text);
  margin: 0;
}

.post-read {
  text-decoration: none;
}

/* --- Color Lab --- */

.color-grid {
  display: grid;
  gap: 2.5rem;
}

.color-card {
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 1.75rem 2rem 2rem;
  background: var(--panel-bg);
  box-shadow:
    inset 1px 1px 0 var(--panel-light),
    inset -1px -1px 0 var(--panel-dark);
}

.color-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px dashed var(--rule);
}

.color-card-head h2 {
  font-size: 1.4rem;
  margin: 0;
  font-family: var(--mono);
  font-style: normal;
}

.color-card-head .kind {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Mock window — shared shape, scheme classes recolor it */
.mock {
  border: 2px solid;
  border-radius: 2px;
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.5;
  overflow: hidden;
}

.mock-titlebar {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.35rem 0.75rem;
  letter-spacing: 0.02em;
}

.mock-body {
  padding: 1rem 1.25rem 1.25rem;
}

.mock-h {
  font-family: var(--serif);
  font-size: 1.6rem;
  margin: 0 0 0.75rem;
  font-weight: 400;
  line-height: 1.15;
}

.mock-body p {
  margin-bottom: 0.65rem;
}

.mock-pre {
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 0.6rem 0.8rem;
  margin: 0.75rem 0;
  border: 1px solid;
  white-space: pre-wrap;
  line-height: 1.4;
}

/* --- Silver (Win95 / System 7) --- */
.scheme-silver .mock {
  background: #ECECEC;
  color: #1a1a1a;
  border-color: #808080;
  box-shadow:
    inset 1px 1px 0 #ffffff,
    inset -1px -1px 0 #5a5a5a;
}
.scheme-silver .mock-titlebar {
  background: #000080;
  color: #ffffff;
  border-bottom: 1px solid #5a5a5a;
}
.scheme-silver .mock-h {
  color: #0a0a0a;
}
.scheme-silver .mock-link {
  color: #000080;
  text-decoration: underline;
}
.scheme-silver .mock-link:hover {
  color: #c00000;
}
.scheme-silver .mock-meta {
  color: #555;
}
.scheme-silver .mock-pre {
  background: #c0c0c0;
  border-color: #808080;
  color: #000;
  box-shadow: inset 1px 1px 0 #5a5a5a, inset -1px -1px 0 #ffffff;
}

/* --- Charcoal (dark) --- */
.scheme-charcoal .mock {
  background: #2b2b2b;
  color: #d4d4d4;
  border-color: #1a1a1a;
  box-shadow:
    inset 1px 1px 0 #404040,
    inset -1px -1px 0 #1a1a1a;
}
.scheme-charcoal .mock-titlebar {
  background: #3a4a6b;
  color: #e8e8e8;
  border-bottom: 1px solid #1a1a1a;
}
.scheme-charcoal .mock-h {
  color: #f0f0f0;
}
.scheme-charcoal .mock-link {
  color: #6ab0ff;
  text-decoration: underline;
}
.scheme-charcoal .mock-link:hover {
  color: #ffb86b;
}
.scheme-charcoal .mock-meta {
  color: #8a8a8a;
}
.scheme-charcoal .mock-pre {
  background: #1e1e1e;
  border-color: #0a0a0a;
  color: #b8d4a0;
  box-shadow: inset 1px 1px 0 #1a1a1a, inset -1px -1px 0 #404040;
}
