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

@keyframes fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

/* Subtle phosphor flicker — analog refresh irregularity */
@keyframes flicker {
  0%   { opacity: 1; }
  2%   { opacity: 0.96; }
  4%   { opacity: 1; }
  52%  { opacity: 1; }
  54%  { opacity: 0.97; }
  56%  { opacity: 1; }
  100% { opacity: 1; }
}

/* Skip-to-content link — visible on keyboard focus, hidden otherwise */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  padding: 0.5rem 1.25rem;
  background: var(--accent);
  color: var(--bg);
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-decoration: none;
  text-transform: uppercase;
  z-index: 10000;
}

.skip-link:focus {
  top: 0;
}

/* Focus indicators — visible for all keyboard/assistive-tech users */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

:root {
  --font-heading: 'IBM Plex Mono', 'Courier New', monospace;
  --font-body: 'IBM Plex Mono', 'Courier New', monospace;
  --bg: #080600;
  --surface: #0d0a00;
  --border: #3a2c00;
  --accent: #ffb300;
  --accent-hover: #ffc840;
  --accent-glow: rgba(255, 179, 0, 0.2);
  --text: #d4940a;
  --muted: #a07030;
  --radius: 0px;
  --radius-sm: 0px;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  /* Global phosphor bloom — all text has slight amber glow like lit phosphor */
  text-shadow: 0 0 4px rgba(255, 179, 0, 0.2);
}

/* CRT scanlines — horizontal raster lines of a phosphor display */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0, 0, 0, 0.22) 3px,
    rgba(0, 0, 0, 0.22) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

/* CRT vignette — screen darker at edges */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 62%, rgba(0, 0, 0, 0.4) 100%);
  pointer-events: none;
  z-index: 9998;
}

main {
  max-width: 720px;
  width: 100%;
  will-change: opacity, transform;
  animation: fade-up 0.45s cubic-bezier(0.25, 1, 0.5, 1) both;
}

/* Flicker only on the landing page — resume is a document, not a terminal session */
main.flicker {
  animation:
    fade-up 0.45s cubic-bezier(0.25, 1, 0.5, 1) both,
    flicker 9s 0.5s linear infinite;
}

header {
  text-align: center;
  margin-bottom: 3rem;
}

header h1 {
  font-family: var(--font-heading);
  font-size: clamp(3rem, 12vw, 8rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  color: var(--accent);
  text-shadow:
    0 0 10px rgba(255, 179, 0, 0.9),
    0 0 30px rgba(255, 179, 0, 0.5),
    0 0 70px rgba(255, 179, 0, 0.2);
}

/* Terminal prompt prefix */
header h1::before {
  content: '> ';
  color: var(--accent);
  opacity: 0.45;
}

/* Blinking cursor — stops after 5 blinks then stays solid, like a real terminal */
header h1::after {
  content: '_';
  animation: blink 1.2s step-end 5;
  animation-fill-mode: forwards;
}

/* Surname hidden on narrow viewports — first name fills the hero at large size */
.name-suffix {
  display: none;
}

@media (min-width: 640px) {
  header h1 {
    font-size: clamp(2rem, 5.5vw, 3.5rem);
  }

  .name-suffix {
    display: inline;
  }
}

/* Index styles */
.tagline {
  margin-top: 0.75rem;
  color: var(--muted);
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.cards {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.card:hover,
.card:focus-visible {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  box-shadow: none;
  text-shadow: none;
}


.card:hover p,
.card:focus-visible p {
  color: var(--bg);
  opacity: 0.75;
}



.card:active {
  background: var(--accent-hover);
  transition-duration: 0.05s;
}

.card:focus-visible {
  outline-offset: 2px;
}

/* Offline / unavailable card variant — dimmed via color, not opacity, to preserve contrast */
.card--offline {
  border-color: rgba(58, 44, 0, 0.55); /* border fades without dragging down text contrast */
}

.card--offline h2 {
  color: var(--muted); /* match body copy level rather than full accent/text brightness */
}

.card--offline:hover,
.card--offline:focus-visible {
  background: var(--surface);
  color: inherit;
  border-color: var(--muted);
  box-shadow: none;
  text-shadow: inherit;
}

.card--offline:hover p,
.card--offline:focus-visible p {
  color: var(--muted);
  opacity: 1;
}

.card h2 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 0.25rem;
}

.card p {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.5;
  overflow-wrap: break-word;
}

/* Shared page styles */
.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem;
  align-self: flex-start; /* Anchor to top; don't float on tall viewports */
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--accent);
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 2rem;
  min-height: 44px;
  padding-inline: 0.25rem;
  transition: color 0.15s;
}

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

.page h1 {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 0.5rem;
}

.page .subtitle {
  color: var(--muted);
  margin-bottom: 2.5rem;
}

.page .subtitle a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s;
  padding-block: 0.75rem; /* 44px minimum touch target */
  display: inline-block;
}

.page .subtitle a:hover {
  color: var(--accent-hover);
}

/* Resume styles */
.section-body {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--muted);
  overflow-wrap: break-word;
}

.skill-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.skill-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: baseline;
}

.skill-label {
  font-size: 0.85rem;
  color: var(--muted);
  min-width: 200px;
}

.skill-row > span:not(.skill-label) {
  overflow-wrap: break-word;
  min-width: 0;
}

.section {
  margin-bottom: 2.5rem;
}

.section h2 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  text-shadow: 0 0 8px rgba(255, 179, 0, 0.4);
}

/* Terminal comment prefix on section labels */
.section h2::before {
  content: '// ';
  opacity: 0.5;
}

