/* ==========================================================================
   editorial — Obscura theme
   Inspired by Foam magazine and LensCulture.
   The photography is the point. Everything else recedes.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Custom Properties
   -------------------------------------------------------------------------- */

:root {
  /* Typography — system stacks that feel editorial, not generic */
  --font-display: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --font-body: 'Helvetica Neue', Helvetica, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', monospace;
  --font-size-xs: 0.6875rem;
  --font-size-sm: 0.8125rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.1875rem;
  --font-size-xl: 1.625rem;
  --font-size-2xl: 2.25rem;
  --font-size-3xl: 3rem;
  --line-height-tight: 1.2;
  --line-height-base: 1.65;
  --letter-spacing-tight: -0.015em;
  --letter-spacing-wide: 0.1em;

  /* Color — warm, high-contrast, ink-on-paper */
  --color-bg: #f8f7f4;
  --color-bg-subtle: #f0eeea;
  --color-surface: #ffffff;
  --color-text: #1c1b19;
  --color-text-secondary: #5c5850;
  --color-text-tertiary: #8a857b;
  --color-border: #ddd9d1;
  --color-border-subtle: #eae7e1;
  --color-accent: #1c1b19;
  --color-accent-hover: #3a3936;
  --color-link: #1c1b19;
  --color-link-hover: #5c5850;
  --color-overlay: rgba(28, 27, 25, 0.75);
  --color-overlay-light: rgba(28, 27, 25, 0.03);
  --color-highlight: #c45d3e;
  --color-highlight-muted: rgba(196, 93, 62, 0.25);
  --color-code-bg: var(--color-bg-subtle);

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.5rem;
  --space-2xl: 4rem;
  --space-3xl: 6rem;

  /* Layout */
  --content-width: 72rem;
  --content-narrow: 42rem;
  --header-height: 3.5rem;
  --grid-gap: 0.375rem;

  /* Transitions */
  --duration-fast: 150ms;
  --duration-base: 300ms;
  --duration-slow: 600ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

/* --------------------------------------------------------------------------
   Reset & Base
   -------------------------------------------------------------------------- */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  color: var(--color-text);
  background-color: var(--color-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

a {
  color: var(--color-link);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
  color: var(--color-link-hover);
}

/* --------------------------------------------------------------------------
   Header & Navigation
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-lg);
  background-color: var(--color-bg);
  border-bottom: 1px solid var(--color-border-subtle);
}

.site-title {
  font-family: var(--font-body);
  font-size: var(--font-size-sm);
  font-weight: 500;
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
  color: var(--color-text);
}

.site-title a {
  color: inherit;
}

.site-title a:hover {
  color: var(--color-text-secondary);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  list-style: none;
}

.site-nav a {
  font-size: var(--font-size-xs);
  font-weight: 400;
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
  color: var(--color-text-secondary);
  position: relative;
}

.site-nav a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--color-text);
  transition: width var(--duration-base) var(--ease-out);
}

.site-nav a:hover {
  color: var(--color-text);
}

.site-nav a:hover::after {
  width: 100%;
}

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

.site-nav a[aria-current="page"]::after {
  width: 100%;
}

/* --------------------------------------------------------------------------
   Layout Containers
   -------------------------------------------------------------------------- */

.content {
  flex: 1;
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg);
}

.content--narrow {
  max-width: var(--content-narrow);
}

.content--full {
  max-width: none;
  padding-left: var(--space-md);
  padding-right: var(--space-md);
}

/* --------------------------------------------------------------------------
   Page Headings
   -------------------------------------------------------------------------- */

.page-title {
  font-family: var(--font-display);
  font-size: var(--font-size-2xl);
  font-weight: 700;
  line-height: var(--line-height-tight);
  letter-spacing: var(--letter-spacing-tight);
  margin-bottom: var(--space-xl);
}

.page-subtitle {
  font-size: var(--font-size-base);
  color: var(--color-text-secondary);
  font-weight: 400;
  margin-top: var(--space-sm);
  line-height: var(--line-height-base);
}

.section-label {
  font-size: var(--font-size-xs);
  font-weight: 500;
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
  color: var(--color-text-tertiary);
  margin-bottom: var(--space-lg);
}

.gallery-grid__toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: var(--space-sm);
}

/* --------------------------------------------------------------------------
   Gallery Grid
   -------------------------------------------------------------------------- */

.gallery-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--grid-gap);
}

