/* ==========================================================================
   Mike G. Bernhardt, mikegbernhardt.com
   Identity: "Living Skies". Prairie night navy, harvest gold, warm paper.
   ========================================================================== */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/assets/fonts/bricolage-grotesque.woff2") format("woff2");
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/assets/fonts/instrument-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --night: #0a1521;
  --ink: #0f1b26;
  --paper: #f6f2ea;
  --sand: #ebe4d5;
  --card: #fffdf8;
  --line: #d8d0bf;
  --muted: #55616c;
  --gold: #f2b33d;
  --teal: #0d5f6c;
  --on-night: #eef2f5;
  --on-night-muted: #a5b5c3;
  --line-night: rgba(238, 242, 245, 0.16);

  --display: "Bricolage Grotesque", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --pad: clamp(1.25rem, 4vw, 3rem);
  --section: clamp(4.5rem, 10vw, 9rem);
}

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

@view-transition { navigation: auto; }

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

body {
  margin: 0;
  font: 400 1.0625rem/1.65 var(--sans);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap { width: min(100% - 2 * var(--pad), 80rem); margin-inline: auto; }

h1, h2, h3 { font-family: var(--display); margin: 0; text-wrap: balance; }
p { margin: 0 0 1rem; }
b { font-weight: inherit; }
img { max-width: 100%; }

a { color: var(--teal); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:focus-visible, .btn:focus-visible { outline: 3px solid var(--night); outline-offset: 3px; border-radius: 6px; }
:is(.site-header, .hero, .facts, .province, .contact, .site-footer, .tile-night) a:focus-visible { outline-color: var(--gold); }
::selection { background: var(--gold); color: var(--night); }

.skip { position: absolute; left: -999px; top: 0; background: var(--gold); color: var(--night); padding: 0.7rem 1rem; z-index: 20; font-weight: 600; }
.skip:focus { left: 0; }

/* ---------- Header ---------- */
.site-header { background: var(--night); color: var(--on-night); border-bottom: 1px solid var(--line-night); }
.bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1.5rem; padding-block: 1.1rem; }
.brand {
  display: inline-flex; align-items: center; gap: 0.7rem;
  font: 700 1.2rem/1 var(--display); letter-spacing: -0.01em;
  color: var(--on-night); text-decoration: none;
}
.brand::before {
  content: ""; width: 2rem; height: 2rem; flex: none;
  background: url("/assets/favicon.svg") center / contain no-repeat;
}
.brand b, .hero h1 b, .mega b { color: var(--gold); }
.site-header nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1.6rem; }
.site-header nav a { color: var(--on-night-muted); text-decoration: none; font-size: 0.95rem; font-weight: 500; transition: color 0.2s; }
.site-header nav a:hover { color: var(--on-night); }
.site-header nav .nav-cta { color: var(--night); background: var(--gold); padding: 0.5rem 1rem; border-radius: 999px; font-weight: 600; }
.site-header nav .nav-cta:hover { color: var(--night); background: #ffc65a; }

/* ---------- Buttons ---------- */
.cta { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.75rem; }
.btn {
  display: inline-flex; align-items: center; gap: 0.55rem;
  padding: 0.95rem 1.4rem; border-radius: 999px;
  font: 600 1rem/1 var(--sans); text-decoration: none;
  border: 1.5px solid transparent;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.btn span { transition: transform 0.2s ease; }
.btn:hover span { transform: translate(2px, -2px); }
.btn.primary { background: var(--gold); color: var(--night); }
.btn.primary:hover { background: #ffc65a; transform: translateY(-2px); }
.btn.ghost { color: var(--on-night); border-color: rgba(238, 242, 245, 0.32); }
.btn.ghost:hover { border-color: var(--gold); color: var(--gold); }

.meta {
  font: 500 0.78rem/1.4 var(--mono); letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--gold); margin: 0;
}

/* ---------- Hero ---------- */
.hero {
  position: relative; isolation: isolate; overflow: hidden;
  background: var(--night); color: var(--on-night);
  padding-top: clamp(2rem, 5vw, 4rem);
  padding-bottom: clamp(13rem, 33vw, 29rem);
}
.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(13rem, 23vw, 20rem);
  grid-template-areas: "top top" "name portrait" "meta meta";
  column-gap: clamp(1.5rem, 3.5vw, 3.5rem);
  align-items: end;
}
.hero-top { grid-area: top; display: flex; justify-content: space-between; gap: 1rem; margin-bottom: clamp(1.25rem, 3vw, 2.5rem); }
.coords { color: var(--on-night-muted); font-variant-numeric: tabular-nums; }
.hero h1 {
  grid-area: name;
  font-weight: 800; font-stretch: 80%;
  font-size: clamp(3.6rem, 17.2vw, 16.25rem);
  line-height: 0.84; letter-spacing: -0.012em;
  margin: 0 0 0 -0.04em;
}
.hero h1 span { display: block; }
.hero-portrait { grid-area: portrait; margin: 0; }
.hero-portrait img {
  display: block; width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover;
  border-radius: 18px; background: #0b0b0b;
  box-shadow: 0 0 0 1px rgba(246, 200, 96, 0.5), 0 40px 80px -30px rgba(0, 0, 0, 0.8);
}
.hero-meta {
  grid-area: meta;
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 2rem clamp(2rem, 6vw, 6rem); align-items: end;
  margin-top: clamp(2rem, 4.5vw, 3.75rem);
}
.headline { font: 600 clamp(1.3rem, 2.4vw, 2rem)/1.15 var(--display); letter-spacing: -0.015em; margin-bottom: 1rem; max-width: 26ch; }
.lede { color: var(--on-night-muted); max-width: 36rem; font-size: 1.1rem; margin: 0; }
.hero .cta { justify-content: flex-end; }

.horizon {
  position: absolute; inset: auto 0 0 0; width: 100%; height: clamp(15rem, 40vw, 34rem); z-index: -1; display: block;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 30%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 30%);
}
.sun { animation: sunrise 2.6s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.stars circle { animation: twinkle 5s ease-in-out 4; }
.stars circle:nth-child(3n) { animation-delay: -1.7s; }
.stars circle:nth-child(3n + 1) { animation-delay: -3.3s; }
@keyframes sunrise { from { transform: translateY(58px); } to { transform: none; } }
@keyframes twinkle { 0%, 100% { opacity: 0.85; } 50% { opacity: 0.25; } }

/* ---------- Facts ---------- */
.facts { background: var(--night); color: var(--on-night); border-top: 1px solid var(--line-night); }
.facts-grid { display: grid; grid-template-columns: repeat(4, 1fr); margin-block: 0; }
.facts-grid > div { padding: clamp(1.5rem, 3vw, 2.5rem) clamp(1rem, 2vw, 2rem); border-left: 1px solid var(--line-night); }
.facts-grid > div:first-child { border-left: 0; padding-left: 0; }
.facts dt { font: 700 clamp(1.5rem, 2.6vw, 2.4rem)/1.05 var(--display); font-stretch: 85%; letter-spacing: -0.02em; color: var(--gold); }
.facts dd { margin: 0.5rem 0 0; color: var(--on-night-muted); font-size: 0.95rem; }

/* ---------- Sections ---------- */
.section { padding-block: var(--section); }
.label { font: 500 0.78rem/1.4 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--teal); margin-bottom: 1.5rem; }
.display { font-weight: 800; font-stretch: 80%; font-size: clamp(3rem, 9vw, 8rem); line-height: 0.88; letter-spacing: -0.015em; }
.section-head { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1.5rem clamp(2rem, 6vw, 6rem); align-items: end; margin-bottom: clamp(2.5rem, 5vw, 4.5rem); }
.section-head p { color: var(--muted); font-size: 1.15rem; max-width: 28rem; margin: 0 0 0.6rem; justify-self: end; }

