/* ============================================================
   Bramley.dev — Principal Engineer portfolio
   Single dark theme. Accent is themeable via --ac.
   ============================================================ */

:root {
  --ac: #7cffb2;              /* accent (swap here to re-theme) */
  --bg: #0b0f10;             /* page background */
  --panel: #0e1416;          /* standard card bg */
  --term: #060b0b;           /* terminal body */
  --bright: #f3f6f4;         /* headings / emphasis */
  --text: #c9d1cf;           /* body base */
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --body: 'Space Grotesk', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  position: relative;
}
a { color: inherit; }
::selection { background: rgba(124, 255, 178, .28); }

@keyframes blink { 0%,49% { opacity: 1; } 50%,100% { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* faint horizontal scanlines behind everything */
.grid-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.022) 1px, transparent 1px);
  background-size: 100% 32px;
}

.wrap { position: relative; z-index: 1; max-width: 1180px; margin: 0 auto; }
.section { padding: 64px clamp(20px, 5vw, 40px) 40px; }

/* ---------- shared bits ---------- */
.prompt { color: var(--ac); }
.cmd {
  font: 400 13px var(--mono);
  color: rgba(201,209,207,.5);
}
.chip {
  font: 500 12px var(--mono);
  color: rgba(201,209,207,.7);
  border: 1px solid rgba(255,255,255,.12);
  padding: 5px 11px; border-radius: 6px; white-space: nowrap;
}
.chips { display: flex; flex-wrap: wrap; gap: 7px; }

.cta {
  text-decoration: none; background: var(--ac); color: #08110c;
  font: 600 14px var(--mono); padding: 14px 26px; border-radius: 7px;
  transition: filter .18s;
}
.cta:hover { filter: brightness(1.08); }
.ghost {
  text-decoration: none; color: rgba(201,209,207,.82);
  font: 500 14px var(--mono); padding: 14px 20px;
  border: 1px solid rgba(255,255,255,.14); border-radius: 7px;
  transition: border-color .2s, color .2s;
}
.ghost:hover { border-color: rgba(124,255,178,.45); color: var(--bright); }

/* section header row: [idx] [h2] [// note] */
.sec-head {
  display: flex; align-items: baseline; gap: 16px;
  margin-bottom: 38px;
  border-top: 1px solid rgba(255,255,255,.08); padding-top: 34px;
}
.sec-idx { font: 500 13px var(--mono); color: var(--ac); }
.sec-head h2 {
  margin: 0; font-size: 34px; font-weight: 600;
  color: var(--bright); letter-spacing: -.02em;
}
.sec-note { margin-left: auto; font: 400 13px var(--mono); color: rgba(201,209,207,.45); }

