/* The homepage look, used by every page built on includes/site.php (was siteCss()) */

/* Homepage theme (overrides the shared template base styles above) */
/* Developer palette (GitHub-dark style): slate surfaces, link blue accent, terminal green */
:root {
  --h-bg: #0d1117;
  --h-surface: #161b22;
  --h-surface-hover: #1c2129;
  --h-border: rgba(240, 246, 252, 0.1);
  --h-border-hover: rgba(240, 246, 252, 0.22);
  --h-text: #e6edf3;
  --h-muted: #8b949e;
  --h-accent: #58a6ff;
  --h-accent-bg: #1f6feb;
  --h-accent-text: #ffffff;
  --h-term: #3fb950;
  --h-wip: #d29922;
  --h-sun-display: inline-flex;
  --h-moon-display: none;
  --h-fx-opacity: 1;
  --h-scanline: rgba(0, 0, 0, 0.35);
  --h-title-shadow: #238636;
  --h-title-fade: #8b949e;
  --h-glow: rgba(56, 139, 253, 0.12);
  --h-dot: rgba(240, 246, 252, 0.06);
  color-scheme: dark;
}
/* Light theme: from the OS unless the visitor chose dark, or chosen with the toggle */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --h-bg: #e9ecef;
    --h-surface: #f4f5f7;
    --h-surface-hover: #f9fafb;
    --h-border: rgba(31, 35, 40, 0.12);
    --h-border-hover: rgba(31, 35, 40, 0.28);
    --h-text: #1f2328;
    --h-muted: #59636e;
    --h-accent: #0969da;
    --h-accent-bg: #0969da;
    --h-accent-text: #ffffff;
    --h-term: #1a7f37;
    --h-wip: #9a6700;
    --h-sun-display: none;
    --h-moon-display: inline-flex;
    --h-fx-opacity: 0.45;
    --h-scanline: rgba(0, 0, 0, 0.03);
    --h-title-shadow: rgba(26, 127, 55, 0.4);
    --h-title-fade: #57606a;
    --h-glow: rgba(9, 105, 218, 0.08);
    --h-dot: rgba(31, 35, 40, 0.08);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --h-bg: #e9ecef;
  --h-surface: #f4f5f7;
  --h-surface-hover: #f9fafb;
  --h-border: rgba(31, 35, 40, 0.12);
  --h-border-hover: rgba(31, 35, 40, 0.28);
  --h-text: #1f2328;
  --h-muted: #59636e;
  --h-accent: #0969da;
  --h-accent-bg: #0969da;
  --h-accent-text: #ffffff;
  --h-term: #1a7f37;
  --h-wip: #9a6700;
  --h-sun-display: none;
  --h-moon-display: inline-flex;
  --h-fx-opacity: 0.45;
  --h-scanline: rgba(0, 0, 0, 0.03);
  --h-title-shadow: rgba(26, 127, 55, 0.4);
  --h-title-fade: #57606a;
  --h-glow: rgba(9, 105, 218, 0.08);
  --h-dot: rgba(31, 35, 40, 0.08);
  color-scheme: light;
}

/* 8bit style: bright arcade palette (cyan, hot pink, neon green, yellow on deep indigo).
   Placed after the theme blocks so it wins over both; the light variant is a warm cream with
   the same saturated colours, darkened enough to read. */
