/* ============================================================
   Shelby — Field Notes
   A maker's editorial page. Warm paper, ink, two riso inks.
   Hand-written CSS. No framework, on purpose.
   ============================================================ */

:root {
  /* paper + ink */
  --paper:      #f3ede0;
  --paper-deep: #ece4d3;
  --ink:        #211c17;
  --ink-soft:   #4a4138;
  --ink-faint:  #8a7d6a;
  --rule:       #d8cdb8;

  /* the two riso inks */
  --gold:       #d99a2b;   /* sprig gold */
  --gold-deep:  #b97e16;
  --orange:     #d1603d;   /* fluorescent riso red-orange, for marginalia */
  --phosphor:   #7fb13b;   /* the lcd's amber-green */

  /* the device screen */
  --screen-bg:  #0e1310;
  --screen-dim: #16201a;

  --maxw: 1180px;
  --gutter: clamp(20px, 5vw, 64px);

  --serif:   "Newsreader", Georgia, "Times New Roman", serif;
  --display: "Fraunces", Georgia, serif;
  --mono:    "Space Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --hand:    "Caveat", "Comic Sans MS", cursive;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background-color: var(--paper);
  /* faint paper grain so it never reads as flat #fff */
  background-image:
    radial-gradient(circle at 12% 18%, rgba(0,0,0,.018) 0 1px, transparent 1px),
    radial-gradient(circle at 62% 72%, rgba(0,0,0,.014) 0 1px, transparent 1px),
    radial-gradient(circle at 84% 32%, rgba(0,0,0,.012) 0 1px, transparent 1px);
  background-size: 7px 7px, 11px 11px, 13px 13px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }

::selection { background: var(--gold); color: #1a1208; }

a { color: inherit; text-decoration-color: var(--gold); text-underline-offset: 3px; }

/* ---------------- top bar ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(6px);
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  border-bottom: 1px solid var(--rule);
}
.topbar .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 62px;
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand .mark {
  font-family: var(--display);
  font-weight: 600; font-size: 22px; letter-spacing: -.01em;
  font-variation-settings: "SOFT" 40, "WONK" 1, "opsz" 40;
}
.brand .by {
  font-family: var(--mono); font-size: 11px; color: var(--ink-faint);
  text-transform: uppercase; letter-spacing: .14em;
}
.nav { display: flex; gap: 26px; align-items: center; }
.nav a {
  font-family: var(--mono); font-size: 12.5px; letter-spacing: .04em;
  text-transform: lowercase; text-decoration: none; color: var(--ink-soft);
  padding-bottom: 2px; border-bottom: 1.5px solid transparent;
  transition: border-color .2s, color .2s;
}
.nav a:hover { color: var(--ink); border-color: var(--gold); }
.status {
  font-family: var(--mono); font-size: 11px; color: var(--ink-faint);
  display: inline-flex; align-items: center; gap: 7px;
}
.status .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--phosphor);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--phosphor) 70%, transparent);
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--phosphor) 60%, transparent); }
  70%  { box-shadow: 0 0 0 6px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@media (max-width: 720px){ .nav { display: none; } }

/* ---------------- hero ---------------- */
.hero { padding: clamp(48px, 9vw, 110px) 0 56px; position: relative; }
.hero-grid {
  display: grid; grid-template-columns: 1.05fr .95fr;
  gap: clamp(28px, 5vw, 72px); align-items: center;
}
.kicker {
  font-family: var(--mono); font-size: 12.5px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--orange); margin: 0 0 22px;
  display: inline-flex; align-items: center; gap: 10px;
}
.kicker::before { content:""; width: 30px; height: 1.5px; background: var(--orange); }

.hero h1 {
  font-family: var(--display); font-weight: 340;
  font-size: clamp(40px, 6.6vw, 82px); line-height: .98;
  letter-spacing: -.022em; margin: 0 0 26px;
  font-variation-settings: "SOFT" 30, "WONK" 0, "opsz" 144;
}
.hero h1 em {
  font-style: italic; color: var(--gold-deep);
  font-variation-settings: "SOFT" 60, "WONK" 1, "opsz" 144;
}
.hero .lede {
  font-size: 20px; color: var(--ink-soft); max-width: 30em; margin: 0 0 32px;
}
.hero .lede b { color: var(--ink); font-weight: 600; }

.cta-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.btn {
  font-family: var(--mono); font-size: 13px; letter-spacing: .03em;
  text-decoration: none; padding: 13px 22px; border-radius: 2px;
  display: inline-flex; align-items: center; gap: 9px;
  transition: transform .12s ease, box-shadow .2s;
}
.btn-primary {
  background: var(--ink); color: var(--paper);
  box-shadow: 4px 4px 0 var(--gold);
}
.btn-primary:hover { transform: translate(-2px,-2px); box-shadow: 6px 6px 0 var(--gold); }
.btn-ghost { color: var(--ink); border: 1.5px solid var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--paper); }

