/* ============================================================
   Pete Clyne · AD0MI / WRYP278 — shared styles
   Modern-technical · dark · neon-green
============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=JetBrains+Mono:wght@300;400;500;600&display=swap');

:root {
  /* surfaces */
  --bg:          oklch(0.135 0.012 220);
  --bg-grad:     oklch(0.115 0.014 220);
  --surface:     oklch(0.175 0.015 220);
  --surface-2:   oklch(0.215 0.018 220);
  --surface-3:   oklch(0.255 0.020 220);
  --border:      oklch(0.30 0.020 220);
  --border-2:    oklch(0.42 0.025 220);

  /* text */
  --text:        oklch(0.97 0.005 220);
  --text-dim:    oklch(0.74 0.012 220);
  --text-faint:  oklch(0.55 0.015 220);

  /* accents */
  --neon:        oklch(0.88 0.22 145);
  --neon-glow:   oklch(0.88 0.22 145 / 0.45);
  --neon-fade:   oklch(0.88 0.22 145 / 0.14);
  --neon-dim:    oklch(0.60 0.16 145);

  --amber:       oklch(0.82 0.16 75);
  --magenta:     oklch(0.72 0.22 340);
  --cyan:        oklch(0.84 0.13 215);
  --danger:      oklch(0.70 0.22 25);

  /* type */
  --font-sans:   'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  --font-mono:   'JetBrains Mono', ui-monospace, 'Menlo', monospace;

  /* metrics */
  --radius:      4px;
  --radius-lg:   10px;
  --max-w:       1240px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, oklch(0.20 0.04 145 / 0.10), transparent 60%),
    radial-gradient(ellipse 70% 50% at 100% 100%, oklch(0.20 0.03 220 / 0.20), transparent 60%),
    linear-gradient(180deg, var(--bg-grad), var(--bg));
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* subtle scanline texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 2px,
    oklch(1 0 0 / 0.012) 2px,
    oklch(1 0 0 / 0.012) 3px
  );
  mix-blend-mode: overlay;
}

/* grid lines */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(to right, oklch(1 0 0 / 0.025) 1px, transparent 1px),
    linear-gradient(to bottom, oklch(1 0 0 / 0.025) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, black 30%, transparent 100%);
}

main, header, footer { position: relative; z-index: 1; }

/* ============================================================
   TYPE
============================================================ */
h1, h2, h3, h4 { font-family: var(--font-sans); font-weight: 600; letter-spacing: -0.02em; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(2.4rem, 5vw, 4.6rem); line-height: 1.02; letter-spacing: -0.035em; }
h2 { font-size: clamp(1.7rem, 3vw, 2.6rem); line-height: 1.08; letter-spacing: -0.025em; }
h3 { font-size: 1.25rem; line-height: 1.2; letter-spacing: -0.01em; }
h4 { font-size: 0.95rem; line-height: 1.3; letter-spacing: 0; }
p { margin: 0; text-wrap: pretty; }
a { color: inherit; text-decoration: none; }

.mono { font-family: var(--font-mono); font-weight: 400; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--neon);
}
.eyebrow.dim { color: var(--text-faint); }
.eyebrow .dot {
  display: inline-block;
  width: 6px; height: 6px;
  background: var(--neon);
  box-shadow: 0 0 8px var(--neon-glow);
  margin-right: 8px;
  transform: translateY(-1px);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.neon  { color: var(--neon); }

/* ============================================================
   LAYOUT
============================================================ */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 32px; }
@media (max-width: 720px) { .container { padding: 0 20px; } }

section.block {
  padding: clamp(64px, 9vw, 120px) 0;
  position: relative;
}
section.block + section.block { border-top: 1px solid var(--border); }

.row { display: flex; }
.col { display: flex; flex-direction: column; }

/* ============================================================
   TOP NAV
============================================================ */
.topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px) saturate(1.2);
  background: oklch(0.13 0.012 220 / 0.78);
  border-bottom: 1px solid var(--border);
}
.topnav .inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
}
.brand .mark {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 1px solid var(--neon);
  color: var(--neon);
  border-radius: 3px;
  background: var(--neon-fade);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: box-shadow .18s, background .18s;
  user-select: none;
}
.brand .mark:hover { box-shadow: 0 0 14px var(--neon-glow); }
.brand .meta { display: flex; flex-direction: column; line-height: 1.1; }
.brand .meta .name { color: var(--text); letter-spacing: 0.02em; }
.brand .meta .sub { color: var(--text-faint); font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; }

.topnav nav {
  display: flex; gap: 4px; margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}