:root[data-style="retro"] {
  --h-bg: #0b0730;
  --h-surface: #17104a;
  --h-surface-hover: #22196a;
  --h-border: #3f30c8;
  --h-border-hover: #00e5ff;
  --h-text: #ffffff;
  --h-muted: #b3adff;
  --h-accent: #00e5ff;
  --h-accent-bg: #ff2e88;
  --h-accent-text: #ffffff;
  --h-term: #39ff14;
  --h-wip: #ffd400;
  --h-fx-opacity: 1;
  --h-scanline: rgba(0, 0, 0, 0.3);
  --h-title-shadow: #ff2e88;
}
@media (prefers-color-scheme: light) {
  :root[data-style="retro"]:not([data-theme="dark"]) {
    --h-bg: #fff3d6;
    --h-surface: #fffaeb;
    --h-surface-hover: #ffefc2;
    --h-border: #6c4cff;
    --h-border-hover: #ff2e88;
    --h-text: #1b0f3d;
    --h-muted: #5a3fb5;
    --h-accent: #0055ff;
    --h-accent-bg: #ff2e88;
    --h-accent-text: #ffffff;
    --h-term: #00a316;
    --h-wip: #c25e00;
    --h-fx-opacity: 0.75;
    --h-scanline: rgba(0, 0, 0, 0.04);
    --h-title-shadow: #ffc400;
  }
}
:root[data-style="retro"][data-theme="light"] {
  --h-bg: #fff3d6;
  --h-surface: #fffaeb;
  --h-surface-hover: #ffefc2;
  --h-border: #6c4cff;
  --h-border-hover: #ff2e88;
  --h-text: #1b0f3d;
  --h-muted: #5a3fb5;
  --h-accent: #0055ff;
  --h-accent-bg: #ff2e88;
  --h-accent-text: #ffffff;
  --h-term: #00a316;
  --h-wip: #c25e00;
  --h-fx-opacity: 0.75;
  --h-scanline: rgba(0, 0, 0, 0.04);
  --h-title-shadow: #ffc400;
}

html { background: var(--h-bg); }

