/* ================================================================
   Keagan Ball - Portfolio v3
   Infrastructure & Automation Engineer
   ================================================================ */

/* ---- Design Tokens ---- */
:root {
  /* Backgrounds */
  --bg-0:   #0d1117;
  --bg-1:   #161b22;
  --bg-2:   #1c2128;
  --bg-3:   #22272e;
  --bg-4:   #2d333b;

  /* Glass */
  --glass:        rgba(22, 27, 34, 0.72);
  --glass-border: rgba(48, 54, 61, 0.55);
  --glass-shine:  rgba(255, 255, 255, 0.04);

  /* Borders */
  --border:        #30363d;
  --border-subtle: #21262d;

  /* Text */
  --t1: #e6edf3;
  --t2: #8b949e;
  --t3: #656d76;
  --t4: #3d444d;

  /* Accent palette */
  --blue:   #58a6ff;
  --green:  #3fb950;
  --teal:   #39d353;
  --amber:  #d29922;
  --purple: #bc8cff;
  --red:    #f85149;
  --orange: #e3b341;

  /* Terminal-specific */
  --bash-prompt:  #3fb950;
  --ps-prompt:    #bc8cff;
  --t-cmd:        #e6edf3;
  --t-out:        #8b949e;
  --t-comment:    #4b5563;
  --t-string:     #a5d6ff;
  --t-flag:       #79c0ff;
  --t-keyword:    #ff7b72;
  --t-value:      #ffa657;

  /* Typography */
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', ui-monospace, monospace;

  /* Layout */
  --nav-h:    60px;
  --max-w:    1100px;
  --pad-x:    clamp(16px, 4vw, 40px);
  --sec-py:   clamp(72px, 10vw, 128px);

  /* Radii */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 24px;

  /* Shadows */
  --sh-sm:    0 1px 3px rgba(0,0,0,.5);
  --sh-md:    0 4px 20px rgba(0,0,0,.6);
  --sh-lg:    0 12px 48px rgba(0,0,0,.75);
  --sh-blue:  0 0 24px rgba(88,166,255,.12);
  --sh-green: 0 0 24px rgba(63,185,80,.12);

  /* Easing */
  --ease:     cubic-bezier(.16,1,.3,1);
  --ease-out: cubic-bezier(0,0,.2,1);
  --t-fast:   120ms;
  --t-mid:    220ms;
  --t-slow:   380ms;
}

/* ================================================================
   RESET & BASE
   ================================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg-0);
  color: var(--t1);
  font-family: var(--sans);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a              { color: var(--blue); text-decoration: none; }
a:hover        { text-decoration: underline; }
img            { max-width: 100%; display: block; }
ul             { list-style: none; }
button         { font-family: inherit; }
::selection    { background: rgba(88,166,255,.25); }

/* ================================================================
   TYPOGRAPHY UTILITIES
   ================================================================ */
.mono { font-family: var(--mono); }

.label {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: .6rem;
}

.section-title {
  font-size: clamp(1.65rem, 4vw, 2.3rem);
  font-weight: 700;
  color: var(--t1);
  line-height: 1.15;
  letter-spacing: -.02em;
  margin-bottom: 1rem;
}

.section-sub {
  font-size: 1rem;
  color: var(--t2);
  max-width: 520px;
  line-height: 1.75;
}

/* ================================================================
   LAYOUT
   ================================================================ */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--pad-x);
}

.container-wide {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--pad-x);
}

section { padding: var(--sec-py) 0; }

.section-header {
  margin-bottom: clamp(40px, 7vw, 72px);
}
.section-header::after {
  content: '';
  display: block;
  width: 36px;
  height: 2px;
  background: var(--blue);
  margin-top: 1.1rem;
  border-radius: 2px;
}

/* ================================================================
   GLASS CARDS
   ================================================================ */
.glass-card {
  background: var(--glass);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-md);
  position: relative;
  overflow: hidden;
}

