/* ==========================================================================
   Matt Battye - mattbattye.com
   ========================================================================== */

:root {
  --clr-rail: #151515;
  --clr-indigo: #303865;
  --clr-primary: #36558e;
  --clr-primary-deep: #293863;
  --clr-navy: #2a3964;
  --clr-ink: #333333;
  --clr-text: #666666;
  --clr-black: #000000;
  --clr-white: #ffffff;
  --clr-paper: #f5f5f5;
  --clr-frame: #f2f2f2;
  --clr-line: #e4e4e4;
  /* brand red, darkened until it clears 4.5:1 on white (6.01:1) and on the
     blog cards' #e5e5e5 (4.77:1) */
  --clr-accent: #b8302b;
  --clr-accent-deep: #8f221e;
  --clr-muted: #666666;

  --font-ui: "Comfortaa", "Trebuchet MS", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --font-prose: "PT Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;

  --rail-w: 260px;
  --utility-h: 46px;
  /* the mobile bar is the 44px monogram plus its 6px padding, top and bottom */
  --bar-h: 56px;
  /* the centred badge hangs below the utility bar; anchors must clear it */
  --badge-h: 68px;
  --container: 1140px;

  --shadow-card: 0 10px 28px rgba(21, 21, 21, 0.12);
  --shadow-card-hover: 0 18px 44px rgba(21, 21, 21, 0.22);
}

/* --------------------------------------------------------------------------
   Reset and base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--bar-h) + 16px);
  /* the off-canvas menu parks itself outside the viewport */
  overflow-x: hidden;
}

body {
  margin: 0;
  padding-top: var(--bar-h);
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.75;
  color: var(--clr-text);
  background: var(--clr-white);
  overflow-wrap: break-word;
}

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

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-ui);
  font-weight: 700;
  line-height: 1.25;
  color: var(--clr-ink);
  margin: 0 0 0.6em;
}

h1 { font-size: clamp(2rem, 5vw, 2.9rem); }
h2 { font-size: clamp(1.7rem, 4vw, 2.4rem); }
h3 { font-size: clamp(1.15rem, 2.4vw, 1.4rem); }

p { margin: 0 0 1.25em; }

a {
  color: var(--clr-primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.2s ease;
}

a:hover { color: var(--clr-primary-deep); }

ul { padding-left: 1.3em; }

/* Two-tone ring: a dark core on light pages, haloed in white so it holds
   3:1 either way. #36558e on white is 7.38:1. */
:focus-visible {
  outline: 3px solid var(--clr-primary);
  outline-offset: 2px;
  border-radius: 2px;
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.95);
}

/* Inverted on the dark chrome: white ring (18.3:1 on the rail, 11.2:1 on the
   utility bar) haloed in the surface colour so the two tones stay distinct. */
.site-rail :focus-visible,
.utility-bar :focus-visible {
  outline-color: var(--clr-white);
  box-shadow: 0 0 0 6px rgba(0, 0, 0, 0.85);
}

.skip-link {
  position: absolute;
  top: -80px;
  left: 12px;
  z-index: 300;
  background: var(--clr-primary);
  color: var(--clr-white);
  padding: 10px 18px;
  border-radius: 0 0 4px 4px;
  text-decoration: none;
  transition: top 0.2s ease;
}

.skip-link:focus { top: 0; color: var(--clr-white); }

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

.icon { width: 20px; height: 20px; fill: currentColor; flex: none; }

.scroll-sentinel {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 25px;
  visibility: hidden;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Header: mobile bar, desktop left rail, indigo utility bar
   -------------------------------------------------------------------------- */
.site-rail {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--bar-h);
  padding: 6px 12px;
  background: var(--clr-rail);
  transition: box-shadow 0.3s ease;
}

.site-header.is-scrolled .site-rail { box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45); }

.brand { display: inline-flex; align-items: center; text-decoration: none; }
.brand img { width: 44px; height: auto; }

.nav-toggle {
  display: block;
  background: none;
  border: 0;
  padding: 12px;
  min-width: 50px;
  min-height: 50px;
  cursor: pointer;
}