/* ---------- About ---------- */
.statement { font-weight: 600; font-stretch: 90%; font-size: clamp(2rem, 5.2vw, 4.75rem); line-height: 1.02; letter-spacing: -0.03em; max-width: 25ch; }
.statement mark { background: linear-gradient(transparent 58%, var(--gold) 58%, var(--gold) 92%, transparent 92%); color: inherit; padding-inline: 0.06em; }
.about-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: clamp(2.5rem, 6vw, 6rem); margin-top: clamp(3rem, 7vw, 6rem); align-items: start; }
.prose { font-size: 1.15rem; line-height: 1.7; max-width: 40rem; }
.prose p { margin-bottom: 1.35rem; }

.bio-card { margin-top: 2.5rem; padding: 1.5rem 1.75rem; background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--gold); border-radius: 12px; }
.bio-card h3, .xp h3 { font: 500 0.78rem/1.4 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.7rem; }
.bio-card p { margin: 0; font-size: 1rem; line-height: 1.6; }
.avatar { float: left; width: 4.75rem; height: 4.75rem; border-radius: 50%; object-fit: cover; margin: 0.1rem 1.25rem 0.5rem 0; }
.bio-card.author::after { content: ""; display: block; clear: both; }

.xp h3 { margin-bottom: 1rem; }
.xp-list { list-style: none; margin: 0; padding: 0; border-top: 1.5px solid var(--ink); }
.xp-list li { display: grid; grid-template-columns: 8.25rem minmax(0, 1fr); gap: 0.25rem 1.5rem; padding: 1.35rem 0; border-bottom: 1px solid var(--line); }
.xp-when { font: 500 0.78rem/1.9 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 0; }
.xp-org { font: 700 1.3rem/1.15 var(--display); letter-spacing: -0.01em; margin: 0 0 0.4rem; }
.xp-what { margin: 0; color: var(--muted); font-size: 1rem; line-height: 1.55; }

