:root {
  --bg: #faf8f5;
  --fg: #1d1b19;
  --muted: #6b665f;
  --line: #e4dfd7;
  --accent: #b4532a;
  --card: #f0ece5;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121110;
    --fg: #f1ede6;
    --muted: #a39d93;
    --line: #2e2b28;
    --accent: #e08a5c;
    --card: #201e1c;
  }
}
:root[data-theme="dark"] {
  --bg: #121110;
  --fg: #f1ede6;
  --muted: #a39d93;
  --line: #2e2b28;
  --accent: #e08a5c;
  --card: #201e1c;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background .3s, color .3s;
}
body.lock { overflow: hidden; }
a { color: inherit; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 24px; }

/* Scroll progress */
#progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 30;
  background: var(--accent); transform-origin: 0 50%; transform: scaleX(0);
}

/* Sticky header */
header.site {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s;
}
header.site.scrolled { border-bottom-color: var(--line); }
.bar { display: flex; justify-content: space-between; align-items: center; padding: 22px 24px; transition: padding .3s; }
header.site.scrolled .bar { padding-top: 12px; padding-bottom: 12px; }
.logo { font-size: 1.1rem; letter-spacing: .04em; text-decoration: none; font-weight: 600; }
header.site nav { display: flex; align-items: center; }
header.site nav a {
  font-family: system-ui, sans-serif; font-size: .9rem; color: var(--muted);
  text-decoration: none; margin-left: 24px; padding-bottom: 2px;
  border-bottom: 2px solid transparent; transition: color .2s, border-color .2s;
}
header.site nav a:hover { color: var(--accent); }
header.site nav a.active { color: var(--fg); border-bottom-color: var(--accent); }
#theme {
  margin-left: 24px; font-family: system-ui, sans-serif; font-size: .8rem;
  color: var(--muted); background: none; border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 12px; cursor: pointer; transition: color .2s, border-color .2s;
}
#theme:hover { color: var(--accent); border-color: var(--accent); }

/* Home page */
.hero { padding: 96px 0 80px; }
.hero h1 {
  font-size: clamp(2.4rem, 7vw, 4.5rem); line-height: 1.08; font-weight: 400;
  letter-spacing: -.02em; max-width: 14em;
}
.hero h1 em {
  color: var(--accent); font-style: italic; display: inline-block;
  transition: opacity .35s, transform .35s;
}
.hero h1 em.out { opacity: 0; transform: translateY(.15em); }
.hero p { margin-top: 24px; max-width: 34em; color: var(--muted); font-size: 1.15rem; }
.btn {
  display: inline-block; margin-top: 32px; padding: 13px 26px;
  background: var(--fg); color: var(--bg); text-decoration: none;
  font-family: system-ui, sans-serif; font-size: .95rem; border-radius: 999px;
  transition: background .2s, transform .2s;
}
.btn:hover { background: var(--accent); transform: translateY(-2px); }

section { padding: 64px 0; border-top: 1px solid var(--line); }
h2 {
  font-family: system-ui, sans-serif; font-size: .8rem; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 32px;
}

/* Gallery: masonry-style columns so portrait and landscape photos sit naturally */
.gallery { column-count: 3; column-gap: 16px; }
.photo { break-inside: avoid; margin-bottom: 16px; cursor: zoom-in; outline-offset: 4px; }
.photo:focus-visible { outline: 2px solid var(--accent); border-radius: 6px; }
.photo .frame {
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, var(--line)), var(--card));
  border-radius: 6px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  font-family: system-ui, sans-serif; font-size: .8rem; color: var(--muted);
  transition: transform .35s, box-shadow .35s;
}
.photo:nth-child(2n) .frame { background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 12%, var(--line)), var(--card)); }
.photo:nth-child(3n) .frame { background: linear-gradient(200deg, color-mix(in srgb, var(--accent) 30%, var(--card)), var(--line)); }
.photo:hover .frame { transform: translateY(-4px); box-shadow: 0 14px 30px rgba(0,0,0,.18); }
.photo .frame.land { aspect-ratio: 3 / 2; }
.photo .frame.port { aspect-ratio: 2 / 3; }
.photo .frame.sq   { aspect-ratio: 1 / 1; }
.photo .frame img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s; }
.photo:hover .frame img { transform: scale(1.05); }
.photo figcaption {
  font-family: system-ui, sans-serif; font-size: .82rem; color: var(--muted);
  margin-top: 8px;
}

.about { display: grid; gap: 24px; max-width: 40em; font-size: 1.1rem; }

.teaser p { font-size: 1.15rem; max-width: 32em; }
.teaser .btn { margin-top: 24px; }

.contact p { font-size: 1.15rem; max-width: 32em; }
.contact a.mail {
  display: inline-block; margin-top: 16px; font-size: 1.5rem; color: var(--accent);
  text-decoration: none; background: linear-gradient(currentColor, currentColor) 0 100% / 100% 2px no-repeat;
  transition: background-size .3s;
}
.contact a.mail:hover { background-size: 0 2px; background-position: 100% 100%; }

footer {
  padding: 32px 0 48px; border-top: 1px solid var(--line);
  font-family: system-ui, sans-serif; font-size: .85rem; color: var(--muted);
}

