/* ==========================================================================
   Uphill Pursuit — shared styles for the adventure blog
   ========================================================================== */

/* --------------------------------------------------------------------------
   Design tokens
   -------------------------------------------------------------------------- */

/* theme.js resolves the system preference and writes data-theme on <html>,
   so the palette below is keyed off that attribute rather than a media query. */
:root {
  color-scheme: light;

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;

  --bg: #f7f5f1;
  --bg-translucent: rgba(247, 245, 241, 0.82);
  --surface: #ffffff;
  --surface-alt: #f0ede7;
  --text: #1e1d1b;
  --text-muted: #6a665f;
  --border: rgba(30, 29, 27, 0.12);
  --accent: #2f6d4f;
  --accent-strong: #24563e;
  --accent-soft: rgba(47, 109, 79, 0.1);

  --shadow-sm: 0 1px 2px rgba(24, 23, 21, 0.06),
    0 4px 12px rgba(24, 23, 21, 0.06);
  --shadow-md: 0 2px 4px rgba(24, 23, 21, 0.06),
    0 12px 32px rgba(24, 23, 21, 0.1);
  --shadow-lg: 0 4px 8px rgba(24, 23, 21, 0.08),
    0 24px 56px rgba(24, 23, 21, 0.16);

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;

  --page-max: 1280px;
  --prose-max: 68ch;
  --figure-max: 940px;
  --gutter: clamp(1.25rem, 4vw, 3rem);
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #14151a;
  --bg-translucent: rgba(20, 21, 26, 0.82);
  --surface: #1c1e24;
  --surface-alt: #23262d;
  --text: #ecebe7;
  --text-muted: #a4a29c;
  --border: rgba(255, 255, 255, 0.13);
  --accent: #79c6a1;
  --accent-strong: #9ad9b9;
  --accent-soft: rgba(121, 198, 161, 0.14);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.32);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.42);
  --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.45), 0 24px 56px rgba(0, 0, 0, 0.55);
}

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

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

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

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.075rem);
  line-height: 1.7;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0;
  text-wrap: balance;
}

p {
  margin: 0 0 1.35em;
}

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

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color 0.18s ease;
}

a:hover {
  color: var(--accent-strong);
}

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

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

/* --------------------------------------------------------------------------
   Site header
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background-color: var(--bg-translucent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0.85rem var(--gutter);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
}

.site-brand {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text);
  text-decoration: none;
}

.site-brand:hover {
  color: var(--accent);
}

.site-header__actions {
  display: flex;
  align-items: center;
  gap: 0.35rem 1.4rem;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.4rem;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}

.site-nav a {
  display: inline-block;
  padding: 0.4rem 0;
  color: var(--text-muted);
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--accent);
}

/* The home link points at the terminal landing page, so it is dressed as a
   shell command. The visible text is a glyph, hence the aria-label in markup. */
.nav-home {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0;
}

/* Theme toggle */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background-color: transparent;
  color: var(--text-muted);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.18s ease, border-color 0.18s ease,
    background-color 0.18s ease;
}

.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
  background-color: var(--accent-soft);
}

.theme-toggle svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle__sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle__sun {
  display: block;
}

:root[data-theme="dark"] .theme-toggle__moon {
  display: none;
}

/* --------------------------------------------------------------------------
   Layout primitives
   -------------------------------------------------------------------------- */

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

.home-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 21rem;
  gap: clamp(2rem, 4vw, 3.5rem);
  align-items: start;
  padding-bottom: 4rem;
}

