/* ============================================================
   STYLE.CSS
   Mobile-first. Dark forest green. Flat files.
   Big name header (Geerling style). Dynomight-style post titles.
   ============================================================ */

@font-face { font-family: century_supra_a; font-style: normal; font-weight: normal; font-display: swap; src: url('century_supra_a_regular.woff2') format('woff2'); }
@font-face { font-family: century_supra_a; font-style: italic; font-weight: normal; font-display: swap; src: url('century_supra_a_italic.woff2') format('woff2'); }
@font-face { font-family: century_supra_a; font-style: normal; font-weight: bold; font-display: swap; src: url('century_supra_a_bold.woff2') format('woff2'); }
@font-face { font-family: century_supra_a; font-style: italic; font-weight: bold; font-display: swap; src: url('century_supra_a_bold_italic.woff2') format('woff2'); }

:root {
  --bg:              #303931;
  --bg-raised:       #1e2420;
  --text:            #E8E2D6;
  --text-bright:     #F5F1EA;
  --text-dim:        #A09A8A;
  --accent:          #D4C4A0;
  --accent-hover:    #EDE0C0;
  --rule:            #4A544B;
  --selection-bg:    #5A6B5A;
  --selection-text:  #F5F1EA;
  --font-heading:    century_supra_a, 'Century Schoolbook', Palatino, Georgia, serif;
  --font-body:       'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Helvetica, sans-serif;
  --font-mono:       'SF Mono', 'Cascadia Code', 'Fira Code', Consolas, Monaco, monospace;
  --content-width:   780px;
  --gutter:          1.25rem;
  --body-size:       1.2rem;
  --body-leading:    1.78;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  background: var(--bg); color: var(--text);
  font-family: var(--font-body); font-size: var(--body-size);
  line-height: var(--body-leading); padding: 0 var(--gutter);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
::selection { background: var(--selection-bg); color: var(--selection-text); }

/* Reading progress */
.reading-progress { position: fixed; top: 0; left: 0; width: 0%; height: 2px; background: var(--accent); z-index: 1000; transition: width 60ms linear; pointer-events: none; }

/* Layout */
.site-wrapper { max-width: var(--content-width); margin: 0 auto; padding-top: 2.5rem; padding-bottom: 4rem; min-height: 100dvh; display: flex; flex-direction: column; }

/* -------------------------------------------------------
   HEADER: Big name (Jeff Geerling style)
   ------------------------------------------------------- */
.site-header { margin-bottom: 0.75rem; }
.site-name { font-family: var(--font-heading); font-weight: 700; margin-bottom: 0.4rem; }
.site-name a {
  font-size: 2.2rem;
  color: var(--text-bright);
  text-decoration: none;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.site-name a:hover { color: var(--accent); }
.site-tagline { font-size: 1rem; font-style: italic; color: var(--text-dim); margin-top: 0.15rem; }
.site-nav-links { display: flex; gap: 1.25rem; list-style: none; }
.site-nav-links a { font-size: 1rem; color: var(--text-dim); text-decoration: none; transition: color 0.25s; }
.site-nav-links a:hover { color: var(--text-bright); }

/* -------------------------------------------------------
   HOME: Hero image
   ------------------------------------------------------- */
.hero-image {
  width: 100%;
  margin-bottom: 2.5rem;
  border-radius: 4px;
  overflow: hidden;
}
.hero-image img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

/* -------------------------------------------------------
   HOME: Article list
   ------------------------------------------------------- */
.article-list { list-style: none; display: flex; flex-direction: column; gap: 2.2rem; }
.article-list-item { padding-bottom: 2.2rem; border-bottom: 1px solid var(--rule); }
.article-list-item:last-child { border-bottom: none; padding-bottom: 0; }
.article-list-item a { text-decoration: none; display: block; }
.article-item-title { font-family: var(--font-heading); font-size: 1.55rem; font-weight: 400; color: var(--text-bright); line-height: 1.32; margin-bottom: 0.35rem; transition: color 0.25s; }
.article-list-item a:hover .article-item-title { color: var(--accent-hover); }
.article-item-date { font-size: 0.92rem; color: var(--text-dim); letter-spacing: 0.03em; margin-bottom: 0.5rem; }
.article-item-description { font-size: 1.05rem; color: var(--text); font-style: italic; line-height: 1.55; opacity: 0.8; }

/* -------------------------------------------------------
   POST: Back link (top of article pages)
   ------------------------------------------------------- */
.post-back {
  display: inline-block;
  font-size: 0.92rem;
  color: var(--text-dim);
  text-decoration: none;
  margin-bottom: 2.5rem;
  transition: color 0.25s;
}
.post-back::before { content: '\2190'; margin-right: 0.35em; }
.post-back:hover { color: var(--text-bright); }

/* -------------------------------------------------------
   POST: Header (title + subtitle only)
   ------------------------------------------------------- */
.post-header { margin-bottom: 2rem; }
.post-title {
  font-family: var(--font-heading);
  font-size: min(2.8rem, 9vw);
  font-weight: 700;
  color: var(--text-bright);
  line-height: 1.12;
  margin-bottom: 0.6rem;
  letter-spacing: -0.015em;
}
.post-subtitle {
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-style: italic;
  color: var(--text-dim);
  line-height: 1.5;
}

/* Post hero image (full-width before body) */
.post-hero { margin-bottom: 2.5rem; }
.post-hero img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
}
.post-hero figcaption {
  text-align: center;
  font-size: 0.88rem;
  color: var(--text-dim);
  margin-top: 0.5em;
  font-style: italic;
}

/* -------------------------------------------------------
   POST: Body
   ------------------------------------------------------- */
.post-body { flex: 1; }
.post-body p { margin-bottom: 1.4em; }
.post-body p:last-child { margin-bottom: 0; }
.post-body h2 { font-family: var(--font-heading); font-size: 1.65rem; font-weight: 700; color: var(--text-bright); margin-top: 2.8em; margin-bottom: 0.7em; line-height: 1.3; }
.post-body h3 { font-family: var(--font-heading); font-size: 1.3rem; font-weight: 700; color: var(--text-bright); margin-top: 2.2em; margin-bottom: 0.6em; line-height: 1.35; }
.post-body a { color: var(--accent); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color 0.25s, color 0.25s; }
.post-body a:hover { color: var(--accent-hover); border-bottom-color: var(--accent-hover); }
.post-body em { font-style: italic; }
.post-body strong { font-weight: 600; color: var(--text-bright); }
.post-body blockquote { margin: 1.8em 0; padding: 0 0 0 1.4em; border-left: 2px solid var(--rule); color: var(--text); font-style: italic; opacity: 0.88; }
.post-body blockquote p { margin-bottom: 0.8em; }
.post-body blockquote p:last-child { margin-bottom: 0; }
.post-body .divider { text-align: center; margin: 2.5em 0; color: var(--text-dim); font-size: 1.1rem; letter-spacing: 0.6em; user-select: none; }
.post-body hr { border: none; border-top: 1px solid var(--rule); margin: 2.5em 0; }
.post-body code { font-family: var(--font-mono); font-size: 0.84em; background: rgba(255,255,255,0.05); padding: 0.15em 0.4em; border-radius: 4px; color: #E06C75; border: 1px solid rgba(255,255,255,0.04); }

/* Code blocks */
.post-body pre {
  position: relative;
  background: #151718;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 2.6em 1.5em 1.4em;
  margin: 2em 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 4px 24px rgba(0,0,0,0.35), 0 1px 3px rgba(0,0,0,0.2);
}
.post-body pre::before {
  content: '';
  position: absolute;
  top: 0.9em;
  left: 1.2em;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #ff5f57;
  box-shadow: 14px 0 0 #febc2e, 28px 0 0 #28c840;
}
.post-body pre code { background: none; padding: 0; border-radius: 0; font-size: 0.88rem; line-height: 1.7; color: #ABB2BF; letter-spacing: 0.01em; font-family: var(--font-mono); }
.post-body pre code .kw   { color: #C678DD; }
.post-body pre code .fn   { color: #E5C07B; }
.post-body pre code .str  { color: #98C379; }
.post-body pre code .num  { color: #D19A66; }
.post-body pre code .cm   { color: #5C6370; font-style: italic; }
.post-body pre code .var  { color: #E06C75; }
.post-body pre code .prop { color: #61AFEF; }
.post-body pre code .type { color: #56B6C2; }
.post-body pre code .tag  { color: #61AFEF; }

.post-body ul, .post-body ol { margin: 1.2em 0; padding-left: 1.5em; }
.post-body li { margin-bottom: 0.4em; }
.post-body img { max-width: 100%; height: auto; display: block; margin: 2em auto; border-radius: 3px; }
.post-body figure { margin: 2.2em 0; }
.post-body figcaption { text-align: center; font-size: 0.88rem; color: var(--text-dim); margin-top: 0.6em; font-style: italic; }
.post-body .note { font-size: 0.95rem; color: var(--text-dim); line-height: 1.5; margin-top: 2em; }

/* -------------------------------------------------------
   DEMO: Box-shadow sponge
   ------------------------------------------------------- */
.demo-wrapper { margin: 2.5em 0; border-radius: 8px; overflow: hidden; border: 1px solid var(--rule); }
.demo-header { display: flex; align-items: center; justify-content: space-between; padding: 0.65em 1em; background: var(--bg-raised); border-bottom: 1px solid var(--rule); font-size: 0.85rem; color: var(--text-dim); }
.demo-header span { font-family: var(--font-mono); letter-spacing: 0.02em; }
.demo-label { font-family: var(--font-body); font-size: 0.85rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; }
.demo-canvas-wrapper { position: relative; width: 100%; height: 420px; background: #0d0f0d; cursor: pointer; touch-action: none; overflow: hidden; }
.demo-canvas-wrapper .render-dot { position: absolute; width: 1px; height: 1px; border-radius: 50%; top: 0; left: 0; pointer-events: none; }
.demo-hint { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); font-size: 0.82rem; color: rgba(255,255,255,0.25); font-family: var(--font-mono); letter-spacing: 0.06em; pointer-events: none; transition: opacity 0.5s ease; }
.demo-fps { position: absolute; top: 10px; right: 12px; font-size: 0.78rem; color: rgba(255,255,255,0.2); font-family: var(--font-mono); pointer-events: none; }

/* Particle demo controls */
.p-controls { display: flex; flex-direction: column; gap: 0.5rem; padding: 0.8rem 1rem; background: var(--bg-raised); border-top: 1px solid var(--rule); }
.p-slider-row { display: flex; align-items: center; gap: 0.8rem; }
.p-slider-row label { font-size: 0.85rem; color: var(--text-dim); min-width: 5.5em; font-family: var(--font-mono); }
.p-slider-row input[type="range"] { flex: 1; height: 6px; -webkit-appearance: none; appearance: none; background: #3a4a3d; border-radius: 3px; outline: none; cursor: pointer; }
.p-slider-row input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); cursor: pointer; border: none; }
.p-slider-row input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); cursor: pointer; border: none; }
.p-slider-val { font-size: 0.82rem; color: var(--text); font-family: var(--font-mono); min-width: 2.5em; text-align: right; }
.p-controls-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.3rem; }
.p-reset { font-size: 0.78rem; font-family: var(--font-mono); color: var(--text-dim); background: none; border: 1px solid var(--rule); border-radius: 3px; padding: 0.25em 0.65em; cursor: pointer; transition: color 0.2s, border-color 0.2s; letter-spacing: 0.03em; }
.p-reset:hover { color: var(--text-bright); border-color: var(--text-dim); }

/* -------------------------------------------------------
   DEMO: Globe
   ------------------------------------------------------- */
.globe-wrapper { margin: 2.5em 0; border-radius: 8px; overflow: hidden; border: 1px solid var(--rule); background: #0a0e0b; }
.globe-canvas-area { position: relative; width: 100%; aspect-ratio: 4/3; cursor: grab; touch-action: none; overflow: hidden; }
.globe-canvas-area:active { cursor: grabbing; }
.globe-canvas-area canvas { display: block; width: 100%; height: 100%; }
.globe-info { position: absolute; top: 12px; left: 14px; font-size: 0.82rem; color: rgba(255,255,255,0.45); font-family: var(--font-mono); pointer-events: none; line-height: 1.6; }
.globe-controls { display: flex; flex-direction: column; gap: 0.6rem; padding: 1rem 1.2rem; background: var(--bg-raised); border-top: 1px solid var(--rule); }
.globe-slider-row { display: flex; align-items: center; gap: 1rem; }
.globe-slider-row label { font-size: 0.88rem; color: var(--text-dim); min-width: 3.8em; font-family: var(--font-mono); }
.globe-slider-row input[type="range"] { flex: 1; height: 6px; -webkit-appearance: none; appearance: none; background: #3a4a3d; border-radius: 3px; outline: none; cursor: pointer; }
.globe-slider-row input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); cursor: pointer; border: none; }
.globe-slider-row input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--accent); cursor: pointer; border: none; }
.globe-date-display { font-size: 0.92rem; color: var(--text); font-family: var(--font-mono); min-width: 7em; text-align: right; }
.globe-legend { display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0 0; }
.globe-legend-bar { flex: 1; height: 10px; border-radius: 3px; }
.globe-legend-labels { display: flex; justify-content: space-between; flex: 1; font-size: 0.78rem; color: var(--text-dim); font-family: var(--font-mono); }
.globe-legend-title { font-size: 0.82rem; color: var(--text-dim); min-width: 3.8em; }

/* Site footer */
.site-footer { margin-top: auto; padding-top: 3.5rem; }
.site-footer-inner { border-top: 1px solid var(--rule); padding-top: 1.5rem; padding-bottom: 1rem; display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 0.4rem 1.5rem; font-size: 0.88rem; color: var(--text-dim); }
.site-footer a { color: var(--text-dim); text-decoration: none; transition: color 0.25s; }
.site-footer a:hover { color: var(--text-bright); }
.footer-links { display: flex; gap: 1rem; }

/* Fade-in */
.fade-in { opacity: 0; transform: translateY(10px); animation: fadeUp 0.5s ease forwards; }
@keyframes fadeUp { to { opacity: 1; transform: translateY(0); } }
.article-list-item:nth-child(1) { animation-delay: 0.04s; }
.article-list-item:nth-child(2) { animation-delay: 0.09s; }
.article-list-item:nth-child(3) { animation-delay: 0.14s; }

/* Desktop */
@media (min-width: 720px) {
  :root { --gutter: 2rem; --body-size: 1.25rem; }
  .site-wrapper { padding-top: 4rem; padding-bottom: 5rem; }
  .site-name a { font-size: 2.6rem; }
  .post-title { font-size: min(3.2rem, 7vw); }
  .post-body h2 { font-size: 1.75rem; }
  .demo-canvas-wrapper { height: 500px; }
}

@media (min-width: 1024px) {
  :root { --gutter: 2.5rem; --body-size: 1.28rem; }
  .site-wrapper { padding-top: 5rem; }
  .site-name a { font-size: 2.8rem; }
}

@media print {
  body { background: #fff; color: #222; }
  .reading-progress, .site-nav-links, .site-footer, .demo-wrapper, .globe-wrapper { display: none; }
  .post-body a { color: #222; text-decoration: underline; border-bottom: none; }
}
