/* diego.pictures — public site. The admin keeps its own rules in admin.css. */

:root {
  --paper: #f7f7f3;
  --paper-tone: #ecece5;
  --ink: #1f221e;
  --muted: #666a62;
  --line: #dcddd5;
  --olive: #56604b;
  --olive-soft: #e3e6dc;
  --darkroom: #121311;
  --on-dark: #ecece6;
  --on-dark-muted: #a7aaa1;

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;

  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.625rem;
  --step-3: clamp(2rem, 1.4rem + 2.4vw, 3rem);
  --step-4: clamp(2.5rem, 1.6rem + 3.6vw, 4.25rem);
  --step-5: clamp(3.25rem, 1.4rem + 7.4vw, 6rem);

  --gutter: clamp(1rem, 4vw, 3.5rem);
  --max: 1440px;
  --gap: clamp(0.5rem, 1vw, 0.875rem);
  --row: 280px;
  --header-h: 72px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body { overflow-x: clip; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 1rem); }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--step-0)/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  caret-color: var(--olive);
  scrollbar-color: #b9bbb2 var(--paper);
}
body.admin-mode { font-size: 14px; }
main { flex: 1 0 auto; }
::selection { background: var(--olive); color: var(--paper); }
img { max-width: 100%; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.1; letter-spacing: -0.02em; text-wrap: balance; margin: 0; overflow-wrap: break-word; min-width: 0; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--olive);
  outline-offset: 3px;
  transition: none;
}
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.icon { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; display: block; }

.container { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); box-sizing: border-box; }
.meta { color: var(--muted); font-size: var(--step--1); font-variant-numeric: tabular-nums; }
.lede { font-family: var(--serif); font-size: var(--step-2); line-height: 1.35; max-width: 34ch; text-wrap: pretty; }
.prose { max-width: 64ch; font-size: 1.0625rem; line-height: 1.7; text-wrap: pretty; }
.prose p + p { margin-top: 1em; }
.prose-large { font-family: var(--serif); font-size: var(--step-1); line-height: 1.6; max-width: 60ch; }

.text-link {
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
  transition: text-decoration-color 0.2s;
}
.text-link:hover { text-decoration-color: currentColor; }
.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 0 1.4rem;
  background: var(--ink); color: var(--paper);
  border: 1px solid var(--ink); border-radius: 999px;
  font: 500 var(--step--1)/1 var(--sans); cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}
.button:hover { background: var(--olive); border-color: var(--olive); }
.button:disabled { opacity: 0.5; cursor: progress; }

/* ---------- Header and footer ---------- */

.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: saturate(1.2) blur(10px);
  -webkit-backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { height: var(--header-h); display: flex; align-items: center; justify-content: space-between; gap: 2rem; }
.wordmark { font: 400 1.375rem/1 var(--serif); letter-spacing: -0.02em; white-space: nowrap; }
.site-nav { display: flex; align-items: center; gap: clamp(1rem, 2.2vw, 2rem); font-size: 0.9375rem; }
.site-nav a, .nav-button { position: relative; padding: 0.5rem 0; color: var(--muted); transition: color 0.2s; }
.site-nav a:hover, .site-nav a[aria-current="page"], .nav-button:hover { color: var(--ink); }
.site-nav a[aria-current="page"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0.15rem; height: 1px; background: currentColor; }
.nav-button { background: none; border: 0; font: inherit; cursor: pointer; }
.nav-admin { padding-left: 1rem !important; border-left: 1px solid var(--line); }
.menu-toggle { display: none; background: none; border: 0; padding: 10px; margin-right: -10px; color: var(--ink); cursor: pointer; }

.site-footer { margin-top: clamp(4rem, 10vw, 8rem); border-top: 1px solid var(--line); }
.footer-inner { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.75rem 2rem; padding-block: 2rem 2.5rem; color: var(--muted); font-size: var(--step--1); }
.footer-inner .wordmark { color: var(--ink); font-size: 1.125rem; margin-right: auto; }

/* ---------- Home ---------- */

.intro {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: end;
  min-height: calc(100svh - var(--header-h));
  padding-block: clamp(1.5rem, 4vh, 3rem);
  box-sizing: border-box;
}
.hero-copy { padding-bottom: clamp(0.5rem, 3vh, 2rem); }
.wordmark-display { font-size: var(--step-5); line-height: 0.92; letter-spacing: -0.04em; }
.wordmark-display span { display: block; }
.wordmark-display span + span { color: var(--olive); padding-left: 0.04em; }
.hero-line { margin-top: 1.5rem; font-family: var(--serif); font-size: var(--step-1); color: var(--muted); }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.75rem; margin-top: 2rem; }