.glass-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--glass-shine) 0%, transparent 60%);
  pointer-events: none;
  border-radius: inherit;
}

/* ================================================================
   BUTTONS
   ================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .58rem 1.3rem;
  border-radius: var(--r-sm);
  font-size: .875rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
  text-decoration: none;
  transition:
    background  var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease),
    color        var(--t-fast) var(--ease),
    box-shadow   var(--t-fast) var(--ease),
    transform    var(--t-fast) var(--ease);
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--blue);
  color: #0d1117;
  border-color: var(--blue);
  font-weight: 600;
}
.btn-primary:hover {
  background: #79bcff;
  border-color: #79bcff;
  box-shadow: 0 0 20px rgba(88,166,255,.3);
}

.btn-outline {
  background: transparent;
  color: var(--t1);
  border-color: var(--border);
}
.btn-outline:hover {
  background: var(--bg-2);
  border-color: var(--blue);
  color: var(--blue);
}

.btn-ghost {
  background: transparent;
  color: var(--t2);
  border-color: transparent;
  padding: .58rem .8rem;
}
.btn-ghost:hover { color: var(--t1); background: var(--bg-2); }

.btn-sm {
  padding: .38rem .85rem;
  font-size: .8rem;
}

/* ================================================================
   NAVIGATION
   ================================================================ */
#nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 1000;
  background: rgba(13,17,23,.82);
  backdrop-filter: blur(16px) saturate(1.5);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  border-bottom: 1px solid var(--border-subtle);
  transition: border-color var(--t-mid), background var(--t-mid);
}
#nav.scrolled { border-bottom-color: var(--border); }

.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--pad-x);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav-logo {
  font-family: var(--mono);
  font-size: .95rem;
  font-weight: 700;
  color: var(--t1);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-shrink: 0;
  letter-spacing: -.01em;
}
.nav-logo:hover { color: var(--blue); text-decoration: none; }
.nav-logo .bracket { color: var(--blue); }

.nav-links {
  display: flex;
  align-items: center;
  gap: .1rem;
}

.nav-links a {
  font-size: .825rem;
  font-weight: 500;
  color: var(--t2);
  padding: .4rem .75rem;
  border-radius: var(--r-sm);
  text-decoration: none;
  transition: color var(--t-fast), background var(--t-fast);
}
.nav-links a:hover { color: var(--t1); background: rgba(255,255,255,.06); }
.nav-links a.active { color: var(--blue); }

.nav-right {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-shrink: 0;
}

.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: .5rem;
  border-radius: var(--r-sm);
}
.nav-hamburger span {
  display: block;
  width: 20px;
  height: 1.5px;
  background: var(--t2);
  border-radius: 2px;
  transition: all var(--t-mid) var(--ease);
}
.nav-hamburger:hover span   { background: var(--t1); }
.nav-hamburger.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

.nav-mobile {
  display: none;
  position: fixed;
  top: var(--nav-h); left: 0; right: 0;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  padding: 1rem var(--pad-x) 1.5rem;
  z-index: 999;
  flex-direction: column;
  gap: .2rem;
}
.nav-mobile.open { display: flex; }
.nav-mobile a {
  font-size: .9rem;
  color: var(--t2);
  padding: .65rem .75rem;
  border-radius: var(--r-sm);
  text-decoration: none;
  transition: all var(--t-fast);
}
.nav-mobile a:hover { color: var(--t1); background: var(--bg-2); }
.nav-mobile hr { border: none; border-top: 1px solid var(--border); margin: .5rem 0; }

/* ================================================================
   FOOTER
   ================================================================ */
footer {
  border-top: 1px solid var(--border-subtle);
  padding: 2rem 0;
  font-size: .8rem;
  color: var(--t3);
}
.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--pad-x);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.footer-logo {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--t2);
}
.footer-links { display: flex; gap: 1.25rem; }
.footer-links a {
  color: var(--t3);
  font-size: .78rem;
  text-decoration: none;
  transition: color var(--t-fast);
}
.footer-links a:hover { color: var(--blue); }

