/*
 * Cosmic Night — theme mockup for matthewhelmke.com
 * A clean, readable dark site with confined "liquid light show" psychedelia,
 * reminiscent of 1967–1972 album/poster art. Accent colour lives in the
 * masthead, wordmark, headings, links, and dividers — never under body text.
 *
 * Pure CSS, no JS, self-hosted fonts. Tweak the palette in :root.
 */

/* --- Self-hosted fonts (no CDN call) ------------------------------------- */
@font-face {
  font-family: "Chicle";           /* bubbly retro display — the wordmark */
  src: url("fonts/chicle.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Chango";           /* fat slab poster — headings & nav */
  src: url("fonts/chango.woff2") format("woff2");
  font-display: swap;
}

/* --- Palette and tokens -------------------------------------------------- */
:root {
  --indigo:   #14082b;   /* page base */
  --indigo-2: #1e1140;   /* raised panels (code, cards) */
  --ink:      #f2e9d8;   /* body text — ~14:1 on indigo */
  --ink-dim:  #b9aec9;   /* muted text (dates, captions) */

  --cyan:     #2de2e6;   /* links */
  --magenta:  #ff2a6d;   /* hover / emphasis */
  --gold:     #ffd23f;   /* headings */

  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --display: "Chango", var(--body);

  --measure: 42rem;      /* readable line length */
  --gap: clamp(1rem, 3vw, 2rem);
}

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

body {
  margin: 0;
  background: var(--indigo);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: var(--measure); margin: 0 auto; padding: 0 var(--gap); }

a { color: var(--cyan); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--magenta); }
a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 2px; }

/* --- Masthead: the liquid light show ------------------------------------- */
/* Layered radial gradients over indigo, drifting slowly like an oil-wheel
   projection. The blobs sit behind a darkening veil so the wordmark stays
   crisp. Motion is disabled for prefers-reduced-motion (see bottom). */
.masthead {
  position: relative;
  overflow: hidden;
  padding: clamp(3rem, 9vw, 6rem) 0 clamp(1.5rem, 4vw, 3rem);
  text-align: center;
  border-bottom: 1px solid rgba(255, 210, 63, 0.18);
}
.masthead::before {
  content: "";
  position: absolute;
  inset: -30%;
  z-index: 0;
  background:
    radial-gradient(38% 50% at 22% 30%, rgba(45, 226, 230, 0.55), transparent 70%),
    radial-gradient(42% 55% at 78% 28%, rgba(255, 42, 109, 0.50), transparent 70%),
    radial-gradient(45% 60% at 50% 80%, rgba(255, 210, 63, 0.40), transparent 70%),
    radial-gradient(50% 60% at 65% 60%, rgba(106, 44, 145, 0.55), transparent 70%);
  filter: blur(28px) saturate(140%);
  animation: drift 24s ease-in-out infinite alternate;
}
/* A veil so text never sits on a hot colour */
.masthead::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: radial-gradient(120% 90% at 50% 35%, transparent, rgba(20, 8, 43, 0.72) 78%);
}
.masthead > * { position: relative; z-index: 2; }

@keyframes drift {
  0%   { transform: translate3d(-3%, -2%, 0) scale(1.05) rotate(0deg); }
  50%  { transform: translate3d(3%, 2%, 0)  scale(1.15) rotate(4deg); }
  100% { transform: translate3d(-2%, 3%, 0) scale(1.08) rotate(-3deg); }
}

/* Wordmark: Chicle with a cycling cyan→magenta→gold gradient fill */
.wordmark {
  margin: 0;
  font-family: "Chicle", var(--display);
  font-weight: 400;
  font-size: clamp(3rem, 10vw, 6.5rem);
  line-height: 1.05;
  letter-spacing: 0.02em;
  background: linear-gradient(100deg, var(--cyan), var(--magenta) 45%, var(--gold) 85%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: huedrift 18s ease-in-out infinite alternate;
}
.wordmark a { color: transparent; text-decoration: none; }
@keyframes huedrift { from { background-position: 0% 50%; } to { background-position: 100% 50%; } }

.tagline { margin: 0.6rem 0 1.4rem; color: var(--ink-dim); font-size: 1.05rem; }

/* --- Navigation ---------------------------------------------------------- */
nav.site { display: flex; flex-wrap: wrap; gap: 1.2rem; justify-content: center; }
nav.site a {
  font-family: var(--body);   /* clean sans — nav reads better than fat slab */
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
}
nav.site a:hover { color: var(--gold); border-bottom-color: var(--magenta); }

/* --- Typography ---------------------------------------------------------- */
main { padding: clamp(2rem, 5vw, 3.5rem) 0; }

h1, h2, h3 { font-family: var(--display); line-height: 1.2; color: var(--gold); }
h1 { font-family: "Chicle", var(--display); font-size: clamp(1.8rem, 4vw, 2.6rem); }
h2 { font-size: 1.6rem; margin-top: 2.5rem; }
h3 { font-size: 1.25rem; color: var(--cyan); }

p, ul, ol { max-width: var(--measure); }

blockquote {
  margin: 1.5rem 0;
  padding: 0.4rem 0 0.4rem 1.2rem;
  border-left: 3px solid var(--magenta);
  color: var(--ink-dim);
  font-style: italic;
}

/* --- Code: a readable raised panel on the dark base ---------------------- */
code {
  font-family: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--indigo-2);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}
pre {
  max-width: var(--measure);
  margin: 1.5rem 0;
  padding: 1rem 1.2rem;
  background: var(--indigo-2);
  border: 1px solid rgba(45, 226, 230, 0.22);
  border-left: 3px solid var(--cyan);
  border-radius: 8px;
  overflow-x: auto;
  line-height: 1.55;
}
pre code { background: none; padding: 0; }

/* --- Blog list ----------------------------------------------------------- */
ul.posts { list-style: none; padding: 0; }
ul.posts li { padding: 0.45rem 0; border-bottom: 1px dotted rgba(185, 174, 201, 0.25); }
ul.posts time { color: var(--ink-dim); font-variant-numeric: tabular-nums; margin-right: 0.6rem; }

/* --- Whiplash divider (Art-Nouveau curve in gold) ----------------------- */
.divider { display: block; width: 100%; max-width: var(--measure); margin: 2.5rem auto; height: 24px; }
.divider path { fill: none; stroke: var(--gold); stroke-width: 2; opacity: 0.7; }

/* --- Footer with a faint mandala watermark ------------------------------ */
footer {
  position: relative;
  overflow: hidden;
  margin-top: 3rem;
  padding: 2.5rem 0;
  border-top: 1px solid rgba(255, 210, 63, 0.18);
  color: var(--ink-dim);
  font-size: 0.95rem;
  text-align: center;
}
/* A repeating conic/radial bloom, kept very low opacity so it reads as texture */
footer::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    repeating-conic-gradient(from 0deg at 50% 120%,
      var(--cyan) 0deg 6deg, transparent 6deg 18deg);
  opacity: 0.05;
}
footer > * { position: relative; z-index: 1; }

/* --- Motion and accessibility ------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .masthead::before, .wordmark { animation: none; }
  .wordmark { background-position: 30% 50%; }  /* a pleasant fixed blend */
}