@media (max-width: 62rem) {
  .home-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

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

.hero {
  padding: clamp(3rem, 8vw, 6rem) 0 clamp(2rem, 4vw, 3.25rem);
  text-align: center;
}

.hero h1 {
  font-size: clamp(2.25rem, 6vw, 4rem);
}

.hero__tagline {
  margin: 1rem 0 0;
  font-size: 1.35rem;
  letter-spacing: 0.35em;
}

.hero__intro {
  margin: 1.5rem auto 0;
  max-width: 46ch;
  color: var(--text-muted);
  font-size: 1.05rem;
}

/* --------------------------------------------------------------------------
   Post cards
   -------------------------------------------------------------------------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(19rem, 100%), 1fr));
  gap: clamp(1.5rem, 3vw, 2.25rem);
}

.card {
  display: flex;
  flex-direction: column;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

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

.card__media {
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background-color: var(--surface-alt);
}

.card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.card:hover .card__media img {
  transform: scale(1.045);
}

.card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 1.4rem 1.5rem 1.6rem;
}

.card__tag {
  align-self: flex-start;
  margin-bottom: 0.85rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background-color: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.card__title {
  font-size: 1.4rem;
  margin-bottom: 0.4rem;
}

.card__title a {
  color: inherit;
  text-decoration: none;
}

.card__title a:hover {
  color: var(--accent);
}

.card__meta {
  margin: 0 0 0.9rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

.card__excerpt {
  margin: 0 0 1.35rem;
  color: var(--text-muted);
}

.card__link {
  margin-top: auto;
  align-self: flex-start;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.card__link::after {
  content: " →";
  display: inline-block;
  transition: transform 0.2s ease;
}

.card__link:hover::after {
  transform: translateX(3px);
}

/* --------------------------------------------------------------------------
   Sidebar
   -------------------------------------------------------------------------- */

.sidebar {
  display: grid;
  gap: clamp(1.5rem, 3vw, 2rem);
}

@media (min-width: 62.0625rem) {
  .sidebar {
    position: sticky;
    top: 5.5rem;
  }
}

.panel {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.panel__media img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.panel__body {
  padding: 1.35rem 1.5rem 1.5rem;
}

.panel__title {
  font-size: 1.2rem;
  margin-bottom: 0.75rem;
}

.panel__body p:last-child {
  margin-bottom: 0;
}

.panel__body p {
  font-size: 0.97rem;
  color: var(--text-muted);
}

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

.checklist li {
  display: flex;
  gap: 0.7rem;
  padding: 0.85rem 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.97rem;
  color: var(--text-muted);
}

.checklist li::before {
  content: "△";
  color: var(--accent);
  font-size: 0.8rem;
  line-height: 1.9;
}

/* --------------------------------------------------------------------------
   Post pages
   -------------------------------------------------------------------------- */

.post {
  padding-bottom: clamp(3rem, 6vw, 5rem);
}

.post-header {
  max-width: var(--prose-max);
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 4.5rem) 0 clamp(1.75rem, 3vw, 2.5rem);
  text-align: center;
}

.post-header h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
}

.post-meta {
  margin: 1.1rem 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.back-link {
  display: inline-block;
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
}

.back-link::before {
  content: "← ";
}

.post-body > p {
  max-width: var(--prose-max);
  margin-left: auto;
  margin-right: auto;
}

.post-body > p.lede {
  font-size: clamp(1.1rem, 1rem + 0.4vw, 1.28rem);
  line-height: 1.65;
  color: var(--text-muted);
}

.post-body figure {
  max-width: var(--figure-max);
  margin: clamp(2rem, 4vw, 3rem) auto;
}

.post-body figure img {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  background-color: var(--surface-alt);
}

.post-body figcaption {
  max-width: 60ch;
  margin: 0.9rem auto 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Photography page
   -------------------------------------------------------------------------- */

.photo-hero {
  position: relative;
  display: grid;
  place-items: center;
  min-height: min(78vh, 46rem);
  padding: 4rem var(--gutter);
  overflow: hidden;
  text-align: center;
  isolation: isolate;
}

.photo-hero img {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    to bottom,
    rgba(12, 14, 16, 0.35),
    rgba(12, 14, 16, 0.62)
  );
}

.photo-hero__title {
  color: #fff;
  font-size: clamp(2.5rem, 9vw, 5.5rem);
  line-height: 1.02;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.45);
}

.photo-hero__subtitle {
  margin: 1.25rem 0 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.95rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

@media (max-width: 40rem) {
  .photo-hero__subtitle {
    letter-spacing: 0.12em;
    font-size: 0.82rem;
  }
}

.section {
  padding: clamp(3rem, 7vw, 5.5rem) 0;
}

.section + .section {
  border-top: 1px solid var(--border);
}

.section__heading {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  margin-bottom: 1.25rem;
}

.section__intro {
  max-width: 60ch;
  color: var(--text-muted);
}

.section--centered {
  text-align: center;
}

.section--centered .section__intro {
  margin-inline: auto;
}

/* About: prose beside a stack of photos. */
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(1.75rem, 4vw, 3.5rem);
  align-items: start;
}

.about-grid + .about-grid {
  margin-top: clamp(2.5rem, 5vw, 4rem);
}

