/* ==========================================================================
   FOAM — a dark engineering portfolio theme
   Palette + type match the ARC / FRC project pages.
   ========================================================================== */

:root {
  --ink: #081820;
  --ink-2: #0d2531;
  --ink-3: #123141;
  --steel: #1d4356;
  --foam: #e9eff1;
  --foam-dim: #9db2bc;
  --foam-faint: #62808c;
  --hivis: #ff6a2b;
  --hivis-soft: #ff8a54;
  --signal: #4fdcc0;
  --line: rgba(155, 178, 188, 0.16);
  --line-strong: rgba(155, 178, 188, 0.32);
  --body-text: #cdd9de;

  --f-display: "Space Grotesk", system-ui, sans-serif;
  --f-body: "IBM Plex Sans", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, monospace;

  --wrap: 1080px;
  --wrap-narrow: 720px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--foam);
  font-family: var(--f-body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--hivis); color: var(--ink); }

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

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 28px; }
.wrap-narrow { max-width: var(--wrap-narrow); }

.eyebrow {
  font-family: var(--f-mono);
  font-size: 12.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--hivis);
  margin: 0 0 22px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.eyebrow::before { content: ""; width: 26px; height: 1px; background: var(--hivis); flex: none; }

.text-link { color: var(--hivis); text-decoration: none; }
.text-link:hover { color: var(--hivis-soft); }

a:focus-visible, button:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 3px;
}

/* ==========================================================================
   Site header
   ========================================================================== */

.site-head {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(8, 24, 32, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.site-head-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.01em;
}

.logo-mark {
  width: 11px;
  height: 11px;
  background: var(--hivis);
  border-radius: 2px;
  transform: rotate(45deg);
  flex: none;
}

.site-nav .nav {
  list-style: none;
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 0;
}

.site-nav .nav a {
  display: block;
  padding: 8px 13px;
  font-family: var(--f-mono);
  font-size: 12.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--foam-dim);
  text-decoration: none;
  border-radius: 2px;
  transition: color 0.15s ease, background 0.15s ease;
}

.site-nav .nav a:hover { color: var(--foam); background: rgba(255, 255, 255, 0.04); }
.site-nav .nav .nav-current a { color: var(--hivis); }

/* ==========================================================================
   Homepage hero
   ========================================================================== */

.home-hero {
  position: relative;
  padding: 96px 0 84px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.hero-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 52px 52px;
  -webkit-mask-image: radial-gradient(120% 90% at 78% 12%, #000 0%, transparent 72%);
  mask-image: radial-gradient(120% 90% at 78% 12%, #000 0%, transparent 72%);
}

.home-hero .wrap { position: relative; }

.home-hero-title {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(38px, 6.4vw, 76px);
  line-height: 1.02;
  letter-spacing: -0.025em;
  margin: 0;
  max-width: 880px;
}

.home-hero-sub {
  font-family: var(--f-display);
  font-size: clamp(17px, 2.2vw, 22px);
  line-height: 1.4;
  color: var(--foam-dim);
  max-width: 620px;
  margin: 26px 0 0;
}

/* Hero quick-facts data-strip */
.hero-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  margin: 42px 0 0;
  max-width: 720px;
}
.hero-stat { background: var(--ink-2); padding: 18px 20px; }
.hero-stat .k {
  display: block;
  font-family: var(--f-mono);
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--foam-faint);
}
.hero-stat .v {
  display: block;
  margin-top: 7px;
  font-size: 15px;
  color: var(--foam);
}

.archive-title { font-size: clamp(34px, 5vw, 60px); }
.archive-head { position: relative; padding: 72px 0 56px; border-bottom: 1px solid var(--line); }

/* ==========================================================================
   Feed
   ========================================================================== */

.feed { padding: 72px 0 96px; }

.feed-label {
  font-family: var(--f-mono);
  font-size: 12.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--foam-faint);
  margin: 0 0 30px;
}

.feed-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.card { background: var(--ink-2); }

.card-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none;
  transition: background 0.18s ease;
}
.card-link:hover { background: var(--ink-3); }

.card-media { aspect-ratio: 16 / 9; overflow: hidden; }
.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.card-link:hover .card-media img { transform: scale(1.025); }

.card-media-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(120% 140% at 50% 0%, rgba(29, 67, 86, 0.4), transparent 60%),
    var(--ink-3);
  border-bottom: 1px solid var(--line);
}
.card-media-empty span {
  font-family: var(--f-mono);
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--foam-faint);
}

.card-body { padding: 26px 26px 28px; display: flex; flex-direction: column; flex: 1; }

