/* ==========================================================================
   Jordan Pears: terminal-native portfolio
   Source of truth for look and feel: DESIGN.md
   ========================================================================== */

/* ---- Tokens ------------------------------------------------------------ */
:root {
  --ink: #0B0B0F;        /* page background */
  --surface: #14141A;    /* cards, tiles, palette */
  --line: #2A2A33;       /* borders, dividers */
  --text: #ECECEC;       /* primary text */
  --muted: #8A8A96;      /* secondary text */
  --lime: #C6FF3D;       /* signature accent */
  --lime-ink: #0B0B0F;   /* text on lime */

  --font: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;

  color-scheme: dark;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---- Base -------------------------------------------------------------- */
*, *::before, *::after { box-sizing: inherit; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: env(safe-area-inset-top, 0px);
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font: 16px/1.7 var(--font);
}

a {
  color: var(--text);
  text-decoration-color: var(--line);
  text-underline-offset: 4px;
}
a:hover,
a:focus-visible {
  color: var(--lime);
  text-decoration-color: var(--lime);
}

:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 3px;
}

h2 {
  margin: 96px 0 24px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: lowercase;
}
h2::before { content: "( ( ( "; }
h2::after  { content: " ) ) )"; }

/* ---- Layout ------------------------------------------------------------ */
#bg {                               /* gutter pear canvas */
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.col {                              /* centered content column */
  position: relative;
  z-index: 1;
  min-height: 100vh;
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 24px 64px;
  background: var(--ink);
  border-inline: 2px solid var(--lime);
  /* the one allowed soft glow (see DESIGN.md, section 4) */
  box-shadow: 0 0 24px rgba(198, 255, 61, 0.25);
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

/* ---- Nav --------------------------------------------------------------- */
.rule {                             /* box-drawing frame lines */
  display: flex;
  overflow: hidden;
  color: var(--line);
  line-height: 1.2;
  white-space: nowrap;
}
.rule i {
  flex: 1;
  overflow: hidden;
  font-style: normal;
}

.nav-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  padding: 12px 8px;
  font-size: 14px;
}
.nav-row a { color: var(--muted); text-decoration: none; }
.nav-row a:hover { color: var(--lime); }
.nav-row .spacer { flex: 1; }
.nav-row .btn { padding: 8px 12px; color: var(--lime-ink); }
.nav-row .btn:hover { color: var(--lime-ink); }   /* beat .nav-row a:hover */

/* ---- Buttons and chips ------------------------------------------------- */
.btn {
  display: inline-block;
  padding: 14px 18px;
  border: 2px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: 500 14px/1 var(--font);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease-out, box-shadow 0.15s ease-out, border-color 0.15s;
}
.btn:hover { border-color: var(--lime); color: var(--text); }
.btn:active { transform: none; box-shadow: none; }

.btn-primary {
  background: var(--lime);
  border-color: var(--lime);
  color: var(--lime-ink);
  font-weight: 700;
}
.btn-primary:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--text);
  color: var(--lime-ink);
}

.chip {                             /* bracketed link chip */
  padding: 2px 8px;
  border: 0;
  border-radius: 6px;
  background: rgba(198, 255, 61, 0.08);
  color: var(--text);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
.chip:hover { color: var(--lime); }

.tag {                              /* inverted category chip */
  display: inline-block;
  margin: 0 4px 4px 0;
  padding: 0 6px;
  background: var(--text);
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1.6;
}

/* ---- Hero -------------------------------------------------------------- */
.hero { padding: 96px 0 64px; text-align: center; }
.prompt { margin: 0 0 24px; color: var(--muted); font-size: 13px; }

h1 {
  margin: 0 0 24px;
  font-size: clamp(34px, 9vw, 64px);
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.1;
  text-transform: lowercase;
}
.hero .lead { max-width: 48ch; margin: 0 auto 32px; font-size: 18px; }
.hero .actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; }

.hero-pear {
  display: inline-block;
  margin: 32px 0 0;
  color: var(--lime);
  font-size: 14px;
  line-height: 1.2;
  text-align: left;
}

