/* ==========================================================
   Matias Villagarcia — personal site
   Dark "observatory" theme. Static CSS, no JavaScript.
   ========================================================== */

:root {
  /* Palette */
  --night:   #0c1222;  /* page background — deep sky blue, not black */
  --dusk:    #121a2e;  /* raised surfaces */
  --rule:    #243049;  /* hairlines and borders */
  --ink:     #e7eaf2;  /* primary text */
  --muted:   #94a0b8;  /* secondary text */
  --star:    #e3c27e;  /* accent — warm starlight */
  --star-dim: rgba(227, 194, 126, 0.14);

  /* Type */
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans:  "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Layout */
  --max: 1120px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius-sm: 6px;
  --radius-lg: 12px;

  color-scheme: dark;
}

/* ---------- Base ---------- */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--night);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;      /* 17px */
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

a {
  color: var(--ink);
  text-decoration-color: var(--star);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
}
a:hover { color: var(--star); }

:focus-visible {
  outline: 2px solid var(--star);
  outline-offset: 3px;
  border-radius: 3px;
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.1;
  margin: 0;
  letter-spacing: -0.01em;
}

p { margin: 0; }

.container {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.muted { color: var(--muted); }

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--star);
  color: var(--night);
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
}
.skip-link:focus { top: 12px; }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(12, 18, 34, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(36, 48, 73, 0.6);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: 0.01em;
}
.brand-mark { width: 16px; height: 16px; fill: var(--star); }

.nav-list {
  display: flex;
  gap: clamp(16px, 3vw, 32px);
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-list a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
}
.nav-list a:hover { color: var(--ink); }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(96px, 16vw, 176px) clamp(80px, 12vw, 136px);
  border-bottom: 1px solid var(--rule);
}

/* Star field + a faint planisphere grid, drawn entirely in CSS */
.sky {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    /* brighter, sparse stars */
    radial-gradient(1.6px 1.6px at 12% 22%, rgba(255,255,255,.9), transparent 60%),
    radial-gradient(1.4px 1.4px at 78% 14%, rgba(255,240,210,.85), transparent 60%),
    radial-gradient(1.8px 1.8px at 64% 68%, rgba(255,255,255,.8), transparent 60%),
    radial-gradient(1.4px 1.4px at 88% 52%, rgba(210,225,255,.85), transparent 60%),
    radial-gradient(1.6px 1.6px at 34% 84%, rgba(255,255,255,.7), transparent 60%),
    radial-gradient(2.2px 2.2px at 71% 36%, rgba(255,236,200,.95), transparent 60%),
    /* tiled faint stars at three scales */
    radial-gradient(1.4px 1.4px at 20px 30px, rgba(255,255,255,.75), transparent 60%) 0 0 / 170px 170px,
    radial-gradient(1.4px 1.4px at 110px 90px, rgba(200,215,255,.65), transparent 60%) 0 0 / 230px 230px,
    radial-gradient(1.4px 1.4px at 60px 150px, rgba(255,255,255,.55), transparent 60%) 0 0 / 310px 310px,
    radial-gradient(1.4px 1.4px at 150px 40px, rgba(255,245,225,.6), transparent 60%) 0 0 / 270px 270px,
    /* a soft glow low on the horizon */
    radial-gradient(120% 70% at 75% 120%, rgba(60, 86, 150, 0.35), transparent 60%);
}