/* Soft accent glow and dot grid behind the hero, fading out towards the edges */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background-image:
    radial-gradient(ellipse 55% 45% at 50% 22%, var(--h-glow), transparent 70%),
    radial-gradient(var(--h-dot) 1px, transparent 1.5px);
  background-size: 100% 100%, 24px 24px;
  -webkit-mask-image: radial-gradient(ellipse 75% 65% at 50% 25%, #000 35%, transparent 80%);
  mask-image: radial-gradient(ellipse 75% 65% at 50% 25%, #000 35%, transparent 80%);
}
html.off body {
  max-width: 760px;
  padding: 0 20px 24px;
  min-height: calc(100vh - 24px);   /* footer at the bottom (css/base.css); 24px padding below */
  min-height: calc(100dvh - 24px);
  color: var(--h-text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.home a, .home a:hover { color: inherit; text-decoration: none; }
.home a:focus-visible, .home button:focus-visible { outline: 2px solid var(--h-accent); outline-offset: 3px; }

/* Icons: line icons for the neutral style, pixel art for the retro style */
.icon-retro { display: none; }
.icon-neutral { display: block; }

/* Toolbar: style and theme switches */
.home { position: relative; }
.toolbar { position: absolute; top: 24px; right: 0; display: flex; gap: 8px; }
/* The style and theme switches need JavaScript; log in/out work without it */
html:not(.js) .style-toggle, html:not(.js) .theme-toggle { display: none; }
.toolbar button, .toolbar .login-link {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0;
  background: var(--h-bg);
  border: 1px solid var(--h-border);
  border-radius: 999px;
  color: var(--h-muted);
  font: inherit;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.toolbar button:hover, .toolbar .login-link:hover { background: var(--h-surface-hover); border-color: var(--h-border-hover); color: var(--h-text); }
.toolbar .theme-toggle { width: 40px; }
.signout-form { margin: 0; }
.toolbar .signout, .toolbar .login-link { padding: 0 16px; font-size: 0.875rem; font-weight: 500; }
.toolbar .style-toggle { gap: 8px; padding: 0 16px 0 14px; font-size: 0.875rem; font-weight: 500; }
.home .style-toggle[aria-pressed="true"] { border-color: var(--h-accent); color: var(--h-accent); }
.icon-sun { display: var(--h-sun-display); }
.icon-moon { display: var(--h-moon-display); }

/* Hero */
.hero { margin: 0; padding: 96px 0 56px; text-align: left; }
.hero-eyebrow, .group h2 {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
/* Badge as a console line: green ">" prompt, the role, then a blinking block cursor */
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  margin: 20px 0 0;
  padding: 6px 12px;
  background: var(--h-bg);
  border: 1px solid var(--h-border);
  border-radius: 6px;
  color: var(--h-text);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.04em;
}
.hero-eyebrow .prompt { margin-right: 0.6em; color: var(--h-term); }
.hero-eyebrow .caret {
  width: 0.55em;
  height: 1.15em;
  margin-left: 0.3em;
  background: var(--h-term);
  animation: caret-blink 1.1s steps(1) infinite;
}
@keyframes caret-blink {
  50% { opacity: 0; }
}
html.bright-theme .hero h1 {
  margin: 0;
  font-size: clamp(2.5rem, 8vw, 3.75rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
  background: linear-gradient(180deg, var(--h-text) 35%, var(--h-title-fade));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Logged out: the page is just the hero, centered vertically in the window, with the footer
   at the bottom. The body (already full height, css/base.css) becomes a column; the main area
   takes the free space and the hero centers in it. (The background layers are fixed, so they
   are not in the column.) */
body:has(> .home-public) {
  display: flex;
  flex-direction: column;
}
.home-public {
  display: flex;
  flex: 1;
  flex-direction: column;
}
html.off body:has(> .home-public) > footer { margin: 0; }
.home-public .hero {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 88px 0;
  text-align: center;
}
html.bright-theme .home-public .hero h1 { font-size: clamp(3rem, 11vw, 5rem); }
.hero-lead { margin: 16px 0 0; max-width: 32em; font-size: 1.125rem; color: var(--h-muted); }
.hero-nav { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  background: var(--h-bg);
  border: 1px solid var(--h-border);
  border-radius: 999px;
  font-size: 0.9375rem;
  font-weight: 500;
  transition: background-color 0.15s, border-color 0.15s;
}
.home .btn:hover { background: var(--h-surface-hover); border-color: var(--h-border-hover); }
.home .btn-primary, .home .btn-primary:hover {
  background: var(--h-accent-bg);
  border-color: var(--h-accent-bg);
  color: var(--h-accent-text);
}
.home .btn-primary:hover { filter: brightness(1.08); }

/* Link groups */
.group { margin: 0 0 48px; }
.group h2 { margin: 0 0 16px; color: var(--h-muted); }
.cards { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 0; padding: 0; list-style: none; }
.card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-sizing: border-box;
  height: 100%;
  padding: 16px 18px;
  background: var(--h-surface);
  border: 1px solid var(--h-border);
  border-radius: 12px;
  transition: background-color 0.15s, border-color 0.15s, transform 0.15s;
}
.home .card:hover { background: var(--h-surface-hover); border-color: var(--h-border-hover); transform: translateY(-2px); }
.card-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; font-weight: 600; }
.card-sub { font-size: 0.875rem; color: var(--h-muted); }
/* "In progress" badge for unfinished items ("status": "in-progress" in includes/links.json) */
.card-badge {
  display: inline-block;
  margin-right: 8px;
  padding: 1px 8px;
  border: 1px solid var(--h-wip);
  border-radius: 999px;
  color: var(--h-wip);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: 1px;
}
.arrow { display: inline-flex; flex-shrink: 0; color: var(--h-muted); transition: transform 0.15s, color 0.15s; }
.card-title .arrow { margin-top: 0.3em; }
.btn .arrow { color: inherit; }
.card:hover .arrow { color: var(--h-accent); transform: translateX(2px); }
.card:hover .arrow-external { transform: translate(2px, -2px); }

/* Footer printed by the template */
html.off body > footer {
  margin: 16px 0 0;
  padding-top: 24px;
  border-top: 1px solid var(--h-border);
  text-align: center;
  font-size: 0.8125rem;
  color: var(--h-muted);
}
html.off body > footer a { color: var(--h-text); }
/* Validation badges (homepage footer), linking to the W3C validators */
html.off .footer-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 14px 0 0; }
html.off body > footer .badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px 0 7px;
  border: 1px solid var(--h-border);
  border-radius: 6px;
  background: var(--h-surface);
  color: var(--h-text);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  transition: border-color 0.15s, background-color 0.15s;
}
html.off body > footer .badge:hover { border-color: var(--h-border-hover); background: var(--h-surface-hover); text-decoration: none; }
html.off body > footer .badge:focus-visible { outline: 2px solid var(--h-accent); outline-offset: 2px; }
.badge-logo { display: block; flex: none; }
html[data-style="retro"] body > footer .badge {
  font-family: "Press Start 2P", monospace;
  font-size: 0.5rem;
  letter-spacing: 0;
  border-radius: 0;
}

/* Retro 8-bit style (html[data-style="retro"], toggled by the Retro button) */
.retro-bg { display: none; }
html[data-style="retro"] .retro-bg {
  display: block;
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: var(--h-fx-opacity);
  /* Quieter behind the content column so text stays readable */
  -webkit-mask-image: linear-gradient(to right, #000 0, rgba(0, 0, 0, 0.35) 28%, rgba(0, 0, 0, 0.35) 72%, #000 100%);
  mask-image: linear-gradient(to right, #000 0, rgba(0, 0, 0, 0.35) 28%, rgba(0, 0, 0, 0.35) 72%, #000 100%);
}
.retro-bg canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.retro-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(to bottom, transparent 0, transparent 2px, var(--h-scanline) 2px, var(--h-scanline) 4px);
}
html[data-style="retro"] .icon-retro { display: block; }
html[data-style="retro"] .icon-neutral { display: none; }
html.off[data-style="retro"] body {
  font-family: "Pixelify Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: auto;
}
/* Arcade display font for the name and section labels (single weight; no faux bold) */
html[data-style="retro"] .hero-eyebrow,
html.bright-theme[data-style="retro"] .hero h1,
html[data-style="retro"] .group h2 {
  font-family: "Press Start 2P", "Pixelify Sans", monospace;
  font-weight: 400;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}
/* The badge at the pixel font's native 8px, about as wide as the normal badge (188 vs 195px) */
html[data-style="retro"] .hero-eyebrow { margin-top: 24px; font-size: 0.5rem; }
html[data-style="retro"] .backdrop { display: none; }
html[data-style="retro"] .group h2 { margin-bottom: 20px; }
/* The name as wide as in the normal style: the same fluid size scaled by 0.491, because
   "Fran Marín" is 10em wide in Press Start 2P (monospace) and 4.91em in Inter Bold. The size is
   no longer always a multiple of the font's 8px grid (crisp on high-density screens, pixel
   edges can be slightly uneven on 1x screens) */
html.bright-theme[data-style="retro"] .hero h1 {
  font-size: calc(clamp(2.5rem, 8vw, 3.75rem) * 0.491);
  line-height: 1.25;
  letter-spacing: 0;
  text-shadow: 0.125em 0.125em 0 var(--h-title-shadow);
  background: none;
  color: var(--h-text);
}

@media (min-width: 640px) {
  .cards { grid-template-columns: 1fr 1fr; }
}
html.bright-theme[data-style="retro"] .home-public .hero h1 { font-size: calc(clamp(3rem, 11vw, 5rem) * 0.491); }
@media (max-width: 480px) {
  .toolbar { position: static; justify-content: flex-end; margin-top: 16px; }
  .hero { padding: 32px 0 40px; }
  .home-public .hero { padding: 40px 0; }
}
@media (prefers-reduced-motion: reduce) {
  .home *, .home *:hover { transition: none; transform: none !important; }
  .hero-eyebrow .caret { animation: none; }
}