/* ================================================================
   PAGE HEADER (inner pages)
   ================================================================ */
.page-header {
  padding: calc(var(--nav-h) + 48px) 0 64px;
  border-bottom: 1px solid var(--border-subtle);
}
.page-header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--pad-x);
}
.page-eyebrow {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: .75rem;
}
.page-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  color: var(--t1);
  line-height: 1.1;
  letter-spacing: -.025em;
  margin-bottom: .75rem;
}
.page-sub {
  font-size: 1.05rem;
  color: var(--t2);
  max-width: 560px;
  line-height: 1.7;
}

/* ================================================================
   TERMINAL COMPONENT
   ================================================================ */
.terminal {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);

  width: 100%;
  max-width: 100%;
  min-width: 0;

  overflow: hidden;

  box-shadow: var(--sh-lg);
  font-family: var(--mono);
  font-size: .84rem;

  contain: layout inline-size;
}

.terminal-bar {
  background: var(--bg-3);
  padding: .55rem 1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  border-bottom: 1px solid var(--border);
  user-select: none;
}

.t-dot {
  width: 11px; height: 11px;
  border-radius: 50%;
}
.t-dot.red    { background: #ff5f57; }
.t-dot.yellow { background: #febc2e; }
.t-dot.green  { background: #28c840; }

.terminal-bar-spacer { flex: 1; }

/* Bash/PS toggle tabs */
.t-tabs {
  display: flex;
  gap: 2px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  padding: 2px;
}
.t-tab {
  font-family: var(--mono);
  font-size: .7rem;
  padding: .2rem .6rem;
  border: none;
  background: transparent;
  color: var(--t3);
  border-radius: 3px;
  cursor: pointer;
  transition: all var(--t-fast);
  letter-spacing: .04em;
}
.t-tab:hover { color: var(--t2); background: var(--bg-3); }
.t-tab.active {
  background: var(--bg-4);
  color: var(--t1);
}
.t-tab.bash.active  { color: var(--bash-prompt); }
.t-tab.ps.active    { color: var(--ps-prompt); }

.terminal-title {
  font-size: .7rem;
  color: var(--t3);
  margin-left: .25rem;
}

/* Terminal body - height is set by JS before animation starts (pre-sized to exact content).
   NO transition: height must snap to the pre-computed value immediately so it never
   expands during typing. overflow:hidden clips any content that exceeds the set height. */
.terminal-body {
  padding: 1.1rem 1.4rem;
  line-height: 1.75;

  overflow-x: hidden;
  overflow-y: hidden;

  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Terminal line types. */
.t-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);

  align-items: start;

  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.t-prompt-bash,
.t-prompt-ps {
  white-space: nowrap;
  flex-shrink: 0;
}

.t-prompt-bash {
  color: var(--bash-prompt);
}

.t-prompt-ps {
  color: var(--ps-prompt);
}

.t-cmd {
  color: var(--t-cmd);

  flex: 1;
  min-width: 0;

  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.t-flag   { color: var(--t-flag); }
.t-string { color: var(--t-string); }
.t-value  { color: var(--t-value); }
.t-kw     { color: var(--t-keyword); }
.t-comment{ color: var(--t-comment); font-style: italic; }

.t-out-line {
  color: var(--t-out);
  display: block;
  word-break: break-word;
}
.t-out-line.dim     { color: var(--t4); }
.t-out-line.success { color: var(--green); }
.t-out-line.warn    { color: var(--amber); }
.t-out-line.err     { color: var(--red); }
.t-out-line.accent  { color: var(--blue); }
/* header: colour + underline only - no extra margin that would break line-height math */
.t-out-line.header  { color: var(--t2); border-bottom: 1px solid var(--border-subtle); }

.t-spacer { height: .5rem; }

.cursor {
  display: inline-block;
  width: 8px; height: 1.05em;
  background: var(--teal);
  vertical-align: text-bottom;
  border-radius: 1px;
  animation: blink 1.1s step-end infinite;
  margin-left: 2px;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }

/* ================================================================
   STATUS INDICATORS
   ================================================================ */
.status-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.running { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot.idle    { background: var(--amber); }
.status-dot.stopped { background: var(--t4); }
.status-dot.error   { background: var(--red); box-shadow: 0 0 6px var(--red); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .04em;
  padding: .2rem .6rem;
  border-radius: 100px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-green  { background: rgba(63,185,80,.1);  border-color: rgba(63,185,80,.3);  color: var(--green); }
.badge-blue   { background: rgba(88,166,255,.1); border-color: rgba(88,166,255,.3); color: var(--blue);  }
.badge-amber  { background: rgba(210,153,34,.1); border-color: rgba(210,153,34,.3); color: var(--amber); }
.badge-purple { background: rgba(188,140,255,.1);border-color: rgba(188,140,255,.3);color: var(--purple);}
.badge-red    { background: rgba(248,81,73,.1);  border-color: rgba(248,81,73,.3);  color: var(--red);   }

/* ================================================================
   TAGS / PILLS
   ================================================================ */
.tag {
  font-family: var(--mono);
  font-size: .7rem;
  background: var(--bg-0);
  border: 1px solid var(--border-subtle);
  color: var(--t3);
  padding: .22rem .6rem;
  border-radius: var(--r-xs);
  transition: all var(--t-fast);
}
.tag:hover { border-color: var(--blue); color: var(--blue); }

.tag-group {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}

/* ================================================================
   SCROLL TO TOP
   ================================================================ */
.scroll-top {
  position: fixed;
  bottom: 1.75rem; right: 1.75rem;
  width: 38px; height: 38px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--t3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .95rem;
  transition: all var(--t-fast);
  opacity: 0;
  pointer-events: none;
  z-index: 99;
}
.scroll-top.visible { opacity: 1; pointer-events: all; }
.scroll-top:hover   { border-color: var(--blue); color: var(--blue); transform: translateY(-2px); }

/* ================================================================
   HOME - HERO
   ================================================================ */
#hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: calc(var(--nav-h) + 32px) 0 80px;
  position: relative;
  overflow: hidden;
}

/* Dot grid background */
#hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(48,54,61,.8) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: .5;
  pointer-events: none;
}
/* Fade bottom */
#hero::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 220px;
  background: linear-gradient(transparent, var(--bg-0));
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;

  width: min(100%, 820px);
  max-width: 820px;
  min-width: 0;

  margin: 0 auto;
  padding: 0 var(--pad-x);

  display: flex;
  flex-direction: column;
  gap: 2.75rem;
}

/* Terminal sits at the top - full width, height-locked */
.hero-terminal {
  width: 100%;
}

/* Content sits below the terminal */
.hero-content { }

.hero-eyebrow {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--green);
  letter-spacing: .1em;
  margin-bottom: .85rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.hero-eyebrow::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

.hero-name {
  font-size: clamp(2.6rem, 6vw, 4.2rem);
  font-weight: 800;
  color: var(--t1);
  line-height: 1.05;
  letter-spacing: -.03em;
  margin-bottom: .5rem;
}

.hero-title {
  font-family: var(--mono);
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: var(--blue);
  margin-bottom: 1.5rem;
}

.hero-summary {
  font-size: 1rem;
  color: var(--t2);
  max-width: 600px;
  line-height: 1.8;
  margin-bottom: 2rem;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: center;
}

/* ================================================================
   HOME - PHILOSOPHY
   ================================================================ */
#philosophy {
  padding: 96px 0;
  border-top: 1px solid var(--border-subtle);
}

.philosophy-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--pad-x);
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 80px;
  align-items: start;
}