/* ============ NAV ============ */
.nav {
  position: sticky; top: 0; z-index: 20;
  background: rgba(11,15,16,.78); backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.nav-inner {
  max-width: 1180px; margin: 0 auto;
  padding: 15px clamp(18px,4vw,40px);
  display: flex; align-items: center; justify-content: space-between;
}
.nav-brand { display: flex; align-items: center; gap: 9px; text-decoration: none; }
.dot { width: 9px; height: 9px; border-radius: 50%; }
.dot.r { background: #ff5f56; }
.dot.y { background: #ffbd2e; }
.dot.g { background: var(--ac); }
.nav-email {
  margin-left: 12px; font: 500 13.5px var(--mono); color: rgba(201,209,207,.85);
}
.nav-links { display: flex; align-items: center; gap: clamp(16px,3vw,30px); }
.navlink {
  color: rgba(201,209,207,.62); text-decoration: none;
  font: 500 13.5px var(--mono); transition: color .18s;
}
.navlink:hover { color: var(--bright); }
.nav-cta {
  text-decoration: none; background: var(--ac); color: #08110c;
  font: 600 13px var(--mono); padding: 9px 16px; border-radius: 6px;
  transition: filter .18s;
}
.nav-cta:hover { filter: brightness(1.08); }

/* ============ HERO ============ */
.hero { position: relative; padding: clamp(48px,7vw,84px) clamp(20px,5vw,40px) clamp(52px,7vw,80px); }
.hero-glow {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(70% 60% at 82% 8%, rgba(124,255,178,.09), transparent 60%);
}
.terminal {
  position: relative; max-width: 900px;
  border-radius: 12px; overflow: hidden;
  border: 1px solid rgba(255,255,255,.13);
  box-shadow: 0 26px 70px rgba(0,0,0,.5);
}
.term-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; background: #0e1517;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.term-bar .dot { width: 11px; height: 11px; }
.term-bar .dot.g { background: #27c93f; }  /* titlebar green is fixed, not accent */
.term-title { flex: 1; text-align: center; font: 500 12.5px var(--mono); color: rgba(201,209,207,.5); }
.term-spacer { width: 45px; }
.term-body { background: var(--term); padding: clamp(22px,3.4vw,34px); cursor: text; }

.term-body .cmd { color: rgba(201,209,207,.5); }
.cmd-whoami { margin-bottom: 16px; }
.cmd-mid { margin: 30px 0 14px; }

.hero-name {
  margin: 0; font-weight: 600; font-size: clamp(40px,7.5vw,68px);
  line-height: .95; letter-spacing: -.025em; color: var(--bright);
}
.caret {
  display: inline-block; width: .4ch; height: .78em;
  background: var(--ac); margin-left: 11px;
  transform: translateY(.04em); opacity: .9;
}
.role-line { margin-top: 16px; font: 400 14.5px var(--mono); color: var(--ac); }
.role-line .sep { color: rgba(201,209,207,.3); }

.bio { margin: 0; max-width: 680px; font-size: clamp(15.5px,1.6vw,17.5px); line-height: 1.7; color: rgba(201,209,207,.85); }
.bio strong { color: var(--bright); font-weight: 500; }

.stats { display: flex; flex-direction: column; gap: 7px; font: 400 13.5px var(--mono); }
.stat-row { display: flex; }
.stat-label { width: 84px; flex: none; color: rgba(201,209,207,.42); }
.stat-val { color: var(--bright); }

.term-history { display: flex; flex-direction: column; gap: 3px; margin: 24px 0 8px; }
.term-line { font: 400 13px/1.55 var(--mono); white-space: pre-wrap; word-break: break-word; }

.pac-wrap { margin: 6px 0 12px; }
.pac-wrap.hidden { display: none; }
#pac {
  display: block; width: 304px; max-width: 100%; height: 176px;
  background: #04070a; border: 1px solid rgba(255,255,255,.12); border-radius: 8px;
}
.pac-help { font: 400 11px var(--mono); color: rgba(201,209,207,.4); margin-top: 7px; }
.pac-help b { color: rgba(201,209,207,.6); font-weight: 400; }

.term-input-row { display: flex; align-items: center; gap: 9px; margin-top: 6px; }
.term-input-row .prompt { font: 600 13px var(--mono); }
.term-inputwrap { flex: 1; min-width: 0; display: flex; align-items: center; }
.term-caret {
  flex: none; width: 7px; height: 15px; margin-right: 2px;
  background: var(--ac); display: none;
  animation: blink 1.05s infinite;
}
.term-input-row.empty .term-caret { display: block; }
.term-input-row.empty #term-input { caret-color: transparent; }  /* avoid a double cursor while empty */
#term-input {
  flex: 1; min-width: 0; background: transparent; border: none; outline: none;
  color: var(--bright); font: 400 13px var(--mono); caret-color: var(--ac);
}

.hero-actions {
  position: relative; max-width: 900px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 22px;
}
.hero-hint { margin-left: auto; font: 400 11.5px var(--mono); color: rgba(201,209,207,.35); }
.hero-hint b { color: rgba(201,209,207,.62); font-weight: 400; }

/* ============ AI-FIRST ============ */
.ai-panel {
  border: 1px solid rgba(124,255,178,.16); border-radius: 14px;
  background: linear-gradient(160deg, rgba(124,255,178,.035), rgba(255,255,255,.008));
  padding: clamp(30px,4vw,48px); position: relative; overflow: hidden;
}
.ai-glow {
  position: absolute; top: 0; right: 0; width: 340px; height: 100%; pointer-events: none;
  background: radial-gradient(80% 120% at 100% 0, rgba(124,255,178,.07), transparent 62%);
}
.ai-panel > * { position: relative; }
.ai-cmd { color: rgba(201,209,207,.5); margin-bottom: 20px; }
.ai-thesis {
  margin: 0; max-width: 760px; font-size: clamp(19px,2.2vw,25px);
  line-height: 1.5; color: var(--bright); font-weight: 500; letter-spacing: -.01em;
}
.ai-thesis .ac { color: var(--ac); }
.principles {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px; margin-top: 38px;
}
@media (max-width: 640px) { .principles { grid-template-columns: 1fr; } }
.principle {
  background: #0c1213; border: 1px solid rgba(255,255,255,.08);
  border-radius: 11px; padding: 26px;
}
.pr-idx { font: 600 12px var(--mono); color: var(--ac); margin-bottom: 12px; }
.principle h3 { margin: 0 0 9px; font-size: 18px; font-weight: 600; color: var(--bright); letter-spacing: -.01em; }
.principle p { margin: 0; font-size: 14.5px; line-height: 1.62; color: rgba(201,209,207,.78); }
.ai-proof {
  margin-top: 34px; padding-top: 26px; border-top: 1px solid rgba(255,255,255,.08);
}
.ai-proof-label { font: 500 11px var(--mono); color: var(--ac); letter-spacing: .06em; margin-bottom: 18px; }
.ai-proof-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.ai-proof-head { font: 600 13px var(--mono); color: var(--bright); margin-bottom: 8px; }
.ai-proof-head::before { content: "➜  "; color: var(--ac); }
.ai-proof-item p { margin: 0; font-size: 14px; line-height: 1.6; color: rgba(201,209,207,.72); }
.ai-close {
  margin-top: 34px; padding-top: 26px; border-top: 1px solid rgba(255,255,255,.08);
  font-size: 16px; line-height: 1.6; color: rgba(201,209,207,.7);
}
.ai-close .g { color: var(--ac); font-family: var(--mono); }

/* ============ SELECTED WORK ============ */
.work-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px; align-items: start;
}
@media (max-width: 720px) { .work-grid { grid-template-columns: 1fr; } }
/* labelled bands that group the case studies */
.work-band { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; margin: 30px 0 2px; scroll-margin-top: 84px; }
.work-band:first-child { margin-top: 0; }
.work-band-label { font: 600 12px var(--mono); color: var(--ac); letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; }
.work-band-note { font: 400 12px var(--mono); color: rgba(201,209,207,.4); white-space: nowrap; }
.work-band-rule { flex: 1; height: 1px; background: rgba(255,255,255,.09); }
@media (max-width: 600px) { .work-band-note { display: none; } }
.pjcard {
  background: var(--panel); border: 1px solid rgba(255,255,255,.09);
  border-radius: 12px; padding: 34px; position: relative; overflow: hidden;
  transition: border-color .25s, transform .25s;
}
.pjcard:hover { border-color: rgba(124,255,178,.4); transform: translateY(-3px); }
.pjcard--full {
  grid-column: 1 / -1;
  background: linear-gradient(160deg, #10181a, #0d1315);
  padding: 38px 40px;
}
.pj-glow {
  position: absolute; top: 0; right: 0; width: 280px; height: 100%; pointer-events: none;
  background: radial-gradient(80% 120% at 100% 0, rgba(124,255,178,.08), transparent 65%);
}
.pj-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 11px; margin-bottom: 14px; position: relative; }
.pj-company { font: 600 13px var(--mono); color: var(--ac); }
.pj-sep { width: 4px; height: 4px; border-radius: 50%; background: rgba(201,209,207,.4); }
.pj-role { font: 400 13px var(--mono); color: rgba(201,209,207,.55); }
.pj-role.dim { font-size: 12.5px; color: rgba(201,209,207,.5); }
.pj-link { margin-left: auto; font: 500 12px var(--mono); color: var(--ac); text-decoration: none; opacity: .85; transition: opacity .18s; }
.pj-link:hover { opacity: 1; }
.pjcard h3 { margin: 0 0 12px; font-weight: 600; color: var(--bright); letter-spacing: -.01em; position: relative; }
.pjcard--full h3 { font-size: 27px; letter-spacing: -.015em; max-width: 620px; }
.pjcard:not(.pjcard--full) h3 { font-size: 21px; }
.pj-desc { margin: 0 0 20px; font-size: 15px; line-height: 1.65; color: rgba(201,209,207,.8); position: relative; }
.pjcard--full .pj-desc { font-size: 16px; line-height: 1.68; color: rgba(201,209,207,.82); max-width: 640px; margin-bottom: 22px; }

.metrics { display: flex; flex-wrap: wrap; gap: 24px; margin-bottom: 20px; position: relative; }
.pjcard--full .metrics { gap: 26px; margin-bottom: 24px; }
.metric-num { font-size: 21px; color: var(--bright); }
.pjcard--full .metric-num { font-size: 23px; }
.metric-label { font: 400 11px var(--mono); color: rgba(201,209,207,.5); margin-top: 3px; }
.pjcard--full .metric-label { font-size: 11.5px; }

.pjcard .chips { position: relative; }

.archbtn {
  margin-top: 24px; background: transparent; border: 1px solid rgba(124,255,178,.3);
  color: var(--ac); font: 500 13px var(--mono); padding: 10px 17px; border-radius: 8px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 9px;
  transition: background .18s; position: relative;
}
.pjcard--full .archbtn { margin-top: 26px; }
.archbtn:hover { background: rgba(124,255,178,.09); }
.chev { font-size: 11px; display: inline-block; transition: transform .2s; }
.archbtn[aria-expanded="true"] .chev { transform: rotate(90deg); }

.arch { margin-top: 24px; border-top: 1px solid rgba(255,255,255,.08); padding-top: 26px; position: relative; }
.arch[hidden] { display: none; }
.arch-title { font: 500 11px var(--mono); color: rgba(201,209,207,.45); letter-spacing: .1em; margin-bottom: 22px; }
.flow { display: flex; align-items: stretch; gap: 4px; overflow-x: auto; padding-bottom: 10px; }
.flow-col { display: flex; flex-direction: column; gap: 9px; flex: none; min-width: 152px; }
.flow-head { font: 600 10px var(--mono); color: var(--ac); letter-spacing: .1em; margin-bottom: 2px; }
.flow-head.muted { color: rgba(201,209,207,.5); }
.node {
  background: #0a1012; border: 1px solid rgba(255,255,255,.11); border-radius: 8px;
  padding: 11px 13px; font: 500 12.5px var(--mono); color: #dfe6e3;
}
.node-sub { font-size: 10px; color: rgba(201,209,207,.42); margin-top: 3px; }
.node--hl { border-color: rgba(124,255,178,.28); }
.node--hl .node-sub { color: var(--ac); opacity: .75; }
.node--dashed { border-style: dashed; border-color: rgba(255,255,255,.13); color: rgba(223,230,227,.8); }
.arrow { display: flex; align-items: center; color: var(--ac); font-size: 17px; padding: 26px 3px 0; }
.arrow.dim { color: rgba(201,209,207,.35); }

.strip {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin-top: 20px; padding: 14px 16px; border: 1px solid rgba(255,255,255,.08);
  border-radius: 9px; background: rgba(255,255,255,.015);
}
.strip-label { font: 600 10px var(--mono); color: var(--ac); letter-spacing: .1em; }
.strip-item { font: 500 12px var(--mono); color: #dfe6e3; }
.strip-arrow { color: rgba(201,209,207,.35); }
.strip-note { margin-left: auto; font: 500 11px var(--mono); color: rgba(201,209,207,.4); }
.strip-note.ac { color: var(--ac); }

/* full-width banner cards: meta header, then title/desc left + metrics/chips right */
.pjcard--banner .banner-grid {
  display: grid; grid-template-columns: 1.15fr 1fr;
  gap: clamp(28px, 4vw, 52px); align-items: start; position: relative;
}
.banner-left { min-width: 0; }
.banner-left h3 { margin-bottom: 14px; }
.pjcard--banner .pj-desc { max-width: none; margin-bottom: 0; }
.banner-right {
  min-width: 0; position: relative;
  border-left: 1px solid rgba(255,255,255,.08);
  padding-left: clamp(24px, 3.5vw, 44px);
}
.banner-right .metrics { margin-bottom: 22px; }
.banner-right .chips { margin-bottom: 0; }
.banner-right .archbtn { margin-top: 24px; }
@media (max-width: 720px) {
  .pjcard--banner .banner-grid { grid-template-columns: 1fr; gap: 22px; }
  .banner-right {
    border-left: 0; padding-left: 0;
    border-top: 1px solid rgba(255,255,255,.08); padding-top: 22px;
  }
}

/* ============ STACK ============ */
.stack-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px,1fr)); gap: 18px; }
.stack-card { background: var(--panel); border: 1px solid rgba(255,255,255,.09); border-radius: 11px; padding: 26px; }
.stack-label { font: 500 12px var(--mono); color: var(--ac); letter-spacing: .06em; margin-bottom: 16px; }