.nav-toggle .bar {
  display: block;
  width: 26px;
  height: 2px;
  background: var(--clr-white);
  margin: 6px 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav-toggle.is-active .bar:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.nav-toggle.is-active .bar:nth-child(2) { opacity: 0; }
.nav-toggle.is-active .bar:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

.nav {
  position: fixed;
  top: var(--bar-h);
  right: 0;
  bottom: 0;
  width: min(320px, 86vw);
  background: rgba(21, 21, 21, 0.98);
  transform: translateX(100%);
  visibility: hidden;
  overflow-y: auto;
  padding: 18px 0 40px;
  transition: transform 0.3s ease, visibility 0.3s;
}

.nav.is-open {
  transform: translateX(0);
  visibility: visible;
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5);
}

.nav ul { list-style: none; margin: 0; padding: 0; }

.nav a {
  display: block;
  padding: 16px 20px 16px 62px;
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--clr-white);
  text-decoration: none;
  background-repeat: no-repeat;
  background-position: 16px center;
  background-size: 32px 32px;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.nav a:hover,
.nav a:focus-visible,
.nav a[aria-current="page"] { color: rgba(255, 255, 255, 0.72); background-color: rgba(255, 255, 255, 0.06); }

.nav--about a { background-image: url("/images/icon-about.webp"); }
.nav--what a { background-image: url("/images/icon-what.webp"); }
.nav--blog a { background-image: url("/images/icon-blog.webp"); }
.nav--testimonials a { background-image: url("/images/icon-testimonial.webp"); }
.nav--connect a { background-image: url("/images/icon-connect.webp"); }

body.nav-open { overflow: hidden; }

/* No-JS: the menu is always in flow */
.no-js .nav-toggle { display: none; }

.no-js .nav {
  position: static;
  transform: none;
  visibility: visible;
  width: 100%;
  background: none;
  padding: 0;
  overflow: visible;
}

@media (max-width: 1023.98px) {
  .no-js .site-rail { position: static; flex-wrap: wrap; }
  /* one clean column, never a ragged wrap */
  .no-js .nav { flex-basis: 100%; }
  .no-js .nav ul { display: block; }
  .no-js .nav a { padding-left: 62px; }
  .no-js body { padding-top: 0; }
}

.utility-bar { display: none; }

.utility-bar__logo { display: block; }
.utility-bar__logo img { width: 74px; height: auto; }

/* --------------------------------------------------------------------------
   Sections and headings
   -------------------------------------------------------------------------- */
.section { padding-block: clamp(48px, 7vw, 82px); }

.section--indigo { background: var(--clr-indigo); color: var(--clr-white); }
.section--indigo h2 { color: var(--clr-white); }

.section--interests,
.section--blog,
.section--connect,
.quote-band {
  background-color: var(--clr-rail);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.section--interests {
  background-image: linear-gradient(rgba(12, 12, 16, 0.62), rgba(12, 12, 16, 0.76)), url("/images/bg-matts-interests.webp");
  color: rgba(255, 255, 255, 0.92);
}

/* lighter veil so the backdrop reads as texture, still well clear of AA */
.section--blog {
  background-image: linear-gradient(rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.86)), url("/images/bg-blog.webp");
}

.section--connect {
  background-image: linear-gradient(rgba(12, 12, 16, 0.62), rgba(12, 12, 16, 0.74)), url("/images/bg-connect.webp");
}

.section-head { text-align: center; margin-bottom: clamp(28px, 4vw, 46px); }
.section-head h1, .section-head h2 { margin-bottom: 0; }

/* Corner brackets are drawn, not stretched from a fixed-ratio image, so they
   keep their shape at every width. */
.heading-divider {
  position: relative;
  display: inline-block;
  padding: 16px clamp(28px, 6vw, 54px);
  color: var(--clr-primary);
}

.heading-divider::before,
.heading-divider::after {
  content: "";
  position: absolute;
  width: clamp(18px, 4vw, 34px);
  height: clamp(14px, 3vw, 24px);
  border: 2px solid currentColor;
  pointer-events: none;
}

.heading-divider::before {
  top: 0;
  left: 0;
  border-right: 0;
  border-bottom: 0;
}