.hero-frame { margin: 0; display: flex; flex-direction: column; gap: 0.875rem; min-width: 0; }
.hero-slides { position: relative; height: min(72svh, 760px); }
.hero-slide { position: absolute; inset: 0; opacity: 0; visibility: hidden; transition: opacity 1.4s var(--ease-out), visibility 0s 1.4s; }
.hero-slide.is-active { opacity: 1; visibility: visible; transition: opacity 1.4s var(--ease-out), visibility 0s; }
.hero-slide img { width: 100%; height: 100%; object-fit: contain; object-position: 50% 100%; display: block; }
.intro-caption { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem 1.5rem; min-height: 1.6em; }
.hero-title { font-family: var(--serif); font-size: var(--step-1); margin-right: auto; }
.hero-count { white-space: nowrap; }

/* The one authored moment: the first frame develops in on load. */
@media (prefers-reduced-motion: no-preference) {
  .hero-slides { animation: develop 1.3s var(--ease-out) both; }
  .wordmark-display span { animation: rise 1s var(--ease-out) both; }
  .wordmark-display span + span { animation-delay: 0.12s; }
}
@keyframes develop { from { clip-path: inset(0 0 100% 0); filter: brightness(1.6) contrast(0.6); } to { clip-path: inset(0); filter: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(0.25em); } to { opacity: 1; transform: none; } }

.band { padding-top: clamp(4rem, 9vw, 7rem); }
.band-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.5rem 2rem; margin-bottom: clamp(1.25rem, 3vw, 2rem); }
.band-head h2 { font-size: var(--step-3); }
.band-head .text-link { color: var(--muted); font-size: 0.9375rem; }

.home-about { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(1.5rem, 5vw, 5rem); }
.home-about h2 { font-size: var(--step-3); }
.home-about .lede { max-width: 40ch; margin-bottom: 1.25rem; }

/* ---------- Page heads ---------- */

.page-head { padding-block: clamp(2.5rem, 7vw, 5rem) clamp(1.5rem, 4vw, 2.75rem); }
.page-head h1 { font-size: var(--step-4); letter-spacing: -0.03em; }
.page-head .meta { margin-top: 0.75rem; }
.page-head .prose { margin-top: 1.75rem; }
.crumb { padding-top: clamp(1.5rem, 4vw, 2.5rem); font-size: 0.9375rem; color: var(--muted); }
.crumb + .page-head { padding-top: 1rem; }
.crumb .meta { margin-left: 0.75rem; }

/* ---------- Justified gallery: every photograph keeps its own shape ---------- */

.gallery { display: flex; flex-wrap: wrap; gap: var(--gap); list-style: none; margin: 0; padding: 0; }
.gallery::after { content: ""; flex-grow: 100000000; }
/* Grow is scaled by 100 so a lone photo still fills its row (flex factors below 1 only take a fraction of the free space). */
.gallery-item { flex: calc(var(--ar) * 100) 1 calc(var(--ar) * var(--row)); min-width: 0; }
.gallery-link { display: block; aspect-ratio: var(--ar); background: var(--paper-tone); overflow: hidden; }
.gallery-link img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.9s var(--ease-out); }
.gallery-link:hover img { transform: scale(1.02); }
.gallery-caption { margin-top: 0.5rem; min-height: 1.5em; font-size: var(--step--1); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

img[loading="lazy"] { opacity: 0; transition: opacity 0.6s var(--ease-out); }
img[loading="lazy"].is-loaded { opacity: 1; }

/* ---------- Albums and collections ---------- */

.story-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: clamp(1.5rem, 3vw, 2.5rem) var(--gap); list-style: none; margin: 0; padding: 0; }
.story-tile { display: block; }
.tile-cover { aspect-ratio: 4 / 5; background: var(--paper-tone); overflow: hidden; margin-bottom: 0.875rem; }
.tile-cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.9s var(--ease-out); }
.story-tile:hover .tile-cover img { transform: scale(1.025); }
.story-tile h3 { font-size: var(--step-2); }
.story-tile .meta { margin-top: 0.25rem; }

