/* --- Design Tokens --- */
:root {
  --color-bg: #f7f4f0;
  --color-surface: #ffffff;
  --color-text: #1e1b18;
  --color-muted: #6F675E;
  --color-accent: #205092;
  --color-accent-lt: #3767A9;
  --color-accent-vlt: #5787C9;
  --color-border: #e4dfd8;
  --color-overlay: rgba(30, 27, 24, .82);

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Gafata', system-ui, sans-serif;
  --text-small: .8125rem;
  --text-very-small: .6875rem;
  --text-light: 300;
  --text-normal: 400;
  --text-bold: 700;

  --gap: clamp(1rem, 4vw, 1.5rem);
  --big-gap: clamp(3rem, 8vw, 6rem);
  --radius: .25rem;
  --transition: .35s cubic-bezier(0.4, 0, .2, 1);

  --col-min: 260px;
  --shadow-sm: 0 2px 12px rgba(30, 27, 24, .08);
  --shadow-md: 0 8px 40px rgba(30, 27, 24, .16);
  --shadow-lg: 0 24px 80px rgba(30, 27, 24, .28);
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

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

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

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
}

ul,
ol {
  list-style: none;
}

body {
  background: var(--color-bg) url('../img/halftone.png') repeat;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: var(--text-normal);
  line-height: 1.65;
  min-height: 100dvh;
}

:focus {
  outline: 2px solid var(--color-accent-vlt);
  outline-offset: 3px;
  border: 0 !important;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 9999;
  background: var(--color-accent);
  color: var(--color-surface);
  padding: .25rem 1rem;
  font-size: var(--text-small);
  border-radius: 0 0 var(--radius) var(--radius);
  transition: top .2s;
}

.skip-link:focus {
  top: 0;
}

/* =============================================
   NAV
   ============================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(247, 244, 240, .92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
}

.nav-inner {
  width: 100%;
  margin: 0 auto;
  padding: 1rem var(--gap);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 1.4rem;
  letter-spacing: .04em;
  color: var(--color-text);
  font-weight: var(--text-bold);
  flex-shrink: 0;
}

.nav-logo span {
  color: var(--color-accent);
  font-weight: var(--text-light);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 3rem;
}

.nav-links a {
  font-size: var(--text-small);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--color-muted);
  transition: color var(--transition);
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
}

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

/* Hamburger */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 44px;
  padding: 14px 6px;
  z-index: 110;
}

.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--color-text);
  transition: transform var(--transition), opacity var(--transition);
  transform-origin: center;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7.5px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7.5px) rotate(-45deg);
}

/* Mobile nav */
@media (max-width: 640px) {
  .nav-toggle {
    display: flex;
  }

  .nav-links {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 105;
    box-shadow: var(--shadow-lg);
    background: var(--color-bg);
    padding: 70px var(--gap) var(--gap);
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    opacity: 0;
    display: none;
    transition: opacity var(--transition);
  }

  .nav-links.is-open {
    opacity: 1;
    display: flex;
  }
}

/* =============================================
   PAGE SHELL
   ============================================= */
.page-section {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--big-gap) var(--gap);
}

/* =============================================
   PAGE HEADERS
   ============================================= */
.page-header {
  margin-bottom: 2rem;
}

.page-header h1 {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 6vw, 5rem);
  font-weight: var(--text-light);
  letter-spacing: -.02em;
  line-height: 1.05;
}

.page-header h1 em {
  font-style: italic;
  color: var(--color-accent);
}

.page-header p {
  margin-top: 1rem;
  color: var(--color-muted);
  max-width: 52ch;
}

/* =============================================
   MASONRY GALLERY
   ============================================= */
.gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: var(--gap) 0;
}

