/* reset */
.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;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
a, button, input, textarea, select { outline: none; -webkit-appearance: none; appearance: none; font: inherit; color: inherit; }
a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px;
}
img { max-width: 100%; display: block; }
ul { list-style: none; }

/* tokens */
:root {
  --bg:      #0A0B0D;
  --surf:    #0E0F12;
  --surf2:   #131418;
  --ink:     #ECEDEF;
  --muted:   #90949C;
  --dim:     #4A4D54;
  --line:    rgba(255,255,255,0.09);
  --accent:  #4CC9C0;           /* signal teal — security/systems mode */
  --accent-dim: rgba(76,201,192,0.14);
  --accent2: #E8432C;           /* signal red — design/creative mode */
  --paper:   #EDEEE8;           /* light surface for design-mode panels */
  --flag:    #C9584A;           /* rare use only: critical/error state */
  --ok:      #5FA87A;           /* rare use only: pass/ok state */
  --font-display: 'Space Grotesk', -apple-system, sans-serif;
  --font-body:    'DM Sans', -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, monospace;
  --edge: max(1.5rem, calc((100vw - 1760px) / 2));
}

html { scroll-behavior: smooth; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px; line-height: 1.6; overflow-x: hidden;
}
em { font-style: italic; }

body::before {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: radial-gradient(rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 24px 24px; opacity: 0.5;
  transform: translate(var(--grid-x, 0px), var(--grid-y, 0px));
  transition: transform 0.6s cubic-bezier(0.2,0.7,0.2,1);
}

/* custom cursor */
#cursor-dot {
  position: fixed; top: 0; left: 0; width: 8px; height: 8px;
  background: var(--accent); border-radius: 50%;
  pointer-events: none; z-index: 9999;
  transform: translate(-50%, -50%);
  transition: width 0.25s cubic-bezier(0.2,0.7,0.2,1), height 0.25s cubic-bezier(0.2,0.7,0.2,1),
              background 0.25s ease, opacity 0.2s ease;
  mix-blend-mode: difference;
}
#cursor-dot.hover { width: 32px; height: 32px; background: var(--ink); }
#cursor-dot.hidden { opacity: 0; }
@media (hover: none), (pointer: coarse) { #cursor-dot { display: none; } }
@media (prefers-reduced-motion: reduce) { #cursor-dot { display: none; } }

/* raw panel chrome, reused everywhere */
.raw {
  background: var(--surf);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.raw-bar {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.04em;
  color: var(--muted);
}
.raw-bar .dots { display: flex; gap: 5px; margin-right: 0.4rem; }
.raw-bar .dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.raw-body {
  padding: 1.1rem 1.2rem;
  font-family: var(--font-mono); font-size: 0.82rem; line-height: 1.75;
  color: var(--muted);
  white-space: pre-wrap; word-break: break-word;
}
.raw-body .k { color: var(--muted); }
.raw-body .v { color: var(--ink); }
.raw-body .accent { color: var(--accent); }
.raw-body .comment { color: var(--dim); }
.cursor {
  display: inline-block; width: 0.5em; height: 1em; background: var(--accent);
  margin-left: 2px; vertical-align: -2px;
  animation: blink 1s step-end infinite;
}
@media (prefers-reduced-motion: reduce) { .cursor { animation: none; opacity: 0.7; } }
@keyframes blink { 50% { opacity: 0; } }

/* collapsible on mobile, always open on desktop */
details.raw { padding: 0; }
details.raw > summary {
  cursor: pointer; list-style: none;
  display: flex; align-items: center; gap: 0.5rem;
}
details.raw > summary::-webkit-details-marker { display: none; }
.raw-toggle-label { display: none; }
@media (max-width: 899px) {
  .raw-toggle-label { display: inline; font-family: var(--font-mono); font-size: 0.7rem; color: var(--muted); margin-left: auto; }
}

/* section titles */
.section { position: relative; z-index: 1; padding: 6.5rem var(--edge); }
.s-eyebrow {
  font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted);
  letter-spacing: 0.18em; text-transform: uppercase; margin-bottom: 0.9rem;
  display: flex; align-items: center; gap: 0.7rem;
}
.s-eyebrow::before { content: ''; width: 20px; height: 1px; background: var(--accent); }
.s-title {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(1.9rem, 3.2vw, 2.6rem); line-height: 1.2; letter-spacing: -0.02em;
  margin-bottom: 3rem; max-width: 780px;
}
.s-title em { font-style: normal; color: var(--accent); }

.reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.2,0.7,0.2,1); }
.reveal.in-view { opacity: 1; transform: translateY(0); }

