/* Rheveal Build Log — self-contained brand stylesheet.
   Paper (light) is the default ground; dark is the darkroom. Values mirror the
   roles in src/styles/tokens.css but live here because the blog is a separate
   surface (like email), not part of the app bundle. */

/* ---- self-hosted fonts (copied into /fonts by the build) ---- */
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 400 900; /* variable: covers 400/500/600/700 + Black 900 */
  font-display: swap;
  src: url("/fonts/archivo-latin-wght-normal.woff2") format("woff2-variations");
}
@font-face {
  font-family: "Archivo";
  font-style: italic;
  font-weight: 400 900;
  font-display: swap;
  src: url("/fonts/archivo-latin-wght-italic.woff2") format("woff2-variations");
}
@font-face {
  font-family: "Space Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/space-mono-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Space Mono";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/space-mono-latin-700-normal.woff2") format("woff2");
}

/* ---- theme tokens ---- */
:root,
:root[data-theme="light"] {
  --bg: #f6ecd8;
  --panel: #efe2c8;
  --text: #241b10;
  --body: #33291a;
  --muted: #7a6e58;
  --hair: #d8cbb0;
  --gold: #f4b400;
  --gold-ink: #a07500; /* readable gold for text/links on cream */
  --red: #d9352b;
  --glow: transparent;
  --shadow: 0 2px 14px rgba(21, 15, 8, 0.14);
  --img-edge: rgba(21, 15, 8, 0.12); /* subtle ink hairline on cream */
}
:root[data-theme="dark"] {
  --bg: #150f08;
  --panel: #241b10;
  --text: #f6ecd8;
  --body: #e8dcc3;
  --muted: #b7a583;
  --hair: #3a2e1a;
  --gold: #f4b400;
  --gold-ink: #f4b400;
  --red: #d9352b;
  --glow: rgba(244, 180, 0, 0.1);
  --shadow: 0 2px 16px rgba(0, 0, 0, 0.4);
  --img-edge: rgba(246, 236, 216, 0.22); /* soft cream stroke lifts dark shots off ink */
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #150f08;
    --panel: #241b10;
    --text: #f6ecd8;
    --body: #e8dcc3;
    --muted: #b7a583;
    --hair: #3a2e1a;
    --gold: #f4b400;
    --gold-ink: #f4b400;
    --red: #d9352b;
    --glow: rgba(244, 180, 0, 0.1);
    --shadow: 0 2px 16px rgba(0, 0, 0, 0.4);
    --img-edge: rgba(246, 236, 216, 0.22);
  }
}

/* ---- reset & base ---- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Archivo", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  position: relative;
  min-height: 100vh;
  transition:
    background 0.25s ease,
    color 0.25s ease;
}
body::before {
  content: "";
  position: fixed;
  top: -140px;
  right: -140px;
  width: 480px;
  height: 480px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow) 0%, transparent 65%);
  pointer-events: none;
  z-index: 0;
}
.wrap {
  position: relative;
  z-index: 1;
  max-width: 680px;
  margin: 0 auto;
  padding: 0 32px 96px;
}
a {
  color: var(--gold-ink);
}

/* ---- theme widget ---- */
.theme-fab {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  min-width: 40px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--hair);
  background: var(--panel);
  color: var(--gold-ink);
  cursor: pointer;
  font-family: "Space Mono", "Courier New", monospace;
  font-size: 11px;
  box-shadow: var(--shadow);
  transition:
    background 0.25s ease,
    border-color 0.25s ease;
}
.theme-fab svg {
  width: 17px;
  height: 17px;
}
.theme-fab .lab {
  letter-spacing: 0.06em;
  color: var(--muted);
}
.theme-fab:hover {
  border-color: var(--gold);
}
.theme-fab:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ---- masthead (sticky global header) ---- */
.masthead {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg);
  padding: 18px 0 16px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--hair);
  transition: background 0.25s ease;
}

/* ---- per-post sticky sub-bar (permalink only) ---- */
.post-bar {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  z-index: 39;
  background: var(--bg);
  border-bottom: 1px solid var(--hair);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}
.post-bar.show {
  opacity: 1;
  transform: none;
}
.post-bar-inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 9px 32px;
  display: flex;
  align-items: baseline;
  justify-content: space-between; /* title left, date right */
  gap: 16px;
}
.pb-stamp {
  font-family: "Space Mono", "Courier New", monospace;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--red);
  white-space: nowrap;
  flex-shrink: 0; /* date keeps its width; title truncates instead */
}
.pb-title {
  flex: 1;
  min-width: 0; /* allow ellipsis inside the flex row */
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- lightbox ---- */
figure img {
  cursor: zoom-in;
}
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 7, 4, 0.93);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  cursor: zoom-out;
}
.lightbox.open {
  display: flex;
}
.lightbox img {
  max-width: 96vw;
  max-height: 92vh;
  width: auto;
  height: auto;
  border-radius: 6px;
  border: 1px solid rgba(246, 236, 216, 0.22);
  box-shadow: 0 8px 44px rgba(0, 0, 0, 0.55);
  cursor: default;
}
.lightbox-close {
  position: fixed;
  top: 16px;
  right: 20px;
  font-family: "Space Mono", "Courier New", monospace;
  font-size: 12px;
  letter-spacing: 0.1em;
  color: #f6ecd8;
}
.mast-left {
  display: flex;
  align-items: baseline;
  gap: 14px;
}
.mast-brand {
  font-family: "Archivo", Helvetica, Arial, sans-serif;
  font-weight: 900;
  font-size: 17px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text);
  text-decoration: none;
}
.mast-log {
  font-family: "Space Mono", "Courier New", monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--gold-ink);
}
.mast-link {
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
  white-space: nowrap;
}
.mast-link:hover {
  color: var(--gold-ink);
}
.tagline {
  color: var(--muted);
  font-size: 14px;
  padding: 18px 0;
  border-bottom: 1px solid var(--hair);
}

