/* =============================================
   Dermot Cochran Photography — Main Stylesheet
   ============================================= */

:root {
  --color-bg: #0d0f12;
  --color-surface: #16181d;
  --color-border: #2a2d34;
  --color-text: #eceef0;
  --color-text-muted: #9a9fa8;
  --color-accent: #d8b26a;
  --color-accent-hover: #eccb8c;
  --color-skip-bg: #d8b26a;
  --color-skip-text: #0d0f12;
  --font-body: Georgia, "Times New Roman", serif;
  --font-ui: system-ui, "Segoe UI", Roboto, sans-serif;
  --max-prose: 68ch;
  --radius: 4px;
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;
  --transition: 200ms ease;
}

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

html {
  font-size: 18px;
  scroll-behavior: smooth;
}

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

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

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

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--spacing-md);
  background: var(--color-skip-bg);
  color: var(--color-skip-text);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-weight: 700;
  text-decoration: none;
  z-index: 9999;
}
.skip-link:focus {
  top: var(--spacing-sm);
}

/* --- Header --- */
.site-header {
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}
.site-header__inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--spacing-md) var(--spacing-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--spacing-md);
}
.site-logo {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
  color: var(--color-text);
  letter-spacing: 0.02em;
}
.site-logo__icon {
  color: var(--color-accent);
}
.site-nav__list {
  display: flex;
  gap: var(--spacing-lg);
  list-style: none;
  font-family: var(--font-ui);
}
.site-nav__list a {
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color var(--transition);
}
.site-nav__list a:hover,
.site-nav__list a[aria-current="page"] {
  color: var(--color-text);
}

/* --- Main --- */
.main-content {
  flex: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--spacing-xl) var(--spacing-lg);
  width: 100%;
}

.page-title {
  font-family: var(--font-ui);
  font-size: 2rem;
  margin-bottom: var(--spacing-md);
}

.page-intro {
  max-width: var(--max-prose);
  color: var(--color-text-muted);
  margin-bottom: var(--spacing-lg);
}

/* Text pages (About, License, Contact): the reset zeroes every margin, so
   paragraphs, lists and section headings need their own spacing back */
.main-content > p,
.main-content > ul,
.main-content > ol {
  margin-bottom: var(--spacing-md);
}

.main-content > ul,
.main-content > ol {
  padding-left: var(--spacing-lg);
}

.main-content > h2 {
  margin-top: var(--spacing-lg);
  margin-bottom: var(--spacing-sm);
}

/* About page portrait: beside the prose on wide screens, above it on narrow */
.about-portrait {
  float: right;
  width: min(280px, 40%);
  margin: 0 0 var(--spacing-md) var(--spacing-lg);
}

.about-portrait img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
}

.about-portrait figcaption {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: var(--spacing-xs);
}

@media (max-width: 600px) {
  .about-portrait {
    float: none;
    width: min(280px, 100%);
    margin: 0 0 var(--spacing-md);
  }
}

.page-hero-image {
  width: 100%;
  border-radius: var(--radius);
  margin-bottom: var(--spacing-lg);
}

/* --- Home hero --- */
.home-hero {
  text-align: center;
  padding: var(--spacing-xl) 0;
}
.home-hero__title {
  font-family: var(--font-ui);
  font-size: 2.5rem;
  letter-spacing: 0.02em;
  margin-bottom: var(--spacing-md);
}
.home-hero__subtitle {
  max-width: var(--max-prose);
  margin: 0 auto var(--spacing-lg);
  color: var(--color-text-muted);
}
.home-hero__cta {
  display: inline-block;
  font-family: var(--font-ui);
  border: 1px solid var(--color-accent);
  color: var(--color-accent);
  padding: var(--spacing-sm) var(--spacing-lg);
  border-radius: var(--radius);
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
}
.home-hero__cta:hover {
  background: var(--color-accent);
  color: var(--color-skip-text);
}

