/* ============================================================
   BENCH NOTES — stylesheet
   Palette: deep PCB substrate + amber phosphor + copper trace
   ============================================================ */

:root {
  --bg: #0f1b1e;
  --bg-alt: #142426;
  --bg-raised: #182b2d;
  --accent: #e8a33d;
  --accent-soft: #c97f2a;
  --trace: #5fa88f;
  --trace-dim: #3a5f57;
  --text: #ededE3;
  --text-dim: #9aa6a0;
  --border: #2a3f3f;

  --font-display: "Space Grotesk", "Archivo", sans-serif;
  --font-mono: "IBM Plex Mono", "JetBrains Mono", monospace;
}

* { box-sizing: border-box; }

img { max-width: 100%; height: auto; }

html { scroll-behavior: smooth; overflow-x: hidden; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 16px;
  line-height: 1.6;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 48px 48px;
  background-position: -1px -1px;
  background-attachment: fixed;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.wrap {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- News ticker ---------- */
.news-ticker {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  padding: 7px 0;
  overflow: hidden;
}
.news-ticker__track {
  display: flex;
  width: max-content;
}
.news-ticker__set {
  display: flex;
  align-items: center;
  white-space: nowrap;
  flex-shrink: 0;
}
.news-ticker__set a {
  color: var(--text-dim);
}
.news-ticker__set a:hover {
  color: var(--accent);
  text-decoration: underline;
}
.news-ticker__sep {
  color: var(--trace-dim);
  margin: 0 14px;
}

/* ---------- Top status bar ---------- */
.statusbar {
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}
.statusbar .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  padding-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}
.statusbar .dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--trace);
  margin-right: 6px;
  box-shadow: 0 0 6px var(--trace);
}

/* ---------- Hero: boot sequence ---------- */
.hero {
  padding: 72px 0 56px;
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.boot-log {
  font-size: 13px;
  color: var(--trace);
  margin: 0 0 28px;
  white-space: pre-wrap;
}
.boot-log .ok { color: var(--trace); }
.boot-log .line { display: block; opacity: 0; animation: appear 0.4s forwards; }
.boot-log .line:nth-child(1) { animation-delay: 0.1s; }
.boot-log .line:nth-child(2) { animation-delay: 0.35s; }
.boot-log .line:nth-child(3) { animation-delay: 0.6s; }
.boot-log .line:nth-child(4) { animation-delay: 0.85s; }
.boot-log .line:nth-child(5) { animation-delay: 1.1s; }

@keyframes appear {
  from { opacity: 0; transform: translateY(2px); }
  to { opacity: 1; transform: translateY(0); }
}

.site-title {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 7vw, 4.4rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--text);
  opacity: 0;
  animation: appear 0.5s forwards;
  animation-delay: 1.3s;
}
.site-title .amber { color: var(--accent); }

.site-tagline {
  font-family: var(--font-mono);
  color: var(--text-dim);
  font-size: 14px;
  margin: 14px 0 0;
  max-width: 46ch;
  opacity: 0;
  animation: appear 0.5s forwards;
  animation-delay: 1.55s;
}

.cursor {
  display: inline-block;
  width: 9px;
  height: 1.1em;
  background: var(--accent);
  vertical-align: text-bottom;
  animation: blink 1s steps(1) infinite;
  margin-left: 2px;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Nav ---------- */
nav.primary {
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}
nav.primary .wrap {
  display: flex;
  gap: 28px;
  padding: 14px 24px;
}
nav.primary a {
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}
nav.primary a:hover,
nav.primary a[aria-current="page"] {
  color: var(--accent);
}
.nav-admin-link { margin-left: auto; }

/* ---------- Post log ---------- */
.log-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 40px 0 8px;
  border-bottom: 1px dashed var(--border);
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.entry {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 20px;
  padding: 28px 0;
  border-bottom: 1px solid var(--border);
}

.entry:hover { background: linear-gradient(90deg, var(--bg-alt), transparent); }

.entry .pid {
  font-size: 12px;
  color: var(--trace);
  padding-top: 4px;
}
.entry .pid::before { content: "PID "; color: var(--trace-dim); }

.entry h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  margin: 0 0 6px;
  font-weight: 600;
}
.entry h2 a { color: var(--text); }
.entry h2 a:hover { color: var(--accent); text-decoration: none; }