.philosophy-label {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: .75rem;
  position: sticky;
  top: calc(var(--nav-h) + 20px);
}

.philosophy-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--t2);
  margin-bottom: 2rem;
  font-family: var(--mono);
}

.philosophy-body p {
  font-size: 1.08rem;
  color: var(--t2);
  line-height: 1.85;
  margin-bottom: 1.25rem;
}
.philosophy-body p:last-child { margin-bottom: 0; }
.philosophy-body strong { color: var(--t1); font-weight: 600; }

/* ================================================================
   HOME - WHAT I BUILD (Pillars)
   ================================================================ */
#pillars {
  background: var(--bg-1);
  padding: var(--sec-py) 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.pillars-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--border);
}

.pillar {
  background: var(--bg-1);
  padding: 2.5rem 2rem;
  transition: background var(--t-mid);
}
.pillar:hover { background: var(--bg-2); }

.pillar-icon {
  font-size: 1.6rem;
  margin-bottom: 1.25rem;
}

.pillar-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--t1);
  margin-bottom: .6rem;
}

.pillar-desc {
  font-size: .875rem;
  color: var(--t2);
  line-height: 1.7;
}

/* ================================================================
   HOME - CURRENTLY EXPLORING
   ================================================================ */
#exploring {
  padding: var(--sec-py) 0;
}

