/* nickberg.org
   Layout: a warm paper page with one reading column, a stenciled title, duct-tape photo frames,
   copper-wire dividers, and small LED details. Mobile first. */

:root {
  --paper: #f4eee0;
  --paper-2: #ebe3d0;
  --paper-3: #e1d7bf;
  --ink: #2a2620;
  --ink-2: #5f5749;
  --ink-3: #8c8372;
  --rule: #cfc4aa;
  --link: #2f4b7c;
  --link-hover: #1c3360;
  --tower: #c8461f;
  --copper: #b2652f;
  --tape: rgba(140, 136, 128, 0.42);
  --panel: #1f1d1a;
  --panel-2: #2a2724;
  --led: #ff3b30;
  --led-dim: #5a1e1a;
  --led-glow: rgba(255, 59, 48, 0.55);
  --amber: #ffb02e;

  --display: "Big Shoulders Stencil", "Arial Narrow", Impact, sans-serif;
  --body: "Source Serif 4", Georgia, "Times New Roman", serif;
  --mono: "IBM Plex Mono", "Courier New", monospace;

  --measure: 66ch;
  --gutter: max(18px, 4vw);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  background-image:
    radial-gradient(circle at 20% 0%, rgba(255,255,255,0.55), transparent 55%),
    radial-gradient(circle at 100% 100%, rgba(178,101,47,0.08), transparent 45%);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.6;
  min-height: 100vh;
}

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

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

h1, h2, h3 { font-family: var(--display); font-weight: 800; line-height: 1; letter-spacing: 0.01em; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(2.6rem, 8vw, 5rem); }
h2 { font-size: clamp(1.8rem, 4.5vw, 2.6rem); margin-top: 2.5rem; }
h3 { font-size: clamp(1.35rem, 3vw, 1.7rem); margin-top: 1.8rem; }
p { margin: 0 0 1rem; max-width: var(--measure); }
ul, ol { max-width: var(--measure); }
.lede { font-size: 1.25rem; line-height: 1.5; color: var(--ink-2); }
.small { font-size: 0.9rem; color: var(--ink-2); }
.mono { font-family: var(--mono); }
.label { font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }

.wrap { width: min(100% - 2 * var(--gutter), 72rem); margin-inline: auto; }
.prose { width: min(100% - 2 * var(--gutter), 48rem); margin-inline: auto; }
.prose > * + h2 { margin-top: 2.5rem; }

/* skip link */
.skip { position: absolute; left: -999px; top: 0; background: var(--panel); color: #fff; padding: 0.5rem 1rem; z-index: 100; }
.skip:focus { left: 1rem; top: 1rem; }

/* ---------- header ---------- */
.site-header {
  border-bottom: 3px solid var(--ink);
  background: var(--paper);
  position: relative;
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4.25rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; color: var(--ink); font-family: var(--display); font-weight: 800; font-size: 1.5rem; letter-spacing: 0.02em; }
.brand:hover { color: var(--tower); }
.led { width: 11px; height: 11px; border-radius: 50%; background: var(--led); box-shadow: 0 0 8px var(--led-glow), inset 0 -2px 3px rgba(0,0,0,0.35); flex: none; }
.led.blink { animation: blink 2.4s steps(1) infinite; }
@keyframes blink { 0%, 86% { opacity: 1; } 87%, 92% { opacity: 0.2; box-shadow: none; } 93%, 100% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .led.blink { animation: none; } }

.nav-toggle { display: none; background: none; border: 2px solid var(--ink); color: var(--ink); font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase; padding: 0.45rem 0.8rem; cursor: pointer; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 0.1rem; flex-wrap: wrap; }
.site-nav a { display: block; padding: 0.55rem 0.7rem; font-family: var(--mono); font-size: 0.82rem; letter-spacing: 0.06em; text-transform: uppercase; text-decoration: none; color: var(--ink-2); border-bottom: 3px solid transparent; }
.site-nav a:hover { color: var(--ink); border-bottom-color: var(--copper); }
.site-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--tower); }
.site-nav a.donate { color: var(--tower); font-weight: 500; }
.site-nav a.donate:hover { border-bottom-color: var(--tower); }