/* section titles rise up from behind a mask on scroll instead of just fading in */
.s-title.reveal { opacity: 1; transform: none; transition: none; }
.line-mask { display: block; overflow: hidden; }
.line-inner { display: block; transform: translateY(112%); transition: transform 0.9s cubic-bezier(0.22,0.85,0.24,1); }
.reveal.in-view .line-inner { transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .line-inner { transform: none !important; transition: none !important; }
}

/* boot loader */
#boot-loader {
  position: fixed; inset: 0; z-index: 1000;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.4s ease;
  /* auto-hides even if script.js never runs */
  animation: bootLoaderFailsafe 0s linear 4s forwards;
}
#boot-loader.done { opacity: 0; pointer-events: none; }
@keyframes bootLoaderFailsafe { to { opacity: 0; pointer-events: none; } }
.boot-lines {
  font-family: var(--font-mono); font-size: 0.82rem; color: var(--muted);
  min-width: 260px;
}
.boot-lines .line { opacity: 0; animation: bootLineIn 0.3s ease forwards; }
.boot-lines .line .ok { color: var(--ok); }
@keyframes bootLineIn { to { opacity: 1; } }

/* hero fade-in, timed to finish as the loader clears */
.boot-item {
  opacity: 0; transform: translateY(14px);
  animation: bootItemIn 0.6s cubic-bezier(0.2,0.7,0.2,1) forwards;
  animation-delay: calc(0.15s + (var(--boot-delay, 0) * 0.09s));
}
@keyframes bootItemIn { to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  #boot-loader { display: none; }
  .boot-item { opacity: 1; transform: none; animation: none; }
}

#heroCta { opacity: 0; transform: translateY(14px); transition: opacity 0.6s cubic-bezier(0.2,0.7,0.2,1), transform 0.6s cubic-bezier(0.2,0.7,0.2,1); }
#heroCta.show { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) { #heroCta { opacity: 1; transform: none; transition: none; } }

/* nav */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem var(--edge);
  background: rgba(10,11,13,0.85);
  backdrop-filter: blur(12px) saturate(1.2); -webkit-backdrop-filter: blur(12px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
.logo {
  font-family: var(--font-display); font-weight: 700; font-size: 0.92rem;
  letter-spacing: 0.1em; text-decoration: none; color: var(--ink);
}
.logo em { color: var(--accent); font-style: normal; }
.nav-links { display: flex; align-items: center; gap: 2.2rem; }
.nav-links a {
  position: relative;
  font-family: var(--font-mono); font-size: 0.74rem; color: var(--muted);
  text-decoration: none; letter-spacing: 0.1em; text-transform: uppercase;
  transition: color 0.2s ease; padding-bottom: 4px;
}
.nav-links a::after {
  content: ''; position: absolute; left: 0; bottom: 0; height: 1px; width: 100%;
  background: var(--accent); transform: scaleX(0); transform-origin: left;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}
.nav-links a:hover, .nav-links a.active { color: var(--accent); }
.nav-links a:hover::after, .nav-links a.active::after { transform: scaleX(1); }
.nav-status {
  display: flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-mono); font-size: 0.7rem; color: var(--muted);
  letter-spacing: 0.04em;
}
.nav-status .pulse {
  width: 6px; height: 6px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 0 0 rgba(95,168,122,0.5);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(95,168,122,0.45); }
  70%  { box-shadow: 0 0 0 6px rgba(95,168,122,0); }
  100% { box-shadow: 0 0 0 0 rgba(95,168,122,0); }
}
@media (prefers-reduced-motion: reduce) { .nav-status .pulse { animation: none; } }