@media (min-width: 40em) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 64em) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 90em) {
  .gallery-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Masonry layout variant — uses CSS Grid with JS-measured row spans */
.gallery-grid--masonry {
  display: grid;
  grid-template-columns: 1fr;
  grid-auto-rows: 4px;
  gap: var(--grid-gap);
}

@media (min-width: 40em) {
  .gallery-grid--masonry { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 64em) {
  .gallery-grid--masonry { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 90em) {
  .gallery-grid--masonry { grid-template-columns: repeat(4, 1fr); }
}

.gallery-grid--masonry .gallery-item {
  aspect-ratio: auto;
  overflow: hidden;
  border-radius: 0;
  /* Fallback height until JS computes the real row span */
  grid-row-end: span 40;
}

.gallery-grid--masonry .gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Layout toggle — minimal, borderless */
.gallery-layout-toggle {
  display: flex;
  gap: var(--space-xs);
  align-items: center;
}

.gallery-layout-toggle button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-border);
  padding: 2px;
  line-height: 1;
  transition: color var(--duration-fast) var(--ease-out);
}

.gallery-layout-toggle button:hover {
  color: var(--color-text-tertiary);
}

.gallery-layout-toggle button.is-active {
  color: var(--color-text-secondary);
}

.gallery-layout-toggle svg {
  width: 13px;
  height: 13px;
  display: block;
}

.gallery-item {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 3 / 2;
  background-color: var(--color-bg-subtle);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--duration-slow) var(--ease-out),
              filter var(--duration-slow) var(--ease-out);
}

.gallery-item:hover img {
  transform: scale(1.03);
}

.gallery-item__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    0deg,
    rgba(28, 27, 25, 0.65) 0%,
    rgba(28, 27, 25, 0) 50%
  );
  opacity: 0;
  transition: opacity var(--duration-base) var(--ease-out);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--space-sm) var(--space-md);
  color: #ffffff;
}

.gallery-item:hover .gallery-item__overlay {
  opacity: 1;
}

.gallery-item__title {
  font-size: var(--font-size-sm);
  font-weight: 500;
  line-height: 1.3;
}

.gallery-item__location {
  font-size: var(--font-size-xs);
  opacity: 0.65;
  margin-top: 1px;
}

/* --------------------------------------------------------------------------
   Gallery Index (list of galleries)
   -------------------------------------------------------------------------- */

.gallery-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
}

@media (min-width: 48em) {
  .gallery-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

.gallery-card {
  display: block;
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background-color: var(--color-bg-subtle);
}

.gallery-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--duration-slow) var(--ease-out);
}

.gallery-card:hover img {
  transform: scale(1.02);
}

.gallery-card__info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-lg);
  background: linear-gradient(
    0deg,
    rgba(28, 27, 25, 0.7) 0%,
    rgba(28, 27, 25, 0) 100%
  );
  color: #ffffff;
}

.gallery-card__title {
  font-family: var(--font-display);
  font-size: var(--font-size-lg);
  font-weight: 700;
  margin-bottom: var(--space-xs);
}

.gallery-card__count {
  font-size: var(--font-size-xs);
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
  opacity: 0.75;
}

/* --------------------------------------------------------------------------
   Photo Permalink Page
   -------------------------------------------------------------------------- */

.photo-detail {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg);
}

.photo-detail__image {
  margin-bottom: var(--space-xl);
}

.photo-detail__image img {
  width: 100%;
  height: auto;
}

.photo-detail__body {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
  max-width: var(--content-narrow);
}

@media (min-width: 48em) {
  .photo-detail__body {
    grid-template-columns: 3fr 2fr;
    grid-template-rows: auto 1fr;
    max-width: none;
  }

  .photo-detail__title {
    grid-column: 1;
    grid-row: 1;
  }

  .photo-detail__caption {
    grid-column: 1;
    grid-row: 2;
    align-self: start;
  }

  .photo-meta {
    grid-column: 2;
    grid-row: 1 / -1;
    align-self: start;
  }

  .photo-detail__body > .photo-backlinks {
    grid-column: 1;
  }

  .photo-detail__back {
    grid-column: 1 / -1;
  }
}

.photo-detail__title {
  font-family: var(--font-display);
  font-size: var(--font-size-xl);
  font-weight: 700;
  line-height: var(--line-height-tight);
}

.photo-detail__caption {
  font-size: var(--font-size-base);
  color: var(--color-text-secondary);
  line-height: var(--line-height-base);
}

.photo-meta {
  list-style: none;
  font-size: var(--font-size-sm);
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-md);
}

