/*
  style.css
  Terminal-styled security portfolio.

  Design tokens live in :root. Everything else is derived from them.
  No external fonts, no external assets, no CDNs — zero third-party
  requests, which sidesteps an entire class of supply-chain and
  subresource-integrity concerns (CWE-829, CWE-1104) before they exist.
*/

:root {
  /* -- Color tokens ------------------------------------------------- */
  --bg:        #0b0f14;   /* base background, near-black w/ slate tint */
  --bg-raised: #10161d;   /* titlebar / raised panels */
  --bg-inset:  #080b0f;   /* recessed areas, code blocks */
  --fg:        #d6e2e8;   /* primary text, soft cool white */
  --fg-dim:    #93a5ad;   /* secondary text */
  --muted:     #5c6b73;   /* comments, timestamps, low emphasis */
  --accent:    #33ff99;   /* phosphor green — prompt, links, success */
  --accent-2:  #ffb454;   /* amber — labels, highlights, warnings */
  --danger:    #ff5c5c;   /* errors, critical severity */
  --border:    #1c2733;

  /* -- Type ----------------------------------------------------------
     System monospace stack only. Real terminals use the system font;
     so does this page. It also means zero font-loading requests. */
  --font-mono: ui-monospace, "Cascadia Code", "JetBrains Mono", "Fira Code",
               "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;

  --fs-xs:   0.75rem;
  --fs-sm:   0.875rem;
  --fs-base: 1rem;
  --fs-md:   1.125rem;
  --fs-lg:   1.5rem;
  --fs-xl:   2rem;
  --fs-2xl:  2.75rem;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4.5rem;

  --radius: 6px;
  --line: 1px solid var(--border);
  --focus-ring: 2px solid var(--accent);
}

/* -- Reset -------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: var(--fs-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button, input {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
}
img, svg { display: block; max-width: 100%; }

/* Screen-reader only utility */
.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;
}

/* Visible, deliberate focus states everywhere — never suppressed */
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
  border-radius: 2px;
}

/* -- Ambient CRT texture -------------------------------------------
   Very subtle, static (no flicker/jitter — avoids motion discomfort),
   purely decorative and inert to assistive tech and to input. */
.crt-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.018) 0px,
      rgba(255, 255, 255, 0.018) 1px,
      transparent 1px,
      transparent 3px
    );
  mix-blend-mode: overlay;
}

/* -- Layout shell -----------------------------------------------------
   True full-viewport terminal, not a centered "window" card. html/body
   are locked to the viewport height and don't themselves scroll — only
   .terminal__body scrolls internally, same as a real terminal emulator
   with a fixed titlebar and a fixed prompt at the bottom. */
html, body {
  height: 100vh;
  height: 100dvh; /* modern browsers: accounts for mobile browser chrome */
  overflow: hidden;
}

.page {
  height: 100%;
  display: flex;
}

.terminal {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  animation: terminal-in 0.5s ease-out;
}

@keyframes terminal-in {
  from { opacity: 0; transform: translateY(6px) scale(0.996); }
  to { opacity: 1; transform: none; }
}