@media (max-width: 1024px) {
  .gallery {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .gallery {
    grid-template-columns: repeat(2, 1fr);
  }
}

.gallery-item {
  position: relative;
  display: flex;
  border-radius: var(--radius);
  margin-right: clamp(1.5rem, var(--rand-space, 4vw), 4rem);
  margin-bottom: clamp(1.5rem, var(--rand-space, 4vw), 4rem);
  transition: opacity var(--transition);
}

.gallery-item>div:first-child {
  border-radius: var(--radius);
  overflow: hidden;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform .55s cubic-bezier(0.4, 0, .2, 1);
}

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

.gallery:has(.gallery-item:hover) .gallery-item:not(:hover) {
  opacity: 0.25;
}

.gallery-item-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top,
      rgba(30, 27, 24, 1) 0%,
      rgba(30, 27, 24, .88) 20%,
      rgba(30, 27, 24, .45) 50%,
      transparent 70%);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1rem;
  opacity: 0;
  transition: opacity var(--transition);
}

.gallery-item:hover .gallery-item-overlay,
.gallery-item-overlay:has(~ .gallery-trigger:focus) {
  opacity: 1;
  box-shadow: var(--shadow-sm);
}

.overlay-meta {
  color: var(--color-surface);
}

.overlay-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  line-height: 1.2;
  margin-bottom: .15rem;
}

.overlay-detail {
  font-size: var(--text-small);
  font-weight: var(--text-light);
  letter-spacing: .04em;
}

.overlay-expand {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, .25) url('../img/icon_expand.svg') center center no-repeat;
  backdrop-filter: blur(6px);
  border-radius: 50%;
  transition: background var(--transition), transform var(--transition);
}

.overlay-expand:hover {
  background: rgba(255, 255, 255, .3);
  transform: scale(1.1);
}

.gallery-trigger {
  border-radius: var(--radius);
  position: absolute;
  inset: 0;
  background: transparent;
  z-index: 1;
}

/* =============================================
   LIGHTBOX
   ============================================= */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .3s ease;
  display: none;
  overflow: auto;
}

.lightbox.is-open {
  opacity: 1;
  display: flex;
}

.lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: var(--color-overlay);
}

.lightbox-inner {
  position: relative;
  z-index: 1;
  display: flex;
  background: var(--color-text);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(0.97);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
  width: fit-content;
  height: fit-content;
  max-width: 98vw;
  max-height: 98vh;
}

.lightbox.is-open .lightbox-inner {
  transform: translateY(0) scale(1);
}

.lightbox-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text);
  background: var(--color-bg);
  border-radius: 50%;
  transition: color var(--transition), background var(--transition);
}

.close-icon {
  position: relative;
  width: 24px;
  height: 24px;
}

.close-icon::before,
.close-icon::after {
  content: '';
  position: absolute;
  top: 0;
  left: 11px;
  height: 24px;
  width: 2px;
  background: var(--color-text);
}

.close-icon::before {
  transform: rotate(45deg);
}

.close-icon::after {
  transform: rotate(-45deg);
}

.lightbox-close:hover {
  background: var(--color-border);
}

.lightbox-details {
  background: var(--color-surface);
  min-width: 300px;
  max-width: 400px;
  padding: var(--gap);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.lightbox-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3.5vw, 2.25rem);
  font-weight: var(--font-light);
  line-height: 1.1;
  letter-spacing: -.01em;
  margin: var(--gap) 0;
}

.lightbox-meta {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin: var(--gap) 0;
}

.lightbox-meta-item {
  display: flex;
  gap: .5rem;
  font-size: var(--text-small);
}

.lightbox-meta-item .meta-label {
  color: var(--color-muted);
  min-width: 60px;
  font-weight: var(--font-light);
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: var(--text-very-small);
  padding-top: 2px;
}

.lightbox-divider {
  border: 0;
  background: transparent;
  border-top: 1px solid var(--color-border);
}

.lightbox-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: var(--gap) 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .75rem 1.25rem;
  font-size: var(--text-small);
  font-family: var(--font-body);
  font-weight: var(--text-normal);
  letter-spacing: .1em;
  text-transform: uppercase;
  border-radius: var(--radius);
  transition: background var(--transition), color var(--transition), transform .15s;
  text-align: center;
}

.btn:active {
  transform: scale(0.98);
}

.btn[aria-hidden="true"] {
  display: none;
}

.btn-primary {
  background: var(--color-text);
  color: #fff;
}

.btn-primary:hover {
  background: var(--color-accent);
}