.meta {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 10px;
}
.meta .tag {
  display: inline-block;
  border: 1px solid var(--trace-dim);
  color: var(--trace);
  padding: 1px 7px;
  border-radius: 3px;
  font-size: 11px;
  margin-right: 6px;
}

.entry p.excerpt {
  color: var(--text-dim);
  margin: 0 0 10px;
  max-width: 62ch;
}

.readmore {
  font-size: 12px;
  letter-spacing: 0.04em;
}
.readmore::after { content: " →"; }

/* ---------- About block ---------- */
.about {
  padding: 40px 0 8px;
  border-top: 1px dashed var(--border);
  margin-top: 12px;
}
.about h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--accent);
  margin: 0 0 10px;
}
.about p { color: var(--text-dim); max-width: 62ch; }

/* ---------- Footer / status bar ---------- */
footer.statusbar {
  margin-top: 48px;
  border-top: 1px solid var(--border);
  border-bottom: none;
}
footer .wrap { font-size: 11px; }

/* ---------- Single post page ---------- */
.post-header {
  padding: 56px 0 24px;
  border-bottom: 1px solid var(--border);
}
.post-header .meta { margin-bottom: 18px; }
.post-header h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 2.8rem);
  line-height: 1.15;
  margin: 0;
}

.post-body {
  padding: 36px 0 60px;
}
.post-body p { margin: 0 0 20px; color: var(--text); }
.post-body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 8px 0 28px;
  border: 1px solid var(--border);
}
.post-body h2 {
  font-family: var(--font-display);
  color: var(--accent);
  font-size: 1.4rem;
  margin: 36px 0 14px;
}
.post-body code {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.9em;
  color: var(--trace);
}
.post-body pre {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: 16px 18px;
  overflow-x: auto;
  border-radius: 3px;
  margin: 0 0 24px;
}
.post-body pre code { background: none; border: none; padding: 0; color: var(--text); }
.post-body blockquote {
  border-left: 3px solid var(--trace);
  margin: 0 0 24px;
  padding: 4px 0 4px 18px;
  color: var(--text-dim);
  font-style: italic;
}

.video-embed {
  width: 100vw;
  max-width: 1040px;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  margin: 8px 0 32px;
}
.video-embed--frame {
  aspect-ratio: 16 / 9;
  border: 1px solid var(--border);
  background: #000;
  overflow: hidden;
}
.video-embed--frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.yt-fallback {
  display: none;
  position: absolute;
  inset: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background-size: cover;
  background-position: center;
  text-decoration: none;
}
.yt-fallback::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(15, 27, 30, 0.55);
}
.yt-fallback-play,
.yt-fallback-label {
  position: relative;
  z-index: 1;
}
.yt-fallback-play {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  padding-left: 4px;
}
.yt-fallback-label {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
}
.yt-video.yt-blocked iframe { display: none; }
.yt-video.yt-blocked .yt-fallback { display: flex; }
.video-embed--native video {
  display: block;
  width: 100%;
  border: 1px solid var(--border);
  background: #000;
}

.weather-map {
  width: 100vw;
  max-width: 820px;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  margin: 8px 0 4px;
  border: 1px solid var(--border);
  background: #000;
  text-align: center;
}
.weather-map img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
}

.back-link { font-size: 13px; }

/* ---------- Responsive ---------- */
@media (max-width: 560px) {
  .entry { grid-template-columns: 1fr; }
  .entry .pid { padding-top: 0; }
  nav.primary .wrap { gap: 10px 18px; padding: 12px 20px; flex-wrap: wrap; }
  .nav-admin-link { margin-left: 0; }
  .hero { padding: 52px 0 40px; }
}

/* Full-bleed breakout (video embeds, weather map) relies on 100vw math
   that's unreliable on mobile browsers — disable it below 700px and let
   these elements sit safely inside the normal content column instead. */
@media (max-width: 700px) {
  .video-embed,
  .weather-map {
    width: 100%;
    max-width: 100%;
    position: relative;
    left: auto;
    transform: none;
  }
}

/* ---------- Admin forms ---------- */
input[type="text"], input[type="password"], input[type="date"], textarea {
  border-radius: 3px;
}
input:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
button { border-radius: 3px; }
