/* ============================================================
   Terminal portfolio — base stylesheet
   Palette: black → green gradient, monospace throughout.
   Tokens match expand.css so both files theme together.
   ============================================================ */

:root {
  /* Surfaces: deepest black at the top of the page, warming into
     green as you scroll. Each section picks one. */
  --bg-0: #040906;
  --bg-1: #05100b;
  --bg-2: #071510;
  --bg-3: #0a1d15;

  --panel: #0f2118;
  --stroke: #1f4433;
  --stroke-soft: #16301f;

  --text: #d8f3e4;
  --muted: #7fae97;
  /* --dim is still secondary text, so it clears 4.5:1 on every surface here
     (5.8:1 on the page ground, 5.0:1 on a card). */
  --dim: #69967f;
  /* Form borders need 3:1 against their own fill to satisfy WCAG 1.4.11;
     --stroke is decorative and sits below that on purpose. */
  --stroke-input: #3d7a5b;

  --accent: #4ade80;
  --accent-hi: #86efac;
  --accent-deep: #17331f;

  --amber: #fbbf24;

  --mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono",
    "Fira Code", Menlo, Consolas, "Liberation Mono", monospace;

  --radius: 10px;
  --maxw: 1180px;
  --gutter: clamp(1.25rem, 5vw, 5rem);

  --glow: 0 0 0 1px rgba(74, 222, 128, 0.14),
    0 0 28px -8px rgba(74, 222, 128, 0.35);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  /* Offset so anchor targets clear the fixed header */
  scroll-padding-top: 6.5rem;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

body {
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  /* The page-long gradient: black at the top, green-tinted at the
     bottom. Sections layer their own translucent tint on top. */
  background:
    radial-gradient(
      1200px 600px at 50% -10%,
      rgba(74, 222, 128, 0.1),
      transparent 70%
    ),
    linear-gradient(180deg, var(--bg-0) 0%, var(--bg-1) 45%, var(--bg-3) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* Faint CRT scanlines over the whole page. Pointer-events off so it
   never eats a click. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  background: repeating-linear-gradient(
    180deg,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.16) 3px,
    rgba(0, 0, 0, 0.16) 4px
  );
  opacity: 0.4;
  mix-blend-mode: multiply;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hi);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

img,
svg {
  max-width: 100%;
  display: block;
}

::selection {
  background: var(--accent);
  color: #040906;
}

/* Scrollbar ------------------------------------------------- */
* {
  scrollbar-color: var(--stroke) transparent;
  scrollbar-width: thin;
}

::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--bg-0);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--accent-deep), var(--stroke));
  border-radius: 99px;
  border: 3px solid var(--bg-0);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-deep);
}

/* Skip link ------------------------------------------------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10000;
  background: var(--accent);
  color: #040906;
  padding: 0.75rem 1.25rem;
  font-weight: 700;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

/* ============================================================
   Header
   ============================================================ */

.header {
  position: fixed;
  inset: 0 0 auto 0;
  /* Clears the notch/status bar on phones; 0 everywhere else. */
  padding-top: calc(0.9rem + env(safe-area-inset-top, 0px));
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem var(--gutter);
  background: rgba(4, 9, 6, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--stroke-soft);
}

.logo {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.logo .prompt {
  color: var(--accent);
}

.logo:hover {
  color: var(--accent-hi);
}

.navbar {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.navbar a {
  font-size: 0.875rem;
  color: var(--muted);
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: color 0.2s, border-color 0.2s;
}

.navbar a::before {
  content: "./";
  color: var(--dim);
}

.navbar a:hover,
.navbar a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--stroke);
  border-radius: 6px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.875rem;
  padding: 0.45rem 0.7rem;
  cursor: pointer;
}

.menu-toggle:hover {
  border-color: var(--accent);
}

/* ============================================================
   Shared layout + typography
   ============================================================ */

section {
  padding: 6rem var(--gutter);
  scroll-margin-top: 5rem;
}

.wrap {
  max-width: var(--maxw);
  margin-inline: auto;
}

.alt-bg {
  background: rgba(7, 21, 16, 0.55);
  border-block: 1px solid var(--stroke-soft);
}

/* Section heading, rendered as a shell prompt */
.heading {
  font-size: clamp(1.4rem, 3.4vw, 2.1rem);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
  overflow-wrap: break-word;
}