.card-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--f-mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--foam-faint);
  margin-bottom: 14px;
}
.card-tag { color: var(--signal); }

.card-title {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 23px;
  line-height: 1.16;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
  color: var(--foam);
}

.card-excerpt {
  font-size: 15.5px;
  color: var(--body-text);
  margin: 0 0 20px;
}

.card-more {
  margin-top: auto;
  font-family: var(--f-mono);
  font-size: 12.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hivis);
}
.card-link:hover .card-more { color: var(--hivis-soft); }

/* Lead card: first post in the feed spans full width, horizontal on desktop */
.card-lead { grid-column: 1 / -1; }
@media (min-width: 781px) {
  .card-lead .card-link { flex-direction: row; align-items: stretch; }
  .card-lead .card-media {
    flex: 1 1 56%;
    aspect-ratio: auto;
    min-height: 360px;
    border-right: 1px solid var(--line);
  }
  .card-lead .card-media-empty { min-height: 360px; }
  .card-lead .card-body {
    flex: 1 1 44%;
    justify-content: center;
    padding: 40px 44px 42px;
  }
  .card-lead .card-title { font-size: 30px; }
  .card-lead .card-excerpt { font-size: 16.5px; }
}

/* Portfolio tag landing (tag-portfolio.hbs) */
.portfolio-hero-inner { display: grid; grid-template-columns: 1fr; gap: 44px; align-items: center; }
@media (min-width: 861px) {
  .portfolio-hero-inner.has-media { grid-template-columns: 1.15fr 0.85fr; }
}
.portfolio-hero-media {
  margin: 0;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  overflow: hidden;
  background:
    radial-gradient(120% 140% at 50% 0%, rgba(29, 67, 86, 0.35), transparent 60%),
    var(--ink-2);
}
.portfolio-hero-media img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 4 / 3; }

.feed-empty {
  grid-column: 1 / -1;
  background: var(--ink-2);
  padding: 48px 28px;
  text-align: center;
  font-family: var(--f-mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--foam-faint);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 40px;
  font-family: var(--f-mono);
  font-size: 12.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--foam-faint);
}
.pagination a {
  color: var(--hivis);
  text-decoration: none;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  padding: 10px 16px;
  transition: background 0.15s ease;
}
.pagination a:hover { background: rgba(255, 255, 255, 0.04); }

/* ==========================================================================
   Post
   ========================================================================== */

.post-head { padding: 84px 0 44px; }

.post-title {
  font-family: var(--f-display);
  font-weight: 650;
  font-size: clamp(32px, 5vw, 54px);
  line-height: 1.06;
  letter-spacing: -0.02em;
  margin: 0;
}

.post-lede {
  font-family: var(--f-display);
  font-size: clamp(17px, 2.2vw, 22px);
  line-height: 1.4;
  color: var(--foam-dim);
  margin: 22px 0 0;
}

.post-feature { margin: 0 0 56px; }
.post-feature img { width: 100%; max-height: 68vh; object-fit: cover; }
.post-feature figcaption {
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--foam-faint);
  letter-spacing: 0.04em;
  text-align: center;
  padding: 14px 28px 0;
}

.page-head { padding: 72px 0 8px; }

/* ---- Post content (Koenig canvas) ---- */

.post-content { padding-bottom: 40px; }
.post-content > * + * { margin-top: 24px; }

.post-content p { color: var(--body-text); margin: 0; }
.post-content strong { color: var(--foam); }

.post-content h2, .post-content h3, .post-content h4 {
  font-family: var(--f-display);
  color: var(--foam);
  line-height: 1.12;
  letter-spacing: -0.01em;
  margin-bottom: 0;
}
.post-content h2 { font-size: 32px; font-weight: 600; margin-top: 56px; }
.post-content h3 { font-size: 23px; font-weight: 500; margin-top: 44px; }
.post-content h4 { font-size: 18px; font-weight: 600; margin-top: 36px; }

.post-content a { color: var(--hivis); text-decoration: none; border-bottom: 1px solid rgba(255, 106, 43, 0.35); }
.post-content a:hover { color: var(--hivis-soft); border-bottom-color: var(--hivis-soft); }

.post-content ul, .post-content ol { color: var(--body-text); padding-left: 26px; }
.post-content li { margin: 8px 0; }
.post-content li::marker { color: var(--hivis); font-family: var(--f-mono); }

.post-content blockquote {
  border-left: 2px solid var(--hivis);
  margin: 32px 0;
  padding: 2px 0 2px 24px;
  font-family: var(--f-display);
  font-weight: 500;
  font-size: 22px;
  line-height: 1.32;
  color: var(--foam);
}