.exploring-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.explore-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1.35rem 1.5rem;
  transition: border-color var(--t-mid), box-shadow var(--t-mid);
}
.explore-card:hover {
  border-color: var(--blue);
  box-shadow: var(--sh-blue);
}

.explore-icon {
  font-size: 1.3rem;
  margin-bottom: .75rem;
}

.explore-name {
  font-size: .875rem;
  font-weight: 600;
  color: var(--t1);
  margin-bottom: .35rem;
}

.explore-desc {
  font-size: .8rem;
  color: var(--t2);
  line-height: 1.55;
}

.explore-badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: .62rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--amber);
  background: rgba(210,153,34,.1);
  border: 1px solid rgba(210,153,34,.25);
  padding: .1rem .4rem;
  border-radius: 100px;
  margin-top: .65rem;
}

/* ================================================================
   PROJECTS PAGE
   ================================================================ */
.projects-filter {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 2.5rem;
}

.filter-btn {
  font-size: .78rem;
  font-family: var(--mono);
  padding: .35rem .9rem;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--t2);
  cursor: pointer;
  transition: all var(--t-fast);
}
.filter-btn:hover { border-color: var(--blue); color: var(--blue); }
.filter-btn.active { background: var(--blue); border-color: var(--blue); color: #0d1117; font-weight: 600; }

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
}

/* Project card - case study style */
.project-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color var(--t-mid) var(--ease), box-shadow var(--t-mid) var(--ease), transform var(--t-mid) var(--ease);
  position: relative;
}

/* Accent top bar */
.project-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--blue), var(--green));
  opacity: 0;
  transition: opacity var(--t-mid);
}

.project-card:hover {
  border-color: var(--border);
  box-shadow: var(--sh-md);
  transform: translateY(-3px);
}
.project-card:hover::after { opacity: 1; }

.project-card-head {
  padding: 1.5rem 1.5rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .75rem;
}

.project-meta { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

.project-icon { font-size: 1.3rem; }

.project-card-body {
  padding: 1.25rem 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.project-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--t1);
  margin-bottom: .35rem;
}

/* Case study sections */
.project-detail {
  font-size: .82rem;
  color: var(--t2);
  line-height: 1.65;
}

.project-detail-label {
  font-family: var(--mono);
  font-size: .65rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--t3);
  margin-bottom: .3rem;
}

.project-highlights {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  margin-top: .25rem;
}

.project-highlight {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  font-size: .8rem;
  color: var(--t2);
  line-height: 1.5;
}
.project-highlight::before {
  content: '▸';
  color: var(--blue);
  flex-shrink: 0;
  font-size: .7rem;
  margin-top: .1rem;
}