/* ---- highlights strip ---- */
.highlights {
  display: flex;
  gap: 8px;
  padding: 18px 0 10px;
  flex-wrap: wrap;
}
.hl {
  font-family: "Space Mono", "Courier New", monospace;
  font-size: 11px;
  letter-spacing: 0.03em;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  border: 1px solid var(--hair);
  white-space: nowrap;
  text-decoration: none;
}
.hl:hover {
  border-color: var(--gold);
}
.hl.on {
  color: var(--gold-ink);
  border-color: color-mix(in srgb, var(--gold) 45%, var(--hair));
}

/* ---- entry ---- */
.entry {
  padding: 48px 0 56px;
  scroll-margin-top: 68px; /* clear the sticky header on anchor jumps */
}
.entry + .entry {
  border-top: 1px solid var(--hair);
}
.stamp {
  font-family: "Space Mono", "Courier New", monospace;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--red);
  text-shadow: 0 0 12px rgba(217, 53, 43, 0.3);
  margin-bottom: 14px;
}
.stamp .star {
  color: var(--gold);
  text-shadow: none;
}
.e-title {
  font-family: "Archivo", Helvetica, Arial, sans-serif;
  font-weight: 900;
  font-size: 34px;
  line-height: 1.02;
  text-transform: uppercase;
  margin-bottom: 12px;
  color: var(--text);
}
.e-title a {
  color: inherit;
  text-decoration: none;
}
.e-title a:hover {
  color: var(--gold-ink);
}
.dek {
  font-size: 18px;
  line-height: 1.45;
  font-style: italic;
  color: var(--muted);
  margin-bottom: 26px;
}
figure {
  margin: 0 0 28px;
}
figure.hero {
  margin-bottom: 8px;
}
figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  /* Theme-aware hairline so dark screenshots don't melt into the dark ground. */
  border: 1px solid var(--img-edge);
}
figure.portrait img {
  max-width: 340px;
  margin: 0 auto;
}
figcaption {
  font-family: "Space Mono", "Courier New", monospace;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
  margin-top: 8px;
}
figure.hero + figcaption {
  margin-bottom: 28px;
}
.lede {
  font-size: 17px;
  line-height: 1.62;
  color: var(--text);
  margin-bottom: 22px;
}
.goal {
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
  margin-bottom: 22px;
}
.goal b {
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-right: 8px;
  color: var(--gold-ink);
}
.entry p {
  margin-bottom: 18px;
  color: var(--body);
}
.entry .subheading {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  margin: 26px 0 14px;
}
.body-ul {
  list-style: none;
  margin-bottom: 26px;
}
.body-ul li {
  font-size: 15.5px;
  line-height: 1.6;
  padding-left: 18px;
  position: relative;
  margin-bottom: 12px;
  color: var(--body);
}
.body-ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 6px;
  height: 6px;
  border-radius: 1px;
  background: var(--gold);
}
.moment {
  border-left: 3px solid var(--gold);
  background: var(--panel);
  padding: 16px 20px;
  border-radius: 0 6px 6px 0;
  margin: 8px 0;
}
.moment .m-label {
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-ink);
  display: block;
  margin-bottom: 8px;
}
.moment p {
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--text);
  margin: 0;
}
.readmore {
  display: inline-block;
  margin-top: 4px;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--gold-ink);
}
.permalink {
  display: inline-block;
  margin-top: 20px;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--gold-ink);
}
.permalink:hover,
.readmore:hover {
  color: var(--gold);
}

/* ---- footer ---- */
.footer {
  border-top: 1px solid var(--hair);
  padding: 24px 0;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-family: "Space Mono", "Courier New", monospace;
  font-size: 11px;
  color: var(--muted);
}
.footer a {
  color: var(--gold-ink);
  text-decoration: none;
}

/* ---- permalink page back-link ---- */
.backlink {
  display: inline-block;
  padding: 24px 0 0;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
}
.backlink:hover {
  color: var(--gold-ink);
}

@media (prefers-reduced-motion: reduce) {
  body,
  .theme-fab,
  .masthead,
  .post-bar {
    transition: none;
  }
}

@media (max-width: 520px) {
  .wrap {
    padding: 0 20px 72px;
  }
  .e-title {
    font-size: 28px;
  }
  /* Compact the sticky post bar so it leaves reading room on small screens. */
  .post-bar-inner {
    padding: 7px 20px;
    gap: 8px;
  }
  .pb-stamp {
    font-size: 11px;
  }
  .pb-title {
    font-size: 12px;
  }
  .masthead {
    padding: 14px 0 12px;
  }
}