.heading .prompt {
  color: var(--accent);
}

.heading .path {
  color: var(--dim);
}

.heading-sub {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 3rem;
}

.heading-sub::before {
  content: "# ";
  color: var(--dim);
}

/* Blinking cursor */
.cursor {
  display: inline-block;
  width: 0.6em;
  height: 1.05em;
  vertical-align: text-bottom;
  background: var(--accent);
  margin-left: 0.15em;
  animation: blink 1.1s steps(2, start) infinite;
}

@keyframes blink {
  to {
    visibility: hidden;
  }
}

/* ============================================================
   Home / hero
   ============================================================ */

.home {
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding-top: 8rem;
}

.home .wrap {
  width: 100%;
}

/* The hero is a terminal window */
.terminal {
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  background: linear-gradient(
    160deg,
    rgba(4, 9, 6, 0.95) 0%,
    rgba(10, 29, 21, 0.95) 100%
  );
  box-shadow: var(--glow);
  overflow: hidden;
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.9rem;
  background: rgba(15, 33, 24, 0.9);
  border-bottom: 1px solid var(--stroke);
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex: none;
}

.dot.r {
  background: #3f1d1d;
  box-shadow: inset 0 0 0 1px #6b2b2b;
}

.dot.y {
  background: #3f341d;
  box-shadow: inset 0 0 0 1px #6b5a2b;
}

.dot.g {
  background: #1d3f2a;
  box-shadow: inset 0 0 0 1px var(--stroke);
}

.terminal-title {
  margin-left: 0.5rem;
  font-size: 0.78rem;
  color: var(--dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.terminal-body {
  padding: clamp(1.25rem, 3.5vw, 2.5rem);
}

.cmd {
  color: var(--muted);
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
}

.cmd .prompt {
  color: var(--accent);
  margin-right: 0.5ch;
}

.home h1 {
  font-size: clamp(2rem, 6.5vw, 3.75rem);
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -0.02em;
  overflow-wrap: break-word;
}

.home h1 .grad {
  background: linear-gradient(90deg, var(--accent-hi) 0%, #15803d 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.home h2 {
  font-size: clamp(0.95rem, 2.6vw, 1.35rem);
  font-weight: 500;
  color: var(--muted);
  margin: 0.75rem 0 1.5rem;
  overflow-wrap: break-word;
}

.home h2 .accent {
  color: var(--accent);
}

.home .intro {
  font-size: 0.95rem;
  color: var(--text);
  max-width: 68ch;
}

.home .intro + .intro {
  margin-top: 0.9rem;
}

/* Key/value facts under the intro */
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.5rem 2rem;
  margin: 2rem 0 0;
  font-size: 0.85rem;
  list-style: none;
}

.facts li {
  display: flex;
  gap: 0.75rem;
  border-top: 1px solid var(--stroke-soft);
  padding-top: 0.5rem;
  overflow-wrap: anywhere;
}

.facts .k {
  color: var(--dim);
  flex: none;
}

.facts .v {
  color: var(--text);
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

/* Buttons --------------------------------------------------- */
.btn {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.7rem 1.4rem;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: linear-gradient(180deg, var(--accent) 0%, #22a75a 100%);
  color: #04090e;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
  text-align: center;
}

.btn:hover {
  color: #04090e;
  transform: translateY(-1px);
  box-shadow: 0 0 22px -4px rgba(74, 222, 128, 0.55);
}

.btn.ghost {
  background: transparent;
  color: var(--accent);
  border-color: var(--stroke);
}

.btn.ghost:hover {
  color: var(--accent-hi);
  border-color: var(--accent);
  background: rgba(74, 222, 128, 0.07);
}

/* Social icons ---------------------------------------------- */
.social-icons {
  display: flex;
  gap: 0.6rem;
  margin-top: 1.75rem;
  flex-wrap: wrap;
}

.social-icons a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--stroke);
  border-radius: 6px;
  color: var(--muted);
  transition: color 0.2s, border-color 0.2s, transform 0.15s,
    box-shadow 0.2s;
}

.social-icons a:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 0 18px -4px rgba(74, 222, 128, 0.5);
}

.social-icons svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

/* ============================================================
   About
   ============================================================ */

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 3rem;
  align-items: start;
}

