/* ==========================================================================
   Margaret O'Brien — Woodworker
   Warm, minimal gallery stylesheet.
   ========================================================================== */

:root {
  --bg: #f5f3ef;
  --surface: #ebe7e0;
  --ink: #1a1917;
  --ink-muted: #635f59;
  --border: rgba(26, 25, 23, 0.14);

  --font: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    'Helvetica Neue', sans-serif;

  --text-sm: clamp(0.875rem, 0.85rem + 0.15vw, 0.975rem);
  --text-base: clamp(1rem, 0.96rem + 0.25vw, 1.15rem);
  --text-xl: clamp(1.5rem, 1.35rem + 0.5vw, 1.85rem);

  --wide-max: 1240px;
  --content-max: 640px;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --gap: clamp(0.85rem, 1.4vw, 1.25rem);
}

/* Reset & Base
   ========================================================================== */

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

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

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--text-base);
  font-weight: 300;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body.no-scroll {
  overflow: hidden;
}

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

a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}

a:hover,
a:focus-visible {
  text-decoration: none;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

h1,
h2 {
  margin: 0;
  font-weight: 600;
  line-height: 1.2;
}

p {
  margin: 0 0 1.35rem;
}

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

figure {
  margin: 0;
}

/* Containers
   ========================================================================== */

.container-wide {
  width: 100%;
  max-width: calc(var(--wide-max) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.container-content {
  width: 100%;
  max-width: calc(var(--content-max) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

main {
  padding-bottom: clamp(3.5rem, 7vh, 6rem);
}

/* Header & Inline Navigation
   ========================================================================== */

.site-header {
  padding-block: clamp(1.5rem, 3vw, 2.25rem);
}

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 2rem;
}

.site-brand {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.65rem;
}

.site-title {
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1.2;
}

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

.site-title a:hover {
  opacity: 0.7;
}

.site-sep {
  color: var(--ink-muted);
  user-select: none;
}

.site-tagline {
  margin: 0;
  font-size: var(--text-base);
  font-weight: 300;
  color: var(--ink-muted);
}

.site-nav {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1.75rem;
}

.site-nav a {
  font-size: var(--text-sm);
  font-weight: 400;
  text-decoration: none;
  color: var(--ink-muted);
  transition: color 0.15s ease;
}

.site-nav a:hover,
.site-nav a:focus-visible,
.site-nav a[aria-current='page'] {
  color: var(--ink);
}

.site-nav a[aria-current='page'] {
  text-decoration: underline;
  text-underline-offset: 0.28em;
  text-decoration-thickness: 1.5px;
}

/* Masonry Gallery (Home & Portfolio — pre-balanced at build time)
   ========================================================================== */

.masonry-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
  align-items: start;
}

.masonry-col {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.masonry-item {
  cursor: zoom-in;
  background-color: var(--surface);
}

.masonry-item img {
  width: 100%;
  height: auto;
  transition: opacity 0.2s ease;
}

.masonry-item:hover img {
  opacity: 0.9;
}

.gallery-cta {
  margin-top: 2rem;
  font-size: var(--text-sm);
  color: var(--ink-muted);
}

.gallery-cta a {
  color: var(--ink);
}

/* About Page
   ========================================================================== */

.page-hero {
  max-width: calc(820px + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
  margin-bottom: clamp(1.75rem, 3vw, 2.5rem);
}

.page-hero img {
  width: 100%;
  max-height: 52vh;
  object-fit: cover;
}

.page-title {
  font-size: var(--text-xl);
  font-weight: 600;
  margin-bottom: 1.5rem;
}

/* Contact Page
   ========================================================================== */

.contact-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
  padding-top: 0.5rem;
}

.contact-photo img {
  width: 100%;
  max-height: 76vh;
  object-fit: cover;
}

.contact-panel {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.25rem;
}

.contact-panel .page-title {
  margin-bottom: 0;
}

.btn {
  appearance: none;
  background-color: var(--ink);
  color: var(--bg);
  border: 1px solid var(--ink);
  border-radius: 3px;
  padding: 0.65rem 1.35rem;
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 400;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.btn:hover,
.btn:focus-visible {
  opacity: 0.82;
}

.btn--subtle {
  background-color: transparent;
  color: var(--ink);
  border-color: var(--border);
  padding: 0.4rem 0.85rem;
}

.btn--subtle:hover,
.btn--subtle:focus-visible {
  border-color: var(--ink);
  opacity: 1;
}

.email-reveal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem 1rem;
}

.email-reveal[hidden] {
  display: none;
}

.email-link {
  font-size: var(--text-base);
  font-weight: 400;
}

/* Lightbox
   ========================================================================== */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background-color: rgba(245, 243, 239, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, visibility 0.18s ease;
}

.lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.lightbox__img {
  max-width: min(90vw, 1200px);
  max-height: 85vh;
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow: 0 12px 40px rgba(26, 25, 23, 0.1);
}

.lightbox__btn {
  position: fixed;
  appearance: none;
  background: none;
  border: 0;
  color: var(--ink);
  cursor: pointer;
  padding: 0.65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s ease;
}

.lightbox__btn:hover {
  opacity: 0.55;
}

.lightbox__close {
  top: 1.25rem;
  right: var(--gutter);
}

.lightbox__prev {
  left: clamp(0.5rem, 2vw, 1.5rem);
  top: 50%;
  transform: translateY(-50%);
}

.lightbox__next {
  right: clamp(0.5rem, 2vw, 1.5rem);
  top: 50%;
  transform: translateY(-50%);
}

.lightbox__counter {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: var(--text-sm);
  color: var(--ink-muted);
}

/* Responsive
   ========================================================================== */

@media (max-width: 760px) {
  .masonry-grid {
    grid-template-columns: 1fr;
  }

  .contact-layout {
    grid-template-columns: 1fr;
    gap: 1.75rem;
  }

  .contact-photo img {
    max-height: 60vh;
  }
}