/* Albums page */
.page-head { padding: 64px 0 40px; }
.page-head h1 {
  font-size: clamp(2rem, 5vw, 3rem); font-weight: 400; letter-spacing: -.02em;
  line-height: 1.15; outline: none;
}
.page-head p { margin-top: 12px; color: var(--muted); max-width: 36em; font-size: 1.1rem; }
.page-head p.album-meta { font-family: system-ui, sans-serif; font-size: .85rem; letter-spacing: .04em; }
.back {
  display: inline-block; margin-bottom: 20px; font-family: system-ui, sans-serif;
  font-size: .88rem; color: var(--muted); text-decoration: none;
}
.back:hover { color: var(--accent); }

#view > .gallery, #view > .album-grid { margin-bottom: 64px; }

.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 40px 32px; }
.album-card { display: block; color: inherit; text-decoration: none; border-radius: 8px; outline-offset: 8px; }
.album-card:focus-visible { outline: 2px solid var(--accent); }
.album-card .stack { position: relative; aspect-ratio: 4 / 3; margin-bottom: 20px; }
.album-card .stack::before, .album-card .stack::after {
  content: ""; position: absolute; inset: 0; border-radius: 6px;
  background: var(--card); border: 1px solid var(--line); transition: transform .35s;
}
.album-card .stack::before { transform: translate(9px, 8px) rotate(2deg); }
.album-card .stack::after  { transform: translate(4px, 4px) rotate(1deg); }
.album-card:hover .stack::before { transform: translate(14px, 10px) rotate(4deg); }
.album-card:hover .stack::after  { transform: translate(7px, 5px) rotate(2deg); }
.album-card .cover {
  position: absolute; inset: 0; z-index: 1; border-radius: 6px; overflow: hidden;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, var(--line)), var(--card));
  display: flex; align-items: center; justify-content: center;
  font-family: system-ui, sans-serif; font-size: .8rem; color: var(--muted);
}
.album-card:nth-child(2n) .cover { background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 12%, var(--line)), var(--card)); }
.album-card:nth-child(3n) .cover { background: linear-gradient(200deg, color-mix(in srgb, var(--accent) 30%, var(--card)), var(--line)); }
.album-card .cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s; }
.album-card:hover .cover img { transform: scale(1.05); }
.album-card h3 { font-size: 1.25rem; font-weight: 400; }
.album-card .meta { font-family: system-ui, sans-serif; font-size: .82rem; color: var(--muted); margin-top: 2px; }

.album-pager {
  display: flex; justify-content: space-between; gap: 16px; margin-bottom: 64px;
  padding-top: 24px; border-top: 1px solid var(--line);
  font-family: system-ui, sans-serif; font-size: .95rem;
}
.album-pager a { color: var(--accent); text-decoration: none; }
.album-pager a:hover { text-decoration: underline; }
.album-pager a:last-child { text-align: right; margin-left: auto; }

/* Scroll reveal (only when JS is running) */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s ease; }
.js .reveal.in { opacity: 1; transform: none; }
.js .btn.reveal { transition: opacity .7s ease, transform .7s ease, background .2s; }
.js .btn.reveal.in:hover { transform: translateY(-2px); }
.js .mail.reveal { transition: opacity .7s ease, transform .7s ease, background-size .3s; }

/* Lightbox */
.lb {
  position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 56px 16px 24px;
  background: rgba(10,9,8,.92); color: #f1ede6;
  visibility: hidden; opacity: 0; transition: opacity .25s, visibility .25s;
}
.lb.open { visibility: visible; opacity: 1; }
.lb-stage { display: flex; align-items: center; justify-content: center; max-width: 100%; }
.lb-stage img { max-width: 100%; max-height: calc(100vh - 160px); object-fit: contain; border-radius: 4px; }
.lb-stage .ph {
  border-radius: 4px; display: flex; align-items: center; justify-content: center;
  font-family: system-ui, sans-serif; color: rgba(255,255,255,.55);
  background: linear-gradient(135deg, color-mix(in srgb, #e08a5c 35%, #201e1c), #201e1c);
}
.ph.land { aspect-ratio: 3 / 2; width: min(90vw, calc((100vh - 160px) * 1.5)); }
.ph.port { aspect-ratio: 2 / 3; width: min(90vw, calc((100vh - 160px) * .6667)); }
.ph.sq   { aspect-ratio: 1 / 1; width: min(90vw, calc(100vh - 160px)); }
.lb-cap { margin-top: 16px; text-align: center; font-family: system-ui, sans-serif; font-size: .9rem; color: #cfc9bf; }
.lb-cap small { display: block; margin-top: 2px; color: #8d877d; font-size: .78rem; }
.lb button {
  position: absolute; background: rgba(255,255,255,.08); color: #f1ede6; border: 0;
  border-radius: 999px; width: 44px; height: 44px; font-size: 1.4rem; line-height: 1;
  cursor: pointer; transition: background .2s;
}
.lb button:hover { background: rgba(255,255,255,.2); }
.lb button:focus-visible { outline: 2px solid #e08a5c; }
.lb-close { top: 12px; right: 12px; }
.lb-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 12px; top: 50%; transform: translateY(-50%); }

@media (max-width: 800px) { .gallery { column-count: 2; } }
@media (max-width: 560px) {
  header.site nav a { margin-left: 14px; }
  #theme { margin-left: 14px; }
  .hero { padding: 64px 0 56px; }
  .page-head { padding: 40px 0 28px; }
  .gallery { column-count: 1; }
  .lb-prev, .lb-next { top: auto; bottom: 16px; transform: none; }
  .lb-prev { left: calc(50% - 56px); } .lb-next { right: calc(50% - 56px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; }
}
