/* Shared layout. Colors and fonts come from theme-*.css via custom properties. */
@view-transition { navigation: auto; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font: 400 1rem/1.6 var(--font);
  overflow-x: hidden;
}
main { flex: 1; width: 100%; max-width: var(--max, 1100px); margin: 0 auto; padding: 0 16px 64px; }
a { color: var(--accent); }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; }

.skip { position: absolute; left: -999px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip:focus { left: 16px; top: 16px; z-index: 10; background: var(--bg); padding: 8px 12px; }

.site-header {
  view-transition-name: header;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  width: 100%; max-width: var(--max, 1100px); margin: 0 auto; padding: 20px 16px;
}
.logo { color: var(--fg); text-decoration: none; font-weight: 700; white-space: nowrap; }
.nav { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.nav a {
  color: var(--muted); text-decoration: none; padding: 6px 12px; border-radius: var(--radius);
  transition: color .2s, background .2s;
}
.nav a:hover, .nav a[aria-current] { color: var(--fg); background: var(--surface); }
.nav .nav-cta { color: var(--accent-fg); background: var(--accent); }
.nav .nav-cta:hover, .nav .nav-cta[aria-current] { color: var(--accent-fg); background: var(--accent); filter: brightness(1.1); }

.site-footer {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  width: 100%; max-width: var(--max, 1100px); margin: 0 auto; padding: 24px 16px;
  color: var(--muted); font-size: .875rem; border-top: 1px solid var(--line);
}
.footer-links { display: flex; gap: 16px; }
.footer-links a { color: var(--muted); }

.btn {
  display: inline-block; padding: 12px 22px; border: 0; border-radius: var(--radius);
  background: var(--accent); color: var(--accent-fg); font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; transition: transform .15s, filter .2s;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.1); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-ghost { background: transparent; color: var(--fg); box-shadow: inset 0 0 0 1px var(--line); }
.btn-ghost:hover { box-shadow: inset 0 0 0 1px var(--accent); }
[data-magnetic] { will-change: transform; }

/* Project cards: always in the hacker palette, on the home page too. */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 20px; }
.pcard {
  --g: #39ff88;
  display: flex; flex-direction: column; overflow: hidden; border-radius: 10px;
  background: #07100a; border: 1px solid #1d3b25; color: #c9ffd9; text-decoration: none;
  font-family: ui-monospace, "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;
  transform-style: preserve-3d; transition: border-color .3s, box-shadow .3s, transform .2s ease-out;
}
.pcard:hover { border-color: var(--g); box-shadow: 0 20px 60px -25px rgba(57,255,136,.6); }
.pcard-cover { aspect-ratio: 16 / 10; display: grid; place-items: center; background: #030703; border-bottom: 1px solid #1d3b25; overflow: hidden; }
.pcard-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2,.7,.2,1); }
.pcard:hover .pcard-cover img { transform: scale(1.05); }
.pcard-ascii { font-size: 3rem; color: var(--g); text-shadow: 0 0 20px rgba(57,255,136,.6); }
.pcard-body { padding: 18px 20px 20px; }
.pcard h3 { margin: 0 0 8px; font-size: 1.2rem; color: #eafff0; }
.pcard p { margin: 0 0 14px; color: #8fbf9c; font-size: .9rem; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.tags li { padding: 2px 8px; border: 1px solid #1d3b25; border-radius: 4px; color: #39ff88; font-size: .78rem; font-family: ui-monospace, Menlo, monospace; }
.tags li::before { content: "#"; opacity: .6; }

/* Scroll reveal: JS adds .is-visible. Without JS everything stays visible. */
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s ease, transform .7s cubic-bezier(.2,.7,.2,1); }
.js .reveal.is-visible { opacity: 1; transform: none; }

/* Page transition between themes. */
::view-transition-old(root) { animation: vt-out .35s ease both; }
::view-transition-new(root) { animation: vt-in .45s ease both; }
@keyframes vt-out { to { opacity: 0; transform: scale(.98); filter: blur(4px); } }
@keyframes vt-in { from { opacity: 0; transform: scale(1.02); filter: blur(4px); } }

@media (max-width: 480px) {
  .site-header { flex-wrap: wrap; padding: 14px 16px; gap: 8px; }
  .nav { width: 100%; justify-content: flex-start; gap: 4px; margin-left: -8px; }
  .nav a { padding: 6px 8px; font-size: .9rem; }
  .nav .nav-cta { margin-left: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .js .reveal { opacity: 1; transform: none; }
  @view-transition { navigation: none; }
}

/* Once revealed, cards follow the cursor quickly instead of the slow reveal easing. */
.js .pcard.reveal.is-visible { transition: border-color .3s, box-shadow .3s, transform .2s ease-out; }