.photo-meta li {
  display: flex;
  justify-content: space-between;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--color-border-subtle);
}

.photo-meta__label {
  color: var(--color-text-tertiary);
  font-size: var(--font-size-xs);
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
}

.photo-meta__value {
  color: var(--color-text);
  text-align: right;
  min-width: 0;
}

.photo-meta__tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0;
}

/* Back-links */

.photo-backlinks {
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--color-border);
}

.photo-backlinks__title {
  font-size: var(--font-size-xs);
  font-weight: 500;
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
  color: var(--color-text-tertiary);
  margin-bottom: var(--space-md);
}

.photo-backlinks__list {
  list-style: none;
}

.photo-backlinks__list li {
  margin-bottom: var(--space-sm);
}

.photo-backlinks__list a {
  font-size: var(--font-size-sm);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 1px;
  transition: border-color var(--duration-fast) var(--ease-out);
}

.photo-backlinks__list a:hover {
  border-color: var(--color-text);
}

.photo-detail__back {
  grid-column: 1 / -1;
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--color-border-subtle);
}

.photo-detail__back a {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.photo-detail__back a:hover {
  color: var(--color-text);
}

/* --------------------------------------------------------------------------
   Photo Card (shortcode embed in blog posts)
   -------------------------------------------------------------------------- */

.photo-card {
  margin: var(--space-xl) 0;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  overflow: hidden;
}

.photo-card a {
  display: block;
  text-decoration: none;
  border-bottom: none;
}

.photo-card a:hover {
  border-bottom: none;
}

.photo-card__image {
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: var(--color-bg-subtle);
}

.photo-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--duration-slow) var(--ease-out);
}

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

.photo-card__info {
  padding: var(--space-md);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-md);
}

.photo-card__title {
  font-family: var(--font-display);
  font-size: var(--font-size-base);
  font-weight: 600;
}

.photo-card__meta {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Blog
   -------------------------------------------------------------------------- */

/* Blog index */

.post-list {
  list-style: none;
  max-width: var(--content-narrow);
}

.post-list__item {
  padding: var(--space-lg) 0;
  border-bottom: 1px solid var(--color-border-subtle);
}

.post-list__item:first-child {
  padding-top: 0;
}

.post-list__date {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
  margin-bottom: var(--space-xs);
}

.post-list__title {
  font-family: var(--font-display);
  font-size: var(--font-size-lg);
  font-weight: 700;
  line-height: var(--line-height-tight);
  margin-bottom: var(--space-sm);
}

.post-list__title a {
  color: var(--color-text);
}

.post-list__title a:hover {
  color: var(--color-text-secondary);
}

.post-list__summary {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  line-height: var(--line-height-base);
}

.post-list__tags {
  margin-top: var(--space-sm);
}

.tag {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  letter-spacing: 0.02em;
}

.tag + .tag::before {
  content: ' · ';
  color: var(--color-border);
}

/* Blog post body */

.post-header {
  max-width: var(--content-narrow);
  margin-bottom: var(--space-2xl);
}

.post-header__date {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
  margin-bottom: var(--space-sm);
}

.post-header__title {
  font-family: var(--font-display);
  font-size: var(--font-size-3xl);
  font-weight: 700;
  line-height: var(--line-height-tight);
  letter-spacing: var(--letter-spacing-tight);
}

.post-body {
  max-width: var(--content-narrow);
}

.post-body h2 {
  font-family: var(--font-display);
  font-size: var(--font-size-xl);
  font-weight: 700;
  line-height: var(--line-height-tight);
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-md);
}

.post-body h3 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin-top: var(--space-xl);
  margin-bottom: var(--space-sm);
}

.post-body p {
  margin-bottom: var(--space-md);
  line-height: var(--line-height-base);
}

.post-body blockquote {
  border-left: 2px solid var(--color-text);
  padding-left: var(--space-lg);
  margin: var(--space-xl) 0;
  font-style: italic;
  color: var(--color-text-secondary);
}

.post-body pre {
  background: var(--color-code-bg);
  padding: var(--space-md);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  margin: var(--space-lg) 0;
  border: 1px solid var(--color-border-subtle);
}

.post-body code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--color-code-bg);
  padding: 0.125rem 0.375rem;
}

.post-body pre code {
  background: none;
  padding: 0;
}

.post-body a {
  border-bottom: 1px solid var(--color-text-tertiary);
  transition: border-color var(--duration-fast) var(--ease-out);
}

.post-body a:hover {
  border-color: var(--color-text);
}