/* ---------- Focus tiles (asymmetric) ---------- */
.focus { background: var(--sand); }
.tiles { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 1.25rem; }
.tile { display: flex; flex-direction: column; border-radius: 20px; padding: clamp(1.5rem, 2.6vw, 2.5rem); transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1); }
.tile:hover { transform: translateY(-6px); }
.tile svg { width: 100%; height: auto; font-family: var(--mono); }
.tile-body { display: flex; flex-direction: column; flex: 1; }
.tile h3 { font-weight: 700; font-stretch: 85%; font-size: clamp(1.6rem, 2.3vw, 2.1rem); line-height: 1.02; letter-spacing: -0.02em; margin-bottom: 0.9rem; }
.tile p { font-size: 1rem; line-height: 1.6; }
.tile .chips { margin: auto 0 0; padding-top: 1.1rem; font: 500 0.76rem/1.5 var(--mono); letter-spacing: 0.04em; text-transform: uppercase; border-top: 1px solid color-mix(in srgb, currentColor 22%, transparent); }

.tile-night { grid-row: span 2; background: var(--night); color: var(--on-night); justify-content: space-between; }
.tile-night svg { margin-bottom: clamp(2rem, 4vw, 3.5rem); }
.tile-night .tile-body { flex: 0 1 auto; }
.tile-night h3 { font-size: clamp(2rem, 3.4vw, 3.1rem); }
.tile-night p:not(.chips) { color: var(--on-night-muted); font-size: 1.1rem; max-width: 34rem; }
.tile-night .chips { margin-top: 1.5rem; }

.tile-sand, .tile-gold { flex-direction: row; align-items: center; gap: clamp(1.25rem, 2.5vw, 2rem); }
.tile-sand svg, .tile-gold svg { flex: 0 0 42%; width: 42%; }
.tile-sand { background: var(--paper); color: var(--ink); }
.tile-sand p:not(.chips) { color: var(--muted); }
.tile-gold { background: var(--gold); color: var(--night); }

/* ---------- Province ---------- */
.province { background: var(--night); color: var(--on-night); padding-block: var(--section); }
.province-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.7fr); gap: clamp(2rem, 6vw, 6rem); align-items: center; }
.province-lede { color: var(--on-night-muted); font-size: 1.2rem; max-width: 34rem; margin: clamp(1.5rem, 3vw, 2.5rem) 0; }
.places { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; max-width: 40rem; }
.places li { font: 500 0.76rem/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; padding: 0.6rem 0.85rem; border: 1px solid var(--line-night); border-radius: 999px; }
.places li:first-child { background: var(--gold); color: var(--night); border-color: var(--gold); }
.places li:last-child { border-style: dashed; color: var(--on-night-muted); }
.sk-map { width: 100%; max-width: 25rem; height: auto; justify-self: end; font-family: var(--mono); }