.heading-divider::after {
  right: 0;
  bottom: 0;
  border-left: 0;
  border-top: 0;
}

.heading-divider--matts,
.heading-divider--connect { color: var(--clr-white); }

.section-cta { text-align: center; margin-top: 38px; margin-bottom: 0; }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
/* inline-flex, so filled and ghost buttons share one box no matter what
   background or border they carry */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--clr-white);
  background: var(--clr-primary-deep);
  border: 2px solid var(--clr-primary-deep);
  padding: 13px 28px;
  transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.btn:hover {
  background: var(--clr-primary);
  border-color: var(--clr-primary);
  color: var(--clr-white);
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(41, 56, 99, 0.35);
}

.btn--ghost {
  background: transparent;
  border-color: var(--clr-primary-deep);
  color: var(--clr-primary-deep);
}

.btn--ghost:hover {
  background: var(--clr-primary-deep);
  border-color: var(--clr-primary-deep);
  color: var(--clr-white);
}

/* Ghost buttons on dark photographic sections */
.section--interests .btn--ghost,
.section--connect .btn--ghost {
  border-color: currentColor;
  color: var(--clr-white);
}

.section--interests .btn--ghost:hover,
.section--connect .btn--ghost:hover {
  background: var(--clr-white);
  border-color: var(--clr-white);
  color: var(--clr-primary-deep);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.4);
}

.btn--light {
  background: transparent;
  border-color: var(--clr-white);
  color: var(--clr-white);
  border-radius: 3px;
}

.btn--light:hover {
  background: var(--clr-white);
  border-color: var(--clr-white);
  color: var(--clr-indigo);
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
/* The scrim is weighted towards the copy rather than flattened across the
   whole frame, so the photograph keeps its colour. */
.hero {
  display: flex;
  align-items: flex-end;
  min-height: 420px;
  padding: clamp(56px, 10vw, 110px) 0 clamp(28px, 6vw, 48px);
  text-align: center;
  color: var(--clr-white);
  background-color: var(--clr-rail);
  background-image: linear-gradient(rgba(10, 12, 20, 0.12) 0%, rgba(10, 12, 20, 0.34) 42%, rgba(8, 10, 18, 0.82) 78%, rgba(8, 10, 18, 0.9) 100%), url("/images/bg-home-hero-mobile.webp");
  background-size: cover;
  background-position: top center;
  background-repeat: no-repeat;
}

.hero h1 {
  color: var(--clr-white);
  margin-bottom: 0.15em;
  letter-spacing: 0.02em;
}

.hero__tagline {
  margin: 0 0 0.6em;
  font-size: clamp(0.85rem, 2.4vw, 1.05rem);
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.86);
}

.hero__lead {
  margin: 0;
  font-family: var(--font-prose);
  font-size: clamp(1.05rem, 2.6vw, 1.35rem);
  color: rgba(255, 255, 255, 0.92);
}

/* --------------------------------------------------------------------------
   Prose blocks
   -------------------------------------------------------------------------- */
.prose,
.about-split p {
  font-family: var(--font-prose);
  font-size: 1.0625rem;
  color: var(--clr-text);
}

.prose { max-width: 900px; margin-inline: auto; }

.about-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(28px, 4vw, 48px);
  align-items: center;
}

/* --------------------------------------------------------------------------
   Quote bands
   -------------------------------------------------------------------------- */
.quote-band {
  background-image: linear-gradient(rgba(12, 12, 16, 0.66), rgba(12, 12, 16, 0.78)), url("/images/bg-quotes.webp");
  padding-block: clamp(40px, 6vw, 66px);
}

.quote {
  margin: 0;
  max-width: 960px;
  margin-inline: auto;
  text-align: center;
}

.quote__mark { width: 27px; margin: 0 auto 14px; }
.quote__mark--close { margin: 14px auto 0; }

.quote blockquote { margin: 0; }

.quote blockquote p {
  margin: 0;
  font-size: clamp(1.25rem, 3vw, 1.9rem);
  font-weight: 600;
  line-height: 1.35;
  color: var(--clr-white);
}