@media (max-width: 860px) {
  .nav-toggle { display: inline-block; }
  .site-nav { flex-basis: 100%; }
  .site-nav[hidden] { display: none; }
  .site-nav ul { flex-direction: column; padding-bottom: 0.5rem; }
  .site-nav a { padding: 0.7rem 0.25rem; border-bottom: 1px solid var(--rule); font-size: 0.95rem; }
  .site-nav a[aria-current="page"] { border-bottom: 1px solid var(--rule); border-left: 4px solid var(--tower); padding-left: 0.75rem; }
}

/* ---------- wire divider ---------- */
.wire { display: block; width: 100%; height: 22px; margin: 2rem 0; color: var(--copper); }
.wire svg { width: 100%; height: 100%; }

/* ---------- duct tape frame ---------- */
.taped { position: relative; display: inline-block; max-width: 100%; background: #fff; padding: 8px; box-shadow: 0 2px 6px rgba(0,0,0,0.18), 0 10px 24px rgba(40,30,10,0.12); transform: rotate(-1.2deg); }
.taped img { display: block; }
.taped::before, .taped::after {
  content: ""; position: absolute; width: 92px; height: 26px; background: var(--tape);
  background-image: repeating-linear-gradient(90deg, rgba(255,255,255,0.18) 0 2px, transparent 2px 5px);
  box-shadow: 0 1px 1px rgba(0,0,0,0.12); opacity: 0.95;
}
.taped::before { top: -12px; left: -28px; transform: rotate(-38deg); }
.taped::after { bottom: -12px; right: -28px; transform: rotate(-38deg); }
.taped.straight { transform: rotate(0.8deg); }
.taped.straight::before { left: auto; right: -30px; transform: rotate(36deg); }
.taped.straight::after { right: auto; left: -30px; transform: rotate(36deg); }
figure { margin: 0; }
figcaption { font-family: var(--mono); font-size: 0.75rem; color: var(--ink-3); margin-top: 1rem; letter-spacing: 0.04em; }

/* ---------- hero ---------- */
.hero { padding-block: clamp(2rem, 6vw, 4.5rem) clamp(1.5rem, 4vw, 3rem); }
.hero .wrap { display: grid; grid-template-columns: 1.15fr 1fr; gap: clamp(1.5rem, 5vw, 4rem); align-items: center; }
.hero .label { margin-bottom: 0.75rem; }
.hero h1 { margin-bottom: 1rem; }
.hero h1 span { display: block; color: var(--tower); }
.hero .lede { margin-bottom: 1.5rem; }
.hero-photo { justify-self: center; }
.cta-row { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; }
@media (max-width: 760px) { .hero .wrap { grid-template-columns: 1fr; } .hero-photo { order: -1; justify-self: start; } }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.7rem 1.1rem; border: 2px solid var(--ink); background: var(--ink); color: var(--paper); font-family: var(--mono); font-size: 0.85rem; letter-spacing: 0.1em; text-transform: uppercase; text-decoration: none; cursor: pointer; transition: transform 0.08s ease, background 0.15s ease; }
.btn:hover { background: var(--tower); border-color: var(--tower); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.tower { background: var(--tower); border-color: var(--tower); color: #fff; }
.btn.tower:hover { background: #a93814; border-color: #a93814; }

/* ---------- sections ---------- */
.section { padding-block: clamp(1.5rem, 4vw, 3rem); }
.section-head { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.section-head h2 { margin-top: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); gap: clamp(1.25rem, 4vw, 3rem); align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: 1.25rem; }
.card { border: 2px solid var(--ink); padding: 1.25rem 1.35rem; background: var(--paper); min-width: 0; }
.card h3 { margin-top: 0; }
.card p:last-child { margin-bottom: 0; }
.card .label { display: block; margin-bottom: 0.5rem; }

/* panel: dark hardware surface */
.panel { background: var(--panel); color: #efe9da; padding: 1.25rem 1.35rem; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06), 0 6px 20px rgba(0,0,0,0.25); min-width: 0; }
.panel .label { color: #a39b89; }
.panel a { color: #ffd08a; }
.panel h3 { margin-top: 0; color: #fff; }

/* ---------- recipients ---------- */
.recipients { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 2.5rem; font-variant-numeric: tabular-nums; }
.recipients li { break-inside: avoid; display: flex; gap: 0.85rem; padding: 0.35rem 0; border-bottom: 1px solid var(--rule); }
.recipients .yr { font-family: var(--mono); color: var(--copper); font-size: 0.9rem; flex: none; width: 3.2rem; padding-top: 0.15rem; }
@media (max-width: 560px) { .recipients { columns: 1; } }
.latest { border-left: 5px solid var(--tower); padding: 0.85rem 1.1rem; background: var(--paper-2); max-width: var(--measure); }
.latest .label { display: block; margin-bottom: 0.25rem; }
.latest strong { font-size: 1.3rem; font-family: var(--display); font-weight: 800; letter-spacing: 0.02em; }

/* ---------- story / long reading ---------- */
.story-head { padding-block: clamp(2rem, 6vw, 4rem) 1rem; }
.story-head .motto { font-family: var(--display); font-size: clamp(2rem, 7vw, 4.4rem); font-weight: 800; line-height: 0.95; color: var(--ink); }
.story-head .motto em { font-style: normal; color: var(--tower); }
.anecdote { padding: 1.4rem 0; border-bottom: 1px dashed var(--rule); max-width: var(--measure); }
.anecdote p { margin-bottom: 0.7rem; }
.anecdote cite { display: block; font-style: normal; font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--copper); margin-top: 0.4rem; }
.anecdote cite::before { content: "— "; }
.tribute { margin-top: 3rem; }
.tribute .label { display: block; margin-bottom: 0.5rem; }

/* email letters */
.letter { background: #fffdf7; border: 1px solid var(--rule); box-shadow: 0 3px 10px rgba(40,30,10,0.08); padding: clamp(1.25rem, 4vw, 2.5rem); margin-block: 1.5rem; max-width: 50rem; }
.letter .hdr { font-family: var(--mono); font-size: 0.8rem; color: var(--ink-2); border-bottom: 1px dashed var(--rule); padding-bottom: 0.75rem; margin-bottom: 1.25rem; white-space: pre-wrap; }
.letter p { max-width: none; }
.letter-list { list-style: none; padding: 0; margin: 1.5rem 0; display: grid; gap: 0.75rem; max-width: 50rem; }
.letter-list a { display: grid; grid-template-columns: 7rem 1fr; gap: 1rem; padding: 0.9rem 1rem; border: 2px solid var(--ink); text-decoration: none; color: var(--ink); background: var(--paper); align-items: baseline; }
.letter-list a:hover { background: var(--paper-2); }
.letter-list .d { font-family: var(--mono); font-size: 0.8rem; color: var(--copper); }
.letter-list .t { font-family: var(--display); font-weight: 800; font-size: 1.35rem; }
@media (max-width: 480px) { .letter-list a { grid-template-columns: 1fr; gap: 0.2rem; } }
.pager { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 2rem; }

/* ---------- LED hardware bits ---------- */
.leds { display: inline-flex; gap: 10px; padding: 10px 14px; background: var(--panel-2); border-radius: 6px; box-shadow: inset 0 2px 6px rgba(0,0,0,0.6); }
.leds i { width: 16px; height: 16px; border-radius: 50%; background: var(--led-dim); box-shadow: inset 0 -2px 3px rgba(0,0,0,0.5); transition: background 0.08s, box-shadow 0.08s; }
.leds i.on { background: var(--led); box-shadow: 0 0 10px var(--led-glow), 0 0 2px #fff inset; }
.readout { font-family: var(--mono); font-size: 1.1rem; letter-spacing: 0.08em; color: var(--amber); background: #0d0c0b; padding: 0.5rem 0.9rem; border-radius: 4px; box-shadow: inset 0 2px 6px rgba(0,0,0,0.8); min-width: 10ch; text-align: center; font-variant-numeric: tabular-nums; }

.toy { display: grid; gap: 1rem; }
.toy .row { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.toy p { max-width: 52ch; }
.terminal { display: inline-flex; align-items: center; gap: 0.6rem; padding: 0.75rem 1.1rem; border-radius: 999px; border: 2px solid var(--copper); background: linear-gradient(#3a332c, #221e1a); color: #ffd08a; font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase; cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.terminal:hover { border-color: var(--amber); }
.terminal:active, .terminal.held { background: linear-gradient(#221e1a, #3a332c); transform: translateY(1px); }
.terminal .wire-end { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffd79a, var(--copper) 60%, #6a3b16); box-shadow: 0 0 0 2px #1a1714; }
.verdict { font-family: var(--display); font-size: clamp(1.4rem, 4vw, 2rem); font-weight: 800; color: #fff; min-height: 1.2em; }

/* Game of life */
.life { width: 100%; max-width: 420px; aspect-ratio: 1; background: #0d0c0b; border-radius: 6px; box-shadow: inset 0 2px 8px rgba(0,0,0,0.8); display: block; touch-action: none; cursor: crosshair; }
.life-ctrls { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.75rem; }
.btn.sm { padding: 0.45rem 0.8rem; font-size: 0.75rem; }
.btn.panelbtn { background: transparent; color: #efe9da; border-color: #6f6657; }
.btn.panelbtn:hover { background: #efe9da; color: var(--panel); border-color: #efe9da; }

/* binary counter */
.binary { display: grid; gap: 0.75rem; }
.binary .bits { display: flex; gap: 12px; flex-wrap: wrap; }
.binary .bit { display: grid; justify-items: center; gap: 4px; font-family: var(--mono); font-size: 0.7rem; color: #a39b89; }
.binary .bit button { width: 40px; height: 40px; border-radius: 50%; border: 2px solid #4a443c; background: var(--led-dim); cursor: pointer; box-shadow: inset 0 -3px 4px rgba(0,0,0,0.5); transition: background 0.1s, box-shadow 0.1s; }
.binary .bit button[aria-pressed="true"] { background: var(--led); box-shadow: 0 0 12px var(--led-glow); border-color: #ff8a80; }

/* ---------- donate ---------- */
.donate-box { border: 3px solid var(--tower); padding: 1.5rem; background: var(--paper); display: grid; gap: 1rem; max-width: 40rem; }
.donate-box h2 { margin-top: 0; }
address { font-style: normal; font-family: var(--mono); font-size: 0.95rem; line-height: 1.7; }

/* ---------- footer ---------- */
.site-footer { margin-top: clamp(3rem, 8vw, 6rem); border-top: 3px solid var(--ink); background: var(--paper-2); padding-block: 2.25rem 2.5rem; font-size: 0.95rem; color: var(--ink-2); }
.site-footer .wrap { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 1.75rem; }
.site-footer h4 { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 0.5rem; }
.site-footer p { margin-bottom: 0.4rem; }
.site-footer .motto { font-family: var(--display); font-weight: 800; font-size: 1.6rem; color: var(--ink); letter-spacing: 0.02em; }
.site-footer .fine { grid-column: 1 / -1; border-top: 1px solid var(--rule); padding-top: 1rem; font-size: 0.82rem; color: var(--ink-3); }
.site-footer .fine a { color: inherit; }

/* utilities */
.mt-0 { margin-top: 0; } .mb-2 { margin-bottom: 2rem; } .mt-2 { margin-top: 2rem; }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* tax info disclosure */
details.ein { font-size: 0.9rem; max-width: var(--measure); margin-top: 0.5rem; }
details.ein summary { cursor: pointer; font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
details.ein summary:hover { color: var(--ink); }
details.ein p { margin: 0.5rem 0 0; }

/* glitch flash for the truth detector */
.glitch-flash { position: fixed; inset: 0; pointer-events: none; z-index: 999; background: #fff; opacity: 0; }
.glitch-flash.on { animation: flash 1.1s steps(2) 1; }
@keyframes flash { 0% { opacity: .9; background:#fff } 25% { opacity: .5; background: var(--led) } 50% { opacity: .9; background:#fff } 75% { opacity: .3; background: var(--amber) } 100% { opacity: 0 } }
.truth-detector.shake { animation: shake 0.5s linear 5; }
@keyframes shake { 0%,100% { transform: translate(0,0) } 20% { transform: translate(-4px,2px) rotate(-.6deg) } 40% { transform: translate(4px,-2px) rotate(.6deg) } 60% { transform: translate(-3px,-1px) } 80% { transform: translate(3px,1px) } }
@media (prefers-reduced-motion: reduce) { .glitch-flash.on, .truth-detector.shake { animation: none; } }