.terminal__titlebar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-raised);
  border-bottom: var(--line);
}
.terminal__dots { display: flex; gap: 7px; }
.terminal__dots span {
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--border);
}
.terminal__dots span:nth-child(1) { background: #4a3a3a; }
.terminal__dots span:nth-child(2) { background: #4a4433; }
.terminal__dots span:nth-child(3) { background: #35452f; }

.terminal__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: var(--space-6) var(--space-5);
}

@media (min-width: 640px) {
  .terminal__body { padding: var(--space-7) var(--space-6); }
}

/* -- Boot sequence --------------------------------------------------- */
.boot {
  font-size: var(--fs-sm);
  color: var(--fg-dim);
}
.boot__line {
  opacity: 0;
  white-space: pre-wrap;
  margin: 0 0 2px;
  transition: opacity 0.15s ease-out;
}
.boot__line.is-in { opacity: 1; }
.boot__line .ok   { color: var(--accent); }
.boot__line .tag  { color: var(--muted); }
.boot__skip {
  margin-top: var(--space-4);
  font-size: var(--fs-xs);
  color: var(--muted);
  border: var(--line);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  cursor: pointer;
}
.boot__skip:hover { color: var(--fg); border-color: var(--fg-dim); }

.boot.is-done,
.boot[hidden] {
  display: none;
}

/* -- Hero / whoami ----------------------------------------------------*/
.hero {
  padding-top: var(--space-2);
  padding-bottom: var(--space-7);
}
.hero__kicker {
  color: var(--muted);
  font-size: var(--fs-sm);
  margin-bottom: var(--space-3);
}
.hero__kicker .flag { color: var(--accent-2); }
.hero__name {
  font-size: var(--fs-2xl);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--fg);
}
.hero__cursor {
  display: inline-block;
  width: 0.55em;
  background: var(--accent);
  margin-left: 2px;
  animation: blink 1s steps(1) infinite;
}
.hero__role {
  margin-top: var(--space-2);
  font-size: var(--fs-md);
  color: var(--accent-2);
}
.hero__tagline {
  margin-top: var(--space-4);
  max-width: 60ch;
  color: var(--fg-dim);
}
.hero__fields {
  margin-top: var(--space-5);
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--space-1) var(--space-4);
  font-size: var(--fs-sm);
}
.hero__fields dt { color: var(--muted); }
.hero__fields dd { color: var(--fg); }
.hero__fields .placeholder { color: var(--accent-2); }
.hero__fields .status-good { color: var(--accent); }

@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* -- Transcript ----------------------------------------------------------
   One continuous scrollback, same idea as a real terminal: each command
   you run appends an echo line immediately followed by its output, right
   here, right below the line above it. Nothing is a separate pane. */
.transcript { }

.tx-prompt {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  font-size: var(--fs-sm);
  margin-top: var(--space-7);
  margin-bottom: var(--space-3);
}
.transcript > .tx-prompt:first-child { margin-top: var(--space-7); }
.tx-prompt__label { color: var(--accent); white-space: nowrap; }
.tx-prompt__cmd { color: var(--fg); }

.tx-line {
  font-size: var(--fs-sm);
  color: var(--fg-dim);
  margin: 0 0 2px;
  white-space: pre-wrap;
}
.tx-err { color: var(--danger); }

/* A rendered section (skills/projects/certs/contact) sits directly under
   its own .tx-prompt echo line — the echo line already marks the start
   of a new block, so the section itself doesn't need its own border. */
.section {
  padding-bottom: var(--space-2);
}

/* Sections rendered into the transcript reuse this reveal treatment,
   triggered by app.js at the moment a command's output is appended. */
.section.js-reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.section.js-reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* Light stagger on the direct children of the card grids, so the
   reveal reads as pieces settling into place rather than one flat
   fade. Purely additive — see the .js-reveal note above re: no-JS. */
.section.js-reveal .skills > *,
.section.js-reveal .projects > *,
.section.js-reveal .certs > * {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}
.section.js-reveal.is-visible .skills > *,
.section.js-reveal.is-visible .projects > *,
.section.js-reveal.is-visible .certs > * {
  opacity: 1;
  transform: none;
}
.section.js-reveal.is-visible .skills > *:nth-child(1),
.section.js-reveal.is-visible .projects > *:nth-child(1),
.section.js-reveal.is-visible .certs > *:nth-child(1) { transition-delay: 0.05s; }
.section.js-reveal.is-visible .skills > *:nth-child(2),
.section.js-reveal.is-visible .projects > *:nth-child(2),
.section.js-reveal.is-visible .certs > *:nth-child(2) { transition-delay: 0.11s; }
.section.js-reveal.is-visible .skills > *:nth-child(3),
.section.js-reveal.is-visible .projects > *:nth-child(3),
.section.js-reveal.is-visible .certs > *:nth-child(3) { transition-delay: 0.17s; }
.section.js-reveal.is-visible .skills > *:nth-child(4),
.section.js-reveal.is-visible .projects > *:nth-child(4),
.section.js-reveal.is-visible .certs > *:nth-child(4) { transition-delay: 0.23s; }
.section__intro {
  color: var(--fg-dim);
  max-width: 65ch;
  margin-bottom: var(--space-5);
}

