/* ============================================================
   Alejandro Gamez portfolio · shared styles (Linear-style dark)
   ============================================================ */
:root {
  --bg: #08090a;
  --bg-raise: #0f1011;
  --text: #f7f8f8;
  --text-2: #8a8f98;
  --text-3: #7a7f87; /* ≥4.5:1 on --bg (WCAG AA) */
  --border: rgba(255,255,255,.08);
  --border-hover: rgba(255,255,255,.16);
  --accent: #5e6ad2;
  --accent-soft: rgba(94,106,210,.16);
  --green: #4cb782;
  --amber: #d2a85e;
  --radius: 10px;
  --font-body: "Inter", -apple-system, system-ui, sans-serif;
  --font-display: "Inter Tight", "Inter", -apple-system, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", Consolas, "SF Mono", monospace;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bg); }
body {
  background: transparent;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid #7c86e0; outline-offset: 2px; }
#main:focus { outline: none; }

/* Skip link: visually hidden until keyboard-focused */
.skip-link {
  position: fixed; left: 16px; top: -52px; z-index: 200;
  background: var(--bg-raise); color: var(--text);
  border: 1px solid var(--border-hover); border-radius: 8px;
  padding: 10px 16px; font-size: 13.5px; text-decoration: none;
  transition: top .15s ease;
}
.skip-link:focus { top: 12px; }

/* Background canvas (constellation animation, behind everything) */
#bg { position: fixed; inset: 0; z-index: -1; }

.wrap { max-width: 1024px; margin: 0 auto; padding: 0 24px; width: 100%; }

/* ---------- Nav ---------- */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  backdrop-filter: blur(12px);
  background: rgba(8,9,10,.72);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 56px;
}
.logo {
  font-family: var(--font-display);
  font-weight: 600; font-size: 15px; letter-spacing: -.01em;
  display: flex; align-items: center; gap: 10px;
  color: var(--text); text-decoration: none;
}
.logo svg { display: block; }
.logo-word {
  font-size: 14px; font-weight: 600;
  letter-spacing: .09em;
}
.nav-links { display: flex; gap: 4px; align-items: center; }
.nav-links a {
  color: var(--text-2); text-decoration: none; font-size: 13.5px;
  padding: 6px 12px; border-radius: 8px; transition: color .15s, background .15s;
}
/* Invisible hit-area extension: small controls reach ~44px touch targets
   without changing the visual (WCAG 2.5.8 / mobile HIG) */
.nav-links a, .kbd-hint, footer a, .btn { position: relative; }
.nav-links a::after, .kbd-hint::after, footer a::after, .btn::after {
  content: ''; position: absolute; left: 0; right: 0; top: 50%;
  height: 44px; min-height: 100%; transform: translateY(-50%);
}
.nav-links a:hover { color: var(--text); background: rgba(255,255,255,.05); }
.nav-links a.active { color: var(--text); }
.kbd-hint {
  display: flex; align-items: center; gap: 6px;
  color: var(--text-3); font-size: 12.5px;
  border: 1px solid var(--border); border-radius: 8px;
  padding: 5px 10px; cursor: pointer; background: transparent;
  font-family: var(--font-body); transition: border-color .15s, color .15s;
}
.kbd-hint:hover { border-color: var(--border-hover); color: var(--text-2); }
kbd {
  font-family: var(--font-body); font-size: 11px;
  background: rgba(255,255,255,.07); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 5px; color: var(--text-2);
}
#langBtn .lang-on { color: var(--text); font-weight: 500; }
#langBtn .lang-off { color: var(--text-3); }

/* ---------- Home hero ---------- */
.hero {
  position: relative;
  min-height: calc(100vh - 210px);
  min-height: calc(100dvh - 210px);
  margin-top: 56px;
  display: grid; place-items: center;
  text-align: center;
  padding: 64px 0;
}
.glow {
  position: absolute; top: -180px; left: 50%; transform: translateX(-50%);
  width: min(720px, 100%); height: 480px; pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(94,106,210,.18), transparent 65%);
}
.grid-lines {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, black, transparent);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, black, transparent);
}
.badge {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-2);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 5px 14px 5px 10px; margin-bottom: 28px;
  background: rgba(255,255,255,.03);
}
.pulse {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(76,183,130,.5);
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(76,183,130,.45); }
  70% { box-shadow: 0 0 0 7px rgba(76,183,130,0); }
  100% { box-shadow: 0 0 0 0 rgba(76,183,130,0); }
}
.hero .wrap { position: relative; }
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(34px, 7vw, 72px);
  font-weight: 600;
  letter-spacing: -.035em;
  line-height: 1.06;
  background: linear-gradient(180deg, #fff 55%, #9ba1ab);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 22px;
}
.sub {
  font-size: 17px; color: var(--text-2);
  max-width: 560px; margin: 0 auto 40px;
  line-height: 1.65;
}
.cta-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn {
  font-family: var(--font-body); font-size: 14px; font-weight: 500;
  border-radius: 9px; padding: 10px 20px; cursor: pointer;
  text-decoration: none; transition: all .15s; border: 1px solid transparent;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn-primary { background: var(--text); color: #08090a; }
.btn-primary:hover { background: #d5d8dd; }
.btn-ghost {
  background: transparent; color: var(--text-2);
  border-color: var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--border-hover); }

/* ---------- Interior pages ---------- */
main.page {
  flex: 1;
  padding: 140px 0 96px;
  position: relative;
  background: radial-gradient(ellipse 640px 320px at 50% 0, rgba(94,106,210,.07), transparent 70%);
}
.sec-head { margin-bottom: 44px; }
.sec-label {
  font-size: 12.5px; font-weight: 500; color: var(--accent);
  letter-spacing: .06em; text-transform: uppercase;
  display: block; margin-bottom: 10px;
}
h2, .page-title {
  font-family: var(--font-display);
  font-size: 32px; font-weight: 600; letter-spacing: -.02em;
  margin-bottom: 10px;
}
.sec-desc { color: var(--text-2); max-width: 520px; }

/* ---------- Project cards (issue-tracker motif) ---------- */
.proj-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .proj-grid { grid-template-columns: 1fr; } }
.card {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-raise);
  padding: 20px;
  transition: border-color .18s, transform .18s, box-shadow .18s;
  display: flex; flex-direction: column; gap: 14px;
}
.card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,.35);
}
.card-meta { display: flex; align-items: center; gap: 10px; }
.issue-id {
  font-size: 12px; font-weight: 500; color: var(--text-3);
  border: 1px solid var(--border); border-radius: 5px;
  padding: 1px 7px; letter-spacing: .02em;
}
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot-done { background: var(--green); }
.dot-wip { background: var(--amber); animation: wip-pulse 2.2s infinite; }
@keyframes wip-pulse {
  0% { box-shadow: 0 0 0 0 rgba(210,168,94,.4); }
  70% { box-shadow: 0 0 0 6px rgba(210,168,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(210,168,94,0); }
}
.card h2 {
  font-family: var(--font-display);
  font-size: 17px; font-weight: 600; letter-spacing: -.01em;
  margin: 0;
}
.card h2 a {
  color: inherit; text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color .15s;
}
.card h2 a:hover { border-color: var(--text-2); }
.card p { color: var(--text-2); font-size: 14px; min-height: 44px; }
.thumb {
  border: 1px dashed rgba(255,255,255,.12);
  border-radius: 8px;
  background: rgba(255,255,255,.02);
  aspect-ratio: 16 / 9;
  display: flex; flex-direction: column;
  overflow: hidden;
  color: var(--text-3); font-size: 12.5px;
}
.thumb-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.02);
}
.thumb-bar span { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,.10); }
.thumb-bar em {
  font-style: normal; font-family: var(--font-mono);
  font-size: 11px; color: var(--text-3); margin-left: 8px;
}
.thumb-body {
  flex: 1; display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 12px;
}
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.tag {
  font-size: 12px; color: var(--text-2);
  background: rgba(255,255,255,.05);
  border: 1px solid var(--border);
  border-radius: 999px; padding: 2px 10px;
}