.post-body ul,
.post-body ol {
  margin-bottom: var(--space-md);
  padding-left: var(--space-lg);
}

.post-body li {
  margin-bottom: var(--space-sm);
}

.post-body hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-2xl) 0;
}

/* Photo cards inside post body break out of narrow width */
.post-body .photo-card {
  max-width: 56rem;
}

.post-body .photo-card a,
.post-body .photo-card a:hover {
  border-bottom: none;
}

/* --------------------------------------------------------------------------
   Simple Pages (About, Contact)
   -------------------------------------------------------------------------- */

.page-body {
  max-width: var(--content-narrow);
}

.page-body h2 {
  font-family: var(--font-display);
  font-size: var(--font-size-xl);
  font-weight: 700;
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-md);
}

.page-body p {
  margin-bottom: var(--space-md);
  line-height: var(--line-height-base);
}

.page-body ul,
.page-body ol {
  margin-bottom: var(--space-md);
  padding-left: var(--space-lg);
}

.page-body li {
  margin-bottom: var(--space-sm);
}

.page-body pre {
  background: var(--color-code-bg);
  padding: var(--space-md);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  margin: var(--space-lg) 0;
  border: 1px solid var(--color-border-subtle);
}

.page-body code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--color-code-bg);
  padding: 0.125rem 0.375rem;
}

.page-body pre code {
  background: none;
  padding: 0;
}

.page-body a {
  border-bottom: 1px solid var(--color-text-tertiary);
}

.page-body a:hover {
  border-color: var(--color-text);
}

/* --------------------------------------------------------------------------
   Tag Pages
   -------------------------------------------------------------------------- */

.tag-list {
  list-style: none;
  max-width: var(--content-narrow);
  border-top: 1px solid var(--color-border);
}

.tag-list__item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--color-border-subtle);
}

.tag-list__item a {
  font-size: var(--font-size-base);
}

.tag-list__count {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
}

.tag-page__header {
  display: flex;
  align-items: baseline;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.tag-page__count {
  font-size: var(--font-size-sm);
  color: var(--color-text-tertiary);
}

.tag-page__back {
  margin-top: var(--space-xl);
}

.tag-page__back a {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.tag-page__back a:hover {
  color: var(--color-text);
}

/* Tags as links */
a.tag {
  text-decoration: none;
  color: var(--color-text-tertiary);
  transition: color var(--duration-fast) var(--ease-out);
}

a.tag:hover {
  color: var(--color-text);
}

/* --------------------------------------------------------------------------
   Homepage — Recent Shots
   -------------------------------------------------------------------------- */

.homepage-intro {
  max-width: var(--content-width);
  margin: 0 auto var(--space-xl);
  padding: var(--space-xl) 0;
  border-top: 1px solid var(--color-border);
  font-family: var(--font-display);
  font-size: var(--font-size-lg);
  line-height: 1.55;
  color: var(--color-text);
  text-align: left;
  letter-spacing: var(--letter-spacing-tight);
}

@media (min-width: 48em) {
  .homepage-intro {
    column-count: 2;
    column-gap: var(--space-2xl);
    font-size: 1.3125rem;
    line-height: 1.5;
  }
}

.homepage-logo {
  column-span: all;
  text-align: center;
  margin-bottom: var(--space-xl);
}

.homepage-logo img {
  max-width: 36rem;
  width: 100%;
  height: auto;
}

/* Light mode: show light logo, hide dark */
.homepage-logo .homepage-logo__dark { display: none; }
.homepage-logo .homepage-logo__light { display: inline-block; }

/* Dark mode (system preference) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .homepage-logo .homepage-logo__light { display: none; }
  :root:not([data-theme="light"]) .homepage-logo .homepage-logo__dark { display: inline-block; }
}

/* Dark mode (manual toggle) */
:root[data-theme="dark"] .homepage-logo .homepage-logo__light { display: none; }
:root[data-theme="dark"] .homepage-logo .homepage-logo__dark { display: inline-block; }

.homepage-intro h1 {
  column-span: all;
  font-family: var(--font-display);
  font-size: var(--font-size-3xl);
  font-weight: 700;
  line-height: var(--line-height-tight);
  letter-spacing: var(--letter-spacing-tight);
  margin-bottom: var(--space-lg);
}

.homepage-intro p {
  margin-bottom: var(--space-lg);
  break-inside: avoid;
}

.homepage-intro p:first-of-type {
  break-after: column;
}

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

/* Prose highlight underlines — used via <u> in Markdown content */
.prose u {
  text-decoration: none;
  background-image:
    linear-gradient(var(--color-highlight), var(--color-highlight)),
    linear-gradient(var(--color-highlight-muted), var(--color-highlight-muted));
  background-size: 0% 2px, 100% 2px;
  background-repeat: no-repeat;
  background-position: bottom left, bottom left;
  padding-bottom: 2px;
  animation: underline-draw 0.8s var(--ease-out) forwards;
  animation-delay: 0.3s;
}

@keyframes underline-draw {
  to {
    background-size: 100% 2px, 100% 2px;
  }
}

/* Also enable prose styling on page bodies */
.page-body u,
.post-body u {
  text-decoration: none;
  background-image: linear-gradient(var(--color-highlight), var(--color-highlight));
  background-size: 100% 2px;
  background-repeat: no-repeat;
  background-position: bottom left;
  padding-bottom: 2px;
}

.recent-shots__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--space-lg);
}