.nav-toggle {
  display: none; width: 42px; height: 42px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surf);
  align-items: center; justify-content: center; cursor: pointer;
}
.nav-toggle .bar { width: 16px; height: 1.5px; background: var(--ink); position: relative; }
.nav-toggle .bar::before, .nav-toggle .bar::after {
  content: ''; position: absolute; left: 0; width: 16px; height: 1.5px; background: var(--ink);
  transition: transform 0.25s ease;
}
.nav-toggle .bar::before { top: -5px; }
.nav-toggle .bar::after { top: 5px; }
.nav-toggle.open .bar { background: transparent; }
.nav-toggle.open .bar::before { top: 0; transform: rotate(45deg); }
.nav-toggle.open .bar::after { top: 0; transform: rotate(-45deg); }

.mobile-nav {
  position: fixed; inset: 0; z-index: 90;
  background: var(--bg);
  display: flex; flex-direction: column; justify-content: center;
  padding: 2rem var(--edge);
  opacity: 0; pointer-events: none; transform: translateY(-12px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.mobile-nav.open { opacity: 1; pointer-events: auto; transform: translateY(0); }
.mobile-nav a {
  font-family: var(--font-display); font-size: 2.1rem; font-weight: 600;
  color: var(--ink); text-decoration: none; padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
}
.mobile-nav a:hover { color: var(--accent); }

@media (max-width: 768px) {
  .nav-links, .nav-status { display: none; }
  .nav-toggle { display: flex; }
}

/* hero */
#home { position: relative; min-height: 100svh; display: flex; align-items: center; padding: 7.5rem var(--edge) 3rem; }
.hero-ascii-bg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  z-index: 0; pointer-events: none; opacity: 0.5;
}
@media (prefers-reduced-motion: reduce) { .hero-ascii-bg { opacity: 0.3; } }
.hero-frame { width: 100%; max-width: 1200px; margin: 0 auto; position: relative; z-index: 1; }
.hero-ascii-bg {
  position: absolute; inset: -2rem -1.5rem auto -1.5rem; height: calc(100% + 4rem);
  width: calc(100% + 3rem); z-index: 0; pointer-events: none; opacity: 0.5;
}
@media (prefers-reduced-motion: reduce) { .hero-ascii-bg { opacity: 0.3; } }
.hero-eyebrow { font-family: var(--font-mono); font-size: 0.74rem; color: var(--muted); letter-spacing: 0.16em; text-transform: uppercase; margin-bottom: 1.4rem; display: flex; align-items: center; gap: 0.7rem; }
.hero-eyebrow::before { content: ''; width: 20px; height: 1px; background: var(--accent); }
.hero-sub { font-size: 1.05rem; color: var(--muted); max-width: 560px; line-height: 1.8; margin: 1.6rem 0 2.2rem; }
.cta-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.85rem 1.6rem;
  font-family: var(--font-mono); font-weight: 500; font-size: 0.74rem;
  letter-spacing: 0.08em; text-transform: uppercase;
  text-decoration: none; cursor: pointer; border-radius: 4px;
  border: 1px solid var(--line); background: transparent; color: var(--ink);
  transition: border-color 0.25s ease, background 0.25s ease, transform 0.25s ease, color 0.25s ease;
}
.btn-fill { background: var(--accent); border-color: var(--accent); color: #06201D; }
.btn-fill:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(76,201,192,0.25); }
.btn-line:hover { border-color: var(--accent); color: var(--accent); }
.btn:active { transform: scale(0.97) translateY(0); transition-duration: 0.1s; }