.entry {
  margin-bottom: 1.25rem;
}

.entry-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.entry h3 {
  font-size: 1rem;
  font-weight: 600;
  min-width: 0;
  overflow-wrap: break-word;
}

.entry .date {
  font-size: 0.8rem;
  color: var(--muted);
}

/* Bracketed dates — terminal timestamp style */
.entry .date::before { content: '['; }
.entry .date::after  { content: ']'; }

.entry .org {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
}

/* @ prefix on org/location — like a handle or address */
.entry .org::before {
  content: '@ ';
  color: var(--accent);
  opacity: 0.7;
}

.entry ul {
  padding-left: 1.5rem;
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--muted);
  overflow-wrap: break-word;
  list-style: none;
}

/* Terminal prompt character as list bullet */
.entry ul li {
  position: relative;
}

.entry ul li::before {
  content: '>';
  position: absolute;
  left: -1.25rem;
  color: var(--accent);
  opacity: 0.6;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  background: var(--border);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.65rem;
  font-size: 0.8rem;
  color: var(--text);
}

/* Terminal session log — offline / status pages */
.terminal-log {
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 2.2;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 1.5rem 1.75rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Projects styles */
.project-grid {
  display: grid;
  gap: 1.25rem;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.project-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 14px var(--accent-glow);
}

.project-card h2 {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.project-card .tags {
  margin-bottom: 0.75rem;
}

.project-card p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 1rem;
  overflow-wrap: break-word;
}

.project-links {
  display: flex;
  gap: 0.75rem;
}

.project-links a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 0.5rem 0.25rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  transition: color 0.15s;
}

.project-links a:hover { color: var(--accent-hover); }

/* Resume page — body copy in sans-serif; terminal chrome stays monospace */
.section-body,
.entry ul,
.skill-row > span:not(.skill-label) {
  font-family: 'IBM Plex Sans', sans-serif;
}

/* Resume page — back/print action bar */
.page-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.page-actions .back {
  margin-bottom: 0;
}

.print-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: none;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-transform: uppercase;
}

.print-btn:hover {
  background: var(--accent);
  color: var(--bg);
}

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  main,
  main.flicker {
    animation: none;
  }

  header h1::after {
    animation: none;
  }

  .card {
    transition: border-color 0.15s;
  }

  .project-card {
    transition: border-color 0.15s;
  }

  .project-card:hover {
    box-shadow: none;
  }

  .back,
  .project-links a {
    transition: color 0.15s;
  }
}

/* Mobile — tighten spacing once content naturally fills narrow viewports */
@media (max-width: 560px) {
  body {
    padding: 1.25rem;
  }

  .page {
    padding: 1.25rem;
  }

  .skill-label {
    min-width: 130px;
    font-size: 0.8rem;
  }
}

/* Print — resume should be readable on paper */
@page {
  margin: 0.5in 0.75in;
  @top-left      { content: ""; }
  @top-center    { content: ""; }
  @top-right     { content: ""; }
  @bottom-left   { content: ""; }
  @bottom-center { content: ""; }
  @bottom-right  { content: ""; }
}

@media print {
  :root {
    --bg: white;
    --surface: white;
    --border: #c8d4df;
    --text: #111;
    --muted: #444;
    --accent: #1a3a5c;
    --accent-hover: #1a3a5c;
  }

  body {
    display: block;
    padding: 0;
    min-height: auto;
    font-size: 11pt;
    background: white;
    color: #111;
  }

  body::before,
  body::after {
    display: none;
  }

  * {
    text-shadow: none !important;
    animation: none !important;
  }

  .page {
    max-width: none;
    padding: 0;
    margin: 0;
  }

  .skip-link,
  .back,
  .page-actions {
    display: none;
  }

  /* Remove touch-target padding from subtitle links — not needed in print */
  .page .subtitle a {
    padding-block: 0;
  }

  /* Remove decorative chrome */
  .card,
  .project-card {
    box-shadow: none;
    border-color: #ddd;
  }

  /* Name header: navy underline separator */
  .page h1 {
    font-size: 18pt;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding-bottom: 0.3rem;
    border-bottom: 2px solid #1a3a5c;
    margin-bottom: 0.4rem;
  }

  /* Keep section heading with the first entry below it */
  .section h2 {
    font-weight: 700;
    border-bottom-width: 1.5px;
    border-bottom-color: #1a3a5c;
    margin-bottom: 0.75rem;
    break-after: avoid;
    page-break-after: avoid;
  }

  /* Prevent page break between a section heading and its first entry */
  .section h2 + .entry {
    break-before: avoid;
    page-break-before: avoid;
  }

  /* Prevent entries from splitting mid-content across pages */
  .entry {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  /* Job titles in accent navy */
  .entry h3 {
    color: #1a3a5c;
  }

  /* Remove default paragraph margins that create large gaps between sections */
  p {
    margin: 0;
  }

  /* Suppress terminal chrome decorations in print */
  .section h2::before,
  .entry .org::before,
  .entry ul li::before,
  .card .icon::before {
    content: none;
  }

  .entry .date::before,
  .entry .date::after {
    content: none;
  }

  /* Restore standard list style for print */
  .entry ul {
    list-style: disc;
    padding-left: 1.25rem;
  }

  .entry ul li::before {
    display: none;
  }

  /* Links: show href for external links, suppress for tel/mailto/subtitle */
  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #555;
  }

  a[href^="tel"]::after,
  a[href^="mailto"]::after,
  .subtitle a::after {
    content: none;
  }
}