/* --- Home slideshow --- */
.home-slideshow {
  position: relative;
  max-width: 900px;
  margin: 0 auto var(--spacing-xl);
}
.home-slideshow__viewport {
  position: relative;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--color-surface);
}
.home-slideshow__slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 600ms ease;
}
.home-slideshow__slide.is-active {
  opacity: 1;
}
.home-slideshow__slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.home-slideshow__caption {
  position: absolute;
  inset: auto 0 0 0;
  padding: var(--spacing-sm) var(--spacing-md);
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75), transparent);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--color-text);
}
.home-slideshow__prev,
.home-slideshow__next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: var(--color-text);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background var(--transition);
}
.home-slideshow__prev:hover,
.home-slideshow__next:hover {
  background: rgba(0, 0, 0, 0.7);
}
.home-slideshow__prev {
  left: var(--spacing-sm);
}
.home-slideshow__next {
  right: var(--spacing-sm);
}
.home-slideshow__dots {
  display: flex;
  justify-content: center;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-md);
}
.home-slideshow__dot {
  width: 0.6rem;
  height: 0.6rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--color-border);
  cursor: pointer;
}
.home-slideshow__dot.is-active {
  background: var(--color-accent);
}

/* --- Gallery grid --- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--spacing-md);
  list-style: none;
  margin-top: var(--spacing-lg);
}
.gallery-grid__item {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--color-surface);
  aspect-ratio: 3 / 2;
}
.gallery-grid__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition);
}
.gallery-grid__item a:hover img,
.gallery-grid__item a:focus img {
  transform: scale(1.04);
}
.gallery-grid__caption {
  position: absolute;
  inset: auto 0 0 0;
  padding: var(--spacing-sm) var(--spacing-md);
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75), transparent);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--color-text);
}

/* --- Photo detail --- */
.photo-detail__image {
  width: 100%;
  border-radius: var(--radius);
  margin-bottom: var(--spacing-lg);
}
/* A panel picture on a phone held upright: the strip gives way to its
   panels stacked, each a box showing one panel of the same JPEG (see
   lib/panels.js and photo.njk). 600px keeps tablets and a phone turned
   sideways on the strip, where the panels read at a fair size and the
   left-to-right order is the picture's own. */
.photo-detail__panels {
  display: none;
}
.photo-detail__panel {
  overflow: hidden;
  border-radius: var(--radius);
}
.photo-detail__panel img {
  display: block;
  max-width: none;
}
@media (max-width: 600px) {
  .photo-detail__image--strip {
    display: none;
  }
  .photo-detail__panels {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
  }
}
/* Optional note beneath the title. Present only on photos whose .md file
   carries body text, so most pages never render it. Sits between the title
   and the metadata, slightly larger than the meta block so it reads as the
   photographer talking rather than as another field. */
.photo-note {
  margin-bottom: var(--spacing-lg);
  max-width: 60ch;
}
.photo-note p {
  margin-bottom: var(--spacing-sm);
}
.photo-note p:last-child {
  margin-bottom: 0;
}
.photo-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--spacing-xs) var(--spacing-md);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  margin-bottom: var(--spacing-lg);
}
.photo-meta__row {
  display: contents;
}
.photo-meta__row dt {
  color: var(--color-text-muted);
}
.photo-license {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-bottom: var(--spacing-lg);
}

/* --- Archive lists (category / location / year / albums) --- */
.archive-list {
  list-style: none;
  font-family: var(--font-ui);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-lg);
}
.archive-list a {
  font-size: 1.1rem;
  text-decoration: none;
}
.archive-list a:hover {
  text-decoration: underline;
}
.archive-list__count {
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

/* --- Comments --- */
.site-comments {
  margin-top: var(--spacing-xl);
  padding-top: var(--spacing-lg);
  border-top: 1px solid var(--color-border);
}
.site-comments__heading {
  font-family: var(--font-ui);
  font-size: 1.25rem;
  margin-bottom: var(--spacing-md);
}

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--color-text-muted);
}
.site-footer__inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--spacing-lg);
  text-align: center;
}