/* the device in the hero */
.hero-device { position: relative; justify-self: center; }
.marginalia {
  position: absolute; font-family: var(--hand); color: var(--orange);
  font-size: 23px; line-height: 1.05; transform: rotate(-7deg);
  pointer-events: none; max-width: 200px;
}
.marginalia.m-clock { top: -34px; right: -8px; transform: rotate(6deg); }
.marginalia.m-glow  { bottom: 4px; left: -120px; transform: rotate(-5deg); text-align: right; }
.arrow { display: block; width: 74px; height: auto; color: var(--orange); }
.arrow.a-clock { position: absolute; top: 6px; right: 56px; transform: rotate(132deg); }
.arrow.a-glow  { position: absolute; bottom: 30px; left: -40px; transform: rotate(-18deg) scaleX(-1); }

@media (max-width: 880px){
  .hero-grid { grid-template-columns: 1fr; text-align: left; }
  .hero-device { margin-top: 40px; }
  .marginalia.m-glow, .arrow.a-glow { display: none; }
}

/* ---------------- the device (shared) ---------------- */
.device {
  --bezel: #cdb98f;
  --shell: #e7d9b8;
  position: relative; width: 360px; max-width: 86vw;
  background: linear-gradient(160deg, var(--shell), #d8c6a0);
  border-radius: 26px; padding: 30px 26px 40px;
  box-shadow:
    0 1px 0 rgba(255,255,255,.6) inset,
    0 40px 60px -30px rgba(40,30,10,.5),
    0 2px 6px rgba(0,0,0,.12);
  border: 1px solid #c4b083;
}
.device::after { /* brand etch */
  content: "SPRIG · running shelby"; position: absolute; bottom: 13px; left: 0; right: 0;
  text-align: center; font-family: var(--mono); font-size: 9px; letter-spacing: .18em;
  color: rgba(60,45,15,.42); text-transform: uppercase;
}
.screen-frame {
  background: #20180f; border-radius: 8px; padding: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,.4) inset;
}
.screen-frame canvas {
  display: block; width: 100%; height: auto; border-radius: 3px;
  image-rendering: pixelated;
  box-shadow: 0 0 22px color-mix(in srgb, var(--phosphor) 22%, transparent);
}
.dpads {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 22px; padding: 0 6px;
}
.dpad { display: grid; grid-template-columns: repeat(3, 20px); grid-template-rows: repeat(3,20px); gap: 3px; }
.key {
  background: #b49e6f; border-radius: 4px; border: 1px solid #a08a5c;
  box-shadow: 0 2px 0 #98835650; font-family: var(--mono); font-size: 9px;
  color: #4a3b18; display: grid; place-items: center; cursor: pointer; user-select: none;
  transition: transform .06s, background .12s;
}
.key:active, .key.hit { transform: translateY(2px); background: var(--gold); }
.key.k-u { grid-area: 1/2; } .key.k-l { grid-area: 2/1; }
.key.k-r { grid-area: 2/3; } .key.k-d { grid-area: 3/2; }
.dpad .center { grid-area: 2/2; background: transparent; border: none; box-shadow: none; }

/* ---------------- section scaffolding ---------------- */
section { position: relative; }
.band { border-top: 1px solid var(--rule); padding: clamp(54px, 8vw, 96px) 0; }
.band.dark { background: var(--paper-deep); }
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 46px; flex-wrap: wrap; }
.sec-no { font-family: var(--mono); font-size: 12px; color: var(--gold-deep); letter-spacing: .14em; }
.sec-head h2 {
  font-family: var(--display); font-weight: 360; font-size: clamp(28px, 4.4vw, 48px);
  letter-spacing: -.02em; margin: 6px 0 0; line-height: 1.04; max-width: 14ch;
  font-variation-settings: "SOFT" 30, "opsz" 80;
}
.sec-head .aside { font-family: var(--mono); font-size: 12.5px; color: var(--ink-faint); max-width: 26ch; text-align: right; }

/* ---------------- manifesto ---------------- */
.manifesto p {
  font-size: clamp(22px, 2.5vw, 30px); line-height: 1.5; max-width: 21ch + 30ch;
  font-family: var(--display); font-weight: 320; letter-spacing: -.01em;
  max-width: 24ch; margin: 0;
}
.manifesto { display: grid; grid-template-columns: 1fr 1.3fr; gap: clamp(28px,5vw,70px); align-items: start; }
.manifesto .body p { font-family: var(--serif); font-size: 19px; max-width: 60ch; }
.manifesto .body p:first-child::first-letter {
  font-family: var(--display); font-size: 3.4em; line-height: .8; float: left;
  padding: 6px 10px 0 0; color: var(--gold-deep); font-weight: 400;
}
.manifesto .lead-q {
  font-family: var(--display); color: var(--ink); margin-bottom: 28px;
}
@media (max-width: 820px){ .manifesto { grid-template-columns: 1fr; } }