@media (max-width: 52rem) {
  .about-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.about-grid--reversed .about-grid__media {
  order: -1;
}

@media (max-width: 52rem) {
  .about-grid--reversed .about-grid__media {
    order: 0;
  }
}

.about-grid__media {
  display: grid;
  gap: 0.85rem;
}

.about-grid__media img {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

/* A landscape frame beside a portrait one looks lopsided, so crop the pair to a
   shared shape. */
.about-grid__media--pair {
  grid-template-columns: 1fr 1fr;
}

.about-grid__media--pair img {
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

.stat {
  display: inline-flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-top: 1.5rem;
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background-color: var(--surface);
}

.stat__number {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--accent);
}

.stat__label {
  color: var(--text-muted);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
}

/* Gallery: an even grid rather than masonry columns. Every photo is 3:2, so
   multi-column balancing only left one column short and the rows ragged. */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(20rem, 100%), 1fr));
  gap: clamp(0.75rem, 1.5vw, 1.25rem);
  margin-top: clamp(2rem, 4vw, 3rem);
}

.gallery-grid figure {
  margin: 0;
}

.photo-card {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--radius);
  background-color: var(--surface-alt);
  box-shadow: var(--shadow-sm);
  cursor: zoom-in;
  -webkit-tap-highlight-color: transparent;
}

.photo-card img {
  display: block;
  width: 100%;
  /* Keeps rows even if a photo that is not 3:2 is ever added. The viewer
     always shows the uncropped frame. */
  aspect-ratio: 3 / 2;
  object-fit: cover;
  transition: transform 0.55s ease, filter 0.35s ease;
}

.photo-card:hover img {
  transform: scale(1.035);
}