.topnav nav a {
  padding: 8px 14px;
  border-radius: 3px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: color .15s, background .15s;
  position: relative;
}
.topnav nav a:hover { color: var(--text); background: var(--surface); }
.topnav nav a.active { color: var(--neon); }
.topnav nav a.active::before {
  content: '';
  position: absolute;
  left: 14px; right: 14px; bottom: 4px;
  height: 1px;
  background: var(--neon);
  box-shadow: 0 0 8px var(--neon-glow);
}
@media (max-width: 820px) {
  .topnav .inner { gap: 12px; padding: 12px 18px; }
  .topnav nav a { padding: 8px 8px; font-size: 0.72rem; }
  .brand .meta .sub { display: none; }
}

/* ============================================================
   HERO BITS
============================================================ */
.hero {
  min-height: 88vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 80px 0 60px;
  position: relative;
}
.hero .callsign-stack {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  color: var(--text-faint);
  text-transform: uppercase;
  display: flex;
  gap: 24px;
  margin-bottom: 28px;
}
.hero .callsign-stack span { color: var(--neon); }

.hero h1 .accent { color: var(--neon); }
.hero h1 .cursor {
  display: inline-block;
  width: 0.5ch;
  height: 0.9em;
  background: var(--neon);
  margin-left: 0.05em;
  transform: translateY(0.05em);
  animation: blink 1.05s steps(1) infinite;
  box-shadow: 0 0 10px var(--neon-glow);
}
@keyframes blink { 50% { opacity: 0; } }

.hero .lede {
  margin-top: 28px;
  max-width: 640px;
  font-size: 1.15rem;
  color: var(--text-dim);
}
.hero .ctarow {
  margin-top: 40px;
  display: flex; gap: 14px; flex-wrap: wrap;
}

/* ============================================================
   BUTTONS
============================================================ */
.btn {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 13px 22px;
  border-radius: 3px;
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all .18s;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.btn:hover { border-color: var(--text-dim); background: var(--surface-2); }
.btn.primary {
  background: var(--neon);
  color: oklch(0.16 0.02 145);
  border-color: var(--neon);
  font-weight: 600;
  box-shadow: 0 0 16px var(--neon-glow);
}
.btn.primary:hover { box-shadow: 0 0 24px var(--neon-glow); transform: translateY(-1px); }
.btn .arrow { transition: transform .15s; }
.btn:hover .arrow { transform: translateX(3px); }

/* ============================================================
   CARDS
============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color .15s, background .15s, transform .15s;
  position: relative;
}
.card:hover { border-color: var(--border-2); background: var(--surface-2); }
.card .corner {
  position: absolute;
  top: -1px; right: -1px;
  width: 14px; height: 14px;
  border-top: 1px solid var(--neon);
  border-right: 1px solid var(--neon);
}
.card.glow {
  background:
    radial-gradient(ellipse 100% 50% at 0% 0%, var(--neon-fade), transparent 60%),
    var(--surface);
}

.grid { display: grid; gap: 20px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
  .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 580px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
}

/* section title block */
.section-title {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 48px;
}
.section-title .number {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: var(--text-faint);
  text-transform: uppercase;
}
.section-title .number::before {
  content: '';
  display: inline-block;
  width: 28px; height: 1px;
  background: var(--neon);
  margin-right: 12px;
  vertical-align: middle;
}

/* ============================================================
   FOOTER
============================================================ */
.footer {
  margin-top: 80px;
  border-top: 1px solid var(--border);
  padding: 40px 0 60px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-faint);
}
.footer .inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: baseline;
  justify-content: space-between;
}
.footer .inner a { color: var(--text-dim); }
.footer .inner a:hover { color: var(--neon); }
.footer .copy { letter-spacing: 0.04em; }
.footer .qth { letter-spacing: 0.12em; text-transform: uppercase; }