/* ---------------- apps grid ---------------- */
.apps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; background: var(--rule); border: 1px solid var(--rule); }
.app-card {
  background: var(--paper); padding: 26px 24px 28px; display: flex; flex-direction: column; gap: 16px;
  transition: background .2s;
}
.app-card:hover { background: #fbf7ee; }
.app-screen { background: #20180f; border-radius: 6px; padding: 9px; align-self: flex-start; }
.app-screen canvas { display:block; width: 200px; height: 160px; image-rendering: pixelated; border-radius: 2px; }
.app-card h3 { font-family: var(--display); font-weight: 460; font-size: 22px; margin: 4px 0 0; letter-spacing: -.01em; }
.app-card .tag { font-family: var(--mono); font-size: 11px; color: var(--gold-deep); letter-spacing: .1em; text-transform: uppercase; }
.app-card p { margin: 0; font-size: 16.5px; color: var(--ink-soft); line-height: 1.55; }
.app-card .note {
  font-family: var(--hand); color: var(--orange); font-size: 19px; line-height: 1.15;
  border-top: 1px dashed var(--rule); padding-top: 12px; margin-top: auto;
}
@media (max-width: 900px){ .apps { grid-template-columns: repeat(2,1fr); } .app-screen canvas{ width:100%; height:auto; } }
@media (max-width: 560px){ .apps { grid-template-columns: 1fr; } }

/* ---------------- interactive demo ---------------- */
.demo { display: grid; grid-template-columns: 1fr 360px; gap: clamp(30px,6vw,80px); align-items: center; }
.demo-copy h2 { font-family: var(--display); font-weight: 360; font-size: clamp(30px,4.6vw,52px); letter-spacing: -.02em; margin: 0 0 18px; line-height: 1.02; }
.demo-copy p { color: var(--ink-soft); max-width: 42ch; }
.keys-legend { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 26px; font-family: var(--mono); font-size: 12.5px; color: var(--ink-soft); }
.keys-legend kbd {
  font-family: var(--mono); background: var(--ink); color: var(--paper); border-radius: 3px;
  padding: 2px 7px; font-size: 11px; margin-right: 6px; box-shadow: 0 2px 0 var(--gold-deep);
}
@media (max-width: 820px){ .demo { grid-template-columns: 1fr; } .demo .hero-device{ justify-self: start; } }

/* ---------------- teardown / specs ---------------- */
.specs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 60px; }
.spec {
  display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: baseline;
  padding: 16px 0; border-bottom: 1px solid var(--rule);
}
.spec .k { font-family: var(--serif); font-size: 18px; }
.spec .k small { display:block; font-family: var(--mono); font-size: 11px; color: var(--ink-faint); letter-spacing:.06em; margin-top: 2px; }
.spec .v { font-family: var(--mono); font-size: 14px; color: var(--gold-deep); text-align: right; white-space: nowrap; }
@media (max-width: 680px){ .specs { grid-template-columns: 1fr; } }

/* ---------------- install ---------------- */
.install { display: grid; grid-template-columns: .9fr 1.1fr; gap: clamp(30px,5vw,64px); align-items: start; }
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps li { position: relative; padding: 0 0 22px 46px; }
.steps li::before {
  counter-increment: step; content: counter(step,decimal-leading-zero);
  position: absolute; left: 0; top: -1px; font-family: var(--mono); font-size: 13px;
  color: var(--paper); background: var(--ink); width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
}
.steps li::after { content:""; position: absolute; left: 14.5px; top: 30px; bottom: 2px; width: 1px; background: var(--rule); }
.steps li:last-child::after { display:none; }
.steps h4 { margin: 4px 0 4px; font-family: var(--display); font-weight: 480; font-size: 19px; }
.steps p { margin: 0; font-size: 16px; color: var(--ink-soft); }
.codeblock {
  background: var(--screen-bg); border-radius: 6px; padding: 22px 22px;
  font-family: var(--mono); font-size: 13px; line-height: 1.9; color: #cfe0c2;
  overflow-x: auto; box-shadow: 0 24px 40px -28px rgba(20,30,12,.7);
}
.codeblock .c { color: #6f8a5b; }
.codeblock .p { color: var(--gold); }
.codeblock .s { color: #e3b06a; }
@media (max-width: 760px){ .install { grid-template-columns: 1fr; } }

/* ---------------- footer ---------------- */
.foot { border-top: 1px solid var(--rule); padding: 56px 0 70px; }
.foot-grid { display: flex; justify-content: space-between; gap: 40px; flex-wrap: wrap; align-items: flex-start; }
.foot .mark { font-family: var(--display); font-size: 30px; font-weight: 500; letter-spacing: -.02em; }
.foot p { color: var(--ink-faint); font-size: 15px; max-width: 34ch; margin: 12px 0 0; }
.foot .cols { display: flex; gap: 60px; flex-wrap: wrap; }
.foot h5 { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); margin: 0 0 14px; }
.foot ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 9px; }
.foot ul a { font-family: var(--serif); font-size: 16px; text-decoration: none; color: var(--ink-soft); }
.foot ul a:hover { color: var(--ink); text-decoration: underline; }
.colophon { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--rule); font-family: var(--mono); font-size: 11.5px; color: var(--ink-faint); display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce){ .reveal { opacity:1; transform:none; } .status .dot{ animation:none; } }