.sequence { display: flex; flex-direction: column; gap: clamp(4rem, 10vw, 8rem); padding-top: 1rem; }
.sequence-item { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 1.25rem; }
.sequence-image { display: block; width: min(100%, calc(84svh * var(--ar))); aspect-ratio: var(--ar); background: var(--paper-tone); }
.sequence-image img { width: 100%; height: 100%; display: block; object-fit: contain; }
.sequence-item figcaption { width: min(100%, 64ch); text-align: left; }
.caption-title { font-size: var(--step-2); margin-bottom: 0.5rem; }
.caption-body { color: var(--muted); line-height: 1.7; }
.caption-body p + p { margin-top: 0.85em; }
.sequence-item .exposure { margin-top: 1rem; }

@media (min-width: 1000px) {
  .sequence-item.has-text { grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); align-items: end; gap: clamp(2rem, 4vw, 4rem); }
  .sequence-item.has-text .sequence-image { width: min(100%, calc(84svh * var(--ar))); justify-self: end; }
  .sequence-item.has-text figcaption { padding-bottom: 0.5rem; }
  .sequence-item.has-text:nth-child(even) { grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); }
  .sequence-item.has-text:nth-child(even) .sequence-image { order: 2; justify-self: start; }
  .sequence-item.has-text:nth-child(even) figcaption { text-align: right; justify-self: end; }
  .sequence-item.has-text:nth-child(even) .exposure { justify-content: flex-end; }
}

/* ---------- Exposure readout ---------- */

.exposure { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; margin: 0; font-variant-numeric: tabular-nums; }
.exposure div { display: flex; flex-direction: column-reverse; }
.exposure dt { font-size: 0.75rem; color: var(--muted); }
.exposure dd { margin: 0; font-family: var(--serif); font-size: var(--step-1); line-height: 1.2; }
.hero-exposure .exposure dd { font-size: 1.0625rem; }

/* ---------- Single photograph ---------- */

.photo-view { padding-top: clamp(1rem, 2.5vw, 2rem); }
.photo-stage { position: relative; display: flex; align-items: center; justify-content: center; gap: 1rem; padding-inline: var(--gutter); }
.stage-image { display: block; padding: 0; border: 0; background: var(--paper-tone); cursor: zoom-in; width: min(100%, calc((100svh - var(--header-h) - 7rem) * var(--ar))); aspect-ratio: var(--ar); }
.stage-image img { width: 100%; height: 100%; object-fit: contain; display: block; }
.stage-nav { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; color: var(--muted); transition: color 0.2s, background-color 0.2s; }
.stage-nav:hover { color: var(--ink); background: var(--paper-tone); }
.photo-info { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1.5rem 4rem; align-items: start; padding-top: 1.5rem; }
.photo-info .crumb { padding-top: 0; margin-bottom: 0.75rem; }
.photo-text h1 { font-size: var(--step-3); margin-bottom: 1rem; }
.photo-meta { padding-top: 2.1rem; }
.photo-meta .exposure { flex-direction: column; gap: 1rem; }

/* ---------- Lightbox ---------- */

.lightbox { position: fixed; inset: 0; z-index: 100; background: var(--darkroom); color: var(--on-dark); display: grid; place-items: center; animation: fade 0.25s ease-out; }
.has-lightbox { overflow: hidden; }
.lb-figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 1rem; padding: 3.5rem 4.5rem 1.5rem; box-sizing: border-box; max-width: 100vw; max-height: 100svh; }
.lb-figure img { max-width: 100%; max-height: calc(100svh - 9rem); object-fit: contain; display: block; }
.lb-caption { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 0.5rem 1.75rem; color: var(--on-dark-muted); font-size: var(--step--1); }
.lb-title { font-family: var(--serif); font-size: var(--step-1); color: var(--on-dark); }
.lb-caption .exposure dt { color: var(--on-dark-muted); }
.lb-caption .exposure dd { color: var(--on-dark); font-size: 1rem; }
.lb-count { font-variant-numeric: tabular-nums; }
.lb-button { position: absolute; display: grid; place-items: center; width: 52px; height: 52px; border: 0; border-radius: 50%; background: transparent; color: var(--on-dark-muted); cursor: pointer; transition: color 0.2s, background-color 0.2s; }
.lb-button:hover { color: var(--on-dark); background: rgba(255, 255, 255, 0.08); }
.lb-button:focus-visible { outline-color: var(--on-dark); }
.lb-close { top: 0.75rem; right: 0.75rem; }
.lb-prev { left: 0.75rem; top: 50%; transform: translateY(-50%); }
.lb-next { right: 0.75rem; top: 50%; transform: translateY(-50%); }
@keyframes fade { from { opacity: 0; } }