.post-content hr {
  border: none;
  border-top: 1px solid var(--line-strong);
  margin: 48px 0;
}

.post-content code {
  font-family: var(--f-mono);
  font-size: 0.88em;
  background: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 2px 6px;
  color: var(--signal);
}

.post-content pre {
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 22px 24px;
  overflow-x: auto;
}
.post-content pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--foam);
  font-size: 14px;
  line-height: 1.6;
}

.post-content figure { margin: 36px 0; }
.post-content figcaption {
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--foam-faint);
  letter-spacing: 0.04em;
  text-align: center;
  padding-top: 12px;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
.post-content th, .post-content td {
  border: 1px solid var(--line-strong);
  padding: 10px 14px;
  text-align: left;
  color: var(--body-text);
}
.post-content th {
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--signal);
  background: var(--ink-2);
}

/* Koenig width cards: wide + full breakouts */
.kg-width-wide {
  position: relative;
  width: min(1080px, calc(100vw - 56px));
  margin-left: 50%;
  transform: translateX(-50%);
}
.kg-width-full {
  position: relative;
  width: 100vw;
  margin-left: 50%;
  transform: translateX(-50%);
}
.kg-width-full img { width: 100%; }

/* Ghost gallery + bookmark basics */
.kg-gallery-container { display: flex; flex-direction: column; gap: 8px; }
.kg-gallery-row { display: flex; gap: 8px; }
.kg-gallery-image img { width: 100%; height: 100%; object-fit: cover; }

.kg-bookmark-card a {
  display: flex;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  text-decoration: none;
  overflow: hidden;
  background: var(--ink-2);
}
.kg-bookmark-content { padding: 18px 20px; }
.kg-bookmark-title { font-family: var(--f-display); font-weight: 600; color: var(--foam); }
.kg-bookmark-description { font-size: 14px; color: var(--foam-dim); margin-top: 6px; }
.kg-bookmark-metadata { font-family: var(--f-mono); font-size: 12px; color: var(--foam-faint); margin-top: 12px; }
.kg-bookmark-thumbnail img { height: 100%; object-fit: cover; }

.kg-button-card a, .kg-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--f-mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  background: var(--hivis);
  padding: 14px 20px;
  border-radius: 2px;
  border-bottom: none;
}
.kg-button-card a:hover { background: var(--hivis-soft); color: var(--ink); }

/* ---- Post prev/next ---- */

.post-foot { border-top: 1px solid var(--line); margin-top: 48px; }

.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding-top: 36px;
  padding-bottom: 72px;
}

.post-nav-item { text-decoration: none; }
.post-nav-next { text-align: right; }

.post-nav-label {
  display: block;
  font-family: var(--f-mono);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--foam-faint);
  margin-bottom: 8px;
}

.post-nav-title {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 18px;
  color: var(--foam);
  transition: color 0.15s ease;
}
.post-nav-item:hover .post-nav-title { color: var(--hivis); }

/* ==========================================================================
   Footer
   ========================================================================== */

.site-foot { border-top: 1px solid var(--line); }

.site-foot-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 26px;
  padding-bottom: 26px;
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--foam-faint);
}

/* ==========================================================================
   Reveal animation (progressive; enabled by JS)
   ========================================================================== */

.js-anim .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.js-anim .reveal.in { opacity: 1; transform: none; }

/* ==========================================================================
   Responsive + motion
   ========================================================================== */

@media (max-width: 780px) {
  body { font-size: 16px; }
  .feed-grid { grid-template-columns: 1fr; }
  .hero-strip { grid-template-columns: 1fr; max-width: 420px; }
  .home-hero { padding: 64px 0 56px; }
  .post-head { padding: 60px 0 36px; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav-next { text-align: left; }
  .site-nav .nav { gap: 0; }
  .site-nav .nav a { padding: 8px 9px; font-size: 11.5px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js-anim .reveal { opacity: 1; transform: none; transition: none; }
  .card-media img, .card-link, .post-nav-title { transition: none; }
}

/* Ghost custom fonts support: if the user picks fonts in Design settings,
   honor them; otherwise fall back to the theme's own pairing. */
:root {
  --gh-font-heading: "Space Grotesk";
  --gh-font-body: "IBM Plex Sans";
}
body { font-family: var(--gh-font-body, "IBM Plex Sans"), system-ui, sans-serif; }
h1, h2, h3, h4, h5, h6,
.home-hero-title, .post-title, .card-title, .post-nav-title,
.home-hero-sub, .post-lede, .site-logo {
  font-family: var(--gh-font-heading, "Space Grotesk"), system-ui, sans-serif;
}