/* marquee */
.marquee-wrap {
  position: relative; z-index: 1; overflow: hidden;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 1rem 0;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee-track { display: flex; align-items: center; gap: 1.3rem; width: max-content; animation: marquee 30s linear infinite; }
.marquee-wrap:hover .marquee-track { animation-play-state: paused; }
.marquee-item { font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.1em; color: var(--muted); white-space: nowrap; }
.marquee-sep { color: var(--dim); font-size: 0.65rem; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .marquee-track { animation: none; } }

/* about + contact layout */
.dual { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 3rem; align-items: start; max-width: 1300px; }
@media (max-width: 899px) { .dual { grid-template-columns: 1fr; gap: 1.5rem; } }

#about { background: var(--surf); }
.about-body p { color: var(--muted); font-size: 1rem; line-height: 1.9; margin-bottom: 1.1rem; max-width: 560px; }
.pull-quote {
  max-width: 760px; margin-top: 3rem;
  border-left: 2px solid var(--accent); padding-left: 1.6rem;
  font-family: var(--font-display); font-size: 1.25rem; line-height: 1.55; font-weight: 500;
}
.pull-quote em { color: var(--accent); font-style: normal; }
#ghStatsPanel { margin-top: 1.4rem; }
#ghStatsPanel .raw-body { white-space: pre-wrap; }

/* capabilities */
.cap-row {
  display: grid; grid-template-columns: 2fr 1.3fr; gap: 2rem;
  padding: 1.6rem 0; border-top: 1px solid var(--line);
  align-items: baseline;
}
.cap-row:last-child { border-bottom: 1px solid var(--line); }
.cap-name { font-family: var(--font-display); font-size: 1.25rem; font-weight: 600; }
.cap-name em { color: var(--accent); font-style: normal; }
.cap-red .cap-name em, .cap-red .cap-meta .accent { color: var(--accent2); }
.cap-desc { color: var(--muted); font-size: 0.94rem; line-height: 1.7; margin-top: 0.4rem; max-width: 480px; }
.cap-meta { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); }
.cap-meta .accent { color: var(--accent); }
@media (max-width: 767px) {
  .cap-row { grid-template-columns: 1fr; gap: 0.5rem; }
}

/* work */
.work-list { display: flex; flex-direction: column; gap: 1.1rem; max-width: 1300px; }
.work-item {
  position: relative;
  display: grid; grid-template-columns: 200px 1fr auto; gap: 1.5rem; align-items: center;
  padding: 1.2rem; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surf);
  transition: transform 0.3s cubic-bezier(0.2,0.7,0.2,1), box-shadow 0.3s ease, border-color 0.3s ease;
}
.work-item::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px;
  background: radial-gradient(220px circle at var(--sx,50%) var(--sy,50%), var(--accent), transparent 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity 0.4s ease; pointer-events: none;
}
.work-item:hover, .work-item:focus-within { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(0,0,0,0.35); border-color: transparent; }
.work-item:hover::before, .work-item:focus-within::before { opacity: 1; }
.work-thumb { width: 200px; height: 130px; border-radius: 6px; overflow: hidden; }
.work-img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.5s cubic-bezier(0.2,0.7,0.2,1); }
.work-item:hover .work-img { transform: scale(1.06); }
.work-title { font-family: var(--font-display); font-size: 1.1rem; font-weight: 600; margin-bottom: 0.35rem; }
.work-desc { color: var(--muted); font-size: 0.88rem; line-height: 1.6; margin-bottom: 0.7rem; max-width: 480px; }
.work-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.work-tag { font-family: var(--font-mono); font-size: 0.66rem; padding: 0.22rem 0.55rem; border: 1px solid var(--line); color: var(--muted); border-radius: 3px; letter-spacing: 0.03em; transition: border-color 0.2s ease, color 0.2s ease; }
.work-item:hover .work-tag { border-color: var(--line); color: var(--muted); }
.work-tag:hover { border-color: var(--accent); color: var(--accent); }
.work-id { display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem; font-family: var(--font-mono); font-size: 0.68rem; color: var(--dim); text-align: right; }
.work-swatch { width: 16px; height: 16px; border-radius: 3px; border: 1px solid var(--line); }