.about-body p + p {
  margin-top: 1.1rem;
}

.about-body p {
  font-size: 0.95rem;
  overflow-wrap: break-word;
}

/* The "stack" side panel, styled as command output */
.panel {
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  background: rgba(15, 33, 24, 0.5);
  padding: 1.5rem;
  min-width: 0;
}

.panel h3 {
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 1rem;
  font-weight: 600;
}

.panel h3 + .panel-group {
  margin-top: 0;
}

.panel-group {
  margin-top: 1.4rem;
}

.panel-group .label {
  font-size: 0.75rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
}

.tags li {
  font-size: 0.75rem;
  color: var(--text);
  border: 1px solid var(--stroke);
  border-radius: 4px;
  padding: 0.25rem 0.55rem;
  background: rgba(74, 222, 128, 0.05);
  overflow-wrap: anywhere;
}

/* ============================================================
   Experience — cards come from expand.css; these are additions
   ============================================================ */

/* Card chrome (background, border, radius, grid) comes from expand.css, which
   is loaded after this file. These selectors are deliberately one level more
   specific so the gradient wins over expand.css's flat --xp-panel fill. */
.projects-box .project-card,
.experience-container .experience-box {
  background: linear-gradient(
    165deg,
    rgba(15, 33, 24, 0.9) 0%,
    rgba(5, 16, 11, 0.9) 100%
  );
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
}

.projects-box .project-card:hover,
.experience-container .experience-box:hover {
  border-color: var(--accent);
  box-shadow: 0 0 30px -12px rgba(74, 222, 128, 0.55);
  transform: translateY(-2px);
}

.project-card h3,
.experience-box h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

/* Experience cards carry longer copy than project cards, so they get more
   lines before the clamp bites. expand.js re-measures either way. */
.experience-container {
  --xp-lines: 6;
}

.experience-box .role {
  font-size: 0.8rem;
  color: var(--accent);
  margin-bottom: 0.9rem;
  overflow-wrap: break-word;
}

/* Certifications list inside the third box */
.cert-list {
  list-style: none;
  font-size: 0.85rem;
  display: grid;
  gap: 0.7rem;
}

.cert-list li {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
  overflow-wrap: anywhere;
}

.cert-list .status {
  color: var(--accent);
  flex: none;
}

.cert-list .status.pending {
  color: var(--amber);
}

.cert-list .when {
  display: block;
  color: var(--dim);
  font-size: 0.75rem;
}

/* ============================================================
   Projects — card chrome lives in expand.css
   ============================================================ */

.stack {
  font-size: 0.75rem;
  color: var(--accent);
  margin-bottom: 0.75rem;
  overflow-wrap: anywhere;
}

.card-links {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: auto;
}

.repo-none {
  font-size: 0.75rem;
  color: var(--dim);
  align-self: center;
}

/* ============================================================
   Contact
   ============================================================ */

.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 3rem;
  align-items: start;
}

.contact-aside p {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
}

.contact-aside .direct {
  font-size: 0.85rem;
  display: grid;
  gap: 0.6rem;
  list-style: none;
}

.contact-aside .direct li {
  overflow-wrap: anywhere;
}

.contact-aside .direct .k {
  color: var(--dim);
  margin-right: 0.5rem;
}

/* Form, styled as a terminal window */
#contactForm {
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  background: rgba(15, 33, 24, 0.4);
  padding: clamp(1.25rem, 3vw, 2rem);
  display: grid;
  gap: 1.1rem;
}

.field {
  display: grid;
  gap: 0.4rem;
  min-width: 0;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1.1rem;
}

.field label {
  font-size: 0.78rem;
  color: var(--muted);
}

.field label .req {
  color: var(--accent);
}

#contactForm input,
#contactForm textarea {
  width: 100%;
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--text);
  background: rgba(4, 9, 6, 0.75);
  border: 1px solid var(--stroke-input);
  border-radius: 6px;
  padding: 0.75rem 0.9rem;
  resize: vertical;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#contactForm input::placeholder,
#contactForm textarea::placeholder {
  color: var(--dim);
}

#contactForm input:focus,
#contactForm textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.13);
}

#contactForm input[aria-invalid="true"],
#contactForm textarea[aria-invalid="true"] {
  border-color: #f87171;
}