/* --------------------------------------------------------------------------
   Find true happiness
   -------------------------------------------------------------------------- */
.happiness {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(24px, 4vw, 48px);
  align-items: center;
  text-align: center;
}

.happiness__diagram { width: 100%; max-width: 520px; margin-inline: auto; }

.happiness__cta { text-align: center; align-self: center; }
.happiness__cta p { font-family: var(--font-prose); font-size: 1.0625rem; }
.happiness__cta p:last-child { margin-bottom: 0; }

/* --------------------------------------------------------------------------
   Matt's Interests cards
   -------------------------------------------------------------------------- */
.interests-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(20px, 3vw, 30px);
}

.interest-card {
  display: flex;
  flex-direction: column;
  padding: 30px 26px;
  text-align: center;
  background: rgba(15, 16, 22, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.14);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.interest-card:hover {
  transform: translateY(-6px);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.45);
}

/* a fixed box gives the three marks the same optical weight despite very
   different aspect ratios */
.interest-card__logo {
  width: auto;
  max-width: 100%;
  height: 162px;
  object-fit: contain;
  margin: 0 auto 18px;
}

/* Compensates for extra empty canvas inside the source artwork. */
.interest-card__logo--zoom { transform: scale(1.25); }

.interest-card h3 { color: var(--clr-white); margin-bottom: 0.2em; }

.interest-card__role {
  margin: 0 0 0.9em;
  font-size: 0.875rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.8);
}

.interest-card p {
  font-family: var(--font-prose);
  font-size: 0.98rem;
  color: rgba(255, 255, 255, 0.9);
}

.interest-card__cta { margin: auto 0 0; padding-top: 6px; }

/* --------------------------------------------------------------------------
   Blog cards (home)
   -------------------------------------------------------------------------- */
.blog-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(22px, 3vw, 32px);
}

.post-card {
  display: flex;
  flex-direction: column;
  background-color: var(--clr-white);
  background-image: url("/images/frame-blog.webp");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  padding: 14px 22px 24px;
  text-decoration: none;
  color: var(--clr-ink);
  box-shadow: var(--shadow-card);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.post-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-card-hover); color: var(--clr-ink); }

.post-card__media { overflow: hidden; margin-bottom: 16px; }
.post-card__media img { width: 100%; transition: transform 0.5s ease; }
.post-card:hover .post-card__media img { transform: scale(1.05); }

.post-card__body { display: flex; flex-direction: column; gap: 8px; flex: 1; }

/* two lines of headroom keeps the meta rows level across the row of cards */
.post-card__title {
  margin: 0;
  min-height: 2.8em;
  font-size: 1.15rem;
  color: var(--clr-black);
  transition: color 0.25s ease;
}

.post-card:hover .post-card__title { color: var(--clr-primary); }

.post-card__meta {
  margin: 0;
  font-family: var(--font-prose);
  font-size: 0.85rem;
  color: var(--clr-text);
}

.post-card__excerpt {
  margin: 0;
  font-family: var(--font-prose);
  font-size: 0.92rem;
  color: #090909;
}

/* --------------------------------------------------------------------------
   Testimonials carousel (native scrolling, JS only enhances)
   -------------------------------------------------------------------------- */
.carousel { position: relative; }

.carousel__track {
  list-style: none;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: min(100%, 460px);
  gap: 24px;
  margin: 0;
  padding: 26px 2px 8px;
  align-items: stretch;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 2px;
  scrollbar-width: thin;
}

.testimonial {
  position: relative;
  scroll-snap-align: start;
  background: var(--clr-paper);
  padding: 34px 22px 26px;
  display: flex;
}

/* Cards fill the row, so the attribution always sits on the card's floor
   and a short quote leaves no dead space beneath it. */
.testimonial__figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.testimonial__quote { margin: 0; }
.testimonial__quote p { margin: 0 0 1.25em; }
.testimonial__cite { margin-top: auto; }

.testimonial::before {
  content: "";
  position: absolute;
  top: -16px;
  left: 50%;
  width: 33px;
  height: 32px;
  transform: translateX(-50%);
  background: url("/images/icon-testi.webp") no-repeat center / contain;
}

