@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/Inter-Regular.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/Inter-SemiBold.woff2") format("woff2");
}

/* Manual palette */
:root {
  --verde: #263B37;
  --marino: #111C2B;
  --pizarra: #66736F;
  --blanco: #FFFFFF;
  --niebla: #F3F5F4;
  --gutter: 24px;
}

/* Light theme: follows the style manual (white background, dark text, soft panels) */
.theme-light {
  --bg: var(--blanco);
  --text: var(--marino);
  --text-muted: var(--pizarra);
  --accent: var(--verde);
  --panel: var(--niebla);
  --panel-border: transparent;
  --rule: #E2E6E4;
  --wordmark-opacity: 1;
}

/* Dark theme: horizon gradient derived from the "Compute Horizon" image */
.theme-dark {
  --bg: #01111B;
  --text: #FFFFFF;
  --text-muted: rgba(255, 255, 255, 0.72);
  --accent: #FFFFFF;
  --panel: rgba(255, 255, 255, 0.05);
  --panel-border: rgba(255, 255, 255, 0.10);
  --rule: rgba(255, 255, 255, 0.12);
  --wordmark-opacity: 0.92;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.theme-dark body {
  background-image:
    radial-gradient(60% 70% at 100% 0%, rgba(14, 102, 95, 0.75) 0%, rgba(14, 102, 95, 0) 70%),
    radial-gradient(45% 45% at 0% 100%, rgba(0, 67, 63, 0.9) 0%, rgba(0, 67, 63, 0) 70%),
    linear-gradient(170deg, #00121C 0%, #01272C 55%, #01111B 100%);
  background-attachment: fixed;
}

.horizon {
  display: none;
}

.theme-dark .horizon {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.horizon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.site-header,
main,
footer {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1120px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.site-header {
  display: flex;
  justify-content: flex-end;
  padding-top: clamp(24px, 4vh, 40px);
}

.wordmark {
  display: block;
  width: clamp(140px, 12vw, 160px);
  height: auto;
  opacity: var(--wordmark-opacity);
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-block: clamp(40px, 8vh, 96px);
}

h1 {
  margin: 0;
  font-weight: 600;
  font-size: clamp(1.75rem, 0.9rem + 4vw, 4rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  max-width: 14ch;
  text-wrap: balance;
}

.contact {
  margin: clamp(20px, 3vh, 32px) 0 0;
  font-size: clamp(1rem, 0.9rem + 0.5vw, 1.25rem);
  color: var(--text-muted);
}

.contact a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  text-decoration-color: color-mix(in srgb, var(--accent) 50%, transparent);
}

a:hover,
a:focus-visible {
  text-decoration-color: var(--accent);
}

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 2px;
}

/* Reading section */
.reading {
  margin-top: clamp(56px, 10vh, 120px);
  padding-top: clamp(24px, 4vh, 40px);
  border-top: 1px solid var(--rule);
}

.reading h2 {
  margin: 0 0 20px;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.reading ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.reading li {
  display: flex;
}

.reading a {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  padding: 20px 22px;
  border-radius: 6px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  color: var(--text);
  text-decoration: none;
  transition: background-color 120ms ease;
}

.theme-light .reading a:hover {
  background: #EAEEEC;
}

.theme-dark .reading a:hover {
  background: rgba(255, 255, 255, 0.09);
}

.reading .source {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.reading .title {
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.35;
  letter-spacing: -0.01em;
  text-wrap: pretty;
}

footer {
  padding-bottom: clamp(24px, 4vh, 40px);
  font-size: 0.875rem;
  color: var(--text-muted);
}

footer p {
  margin: 0;
}

@media (max-width: 480px) {
  :root {
    --gutter: 20px;
  }
}

/* ---------- Intro sequence: light page, burst from the centre, dark page revealed ---------- */

.theme-dark body {
  min-height: 100vh;
}

.intro {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  z-index: 10;
  display: flex;
  flex-direction: column;
  pointer-events: none;
  background: #FFFFFF;
  color: #111C2B;
  --text: #111C2B;
  --text-muted: #66736F;
  --accent: #263B37;
  --wordmark-opacity: 1;
  /* Two mask layers composited with "exclude": a full sheet minus a growing circle = a hole that reveals the dark page */
  mask-image: linear-gradient(#000, #000), radial-gradient(circle closest-side, #000 99%, transparent 100%);
  mask-size: 100% 100%, 0 0;
  mask-position: 0 0, center;
  mask-repeat: no-repeat;
  mask-composite: exclude;
  animation:
    intro-reveal 1.5s cubic-bezier(0.7, 0, 0.3, 1) 1.1s forwards,
    intro-fade 0.3s linear 2.4s forwards;
}

.intro .site-header,
.intro main,
.intro footer {
  z-index: auto;
}

.intro .contact {
  color: #66736F;
}

.intro .contact a {
  color: #263B37;
  text-decoration-color: rgba(38, 59, 55, 0.5);
}

.intro footer {
  color: #66736F;
}

@keyframes intro-reveal {
  from { mask-size: 100% 100%, 0 0; }
  to   { mask-size: 100% 100%, 320vmax 320vmax; }
}

@keyframes intro-fade {
  to { opacity: 0; visibility: hidden; }
}

/* The spark that ignites in the centre */
.spark {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 14vmax;
  height: 14vmax;
  z-index: 12;
  pointer-events: none;
  border-radius: 50%;
  background: radial-gradient(circle, #FFFFFF 0%, #FFFFFF 12%, rgba(95, 227, 200, 0.95) 30%, rgba(14, 102, 95, 0.5) 55%, rgba(14, 102, 95, 0) 72%);
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  animation: spark 1.1s cubic-bezier(0.2, 0.8, 0.3, 1) 0.5s forwards;
}

@keyframes spark {
  0%   { transform: translate(-50%, -50%) scale(0);    opacity: 0; }
  45%  { transform: translate(-50%, -50%) scale(0.55); opacity: 1; }
  75%  { transform: translate(-50%, -50%) scale(0.9);  opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(2.2);  opacity: 0; }
}

/* The shock front: a glowing ring that expands with the reveal */
.ring {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  z-index: 11;
  pointer-events: none;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow:
    0 0 1.2vmax 0.6vmax rgba(255, 255, 255, 0.95),
    0 0 6vmax 2.5vmax rgba(95, 227, 200, 0.55),
    inset 0 0 6vmax 2vmax rgba(95, 227, 200, 0.35);
  opacity: 0;
  animation: ring 1.5s cubic-bezier(0.7, 0, 0.3, 1) 1.1s forwards;
}

@keyframes ring {
  0%   { width: 0;       height: 0;       opacity: 1; }
  70%  { opacity: 1; }
  100% { width: 320vmax; height: 320vmax; opacity: 0; }
}

/* Reduced motion: no burst, the light page simply fades into the dark page */
@media (prefers-reduced-motion: reduce) {
  .spark,
  .ring {
    display: none;
  }

  .intro {
    mask-image: none;
    animation: intro-fade 0.8s ease 0.6s forwards;
  }
}