/* -- Skills -------------------------------------------------------------*/
.skills {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.skill-card {
  border: var(--line);
  border-radius: var(--radius);
  padding: var(--space-4);
  background: var(--bg-inset);
}
.skill-card__title {
  color: var(--accent-2);
  font-size: var(--fs-sm);
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.skill-card__title::before { content: "#"; color: var(--muted); }
.skill-card ul li {
  position: relative;
  padding-left: var(--space-4);
  color: var(--fg-dim);
  font-size: var(--fs-sm);
  margin-bottom: var(--space-2);
}
.skill-card ul li::before {
  content: "-";
  position: absolute;
  left: 0;
  color: var(--muted);
}

/* -- Projects -------------------------------------------------------------*/
.projects {
  display: grid;
  gap: var(--space-4);
}
.project-card {
  border: var(--line);
  border-radius: var(--radius);
  padding: var(--space-5);
  background: var(--bg-inset);
}
.project-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}
.project-card__name { color: var(--fg); font-size: var(--fs-md); }
.project-card__tag {
  font-size: var(--fs-xs);
  color: var(--accent);
  border: 1px solid rgba(51, 255, 153, 0.35);
  border-radius: 999px;
  padding: 2px var(--space-2);
}
.project-card__desc { color: var(--fg-dim); font-size: var(--fs-sm); max-width: 70ch; }
.project-card__meta {
  margin-top: var(--space-3);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  font-size: var(--fs-xs);
  color: var(--muted);
}
.project-card__meta a { color: #6fb8ff; }
.project-card__meta a:hover { color: var(--accent); }

/* -- Certs -------------------------------------------------------------*/
.certs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}
.cert-badge {
  border: var(--line);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  font-size: var(--fs-sm);
  min-width: 220px;
}
.cert-badge__name { color: var(--fg); }
.cert-badge__meta { color: var(--muted); font-size: var(--fs-xs); margin-top: 2px; }

/* -- Contact -------------------------------------------------------------*/
.contact-list {
  display: grid;
  gap: var(--space-2);
  font-size: var(--fs-sm);
}
.contact-list li {
  display: flex;
  gap: var(--space-3);
  border: var(--line);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-inset);
}
.contact-list dt { color: var(--muted); min-width: 6ch; }
.contact-list a { color: #6fb8ff; word-break: break-all; }
.contact-list a:hover { color: var(--accent); }

/* -- Live prompt line -----------------------------------------------------
   The last line of the transcript, always — not a separate fixed panel.
   As commands are appended above it, app.js scrolls this back into view,
   same as a real terminal keeping the cursor line visible. */
.promptline {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-sm);
  margin-top: var(--space-7);
}
.promptline__prompt { color: var(--accent); white-space: nowrap; }
.promptline__input {
  flex: 1;
  min-width: 0;
  caret-color: var(--accent);
}
.hint {
  font-size: var(--fs-xs);
  color: var(--muted);
  margin-top: var(--space-2);
  padding-bottom: var(--space-5);
}
.hint kbd {
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0 4px;
  font-family: inherit;
}

.noscript-notice {
  margin-top: var(--space-6);
  padding: var(--space-4);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--fg-dim);
  font-size: var(--fs-sm);
  max-width: 60ch;
}
.noscript-notice a { color: #6fb8ff; }

/* -- Responsive -----------------------------------------------------------*/
@media (max-width: 640px) {
  .hero__fields { grid-template-columns: 1fr; }
  .hero__fields dt { margin-top: var(--space-2); }
}

/* -- Reduced motion --------------------------------------------------------
   Boot sequence resolves instantly, cursor stops blinking, no animated
   reveals. Content and function are unaffected either way. */
@media (prefers-reduced-motion: reduce) {
  .terminal { animation: none; }
  .boot__line { transition: none; opacity: 1; }
  .hero__cursor { animation: none; opacity: 1; }
  .section.js-reveal,
  .section.js-reveal .skills > *,
  .section.js-reveal .projects > *,
  .section.js-reveal .certs > * {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  * { scroll-behavior: auto !important; }
}

html { scroll-behavior: smooth; }