.project-card-foot {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
}

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

.project-link {
  width: 30px; height: 30px;
  border-radius: var(--r-sm);
  background: var(--bg-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--t3);
  transition: all var(--t-fast);
  text-decoration: none;
}
.project-link:hover { border-color: var(--blue); color: var(--blue); text-decoration: none; }

/* ================================================================
   LAB PAGE
   ================================================================ */

/* Topology - full-width elevated card at the top of lab content.
   Strong shadow gives it physical depth above the content below. */
.topology-wrapper {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-top: 2px solid rgba(88,166,255,.28);
  border-radius: var(--r-lg);
  padding: 1.75rem 2rem 1.5rem;
  overflow: hidden;
  position: relative;
  z-index: 1;
  box-shadow:
    0 8px 40px rgba(0,0,0,.55),
    0 2px  8px rgba(0,0,0,.35),
    0 0 0 1px rgba(88,166,255,.07) inset;
  margin-bottom: 2rem;
}

.topology-title {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--t3);
  margin-bottom: 1.1rem;
}

.topology-svg {
  width: 100%;
  height: auto;
}

/* Lower section below topology - services left, mini-info right */
.lab-lower-grid {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 1.5rem;
  align-items: start;
  margin-bottom: 3rem;
}
@media (max-width: 720px) {
  .lab-lower-grid { grid-template-columns: 1fr; }
}

/* Service table */
.services-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.services-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.services-title {
  font-family: var(--mono);
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--t3);
}

.services-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}

.services-table th {
  font-family: var(--mono);
  font-size: .65rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--t3);
  padding: .65rem 1.5rem;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.services-table td {
  padding: .75rem 1.5rem;
  color: var(--t2);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}
.services-table tr:last-child td { border-bottom: none; }
.services-table tr:hover td { background: var(--bg-2); }

.service-name { color: var(--t1); font-weight: 500; }
.service-host { font-family: var(--mono); font-size: .75rem; color: var(--t3); }

/* Spec cards */
.spec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.spec-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1.25rem;
}

.spec-label {
  font-family: var(--mono);
  font-size: .65rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--t3);
  margin-bottom: .5rem;
}

.spec-value {
  font-size: .95rem;
  font-weight: 600;
  color: var(--t1);
  margin-bottom: .25rem;
}

.spec-sub {
  font-size: .75rem;
  color: var(--t3);
  font-family: var(--mono);
}

/* ================================================================
   EXPERIENCE PAGE - TIMELINE
   ================================================================ */
.timeline {
  position: relative;
  padding-left: 24px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0; top: 8px; bottom: 0;
  width: 1px;
  background: linear-gradient(var(--border), transparent);
}

.timeline-item {
  position: relative;
  margin-bottom: 2.5rem;
}
.timeline-item:last-child { margin-bottom: 0; }

.timeline-item::before {
  content: '';
  position: absolute;
  left: -28px;
  top: 8px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--bg-0);
  border: 2px solid var(--border);
  transition: border-color var(--t-mid);
  z-index: 1;
}
.timeline-item:hover::before { border-color: var(--blue); }

.exp-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1.75rem;
  transition: border-color var(--t-mid), box-shadow var(--t-mid);
}
.exp-card:hover {
  border-color: rgba(88,166,255,.35);
  box-shadow: var(--sh-blue);
}

.exp-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: .85rem;
  flex-wrap: wrap;
}

.exp-role {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--t1);
  letter-spacing: -.01em;
}

.exp-company {
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--blue);
  margin-top: .3rem;
}

.exp-date {
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--t3);
  background: var(--bg-2);
  border: 1px solid var(--border-subtle);
  padding: .25rem .65rem;
  border-radius: 100px;
  white-space: nowrap;
}

.exp-summary {
  font-size: .9rem;
  color: var(--t2);
  line-height: 1.75;
  margin-bottom: 1.1rem;
}