.btn-secondary {
  border: 1px solid var(--color-muted);
  color: var(--color-muted);
  background: var(--color-surface);
}

.btn-secondary:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  flex-shrink: 0;
}

.lightbox-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}

.lightbox-prev,
.lightbox-next {
  width: 36px;
  height: 36px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 16px 16px;
  border-radius: var(--radius);
  color: var(--color-text);
  transition: background var(--transition), transform var(--transition), opacity var(--transition);
}

.lightbox-prev {
  background-image: url('../img/icon_arrow_left.svg');
}

.lightbox-next {
  background-image: url('../img/icon_arrow_right.svg');
}

.lightbox-prev:hover,
.lightbox-next:hover {
  background-color: var(--color-bg);
  transform: translateY(-2%) translateX(-2px);
}

.lightbox-prev:disabled,
.lightbox-next:disabled {
  opacity: 0.25;
  pointer-events: none;
}

.lightbox-img-wrap {
  background: var(--color-text);
  display: flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  height: fit-content;
}

.lightbox-img {
  max-width: min(100vw, 1200px);
  max-height: min(100vh, 1200px);
  transition: opacity 0.2s ease;
  margin: 0 auto;
}

.lightbox-img.is-loading {
  opacity: 0;
}

@media (max-width: 768px) {
  .lightbox {
    align-items: flex-start;
    padding: .5rem;
  }

  .lightbox-inner {
    flex-direction: column;
    max-height: fit-content;
    width: 98vw;
  }

  .lightbox-details {
    max-width: 100%;
    padding-bottom: .5rem;
  }

  .lightbox-details>div:first-child {
    position: relative;
  }

  .lightbox-title {
    margin: 0 0 1rem;
    padding-right: 45px;
  }

  .lightbox-meta {
    margin: 1rem 0;
    gap: .25rem;
  }

  .lightbox-close {
    position: absolute;
    right: 0;
    top: 0;
  }

  .lightbox-actions {
    flex-direction: row;
    flex-wrap: wrap;
    margin: 1rem 0;
  }

  .lightbox-nav {
    padding-top: .25rem
  }

  .lightbox-img-wrap {
    width: 100%;
  }
}

/* =============================================
   ABOUT & CONTACT PAGE
   ============================================= */
.about-layout,
.contact-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--big-gap);
}

.about-content h2,
.contact-content h2 {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 44px);
  font-weight: var(--text-light);
  line-height: 1.15;
  letter-spacing: -.01em;
  margin-bottom: var(--gap);
}

.about-content h2 em,
.contact-content h2 em {
  font-style: italic;
  color: var(--color-accent);
}

.about-content p {
  margin-bottom: 1rem;
}

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

.contact-intro {
  color: var(--color-muted);
  margin-bottom: var(--gap);
}

.contact-links {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.contact-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  transition: border-color var(--transition), box-shadow var(--transition);
  color: var(--color-text);
}

.contact-link:hover {
  border-color: var(--color-accent-lt);
  box-shadow: var(--shadow-sm);
}

.contact-link-icon {
  width: 40px;
  height: 40px;
  background: var(--color-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--color-accent);
}

.contact-link-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
}

.contact-link-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.contact-link-label {
  font-size: var(--text-very-small);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.contact-link-value {
  color: var(--color-text);
}

.about-img-wrap img,
.contact-img-wrap img {
  width: 100%;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.about-img-caption {
  margin-top: .75rem;
  font-size: var(--text-very-small);
  color: var(--color-muted);
  letter-spacing: .06em;
  text-transform: uppercase;
}

@media (max-width: 768px) {

  .about-layout,
  .contact-layout {
    grid-template-columns: 1fr;
  }

  .about-img-wrap,
  .contact-img-wrap {
    max-width: 360px;
    margin: 0 auto;
  }
}

/* =============================================
   FOOTER
   ============================================= */
.site-footer {
  border-top: 1px solid var(--color-border);
}

.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--gap);
}

.footer-copy {
  font-size: var(--text-very-small);
  color: var(--color-muted);
  letter-spacing: .04em;
}

/* =============================================
   UTILITIES
   ============================================= */
/* Reduced motion */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}