/* ---------- About, store, login, empty ---------- */

.about-layout { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); gap: clamp(2rem, 6vw, 6rem); align-items: start; }
.contact-card { position: sticky; top: calc(var(--header-h) + 2rem); display: flex; flex-direction: column; gap: 0.75rem; }
.contact-card h2 { font-size: var(--step-2); }
.contact-card p { color: var(--muted); }
.email-link { font: 400 var(--step-1)/1.3 var(--serif); overflow-wrap: anywhere; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; text-decoration-color: var(--line); }
.email-link:hover { text-decoration-color: currentColor; }
.about-photo { display: block; margin-top: 1.5rem; background: var(--paper-tone); }
.about-photo img { width: 100%; height: auto; display: block; }

.page-actions { margin-top: 1.75rem; }
.store-intro { display: flex; flex-direction: column; gap: 2rem; }
.store-note { color: var(--muted); margin-bottom: 2rem; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 2.5rem var(--gap); list-style: none; margin: 0; padding: 0; }
.product-photo { aspect-ratio: 4 / 5; background: var(--paper-tone); margin-bottom: 1rem; }
.product-photo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.product h2 { font-size: var(--step-2); }
.price { margin: 0.25rem 0 0.5rem; font-variant-numeric: tabular-nums; }
.specs { color: var(--muted); font-size: var(--step--1); margin-bottom: 0.75rem; white-space: pre-line; }

.login { max-width: 30rem; padding-top: clamp(3rem, 10vw, 6rem); display: flex; flex-direction: column; gap: 1.25rem; }
.login h1 { font-size: var(--step-4); }
.login p { color: var(--muted); }
.login-form { display: flex; flex-direction: column; gap: 0.75rem; align-items: flex-start; }
.login-form label { font-size: var(--step--1); }
.login-form input { width: 100%; box-sizing: border-box; min-height: 48px; padding: 0 1rem; border: 1px solid #c9cbc1; border-radius: 6px; background: #fff; font: inherit; }
.login-note:empty { display: none; }

.empty-state { padding: clamp(3rem, 8vw, 5rem) 0; border-top: 1px solid var(--line); }
.empty-title { font-family: var(--serif); font-size: var(--step-2); }
.empty-state p + p { color: var(--muted); margin-top: 0.5rem; }

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

@media (max-width: 860px) {
  :root { --row: 170px; --header-h: 60px; }
  .menu-toggle { display: block; }
  .site-nav { position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0; padding: 0.5rem var(--gutter) 1.25rem; background: var(--paper); border-bottom: 1px solid var(--line); display: none; font-size: var(--step-1); }
  .menu-open .site-nav { display: flex; }
  .site-nav a, .nav-button { padding: 0.8rem 0; text-align: left; border-bottom: 1px solid var(--line); }
  .site-nav a[aria-current="page"]::after { display: none; }
  .nav-admin { padding-left: 0 !important; border-left: 0; }

  .intro { grid-template-columns: minmax(0, 1fr); min-height: 0; align-items: start; gap: 2rem; padding-top: 2rem; }
  .hero-slides { height: 62svh; }
  .home-about, .about-layout, .photo-info { grid-template-columns: minmax(0, 1fr); }
  .contact-card { position: static; }
  .photo-meta { padding-top: 0; }
  .photo-meta .exposure { flex-direction: row; gap: 0.25rem 1.5rem; }
  .photo-stage { padding-inline: 0; }
  .stage-nav { display: none; }
  .stage-image { width: min(100%, calc((100svh - var(--header-h) - 8rem) * var(--ar))); }
  .lb-figure { padding: 3.5rem 0.75rem 1.25rem; }
  .lb-prev, .lb-next { top: auto; bottom: 0.5rem; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

@media print {
  .site-header, .site-footer, .stage-nav { display: none; }
}

/* ---------- Image protection ---------- */
.public-mode img, .lightbox img { -webkit-user-select: none; user-select: none; -webkit-user-drag: none; -webkit-touch-callout: none; }
.public-mode main img { pointer-events: none; }
.public-mode .gallery-link, .public-mode .hero-slide, .public-mode .stage-image, .public-mode .sequence-image, .public-mode .tile-cover, .public-mode .about-photo, .public-mode .product-photo, .lightbox { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.public-mode.is-veiled main img, .is-veiled .lightbox img { filter: blur(40px) brightness(0.6); transition: none; }
@media print {
  .public-mode img, .lightbox { display: none !important; }
}
