/* Hanging Context — shared styles */

:root {
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Space Grotesk", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;

  --h1-size: clamp(2.5rem, 5vw, 3.5rem);
  --h2-size: clamp(1.625rem, 2.8vw, 2.125rem);
  --h3-size: clamp(1.125rem, 1.6vw, 1.25rem);
  --body-size: 1.0625rem;
  --small-size: 0.9375rem;
  --mono-size: 0.75rem;

  --bg: #fafafa;
  --bg-subtle: #f0f0f0;
  --text: #1a1a1a;
  --text-secondary: #484848;
  --text-tertiary: #999999;
  --line: rgba(0, 0, 0, 0.08);
  --selection-bg: rgba(0, 0, 0, 0.08);

  --measure: 64ch;
  --page-max: 720px;
  --page-pad: clamp(1.25rem, 4vw, 2.5rem);
  --section-space: clamp(3rem, 6vh, 5rem);
}

[data-theme="dark"] {
  --bg: #0a0a0a;
  --bg-subtle: #111111;
  --text: #ededed;
  --text-secondary: #999999;
  --text-tertiary: #666666;
  --line: rgba(255, 255, 255, 0.07);
  --selection-bg: rgba(255, 255, 255, 0.15);
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: var(--body-size);
  line-height: 1.7;
  color: var(--text-secondary);
  background: var(--bg);
  transition: background 0.3s ease, color 0.3s ease;
}

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

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

.page {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--page-pad);
}

/* ============ NAV ============ */
.site-header {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--line);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-family: "IBM Plex Sans", var(--font-body);
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-right a {
  font-size: var(--small-size);
  color: var(--text-tertiary);
  transition: color 0.15s ease;
}

.nav-right a:hover { color: var(--text); }

.theme-toggle {
  background: none;
  border: 1px solid var(--line-strong, rgba(0,0,0,0.12));
  border-radius: 50%;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-tertiary);
  font-size: 0.875rem;
  transition: color 0.15s ease, border-color 0.15s ease;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--text-secondary);
}

/* ============ INDEX ============ */
.index-hero {
  padding: clamp(4rem, 10vh, 7rem) 0 var(--section-space);
  border-bottom: 1px solid var(--line);
}

.index-hero h1 {
  font-family: var(--font-display);
  font-size: var(--h1-size);
  font-weight: 400;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}

.index-hero .tagline {
  font-size: var(--body-size);
  max-width: var(--measure);
  line-height: 1.7;
}

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

.post-list li {
  border-bottom: 1px solid var(--line);
}

.post-list a {
  display: block;
  padding: 1.75rem 0;
  transition: color 0.15s ease;
}

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

.post-list .post-date {
  font-family: var(--font-mono);
  font-size: var(--mono-size);
  color: var(--text-tertiary);
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}

.post-list .post-title {
  font-family: var(--font-display);
  font-size: clamp(1.125rem, 2vw, 1.375rem);
  font-weight: 400;
  color: var(--text);
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.post-list .post-desc {
  font-size: var(--small-size);
  max-width: var(--measure);
  line-height: 1.6;
}

/* ============ POST ============ */
.post-header {
  padding: clamp(3rem, 8vh, 5rem) 0 2rem;
  border-bottom: 1px solid var(--line);
}

.post-header .post-meta {
  font-family: var(--font-mono);
  font-size: var(--mono-size);
  color: var(--text-tertiary);
  letter-spacing: 0.06em;
  margin-bottom: 1rem;
}

.post-header h1 {
  font-family: var(--font-display);
  font-size: var(--h2-size);
  font-weight: 400;
  color: var(--text);
  line-height: 1.15;
  letter-spacing: -0.025em;
  max-width: var(--measure);
}

.post-body {
  padding: var(--section-space) 0;
}

.post-body .lede {
  font-size: 1.0625rem;
  color: var(--text);
  line-height: 1.65;
  margin-bottom: 1.5rem;
  max-width: var(--measure);
}

.post-body p {
  max-width: var(--measure);
  margin-bottom: 1rem;
}

.post-body p:last-child { margin-bottom: 0; }

.post-body h2 {
  font-family: var(--font-display);
  font-size: var(--h3-size);
  font-weight: 400;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  max-width: var(--measure);
}

.post-body ul {
  list-style: none;
  max-width: var(--measure);
  margin: 1.25rem 0;
}

.post-body ul li {
  padding: 0.5rem 0 0.5rem 1.25rem;
  position: relative;
}

.post-body ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1.05rem;
  width: 5px;
  height: 1px;
  background: var(--text-tertiary);
}

.thesis-line {
  font-family: var(--font-display);
  font-size: var(--h3-size);
  font-style: italic;
  color: var(--text);
  padding: 1.5rem 0;
  margin: 1.5rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  max-width: var(--measure);
  line-height: 1.4;
}

/* Share buttons */
.share-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--line);
}

.share-label {
  font-family: var(--font-mono);
  font-size: var(--mono-size);
  color: var(--text-tertiary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.share-bar a {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: var(--small-size);
  color: var(--text-tertiary);
  transition: color 0.15s ease;
}

.share-bar a:hover { color: var(--text); }

/* Post nav */
.post-nav {
  padding: 2rem 0;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.post-nav a {
  font-size: var(--small-size);
  color: var(--text-tertiary);
  transition: color 0.15s ease;
}

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

/* ============ FOOTER ============ */
.site-footer {
  padding: clamp(2.5rem, 5vh, 4rem) 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-copy {
  font-size: var(--mono-size);
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.footer-links a {
  font-size: var(--mono-size);
  color: var(--text-tertiary);
  transition: color 0.15s ease;
}

.footer-links a:hover { color: var(--text); }

/* ============ FOCUS ============ */
a:focus-visible,
button:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ============ RESPONSIVE ============ */
@media (min-width: 1200px) { :root { --page-max: 760px; } }
@media (min-width: 1600px) { :root { --page-max: 800px; --body-size: 1.125rem; --small-size: 1rem; } }

@media (max-width: 480px) {
  .footer-links { gap: 1rem; }
  .nav-right a.hide-mobile { display: none; }
}