@media (max-width: 767px) {
  .work-item { grid-template-columns: 1fr; }
  .work-thumb { width: 100%; height: 160px; }
  .work-id { flex-direction: row; justify-content: space-between; align-items: center; }
}

/* contact form */
.form-group { margin-bottom: 1.2rem; }
.form-group label { display: block; font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 0.5rem; }
.form-group input, .form-group textarea {
  width: 100%; background: var(--surf); border: 1px solid var(--line); border-radius: 5px;
  padding: 0.85rem 1rem; color: var(--ink); font-family: var(--font-body); font-size: 0.95rem;
  transition: border-color 0.25s ease;
}
.form-group input:focus, .form-group textarea:focus { border-color: var(--accent); }
.form-group textarea { min-height: 120px; resize: vertical; }
.contact-links { display: flex; flex-direction: column; gap: 1rem; margin-top: 1.6rem; }
.contact-link { display: flex; align-items: center; gap: 0.8rem; text-decoration: none; color: var(--ink); font-size: 0.95rem; }
.contact-link svg { width: 18px; height: 18px; color: var(--accent); flex-shrink: 0; }
.contact-link:hover { color: var(--accent); }
.contact-raw .raw-body { display: flex; flex-direction: column; gap: 0.5rem; min-height: 180px; }

/* footer */
footer { padding: 3rem var(--edge) 2rem; border-top: 1px solid var(--line); }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 2rem; max-width: 1300px; margin: 0 auto 2.5rem; }
.footer-about { max-width: 300px; }
.footer-about p { color: var(--muted); font-size: 0.85rem; line-height: 1.7; margin-top: 0.8rem; }
.footer-col h4 { font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 1rem; }
.footer-col ul { display: flex; flex-direction: column; gap: 0.6rem; }
.footer-col a { color: var(--ink); text-decoration: none; font-size: 0.88rem; opacity: 0.85; transition: opacity 0.2s, color 0.2s; }
.footer-col a:hover { opacity: 1; color: var(--accent); }
.footer-bottom { max-width: 1300px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; padding-top: 2rem; border-top: 1px solid var(--line); }
.social-links { display: flex; gap: 0.8rem; }
.social-link { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); text-decoration: none; transition: all 0.25s ease; }
.social-link:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }
.copyright { font-family: var(--font-mono); font-size: 0.7rem; color: var(--muted); }

@media (max-width: 899px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-about { grid-column: 1 / -1; max-width: none; }
}
@media (max-width: 540px) {
  .footer-grid { grid-template-columns: 1fr; }
}

/* back to top button */
#back-to-top {
  position: fixed; bottom: 1.8rem; right: 1.8rem; z-index: 80;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--surf); border: 1px solid var(--line); color: var(--muted);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  opacity: 0; pointer-events: none; transform: translateY(8px);
  transition: all 0.3s cubic-bezier(0.25,1,0.5,1);
}
#back-to-top.visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
#back-to-top:hover { border-color: var(--accent); color: var(--accent); }

/* scroll progress bar */
#scroll-progress { position: fixed; top: 0; left: 0; height: 2px; width: 0%; background: var(--accent); z-index: 999; pointer-events: none; }

/* big screens */
@media (min-width: 1920px) {
  body { font-size: 18px; }
  .s-title { font-size: clamp(2.5rem, 2.4vw, 3.2rem); }
  .hero-sub, .about-body p, .cap-desc { font-size: 1.08rem; }
  .raw-body { font-size: 0.92rem; }
}

/* small phones */
@media (max-width: 420px) {
  .section { padding: 4.5rem var(--edge); }
  .cta-row { flex-direction: column; }
  .btn { width: 100%; justify-content: center; }
}