.recent-shots__actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.recent-shots__link {
  font-size: var(--font-size-xs);
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border);
}

.recent-shots__link:hover {
  color: var(--color-text);
  border-color: var(--color-text);
}

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

.site-footer {
  border-top: 1px solid var(--color-border-subtle);
  padding: var(--space-xl) var(--space-lg);
  margin-top: auto;
}

.site-footer__inner {
  max-width: var(--content-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
}

.site-footer a {
  color: var(--color-text-tertiary);
}

.site-footer a:hover {
  color: var(--color-text-secondary);
}

/* --------------------------------------------------------------------------
   404 Page
   -------------------------------------------------------------------------- */

.error-page {
  text-align: center;
  padding: var(--space-3xl) var(--space-lg);
}

.error-page__code {
  font-family: var(--font-display);
  font-size: 8rem;
  font-weight: 700;
  line-height: 1;
  color: var(--color-border);
  margin-bottom: var(--space-md);
}

.error-page__message {
  font-size: var(--font-size-lg);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-xl);
}

.error-page__links {
  display: flex;
  justify-content: center;
  gap: var(--space-lg);
  font-size: var(--font-size-sm);
}

.error-page__links a {
  border-bottom: 1px solid var(--color-border);
}

.error-page__links a:hover {
  border-color: var(--color-text);
}

/* --------------------------------------------------------------------------
   Dark Mode
   -------------------------------------------------------------------------- */

/* System preference — applies when no manual override is set */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: #121211;
    --color-bg-subtle: #1b1b19;
    --color-surface: #1f1f1d;
    --color-text: #e5e3de;
    --color-text-secondary: #908b82;
    --color-text-tertiary: #605c55;
    --color-border: #2c2c28;
    --color-border-subtle: #232320;
    --color-accent: #e5e3de;
    --color-accent-hover: #c5c3be;
    --color-link: #e5e3de;
    --color-link-hover: #908b82;
    --color-overlay: rgba(18, 18, 17, 0.85);
    --color-overlay-light: rgba(229, 227, 222, 0.04);
    --color-highlight: #d4745a;
    --color-highlight-muted: rgba(212, 116, 90, 0.3);
    --color-code-bg: #262622;
  }
}

/* Manual dark override */
:root[data-theme="dark"] {
  --color-bg: #121211;
  --color-bg-subtle: #1b1b19;
  --color-surface: #1f1f1d;
  --color-text: #e5e3de;
  --color-text-secondary: #908b82;
  --color-text-tertiary: #605c55;
  --color-border: #2c2c28;
  --color-border-subtle: #232320;
  --color-accent: #e5e3de;
  --color-accent-hover: #c5c3be;
  --color-link: #e5e3de;
  --color-link-hover: #908b82;
  --color-overlay: rgba(18, 18, 17, 0.85);
  --color-highlight: #d4745a;
  --color-highlight-muted: rgba(212, 116, 90, 0.3);
  --color-overlay-light: rgba(229, 227, 222, 0.04);
  --color-code-bg: #262622;
}

/* Theme toggle button */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-secondary);
  padding: var(--space-xs);
  line-height: 1;
  transition: color var(--duration-fast) var(--ease-out);
}

.theme-toggle:hover {
  color: var(--color-text);
}

.theme-toggle svg {
  width: 1rem;
  height: 1rem;
  display: block;
}

/* Show sun in dark mode, moon in light mode */
.theme-toggle .icon-moon { display: block; }
.theme-toggle .icon-sun  { display: none; }

:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-sun  { display: block; }
}

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

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