/* ============ CONTACT ============ */
.contact { padding-bottom: 100px; }
.contact-panel {
  background: linear-gradient(160deg, #10181a, #0c1113);
  border: 1px solid rgba(124,255,178,.18); border-radius: 14px;
  padding: clamp(32px,5vw,56px) clamp(24px,4vw,48px); position: relative; overflow: hidden;
}
.contact-glow {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(60% 100% at 90% 0, rgba(124,255,178,.1), transparent 60%);
}
.contact-inner {
  position: relative; display: flex; align-items: center;
  gap: clamp(28px, 4vw, 56px); justify-content: space-between;
}
.contact-text { flex: 1; min-width: 0; }
.contact-figure { flex: none; display: block; line-height: 0; }
.contact-photo {
  display: block; width: clamp(200px, 26vw, 300px); height: auto;
  aspect-ratio: 4 / 5; object-fit: cover; border-radius: 14px;
  border: 1px solid rgba(124,255,178,.25); box-shadow: 0 12px 32px rgba(0,0,0,.45);
}
@media (max-width: 720px) {
  .contact-inner { flex-direction: column-reverse; align-items: flex-start; }
  .contact-photo { width: clamp(160px, 42vw, 220px); }
}
.avail {
  display: inline-flex; align-items: center; gap: 9px;
  font: 500 12.5px var(--mono); color: var(--ac);
  border: 1px solid rgba(124,255,178,.3); padding: 6px 13px; border-radius: 20px; margin-bottom: 24px;
}
.contact-inner h2 { margin: 0; font-size: clamp(30px,7vw,44px); font-weight: 600; color: var(--bright); letter-spacing: -.025em; max-width: 640px; }
.contact-inner p { margin: 18px 0 34px; font-size: 17px; line-height: 1.65; color: rgba(201,209,207,.82); max-width: 560px; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.contact-actions .cta { font-size: 14.5px; padding: 15px 28px; border-radius: 8px; }
.contact-actions .ghost { padding: 15px 22px; border-radius: 8px; }
.footer {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 34px; font: 400 12.5px var(--mono); color: rgba(201,209,207,.4);
}

/* ---------- architecture diagram modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(14px, 4vw, 48px);
  background: rgba(4,7,8,.74); backdrop-filter: blur(6px);
  animation: fade .18s ease both;
}
.modal-overlay[hidden] { display: none; }
.modal {
  position: relative; width: min(1100px, 96vw); max-height: 88vh; overflow: auto;
  background: linear-gradient(160deg,#10181a,#0d1315);
  border: 1px solid rgba(124,255,178,.18); border-radius: 14px;
  padding: clamp(20px,3vw,32px);
  box-shadow: 0 40px 120px rgba(0,0,0,.6);
  animation: rise .26s cubic-bezier(.2,.7,.2,1) both;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.modal-title { font: 600 13px var(--mono); color: var(--ac); letter-spacing: .04em; }
.modal-close {
  flex: none; width: 34px; height: 34px; border-radius: 8px; cursor: pointer;
  background: transparent; border: 1px solid rgba(255,255,255,.14);
  color: var(--text); font-size: 15px; line-height: 1;
  transition: border-color .18s, color .18s;
}
.modal-close:hover { border-color: rgba(124,255,178,.45); color: var(--bright); }
/* the diagram's inline-context spacing is dropped inside the modal */
.modal-body .arch { border-top: 0; margin-top: 0; padding-top: 0; }

/* ---------- page-load entrance ---------- */
/* The terminal window rises in, then its output lines cascade like the
   commands just executed; the action row floats up last. */
.nav { animation: fade .7s ease both; }
.terminal { animation: rise .5s cubic-bezier(.2,.7,.2,1) both; }
.term-body > * { animation: fade .45s ease both; }
.term-body > *:nth-child(1) { animation-delay: .28s; }
.term-body > *:nth-child(2) { animation-delay: .34s; }
.term-body > *:nth-child(3) { animation-delay: .40s; }
.term-body > *:nth-child(4) { animation-delay: .46s; }
.term-body > *:nth-child(5) { animation-delay: .52s; }
.term-body > *:nth-child(6) { animation-delay: .58s; }
.term-body > *:nth-child(7) { animation-delay: .64s; }
.term-body > *:nth-child(8) { animation-delay: .70s; }
.term-body > *:nth-child(9) { animation-delay: .76s; }
.term-body > *:nth-child(10) { animation-delay: .82s; }
.hero-actions { animation: rise .5s ease both; animation-delay: .95s; }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .term-caret { animation: none; }  /* stays solid rather than blinking */
  /* skip the load entrance — show everything in place */
  .nav, .terminal, .term-body > *, .hero-actions {
    animation: none !important; opacity: 1 !important; transform: none !important;
  }
  .modal-overlay, .modal { animation: none !important; }
  * { transition: none !important; }
}

/* ---------- nav collapse ---------- */
@media (max-width: 600px) {
  .navmid { display: none; }
  .nav-email { font-size: 12px; }
  .footer { flex-direction: column; gap: 6px; }
}