.sky::after {
  content: "";
  position: absolute;
  width: min(900px, 120vw);
  aspect-ratio: 1;
  right: max(-320px, -28vw);
  top: 50%;
  translate: 0 -50%;
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle at center,
      transparent 0 89px,
      rgba(227, 194, 126, 0.16) 89px 90px),
    repeating-conic-gradient(from 0deg at center,
      rgba(227, 194, 126, 0.12) 0deg 0.25deg,
      transparent 0.25deg 15deg);
  -webkit-mask-image: radial-gradient(circle at center, #000 0 30%, transparent 70%);
          mask-image: radial-gradient(circle at center, #000 0 30%, transparent 70%);
}

.hero-inner { position: relative; }

.hero-name {
  font-size: clamp(3.25rem, 10vw, 7.5rem);
  line-height: 0.95;
  letter-spacing: -0.025em;
  font-weight: 400;
}

.hero-lede {
  max-width: 36rem;
  margin-top: clamp(24px, 4vw, 40px);
  font-size: clamp(1.0625rem, 1.8vw, 1.25rem);
  line-height: 1.6;
  color: #c3cad9;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 36px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 22px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn-primary {
  background: var(--star);
  color: var(--night);
}
.btn-primary:hover { background: #ecd29c; color: var(--night); }
.btn-ghost {
  border: 1px solid var(--rule);
  color: var(--ink);
  background: rgba(18, 26, 46, 0.6);
}
.btn-ghost:hover { border-color: var(--muted); color: var(--ink); }

/* ---------- Sections ---------- */

.section { padding-block: clamp(72px, 10vw, 128px); }

.section-head {
  display: grid;
  gap: 12px;
  margin-bottom: clamp(40px, 6vw, 64px);
}
.section-head h2,
.about-text h2 {
  font-size: clamp(2.25rem, 5vw, 3.25rem);
}
.section-intro {
  max-width: 36rem;
  color: var(--muted);
}

/* ---------- Featured project ---------- */

.feature {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: clamp(28px, 5vw, 64px);
  align-items: center;
  margin-bottom: clamp(56px, 8vw, 88px);
}

.feature-shot { margin: 0; }

.window {
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--dusk);
  overflow: hidden;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.7);
}
.window-bar {
  display: flex;
  gap: 6px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--rule);
}
.window-bar span {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--rule);
}
.window img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top left;
  background: #0f1628;
}

.feature-body h3 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  margin-block: 12px 16px;
}
.feature-body p:last-child { color: #c3cad9; max-width: 30rem; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--star);
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--star);
  box-shadow: 0 0 0 4px var(--star-dim);
}

/* ---------- Project list ---------- */

.project-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  column-gap: clamp(32px, 6vw, 80px);
}

.project {
  padding-block: 28px;
  border-top: 1px solid var(--rule);
  display: grid;
  gap: 10px;
  align-content: start;
}
.project h3 { font-size: 1.625rem; }
.project p { color: #c3cad9; max-width: 32rem; }

.project-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-top: 6px;
  font-size: 0.9375rem;
}
.project .project-meta { color: var(--muted); }

.tag {
  display: inline-block;
  padding: 2px 10px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-size: 0.8125rem;
  color: var(--muted);
}

/* ---------- About ---------- */

.section-about {
  background: var(--dusk);
  border-block: 1px solid var(--rule);
}

.about-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: clamp(40px, 7vw, 96px);
  align-items: start;
}

.about-text h2 { margin-bottom: 28px; }
.about-text p {
  max-width: 34rem;
  color: #c3cad9;
  font-size: 1.125rem;
  line-height: 1.7;
}
.about-text p + p { margin-top: 1.1em; }

.facts {
  margin: 0;
  display: grid;
  gap: 0;
  border-top: 1px solid var(--rule);
}
.fact {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 16px;
  padding-block: 18px;
  border-bottom: 1px solid var(--rule);
}
.fact dt {
  color: var(--muted);
  font-size: 0.9375rem;
}
.fact dd { margin: 0; }

.links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
}

/* ---------- Footer ---------- */

.site-footer { padding-block: 32px; }
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  font-size: 0.9375rem;
  color: var(--muted);
}
.footer-inner a { color: var(--muted); }
.footer-inner a:hover { color: var(--star); }

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .feature,
  .about-grid { grid-template-columns: 1fr; }
  .project-list { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .brand span { display: none; }   /* keep the star mark, give nav the room */
}

@media (max-width: 520px) {
  .fact { grid-template-columns: 1fr; gap: 4px; }
  .hero-actions .btn { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