.testimonial__quote p {
  font-family: var(--font-prose);
  font-size: 0.95rem;
  color: var(--clr-text);
}

.testimonial__cite {
  display: flex;
  align-items: center;
  gap: 14px;
}

.testimonial__cite img { width: 64px; height: auto; border-radius: 50%; }

.testimonial__name { display: block; font-weight: 700; color: var(--clr-ink); }

.testimonial__role { display: block; font-size: 0.85rem; color: var(--clr-text); }

.carousel__nav { display: flex; justify-content: center; gap: 12px; margin-top: 18px; }

/* the controls are hidden by script when the track cannot scroll */
.carousel__nav[hidden] { display: none; }

.carousel__btn {
  width: 46px;
  height: 46px;
  border: 2px solid var(--clr-primary);
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: background 0.25s ease;
}

.carousel__btn:hover { background: rgba(54, 85, 142, 0.12); }

.carousel__btn::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 11px;
  height: 11px;
  border-right: 2px solid var(--clr-primary);
  border-bottom: 2px solid var(--clr-primary);
}

.carousel__btn--prev::before { transform: rotate(135deg) translate(-2px, -2px); }
.carousel__btn--next::before { transform: rotate(-45deg) translate(-2px, -2px); }

.no-js .carousel__nav { display: none; }

/* --------------------------------------------------------------------------
   Connect banners
   -------------------------------------------------------------------------- */
.connect-grid {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
  margin: 0;
  padding: 0;
}

/* the item stretches to the tallest in the row; the button fills it */
.connect-grid li { display: flex; }

/* Real buttons with live text, in place of the original images of text. */
.connect-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 258px;
  min-height: 56px;
  padding: 13px 18px;
  border-radius: 3px;
  border-color: transparent;
  text-align: left;
}

.connect-btn .icon { width: 22px; height: 22px; }

.connect-btn:hover {
  transform: translateY(-4px);
  border-color: transparent;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.45);
}