.field-error {
  font-size: 0.72rem;
  color: #fca5a5;
  min-height: 0;
}

.field-error:empty {
  display: none;
}

/* Honeypot — hidden from humans, visible to naive bots */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  justify-content: space-between;
}

#submitBtn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Status line, written like shell output */
.form-status {
  font-size: 0.82rem;
  min-height: 1.4em;
  overflow-wrap: anywhere;
}

.form-status[data-state="ok"] {
  color: var(--accent);
}

.form-status[data-state="err"] {
  color: #fca5a5;
}

.form-status[data-state="busy"] {
  color: var(--muted);
}

.form-status:not(:empty)::before {
  content: "→ ";
  color: var(--dim);
}

/* ============================================================
   Legal / prose pages (privacy.html)
   ============================================================ */

.legal {
  padding-top: 8rem;
}

.legal .wrap {
  max-width: 76ch;
}

.legal .updated {
  font-size: 0.8rem;
  color: var(--dim);
  margin-bottom: 3rem;
}

.legal h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 2.75rem 0 0.9rem;
  overflow-wrap: break-word;
}

.legal h3::before {
  content: "## ";
  color: var(--accent);
}

.legal h3:first-of-type {
  margin-top: 0;
}

.legal p,
.legal li {
  font-size: 0.9rem;
  overflow-wrap: break-word;
}

.legal p + p {
  margin-top: 0.9rem;
}

.legal ul {
  list-style: none;
  margin: 0.9rem 0;
  display: grid;
  gap: 0.6rem;
}

.legal ul li {
  padding-left: 1.4rem;
  position: relative;
}

.legal ul li::before {
  content: "-";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.legal .lead {
  color: var(--muted);
}

/* Key/value rows: what is collected, and why */
.legal dl {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  margin: 1.1rem 0;
  border-top: 1px solid var(--stroke-soft);
  padding-top: 1.1rem;
}

.legal dt {
  font-size: 0.82rem;
  color: var(--accent);
  overflow-wrap: anywhere;
}

.legal dd {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0.3rem 0 0;
  overflow-wrap: break-word;
}

.legal dl > div {
  border-bottom: 1px solid var(--stroke-soft);
  padding-bottom: 1rem;
  min-width: 0;
}

.legal dl > div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

/* Callout for the short summary at the top */
.legal .summary {
  border: 1px solid var(--stroke);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: rgba(15, 33, 24, 0.5);
  padding: 1.35rem 1.5rem;
  margin-bottom: 3rem;
}

.legal .summary p {
  font-size: 0.88rem;
}

.legal a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.back-link {
  display: inline-block;
  margin-top: 3.5rem;
  font-size: 0.85rem;
}

.back-link::before {
  content: "$ cd ";
  color: var(--dim);
}

/* Small privacy line under the contact form */
.form-note {
  font-size: 0.75rem;
  color: var(--dim);
  margin-top: -0.3rem;
}

.form-note a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.form-note a:hover {
  color: var(--accent);
}

/* ============================================================
   Footer
   ============================================================ */

.footer {
  padding: 3rem var(--gutter);
  border-top: 1px solid var(--stroke-soft);
  background: rgba(4, 9, 6, 0.6);
}

.footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: center;
  justify-content: space-between;
}

.footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  font-size: 0.82rem;
}

.footer nav a {
  color: var(--muted);
}

.footer nav a:hover {
  color: var(--accent);
}

.footer .social-icons {
  margin-top: 0;
}

.copyright {
  font-size: 0.78rem;
  color: var(--dim);
  width: 100%;
  overflow-wrap: anywhere;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 900px) {
  .about-grid,
  .contact-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 2rem;
  }
}

@media (max-width: 780px) {
  .menu-toggle {
    display: block;
  }

  .navbar {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.5rem var(--gutter) 1.25rem;
    background: rgba(4, 9, 6, 0.97);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--stroke);
    display: none;
  }

  .navbar.active {
    display: flex;
  }

  .navbar a {
    padding: 0.85rem 0;
    font-size: 0.95rem;
    border-bottom: 1px solid var(--stroke-soft);
  }

  section {
    padding: 4rem var(--gutter);
  }

  .home {
    padding-top: 7rem;
  }
}