/* morse pulse overlay */
.morse-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  border: 0 solid var(--neon);
  transition: border-width 50ms, box-shadow 50ms;
}
.morse-overlay.dit { border-width: 2px; box-shadow: inset 0 0 60px var(--neon-glow); }
.morse-overlay.dah { border-width: 4px; box-shadow: inset 0 0 120px var(--neon-glow); }
.morse-readout {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  z-index: 101;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.32em;
  color: var(--neon);
  background: oklch(0.135 0.012 220 / 0.9);
  border: 1px solid var(--neon);
  padding: 10px 18px;
  border-radius: 3px;
  box-shadow: 0 0 20px var(--neon-glow);
  text-shadow: 0 0 8px var(--neon-glow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
.morse-readout.show { opacity: 1; }

/* ============================================================
   PHOTO FRAME
============================================================ */
.photo-frame {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}
.photo-frame .cap {
  display: flex; justify-content: space-between;
  padding: 8px 14px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  border-top: 1px solid var(--border);
}

/* ============================================================
   PROJECT CARDS
============================================================ */
.project {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .15s, transform .15s;
  position: relative;
}
.project:hover { border-color: var(--neon); }
.project .thumb {
  height: 200px;
  background:
    repeating-linear-gradient(135deg, transparent 0 12px, oklch(1 0 0 / 0.02) 12px 13px),
    var(--surface-2);
  position: relative;
  display: grid;
  place-items: center;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  overflow: hidden;
}
.project .meta {
  padding: 0 20px 22px;
  display: flex; flex-direction: column; gap: 8px;
}
.project .meta .tags {
  display: flex; gap: 6px; flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.project .meta .tags span { padding: 2px 8px; border: 1px solid var(--border); border-radius: 2px; }
.project .meta h3 { color: var(--text); }
.project .meta p { color: var(--text-dim); font-size: 0.92rem; }
.project .idx {
  position: absolute;
  top: 14px; left: 14px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  color: var(--neon);
  background: oklch(0.135 0.012 220 / 0.7);
  padding: 4px 8px;
  border-radius: 2px;
  z-index: 2;
}

/* ============================================================
   STAT TILES
============================================================ */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.stats .stat {
  padding: 26px 24px;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 6px;
}
.stats .stat:last-child { border-right: 0; }
.stats .stat .k {
  font-family: var(--font-mono);
  font-size: 2.1rem;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1;
}
.stats .stat .k .unit { font-size: 0.9rem; color: var(--text-faint); margin-left: 4px; }
.stats .stat .l {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
}
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats .stat { border-bottom: 1px solid var(--border); }
  .stats .stat:nth-child(2) { border-right: 0; }
}

/* ============================================================
   FORM ELEMENTS
============================================================ */
.field {
  display: flex; flex-direction: column; gap: 8px;
}
.field label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.field input, .field textarea {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 3px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field textarea:focus {
  border-color: var(--neon);
  box-shadow: 0 0 0 3px var(--neon-fade);
}
.field textarea { resize: vertical; min-height: 120px; }

/* ============================================================
   UTILS
============================================================ */
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-2), transparent);
  margin: 32px 0;
}
.kbd {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 2px 6px;
  border: 1px solid var(--border-2);
  border-radius: 3px;
  background: var(--surface-2);
  color: var(--text-dim);
}
.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 2px;
  border: 1px solid var(--border-2);
  color: var(--text-dim);
}
.tag.neon { border-color: var(--neon); color: var(--neon); }

/* ============================================================
   CASE / RIG DETAIL MODAL
============================================================ */
.case-cue { display:block; margin-top:14px; font-size:0.72rem; letter-spacing:0.18em; color:var(--neon); opacity:0.65; transition:opacity .2s ease; }
.project:hover .case-cue { opacity:1; }

.case-modal { position:fixed; inset:0; z-index:120; display:flex; align-items:center; justify-content:center; padding:32px 20px; visibility:hidden; opacity:0; transition:opacity .28s ease, visibility 0s linear .28s; }
.case-modal.open { visibility:visible; opacity:1; transition:opacity .28s ease; }
.case-modal__scrim { position:absolute; inset:0; background:oklch(0.08 0.014 230 / 0.62); backdrop-filter:blur(6px); -webkit-backdrop-filter:blur(6px); }

.case-modal__panel { position:relative; width:min(760px, 100%); max-height:88vh; overflow-y:auto; padding:clamp(28px, 4vw, 44px); transform:translateY(18px) scale(0.97); opacity:0; transition:transform .32s cubic-bezier(.22,.61,.36,1), opacity .32s ease; }
.case-modal.open .case-modal__panel { transform:translateY(0) scale(1); opacity:1; }

.case-modal__close { position:absolute; top:18px; right:18px; width:38px; height:38px; display:flex; align-items:center; justify-content:center; background:transparent; border:1px solid var(--border); border-radius:3px; color:var(--text-faint); cursor:pointer; transition:color .2s ease, border-color .2s ease; z-index:2; }
.case-modal__close:hover { color:var(--neon); border-color:var(--neon); }

.case-modal__outcomes { margin-top:26px; padding-top:22px; border-top:1px solid var(--border); clear:both; }
.case-modal__outcomes ul { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:14px; }
.case-modal__outcomes li { position:relative; padding-left:26px; color:var(--text); line-height:1.55; }
.case-modal__outcomes li::before { content:""; position:absolute; left:0; top:0.55em; width:8px; height:8px; background:var(--neon); box-shadow:0 0 10px var(--neon-glow, var(--neon)); border-radius:1px; }

.case-modal__figure { margin:22px 0 0; float:right; width:min(300px, 42%); margin-left:24px; }
.case-modal__figure img { display:block; width:100%; border:1px solid var(--border); border-radius:3px; }
.case-modal__figure figcaption { margin-top:8px; font-size:0.78rem; line-height:1.45; color:var(--text-faint); }

@media (max-width:560px) {
  .case-modal { padding:16px; align-items:flex-start; }
  .case-modal__panel { max-height:92vh; }
  .case-modal__figure { float:none; width:100%; margin:20px 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  .case-modal, .case-modal__panel { transition:opacity .15s ease; transform:none; }
}