.exp-bullets {
  display: flex;
  flex-direction: column;
  gap: .55rem;
  margin-bottom: 1.25rem;
}

.exp-bullet {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  font-size: .875rem;
  color: var(--t2);
  line-height: 1.6;
}
.exp-bullet::before {
  content: '▸';
  color: var(--blue);
  flex-shrink: 0;
  font-size: .7rem;
  margin-top: .18rem;
}

/* ================================================================
   CONTACT PAGE
   ================================================================ */
.contact-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: start;
}

.contact-intro p {
  font-size: 1rem;
  color: var(--t2);
  line-height: 1.8;
  margin-bottom: 1rem;
}

.contact-links {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  margin-top: 2rem;
}

.contact-link {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: 1rem 1.25rem;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  text-decoration: none;
  color: var(--t2);
  transition: all var(--t-fast);
}
.contact-link:hover {
  border-color: var(--blue);
  color: var(--blue);
  box-shadow: var(--sh-blue);
  text-decoration: none;
}

.contact-link-icon {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  background: var(--bg-2);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: .95rem;
  transition: all var(--t-fast);
}
.contact-link:hover .contact-link-icon {
  background: rgba(88,166,255,.1);
  border-color: rgba(88,166,255,.3);
}

.contact-link-body { flex: 1; }
.contact-link-name { font-size: .875rem; font-weight: 600; color: inherit; }
.contact-link-handle { font-family: var(--mono); font-size: .75rem; color: var(--t3); margin-top: .1rem; }
.contact-link-arrow { color: var(--t4); font-size: .8rem; transition: transform var(--t-fast); }
.contact-link:hover .contact-link-arrow { transform: translateX(3px); color: var(--blue); }

/* Contact form card */
.contact-form-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 2rem;
}

.form-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: .35rem;
}
.form-sub { font-size: .82rem; color: var(--t2); margin-bottom: 1.5rem; }

.form-fields { display: flex; flex-direction: column; gap: 1rem; }

.form-group label {
  display: block;
  font-size: .78rem;
  font-weight: 500;
  color: var(--t2);
  margin-bottom: .4rem;
}

.form-input {
  width: 100%;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: .65rem .9rem;
  font-size: .875rem;
  font-family: var(--sans);
  color: var(--t1);
  outline: none;
  resize: vertical;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.form-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(88,166,255,.12);
}
.form-input::placeholder { color: var(--t4); }
textarea.form-input { min-height: 110px; }

/* ================================================================
   ANIMATIONS
   ================================================================ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 6px var(--green); }
  50%       { box-shadow: 0 0 12px var(--green), 0 0 24px rgba(63,185,80,.3); }
}

.fade-up { animation: fadeUp .55s var(--ease) both; }
.fade-in { animation: fadeIn .55s var(--ease) both; }

.hero-eyebrow  { animation-delay: .05s; }
.hero-name     { animation-delay: .12s; }
.hero-title    { animation-delay: .18s; }
.hero-summary  { animation-delay: .24s; }
.hero-cta      { animation-delay: .30s; }

/* ================================================================
   REVEAL ON SCROLL
   ================================================================ */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .5s var(--ease), transform .5s var(--ease);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 960px) {
  .philosophy-inner { grid-template-columns: 1fr; gap: 32px; }
  .philosophy-label { position: static; }
  .lab-grid     { grid-template-columns: 1fr; }
  .contact-layout { grid-template-columns: 1fr; gap: 48px; }
  .pillars-grid { grid-template-columns: 1fr; }
  .pillars-grid .pillar { border-bottom: 1px solid var(--border); }
  .pillars-grid .pillar:last-child { border-bottom: none; }
}

@media (max-width: 768px) {
  .nav-links, .nav-right { display: none; }
  .nav-hamburger { display: flex; }
  .projects-grid { grid-template-columns: 1fr; }
  .footer-inner  { flex-direction: column; text-align: center; }
}

