/*
 * postinstall - global styles
 *
 * Dark-first aesthetic with light mode as a clean inversion.
 * Typography: IBM Plex Mono (logo, code), Plex Sans (UI, headings),
 * Plex Serif (body prose). All loaded via @fontsource in BaseLayout.astro.
 *
 * Palette reasoning: the "postinstall" metaphor is the moment right after
 * a fresh OS install, when the terminal is waiting for its first real
 * command. Amber phosphor (#CC7722) evokes old CRT monitors without being
 * cyberpunk neon. Carbon and paper are the canvas, everything else is
 * structural. One accent color does all the heavy lifting.
 */

:root {
  /* Brand canvas - dark mode primary */
  --carbon: #0F0F0F;
  --carbon-lift: #1E1E1E;
  --carbon-border: #2A2A2A;
  --paper: #F5F1E8;
  --paper-dim: #CDC8B8;

  /* Brand accent */
  --amber: #CC7722;
  --amber-bright: #E18A2A;
  --amber-deep: #8A4E13;

  /* Structural */
  --steel: #475569;
  --muted: #8B8680;
  --muted-soft: #6B6761;

  /* Applied tokens - default to dark mode */
  --bg: var(--carbon);
  --bg-lift: var(--carbon-lift);
  --fg: var(--paper);
  --fg-soft: var(--paper-dim);
  --fg-muted: var(--muted);
  --accent: var(--amber);
  --accent-hover: var(--amber-bright);
  --border: var(--carbon-border);
  --code-bg: var(--carbon-lift);

  /* Typography */
  --font-sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-serif: 'IBM Plex Serif', Georgia, Cambria, "Times New Roman", serif;
  --font-mono: 'IBM Plex Mono', "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* Layout */
  --max-width: 44rem;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: var(--paper);
    --bg-lift: #EDE8D6;
    --fg: #1A1A1A;
    --fg-soft: #3D3D3D;
    --fg-muted: var(--muted);
    --border: #D8D2BD;
    --code-bg: #EDE8D6;
    /* Amber shifts slightly darker in light mode for contrast */
    --accent: var(--amber-deep);
    --accent-hover: var(--amber);
  }
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
}

html, body {
  margin: 0;
  padding: 0;
  color: var(--fg);
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}

/* Header */

.site-header {
  border-bottom: 0.5px solid var(--border);
  padding: 1.25rem 1.5rem;
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 1rem;
}

.site-title {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--fg);
}

.site-title .accent {
  color: var(--accent);
}

.site-header nav {
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.site-header nav a {
  color: var(--fg-muted);
  text-decoration: none;
  margin-left: 1.5rem;
}

.site-header nav a:hover { color: var(--accent); }

/* Footer */

.site-footer {
  border-top: 0.5px solid var(--border);
  padding: 1.75rem 1.5rem;
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
  color: var(--fg-muted);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.site-footer p { margin: 0; }

/* Links */

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease;
}

a:hover {
  border-bottom-color: var(--accent);
}

/* Headings - Plex Sans for UI/headings */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  color: var(--fg);
  letter-spacing: -0.015em;
  line-height: 1.25;
}

h1 {
  font-size: 2rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
}

h2 {
  font-size: 1.4rem;
  font-weight: 600;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
}

h3 {
  font-size: 1.15rem;
  font-weight: 500;
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
}

/* Body prose */

p {
  margin: 1rem 0;
  color: var(--fg-soft);
}

strong {
  color: var(--fg);
  font-weight: 500;
}

/* Code */

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: var(--fg);
}

pre {
  font-family: var(--font-mono);
  background: var(--code-bg);
  padding: 1rem 1.25rem;
  border-radius: 6px;
  overflow-x: auto;
  border: 0.5px solid var(--border);
  font-size: 0.88rem;
  line-height: 1.6;
}

pre code {
  background: transparent;
  padding: 0;
  font-size: inherit;
}

/* Blockquotes */

blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 1.25rem;
  color: var(--fg-muted);
  margin: 1.5rem 0;
  font-style: italic;
}

hr {
  border: none;
  border-top: 0.5px solid var(--border);
  margin: 2.5rem 0;
}

/* Post list (index page) */

.post-list {
  list-style: none;
  padding: 0;
  margin: 2rem 0 0 0;
}

.post-list li {
  border-bottom: 0.5px solid var(--border);
  padding: 1.5rem 0;
}

.post-list li:last-child {
  border-bottom: none;
}

.post-list h2 {
  font-family: var(--font-sans);
  font-weight: 600;
  margin: 0 0 0.35rem 0;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}

.post-list h2 a {
  color: var(--fg);
  border-bottom: none;
}

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

.post-list .meta {
  font-family: var(--font-mono);
  color: var(--fg-muted);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}

.post-list .summary {
  font-family: var(--font-serif);
  margin: 0.6rem 0 0 0;
  color: var(--fg-soft);
  font-size: 0.97rem;
  line-height: 1.6;
}

/* Post page */

.post-meta {
  font-family: var(--font-mono);
  color: var(--fg-muted);
  font-size: 0.78rem;
  margin-bottom: 2.5rem;
  letter-spacing: 0.02em;
}

.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.15rem 0.6rem;
  background: transparent;
  border: 0.5px solid var(--border);
  border-radius: 999px;
  color: var(--fg-muted);
  margin-right: 0.3rem;
  text-transform: lowercase;
}

/* Lead paragraph immediately after h1 gets slightly lifted weight */
article > h1 + .post-meta + p,
article > h1 + p {
  font-size: 1.08rem;
  color: var(--fg);
}

/* Intro paragraph on index */

.intro {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  color: var(--fg-soft);
  max-width: 36rem;
  margin: 1.5rem 0 0 0;
  line-height: 1.65;
}