/* ---- Project tiles ----------------------------------------------------- */
.tile {
  display: block;
  border: 2px solid var(--line);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.15s ease-out, box-shadow 0.15s ease-out, border-color 0.15s;
}
.tile:hover,
.tile:focus-visible {
  border-color: var(--lime);
  box-shadow: 6px 6px 0 var(--lime);
  transform: translate(-2px, -2px);
  color: var(--text);
}
.tile-preview {
  display: grid;
  place-items: center;
  height: 120px;
  border-bottom: 2px solid var(--line);
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(255, 255, 255, 0.02) 3px 4px);
  color: var(--lime);
  font-size: 12px;
  line-height: 1.1;
  white-space: pre;
}
.tile-body { padding: 16px; }
.tile h3 { margin: 0 0 8px; font-size: 18px; font-weight: 600; }
.tile p { margin: 0 0 12px; color: var(--muted); font-size: 14px; line-height: 1.5; }

/* ---- Playground -------------------------------------------------------- */
.playground-row { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.playground-row + .playground-row { margin-top: 16px; }
.playground-row b { color: var(--lime); font-size: 28px; }

/* needle box and spawn controls: inline on narrow screens; on wide ones the rate sits above the grass and the needle box in it, beside the column */
.toybox { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; margin-top: 24px; }
.pinbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border: 2px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  color: var(--muted);
  font: 500 11px/1 var(--font);
  letter-spacing: 0.04em;
  cursor: pointer;
  opacity: 0.7;
  transition: border-color 0.15s, opacity 0.15s;
}
.pinbox .needle { font-size: 18px; line-height: 1; }
.pinbox:hover,
.pinbox:focus-visible { border-color: var(--lime); color: var(--text); opacity: 1; }
.pinbox[aria-pressed="true"] { border-style: dashed; }
.pinbox[aria-pressed="true"] .needle { visibility: hidden; }
.spawnctl { display: flex; flex-direction: column; gap: 8px; color: var(--muted); font-size: 12px; }
.spawnctl b { color: var(--text); font-weight: 500; }
.spawnbtns { display: flex; flex-wrap: wrap; gap: 4px; }
.spawnctl .chip { padding: 2px 6px; font-size: 12px; }
.spawnctl .chip:disabled { opacity: 0.4; cursor: default; }
@media (min-width: 1100px) {
  .toybox { display: contents; }
  .spawnctl,
  .pinbox {
    position: fixed;
    z-index: 5;
    left: calc(50% + 360px + 16px);
  }
  .pinbox { bottom: 48px; }                 /* clear of the grass */
  .spawnctl { bottom: 92px; }
}
.hint { color: var(--muted); font-size: 14px; }

/* ---- Posts, find me, footer ------------------------------------------- */
.month {
  margin: 24px 0 8px;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--lime);
  text-underline-offset: 6px;
}
.post { margin: 0 0 8px 24px; font-size: 14px; }
.post time { margin: 0 8px; color: var(--muted); }

.kv {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 8px 16px;
  font-size: 14px;
}
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.note {
  margin-top: 64px;
  padding: 16px;
  border: 2px dashed var(--line);
  color: var(--muted);
  font-size: 13px;
}

footer { margin-top: 96px; color: var(--muted); font-size: 13px; text-align: center; }
footer p { margin: 8px 0; }

/* ---- Cursor effects ---------------------------------------------------- */
body > .star,
#pin-cursor {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
}
.star { z-index: 50; width: 4px; height: 4px; transition: opacity 0.5s; }

#pin-cursor {
  display: none;
  z-index: 60;
  font-size: 26px;
  line-height: 1;
  transform: translate(-100px, -100px);
}
body.pin-held,
body.pin-held * { cursor: none !important; }
body.pin-held #pin-cursor { display: block; }

/* ---- Command palette --------------------------------------------------- */
#palette {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  background: rgba(11, 11, 15, 0.85);
}
#palette.open { display: flex; }

.palette-box {
  width: min(560px, 92vw);
  border: 2px solid var(--lime);
  background: var(--surface);
  box-shadow: 6px 6px 0 var(--lime);
}
.palette-box input {
  width: 100%;
  padding: 16px;
  border: 0;
  border-bottom: 2px solid var(--line);
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
}
.palette-box ul { margin: 0; padding: 8px; list-style: none; }
.palette-box li a { display: block; padding: 8px 12px; font-size: 14px; text-decoration: none; }
.palette-box li a:hover,
.palette-box li a:focus-visible { background: var(--lime); color: var(--lime-ink); }

/* ---- Responsive and accessibility ------------------------------------- */
@media (max-width: 600px) {
  .grid { grid-template-columns: 1fr; }
  .hero { padding-top: 64px; }
}

@media (pointer: coarse) {
  .star { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
  .star { display: none; }
}