@media (max-width: 480px) {
  .hero-name { font-size: 2.3rem; }
  .page-title { font-size: 2rem; }
  .exp-header { flex-direction: column; }
  .exploring-grid { grid-template-columns: 1fr; }
}

/* ================================================================
   UTILITY
   ================================================================ */
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap;
}

.divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 0;
}

.text-mono { font-family: var(--mono); }
.text-dim  { color: var(--t3); }
.text-blue { color: var(--blue); }
.text-green{ color: var(--green); }


    /* ── Resume-page  ── */
    .resume-identity {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      gap: 2rem;
      flex-wrap: wrap;
      margin-bottom: 2rem;
    }

    .identity-meta {
      font-family: var(--mono);
      font-size: .78rem;
      color: var(--t3);
      line-height: 1.9;
    }
    .identity-meta a { color: var(--blue); text-decoration: none; }
    .identity-meta a:hover { text-decoration: underline; }

    .identity-cta {
      display: flex;
      gap: .5rem;
      flex-wrap: wrap;
      align-self: flex-start;
    }

    /* Skills category block */
    .skills-section {
      display: grid;
      gap: 1.5rem;
    }

    .skill-block {
      display: grid;
      gap: .65rem;
    }

    .skill-block-label {
      font-family: var(--mono);
      font-size: .65rem;
      letter-spacing: .12em;
      text-transform: uppercase;
      color: var(--t3);
      padding-bottom: .45rem;
      border-bottom: 1px solid var(--border-subtle);
    }

    /* Strength chips */
    .strength-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
      gap: .85rem;
    }

    .strength-item {
      display: flex;
      align-items: flex-start;
      gap: .65rem;
      font-size: .875rem;
      color: var(--t2);
      line-height: 1.6;
    }
    .strength-item::before {
      content: '▸';
      color: var(--green);
      flex-shrink: 0;
      font-size: .7rem;
      margin-top: .22rem;
    }

    /* Download CTA banner */
    .resume-cta-banner {
      background: var(--bg-1);
      border: 1px solid var(--border);
      border-left: 3px solid var(--blue);
      border-radius: var(--r-md);
      padding: 1.5rem 2rem;
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 1.5rem;
      flex-wrap: wrap;
    }

    .cta-banner-copy p {
      font-size: .875rem;
      color: var(--t2);
      line-height: 1.65;
      margin-top: .25rem;
    }

    .section-divider {
      border: none;
      border-top: 1px solid var(--border-subtle);
      margin: 0;
    }

    /* Education & cert cards */
    .edu-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
      gap: 1rem;
    }

    .edu-card {
      background: var(--bg-1);
      border: 1px solid var(--border);
      border-radius: var(--r-md);
      padding: 1.35rem 1.5rem;
      transition: border-color var(--t-mid);
    }
    .edu-card:hover { border-color: rgba(88,166,255,.35); }

    .edu-card-label {
      font-family: var(--mono);
      font-size: .62rem;
      letter-spacing: .1em;
      text-transform: uppercase;
      color: var(--t3);
      margin-bottom: .45rem;
    }

    .edu-card-title {
      font-size: .925rem;
      font-weight: 600;
      color: var(--t1);
      margin-bottom: .3rem;
    }

    .edu-card-sub {
      font-size: .8rem;
      color: var(--t2);
      line-height: 1.6;
    }

    /* Interest chips */
    .interest-group {
      display: flex;
      flex-wrap: wrap;
      gap: .4rem;
    }

    .interest-chip {
      font-size: .78rem;
      color: var(--t2);
      background: var(--bg-2);
      border: 1px solid var(--border-subtle);
      border-radius: 100px;
      padding: .25rem .75rem;
      transition: all var(--t-fast);
    }
    .interest-chip:hover { border-color: var(--blue); color: var(--blue); }

    @media (max-width: 640px) {
      .resume-identity { flex-direction: column; }
      .identity-cta { width: 100%; }
    }