/* ---------- Stack (keyline table) ---------- */
.stack-table {
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
.stack-row {
  display: flex; align-items: center; gap: 16px;
  padding: 18px; background: var(--bg-raise);
}
.stack-row + .stack-row { border-top: 1px solid var(--border); }
.stack-row .row-h {
  width: 140px; flex-shrink: 0;
  font-size: 13px; font-weight: 500; color: var(--text-2);
  letter-spacing: .02em;
}
@media (max-width: 720px) {
  .stack-row { flex-direction: column; align-items: flex-start; gap: 10px; }
  .stack-row .row-h { width: auto; }
}
.edit-note { font-size: 12px; color: var(--amber); margin-top: 14px; display: block; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 48px; align-items: start; }
@media (max-width: 720px) { .about-grid { grid-template-columns: 1fr; } }
.about-grid p { color: var(--text-2); margin-bottom: 16px; }
.placeholder-inline {
  color: var(--amber); font-style: normal;
  border-bottom: 1px dashed rgba(210,168,94,.4);
}
.facts { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.fact {
  display: flex; justify-content: space-between; padding: 14px 18px;
  font-size: 13.5px; background: var(--bg-raise);
}
.fact + .fact { border-top: 1px solid var(--border); }
.fact span:first-child {
  font-family: var(--font-mono); font-size: 12px;
  color: #9cdcfe; letter-spacing: .03em;
}
.fact > :last-child { color: var(--text); }
.fact a { color: var(--text); text-decoration: none; }
.fact a:hover { text-decoration: underline; }
.facts-narrow { max-width: 520px; }
.cta-left { justify-content: flex-start; margin-top: 32px; }

/* ---------- Contact ---------- */
.contact-box {
  text-align: center; padding: 72px 24px;
  border: 1px solid var(--border); border-radius: 16px;
  background:
    radial-gradient(ellipse 60% 90% at 50% -10%, rgba(94,106,210,.12), transparent),
    var(--bg-raise);
}
.contact-box h2 { margin-bottom: 12px; }
.contact-box p { color: var(--text-2); margin-bottom: 32px; }

/* ---------- Footer ---------- */
footer {
  border-top: 1px solid var(--border);
  padding: 28px 0; display: flex; justify-content: space-between;
  color: var(--text-3); font-size: 13px;
}
footer a { color: var(--text-3); text-decoration: none; margin-left: 16px; }
footer a:hover { color: var(--text-2); }

/* ---------- VS Code-style terminal panel ---------- */
.term {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #0b0c0e;
  overflow: hidden;
  margin-bottom: 28px;
  max-width: 680px;
  font-family: var(--font-mono);
  font-size: 13px;
}
.term-head {
  display: flex; align-items: center;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.02);
}
.term-tab {
  font-size: 10px; font-weight: 500;
  letter-spacing: .14em; color: var(--text-2);
}
.term-shell { font-size: 10px; color: var(--text-3); margin-left: auto; }
.term-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 5px; }
.term-line, .term-row { line-height: 1.55; color: #c8ccd4; }
.term-prompt { color: var(--green); margin-right: 9px; }
body.js-type .term-row { opacity: 0; transition: opacity .18s ease; }
.term-row.show, body.js-type .term-row.show { opacity: 1; }

/* interactive prompt (enabled by JS) */
.term-cli { display: none; align-items: center; }
.term-cli.on { display: flex; }
.term-cli:focus-within { box-shadow: inset 0 -1px 0 rgba(124,134,224,.35); }
.term-cli input {
  flex: 1; background: transparent; border: none; outline: none;
  color: #d4d4d4; font-family: var(--font-mono); font-size: 13px;
  caret-color: #4ec9b0;
}
.term-cli input::placeholder { color: #62666d; }
/* Live region for CLI responses (screen readers announce command output) */
.term-log { display: flex; flex-direction: column; gap: 5px; }
.term-log:empty { display: none; }
.term-mini { margin: 48px auto 0; text-align: left; }

/* VS Code Dark+ terminal tokens */
.t-cmd  { color: #dcdcaa; }
.t-flag { color: #9cdcfe; }
.t-str  { color: #ce9178; }
.t-key  { color: #9cdcfe; }
.t-kw   { color: #c586c0; }
.t-com  { color: #6a9955; }
.t-hash { color: #dcdcaa; }
.t-ref  { color: #4ec9b0; }
.t-ok   { color: #4cb782; }
.t-err  { color: #f44747; }
.t-dim  { color: #7a7f87; }

/* ---------- Hero typewriter ---------- */
.tw-host { position: relative; }
.tw-caret {
  position: absolute;
  width: max(2px, .05em);
  border-radius: 1px;
  background: #b9bec9;
  animation: caret-blink 1s steps(1) infinite;
  pointer-events: none;
  -webkit-text-fill-color: initial;
}
@keyframes caret-blink { 0%, 55% { opacity: 1; } 56%, 100% { opacity: 0; } }
.tw-caret.block { width: .55em; background: rgba(76,183,130,.65); }
.tw-caret.tw-done { animation: none; transition: opacity .5s ease; opacity: 0; }
body.js-type .tw-after {
  opacity: 0; transform: translateY(8px);
  transition: opacity .5s ease .1s, transform .5s ease .1s;
}
body.js-type .tw-after.in { opacity: 1; transform: none; }

/* ---------- Scroll reveal (only hides content when JS is running) ---------- */
body.js-anim .reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
body.js-anim .reveal.in { opacity: 1; transform: none; }

/* ---------- Command palette (Ctrl/Cmd+K) ---------- */
.palette-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.5); backdrop-filter: blur(4px);
  display: none; align-items: flex-start; justify-content: center;
  padding-top: 18vh;
}
.palette-overlay.open { display: flex; }
.palette {
  width: min(560px, 92vw);
  background: #101113;
  border: 1px solid var(--border-hover);
  border-radius: 12px;
  box-shadow: 0 24px 80px rgba(0,0,0,.6);
  overflow: hidden;
  animation: palette-in .16s ease;
}
@keyframes palette-in { from { opacity: 0; transform: scale(.98) translateY(-6px); } }
.palette input {
  width: 100%; background: transparent; border: none; outline: none;
  color: var(--text); font-family: var(--font-body); font-size: 15px;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.palette input:focus { border-bottom-color: rgba(124,134,224,.45); }
.palette input:focus-visible, .term-cli input:focus-visible { outline: none; }
.palette input::placeholder { color: var(--text-3); }
.palette-list { padding: 6px; max-height: 280px; overflow-y: auto; }
.palette-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-radius: 8px; cursor: pointer;
  color: var(--text-2); font-size: 14px;
}
.palette-item .pi-left { display: flex; align-items: center; gap: 10px; }
.palette-item.active { background: rgba(255,255,255,.06); color: var(--text); }
.palette-item .hint { font-size: 12px; color: var(--text-3); }

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
  #openPalette { display: none; } /* palette needs a keyboard; nav covers everything on touch */
}
@media (max-width: 480px) {
  /* nav becomes a horizontally scrollable row (scrollbar hidden) so every
     item stays reachable on narrow phones without breaking the 56px bar */
  .logo { flex-shrink: 0; }
  .nav-links { gap: 0; overflow-x: auto; scrollbar-width: none; margin-left: 12px; }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-links a { padding: 6px 8px; }
}
@media (max-width: 420px) {
  .logo-word { display: none; }
  .wrap { padding: 0 16px; }
}