/* ---------- Insights ---------- */
.posts { list-style: none; margin: 0; padding: 0; border-top: 1.5px solid var(--ink); }
.post-row {
  display: grid; grid-template-columns: 9rem minmax(0, 1fr) auto 3.5rem; gap: 1rem clamp(1rem, 3vw, 2.5rem); align-items: start;
  padding: clamp(1.6rem, 3vw, 2.5rem) clamp(0.5rem, 1.5vw, 1.25rem);
  border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none;
  transition: background 0.25s ease;
}
.post-row:hover { background: var(--card); }
.tag { font: 500 0.76rem/1.5 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--teal); margin: 0; padding-top: 0.5rem; }
.post-main :is(h2, h3) { font-weight: 700; font-stretch: 88%; font-size: clamp(1.45rem, 2.7vw, 2.3rem); line-height: 1.06; letter-spacing: -0.02em; margin-bottom: 0.7rem; max-width: 26ch; }
.post-main p { color: var(--muted); margin: 0; max-width: 44rem; }
.post-meta { font: 500 0.76rem/1.5 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); white-space: nowrap; margin: 0; padding-top: 0.5rem; }
.arrow {
  display: grid; place-items: center; width: 3.25rem; height: 3.25rem; border-radius: 50%;
  border: 1.5px solid var(--ink); font-size: 1.25rem;
  transition: background 0.25s ease, transform 0.25s ease, border-color 0.25s ease;
}
.post-row:hover .arrow { background: var(--gold); border-color: var(--gold); transform: rotate(45deg); }

.all-link { margin: 2rem 0 0; font-weight: 600; }
.all-link a { text-decoration: none; }
.all-link a:hover { text-decoration: underline; }

/* ---------- Contact ---------- */
.contact { background: var(--night); color: var(--on-night); padding-block: var(--section); }
.mega { font-weight: 800; font-stretch: 80%; font-size: clamp(4.5rem, 20vw, 19rem); line-height: 0.82; letter-spacing: -0.012em; margin: 0 0 2.5rem -0.04em; }
.contact-lede { color: var(--on-night-muted); font-size: 1.2rem; max-width: 38rem; margin-bottom: 2rem; }

/* ---------- Footer ---------- */
.site-footer { background: var(--night); color: var(--on-night-muted); border-top: 1px solid var(--line-night); padding-block: 2rem; font-size: 0.9rem; }
.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 2rem; }
.site-footer p { margin: 0; }
.site-footer a { color: var(--on-night); }
.fine { flex-basis: 100%; font-size: 0.82rem; opacity: 0.8; }