.connect-btn--linkedin { background: #0a5c8a; }
.connect-btn--linkedin:hover { background: #0d76b0; }
.connect-btn--x { background: #1d1d1f; }
.connect-btn--x:hover { background: #34343a; }
.connect-btn--youtube { background: #b3000f; }
.connect-btn--youtube:hover { background: #d20a1a; }
.connect-btn--mail { background: var(--clr-accent); }
.connect-btn--mail:hover { background: #cf3b35; }

/* --------------------------------------------------------------------------
   Video facade
   -------------------------------------------------------------------------- */
.yt {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  text-decoration: none;
}

.yt__thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.88;
  transition: opacity 0.3s ease, transform 0.4s ease;
}

.yt:hover .yt__thumb { opacity: 1; transform: scale(1.03); }

.yt__play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 84px;
  height: 60px;
  border-radius: 12px;
  background: rgba(21, 21, 21, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.25s ease, transform 0.25s ease;
}

.yt__play::after {
  content: "";
  border-style: solid;
  border-width: 12px 0 12px 22px;
  border-color: transparent transparent transparent var(--clr-white);
  margin-left: 5px;
}

.yt:hover .yt__play { background: var(--clr-primary); transform: scale(1.08); }

.yt iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* --------------------------------------------------------------------------
   Blog index list
   -------------------------------------------------------------------------- */
.breadcrumbs { font-size: 0.82rem; margin: 0 0 26px; }

.breadcrumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
}

/* #666666 is 5.74:1 on white */
.breadcrumbs__sep { margin-right: 6px; color: var(--clr-muted); }

.breadcrumbs a,
.breadcrumbs [aria-current] {
  display: inline-block;
  padding-block: 4px;
}

.breadcrumbs a { color: var(--clr-primary); text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs [aria-current] { color: var(--clr-text); }

.blog-list { display: grid; gap: clamp(24px, 3vw, 36px); }

.blog-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  background: #e5e5e5;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.blog-item:hover { transform: translateY(-4px); box-shadow: var(--shadow-card-hover); }

/* the media sits in the card with the same inset as the copy alongside it */
.blog-item__media { display: block; padding: 26px 24px; }
.blog-item__media img { width: 100%; }

.blog-item__body { padding: 26px 24px; align-self: center; }

.blog-item__body h2 { font-size: clamp(1.25rem, 3vw, 1.55rem); color: var(--clr-navy); }
.blog-item__body h2 a { color: inherit; text-decoration: none; }
.blog-item__body h2 a:hover { color: var(--clr-primary); }

.blog-item__meta {
  font-family: var(--font-prose);
  font-size: 0.95rem;
  color: var(--clr-text);
}

.blog-item__meta time { color: var(--clr-text); font-weight: 700; }

.blog-item__excerpt { font-family: var(--font-prose); font-size: 1rem; color: var(--clr-black); }

.blog-item .btn { background: var(--clr-primary); border-color: var(--clr-primary); }
.blog-item .btn:hover { background: var(--clr-primary-deep); border-color: var(--clr-primary-deep); }

/* --------------------------------------------------------------------------
   Single post
   -------------------------------------------------------------------------- */
.post-frame {
  max-width: 1000px;
  margin-inline: auto;
  border: 14px solid var(--clr-frame);
  padding: clamp(20px, 4vw, 34px);
}

.post-frame h1 { font-size: clamp(1.5rem, 4vw, 2rem); font-weight: 600; }

.post-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 0.9rem;
  color: var(--clr-text);
  padding-bottom: 18px;
  border-bottom: 1px solid var(--clr-line);
}

.post-body {
  font-family: var(--font-prose);
  font-size: 1.0625rem;
  padding-top: 22px;
}

/* In-post links carry the brand red, darkened to 6.01:1 on white. */
.post-body a { word-break: break-word; color: var(--clr-primary); }
.post-body a:hover,
.post-body a:focus-visible { color: var(--clr-primary-deep); }

.post-nav {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  margin-top: 28px;
}

.post-nav__link {
  display: block;
  padding: 16px 18px;
  background: var(--clr-white);
  border: 1px solid var(--clr-line);
  text-decoration: none;
  transition: box-shadow 0.2s ease;
}

.post-nav__link:hover { box-shadow: var(--shadow-card); }

.post-nav__label {
  display: block;
  font-family: var(--font-prose);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--clr-text);
  margin-bottom: 6px;
}

.post-nav__title {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--clr-primary);
}

.post-nav__link:hover .post-nav__title { color: var(--clr-primary-deep); }

@media (min-width: 760px) {
  .post-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .post-nav__link--newer { grid-column: 1; }
  .post-nav__link--older { grid-column: 2; text-align: right; }
}


/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.site-footer {
  background: var(--clr-black);
  color: var(--clr-white);
  padding: 44px 0;
  text-align: center;
}

.site-footer .container { display: flex; flex-direction: column; align-items: center; gap: 18px; }

.site-footer__brand img { width: 78px; height: auto; }

.site-footer__legal { margin: 0; font-size: 0.95rem; font-weight: 500; }

/* Bottom bar: one centred column on small screens, three tracks from 760px
   up - copyright left, social centre, credit right. */
.site-footer__bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  width: 100%;
}

.footer-social {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
  margin: 0;
  padding: 0;
}

.footer-social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: var(--clr-white);
  transition: color 0.2s ease, transform 0.2s ease;
}

.footer-social a:hover { color: rgba(255, 255, 255, 0.72); transform: translateY(-2px); }

.built-by { display: inline-block; opacity: 0.8; transition: opacity 0.3s ease; }
.built-by:hover { opacity: 1; }
.built-by img { width: 118px; height: auto; }

@media (min-width: 760px) {
  .site-footer__bar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
  }

  .site-footer__legal { justify-self: start; text-align: left; }
  .built-by { justify-self: end; }
}

/* --------------------------------------------------------------------------
   404
   -------------------------------------------------------------------------- */
.error-page { text-align: center; min-height: 56vh; display: flex; align-items: center; }

.error-page__code {
  display: block;
  font-size: clamp(4.5rem, 13vw, 8rem);
  font-weight: 700;
  line-height: 1;
  color: var(--clr-primary);
}

.error-page .btn { margin: 6px; }