.photo-card__caption {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  padding: 2.5rem 1rem 0.9rem;
  background: linear-gradient(to top, rgba(10, 12, 14, 0.78), transparent);
  color: #fff;
  font-size: 0.88rem;
  letter-spacing: 0.03em;
  opacity: 0;
  transform: translateY(0.4rem);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.photo-card:hover .photo-card__caption,
.photo-card:focus-visible .photo-card__caption {
  opacity: 1;
  transform: translateY(0);
}

/* Touch devices have no hover, so keep captions visible there. */
@media (hover: none) {
  .photo-card__caption {
    opacity: 1;
    transform: none;
  }
}

/* --------------------------------------------------------------------------
   Utilities
   -------------------------------------------------------------------------- */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

kbd {
  display: inline-block;
  min-width: 1.5em;
  padding: 0.1rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background-color: var(--surface-alt);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.75rem;
  line-height: 1.4;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Photo viewer
   -------------------------------------------------------------------------- */

.viewer {
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  margin: 0;
  padding: 0;
  border: 0;
  background-color: rgba(9, 10, 12, 0.96);
  color: #fff;
}

.viewer::backdrop {
  background-color: rgba(9, 10, 12, 0.92);
}

.viewer__stage {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  width: 100%;
  height: 100%;
  padding: clamp(0.75rem, 2vw, 2rem);
  /* Leaves room for the keyboard hint pinned to the bottom edge. */
  padding-bottom: 2.75rem;
  gap: 0.9rem;
}

/* The photo is absolutely positioned inside its row: a percentage max-height
   does not clamp reliably against a stretched grid item, and an overflowing
   20-megapixel original would cover the caption. */
.viewer__figure {
  position: relative;
  min-height: 0;
  margin: 0;
  overflow: hidden;
}

.viewer__figure img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.viewer__bar {
  display: grid;
  gap: 0.75rem;
  justify-items: center;
}

.viewer__caption {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  text-align: center;
}

.viewer__exif {
  display: none;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.75rem;
  margin: 0;
  padding: 0.85rem 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
  background-color: rgba(255, 255, 255, 0.05);
  font-size: 0.85rem;
}

.viewer__exif.is-visible {
  display: flex;
}

.viewer__exif div {
  display: grid;
  gap: 0.15rem;
  justify-items: center;
}

.viewer__exif div.is-empty {
  display: none;
}

.viewer__exif dt {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.viewer__exif dd {
  margin: 0;
  color: rgba(255, 255, 255, 0.92);
  font-variant-numeric: tabular-nums;
}

.viewer__controls {
  position: absolute;
  top: clamp(0.75rem, 2vw, 1.5rem);
  right: clamp(0.75rem, 2vw, 1.5rem);
  display: flex;
  gap: 0.5rem;
}

.viewer__button,
.viewer__nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  background-color: rgba(20, 22, 26, 0.65);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}

.viewer__button:hover,
.viewer__nav:hover {
  background-color: rgba(70, 74, 82, 0.85);
  border-color: rgba(255, 255, 255, 0.55);
}

.viewer__button[data-action="exif"] {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.1rem;
}

.viewer__button[aria-pressed="true"] {
  background-color: #fff;
  border-color: #fff;
  color: #14151a;
}

.viewer__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.viewer__nav--prev {
  left: clamp(0.5rem, 2vw, 1.5rem);
}

.viewer__nav--next {
  right: clamp(0.5rem, 2vw, 1.5rem);
}

.viewer__hint {
  position: absolute;
  inset-inline: 0;
  bottom: 0.5rem;
  margin: 0;
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.72rem;
  text-align: center;
}

.viewer__hint kbd {
  border-color: rgba(255, 255, 255, 0.2);
  background-color: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
}

/* Touch screens get swipe and tap instead, and the space is precious. */
@media (hover: none), (max-width: 40rem) {
  .viewer__hint,
  .viewer__nav {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   Command palette
   -------------------------------------------------------------------------- */

.palette-open {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background-color: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease,
    background-color 0.18s ease;
}

.palette-open:hover {
  color: var(--accent);
  border-color: var(--accent);
  background-color: var(--accent-soft);
}

@media (max-width: 30rem) {
  .palette-open kbd {
    display: none;
  }
}

.palette {
  width: min(40rem, calc(100vw - 2rem));
  max-width: none;
  margin: min(12vh, 6rem) auto auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background-color: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.palette::backdrop {
  background-color: rgba(12, 13, 16, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.palette__field {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1.15rem;
  border-bottom: 1px solid var(--border);
}

.palette__prompt {
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1rem;
}

.palette__input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  /* 16px keeps iOS from zooming the page when the field takes focus. */
  font-size: 1rem;
}

.palette__input:focus {
  outline: none;
}

.palette__input::placeholder {
  color: var(--text-muted);
}

.palette__results {
  max-height: min(24rem, 56vh);
  margin: 0;
  padding: 0.4rem;
  overflow-y: auto;
  list-style: none;
}

.palette__group {
  padding: 0.7rem 0.85rem 0.35rem;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.palette__item {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.palette__item[aria-selected="true"] {
  background-color: var(--accent-soft);
}

.palette__item[aria-selected="true"] .palette__title {
  color: var(--accent-strong);
}

.palette__title {
  font-weight: 500;
}

.palette__meta {
  flex: 1;
  color: var(--text-muted);
  font-size: 0.82rem;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.palette__thumb {
  flex: none;
  width: 2.6rem;
  height: 1.9rem;
  border-radius: 4px;
  object-fit: cover;
  background-color: var(--surface-alt);
}

.palette__empty {
  padding: 1.75rem 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

.palette__footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
  padding: 0.6rem 1.15rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.75rem;
}

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

.site-footer {
  border-top: 1px solid var(--border);
  background-color: var(--surface);
}

.site-footer__inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 2.5rem var(--gutter);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.site-footer__inner p {
  margin: 0;
}

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.4rem;
}

.site-footer a {
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   Small screens
   -------------------------------------------------------------------------- */

@media (max-width: 40rem) {
  /* Brand and toggle share the first row; the nav spans the row below. */
  .site-header__inner {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 0.15rem 1rem;
    padding-block: 0.6rem;
  }

  .site-header__actions {
    display: contents;
  }

  .theme-toggle {
    grid-column: 2;
    grid-row: 1;
  }

  .site-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    gap: 0 1.1rem;
    font-size: 0.84rem;
  }

  .hero {
    text-align: left;
  }

  .hero__tagline {
    letter-spacing: 0.25em;
  }

  .hero__intro,
  .post-header {
    margin-left: 0;
    text-align: left;
  }

  .post-meta {
    letter-spacing: 0.04em;
  }

  /* Photos run edge to edge, which suits a phone better than inset cards. */
  .post-body figure {
    margin-inline: calc(var(--gutter) * -1);
  }

  .post-body figure img {
    border-radius: 0;
    box-shadow: none;
  }

  .post-body figcaption {
    padding-inline: var(--gutter);
    text-align: left;
  }

  .site-footer__inner {
    flex-direction: column;
    align-items: flex-start;
    padding-block: 2rem;
  }
}

/* --------------------------------------------------------------------------
   Motion & print
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .site-header,
  .site-footer,
  .back-link {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
  }

  .post-body figure img {
    box-shadow: none;
  }
}