/* ---------- Article + hub pages ---------- */
.article { max-width: 43rem; padding-block: clamp(3rem, 7vw, 6rem); }
.article .tag { padding: 0; margin-bottom: 1.25rem; }
.article h1 { font-weight: 800; font-stretch: 80%; font-size: clamp(2.4rem, 6vw, 4.2rem); line-height: 0.98; letter-spacing: -0.015em; }
.article h2 { font-weight: 700; font-stretch: 88%; font-size: clamp(1.5rem, 2.6vw, 1.9rem); line-height: 1.1; letter-spacing: -0.02em; margin: 2.75rem 0 0.9rem; }
.article article > p { font-size: 1.15rem; line-height: 1.75; margin-bottom: 1.3rem; max-width: 65ch; }
.article article > p strong { font-weight: 700; }
.byline { color: var(--muted); font-size: 0.95rem !important; margin: 1.5rem 0 2.75rem !important; padding-bottom: 1.5rem; border-bottom: 1.5px solid var(--ink); max-width: none !important; }
.article .lead { font: 500 clamp(1.3rem, 2.2vw, 1.6rem)/1.4 var(--display); font-stretch: 95%; letter-spacing: -0.01em; }
.tldr { margin: 0 0 2.5rem; padding: 1.4rem 1.6rem 1.5rem; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.article .tldr h2 { font: 500 0.78rem/1.4 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 0 0 0.8rem; }
.tldr ul { margin: 0; padding-left: 1.2rem; }
.tldr li { margin-bottom: 0.5rem; line-height: 1.55; }
.tldr li:last-child { margin-bottom: 0; }
.tldr li::marker { color: var(--teal); }
.more { margin-top: 3.5rem; border-top: 1.5px solid var(--ink); padding-top: 1.5rem; }
.more h2 { font: 500 0.78rem/1.4 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 0 0 1rem; }
.more ul { list-style: none; margin: 0; padding: 0; }
.more li { border-bottom: 1px solid var(--line); }
.more a { display: flex; justify-content: space-between; gap: 1rem; padding: 1rem 0; color: var(--ink); text-decoration: none; font: 600 1.2rem/1.25 var(--display); letter-spacing: -0.01em; }
.more a:hover { color: var(--teal); }
.back { margin-top: 2rem; font-weight: 600; }

.hub { padding-block: clamp(3rem, 7vw, 6rem); }
.hub .section-head { align-items: end; }
.hub h1 { margin: 0; }

/* 404 */
.notfound { min-height: 60vh; display: grid; align-content: center; gap: 1.5rem; padding-block: var(--section); }

/* ---------- Scroll reveal ---------- */
.js .reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1); }
.js .reveal.in { opacity: 1; transform: none; }
.js .facts-grid .reveal:nth-child(2) { transition-delay: 0.08s; }
.js .facts-grid .reveal:nth-child(3) { transition-delay: 0.16s; }
.js .facts-grid .reveal:nth-child(4) { transition-delay: 0.24s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .sun, .stars circle { animation: none; }
  .btn, .tile, .arrow { transition: none; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .tiles { grid-template-columns: 1fr; }
  .tile-night { grid-row: auto; }
  .tile-night svg { max-width: 30rem; }
  .facts-grid { grid-template-columns: repeat(2, 1fr); }
  .facts-grid > div:nth-child(odd) { border-left: 0; padding-left: 0; }
  .facts-grid > div:nth-child(n + 3) { border-top: 1px solid var(--line-night); }
  .about-grid { grid-template-columns: 1fr; }
  .province-grid { grid-template-columns: 1fr; }
  .sk-map { justify-self: start; max-width: 20rem; }
}
@media (max-width: 820px) {
  .hero-inner { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "name" "portrait" "meta"; }
  .hero h1 { font-size: clamp(3.4rem, 19vw, 9rem); }
  .hero-portrait { width: 10rem; margin-top: 1.75rem; }
  .hero-portrait img { border-radius: 14px; }
  .hero-meta { margin-top: 1.75rem; }
  .hero-meta, .section-head { grid-template-columns: 1fr; }
  .hero .cta { justify-content: flex-start; }
  .section-head p { justify-self: start; }
  .coords { display: none; }
  .bar { gap: 0.75rem 1rem; }
  .site-header nav { width: 100%; justify-content: space-between; gap: 0.4rem 1rem; }
  .site-header nav a { font-size: 0.9rem; }
  .site-header nav .nav-cta { padding: 0.45rem 0.85rem; white-space: nowrap; }
  .brand { font-size: 1.05rem; gap: 0.55rem; }
  .brand::before { width: 1.75rem; height: 1.75rem; }
  .post-row { grid-template-columns: minmax(0, 1fr) 3rem; }
  .post-row .tag { grid-column: 1 / -1; padding: 0; }
  .post-meta { display: none; }
  .arrow { width: 2.75rem; height: 2.75rem; }
}
@media (max-width: 560px) {
  .tile-sand, .tile-gold { flex-direction: column; align-items: stretch; }
  .tile-sand svg, .tile-gold svg { flex: none; width: 100%; max-width: 20rem; }
  .xp-list li { grid-template-columns: 1fr; }
}

@media print {
  .site-header, .horizon, .cta, .site-footer { display: none; }
  .hero, .contact, .facts { background: none; color: #000; padding: 0; }
  .hero *, .facts *, .contact * { color: #000 !important; }
  .js .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
}