/* --------------------------------------------------------------------------
   Utilities
   -------------------------------------------------------------------------- */
.u-mt { margin-top: 22px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   Reveal on scroll
   -------------------------------------------------------------------------- */
/* Hiding is gated on the class main.js sets before it does anything else.
   If the script 404s or throws, nothing is ever hidden. */
.js-ready .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.js-ready .reveal.in-view { opacity: 1; transform: none; }
.reveal-d1 { transition-delay: 0.1s; }
.reveal-d2 { transition-delay: 0.2s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js-ready .reveal { opacity: 1; transform: none; transition: none; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------------------
   Wider viewports
   -------------------------------------------------------------------------- */
@media (min-width: 600px) {
  .hero {
    background-image: linear-gradient(rgba(10, 12, 20, 0.14) 0%, rgba(10, 12, 20, 0.34) 40%, rgba(8, 10, 18, 0.8) 76%, rgba(8, 10, 18, 0.88) 100%), url("/images/bg-home-hero.webp");
  }

  .blog-item { grid-template-columns: 45% minmax(0, 1fr); align-items: center; }
  .blog-item__media { align-self: center; padding: 30px 0 30px 30px; }
  .blog-item__body { padding: 30px 30px 30px 40px; }
  .interests-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .blog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .happiness { grid-template-columns: repeat(2, minmax(0, 1fr)); text-align: left; }
  .happiness__diagram { margin-inline: 0; }
}

@media (min-width: 1024px) {
  body { padding-top: var(--utility-h); padding-left: var(--rail-w); }

  html { scroll-padding-top: calc(var(--badge-h) + 22px); }

  .site-rail {
    inset: 0 auto 0 0;
    width: var(--rail-w);
    min-height: 100vh;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    padding: 40px 10px 10px;
    z-index: 130;
    overflow-y: auto;
  }

  .brand { justify-content: center; margin-bottom: 26px; }
  .brand img { width: 168px; }

  .nav-toggle { display: none; }

  .nav {
    position: static;
    transform: none;
    visibility: visible;
    width: auto;
    background: none;
    padding: 0;
    overflow: visible;
  }

  .nav a { font-size: 0.94rem; font-weight: 700; padding: 15px 8px 15px 46px; background-position: 4px center; background-size: 30px 30px; }

  .utility-bar {
    display: block;
    position: fixed;
    top: 0;
    left: var(--rail-w);
    right: 0;
    z-index: 110;
    height: var(--utility-h);
    background: var(--clr-indigo);
  }

  /* The bar carries the centred badge alone, so the inner block only has to
     hold the container width and give the badge its positioning context. */
  .utility-bar__inner {
    position: relative;
    max-width: var(--container);
    margin-inline: auto;
    height: 100%;
    padding-inline: 20px;
  }

  /* The badge hangs below the bar, so it carries the bar's own colour as an
     opaque disc. Content scrolls behind solid chrome, never a floating mark. */
  .utility-bar__logo {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
    width: var(--badge-h);
    height: var(--badge-h);
    display: grid;
    place-items: center;
    padding: 6px;
    background: var(--clr-indigo);
    border-radius: 0 0 50% 50%;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.28);
  }

  .utility-bar__logo img { width: 100%; height: auto; }

  .interests-grid,
  .blog-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  .about-split { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); }

  /* Desktop: the copy moves left into the dark stage, clear of the speaker,
     so the scrim can stay light over the photograph itself. */
  .hero {
    min-height: 525px;
    align-items: center;
    text-align: left;
    padding-block: clamp(56px, 10vw, 110px);
    background-image: linear-gradient(100deg, rgba(8, 10, 18, 0.88) 0%, rgba(8, 10, 18, 0.8) 32%, rgba(8, 10, 18, 0.46) 54%, rgba(8, 10, 18, 0.24) 76%, rgba(8, 10, 18, 0.32) 100%), url("/images/hero-banner.webp");
    background-position: top center;
  }

  .hero .container > * { max-width: min(28rem, 44%); }

  .carousel__track { grid-auto-columns: minmax(0, calc(50% - 20px)); }

  .post-frame { border-width: 24px; }
}
