/* Kiwi Photography — refined restyle. Hand-written, no framework. */

:root {
  --bg: #fbfaf8;
  --fg: #1c1a17;
  --muted: #726d64;
  --line: #e7e2d9;
  --accent: #8a7a5c;
  --card: #ffffff;
  --max: 1180px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Georgia", "Songti SC", "STSong", serif;
  --sans: "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14130f;
    --fg: #ece7dd;
    --muted: #9b948780;
    --muted: #9b9487;
    --line: #2c2a24;
    --accent: #c3ac82;
    --card: #1b1a15;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.5);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--fg);
  color: var(--bg);
  padding: .6rem 1rem;
  z-index: 100;
}
.skip-link:focus { left: 0; }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: .9rem 1.4rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  font-family: var(--serif);
  font-size: 1.25rem;
  letter-spacing: .02em;
  font-weight: 600;
}
.nav-links { display: flex; gap: 1.6rem; }
.nav-links a {
  font-size: .82rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: color .2s, border-color .2s;
}
.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--fg);
  border-color: var(--accent);
}

/* ---------- Hero ---------- */
.hero {
  max-width: 760px;
  margin: 0 auto;
  padding: 5.5rem 1.4rem 3rem;
  text-align: center;
}
.hero h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.1rem, 5vw, 3.2rem);
  margin: 0 0 1.1rem;
  letter-spacing: .01em;
}
.hero p {
  color: var(--muted);
  font-size: 1.08rem;
  margin: 0;
}

/* ---------- Section headings ---------- */
.section-title {
  font-family: var(--serif);
  text-align: center;
  font-size: 1.7rem;
  font-weight: 500;
  margin: 3rem 0 0;
}
.section-title::after {
  content: "";
  display: block;
  width: 46px;
  height: 1px;
  background: var(--accent);
  margin: .9rem auto 0;
}

/* ---------- Section cards (homepage) ---------- */
.cards {
  max-width: var(--max);
  margin: 2.5rem auto;
  padding: 0 1.4rem;
  display: grid;
  gap: 1.6rem;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .28s ease, box-shadow .28s ease;
  display: flex;
  flex-direction: column;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 12px 34px rgba(0,0,0,.12); }
.card-thumb { aspect-ratio: 3 / 2; overflow: hidden; }
.card-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .5s ease;
}
.card:hover .card-thumb img { transform: scale(1.05); }
.card-body { padding: 1.15rem 1.25rem 1.35rem; flex: 1; display: flex; flex-direction: column; }
.card-body h3 {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 500;
  margin: 0 0 .5rem;
}
.card-body p { color: var(--muted); font-size: .93rem; margin: 0 0 1rem; flex: 1; }
.card-cta {
  align-self: flex-start;
  font-size: .78rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
}
.card-cta.soon { color: var(--muted); }
.badge {
  position: absolute;
  top: .8rem; right: .8rem;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: .68rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: .2rem .55rem;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}

/* ---------- Pull quote ---------- */
.quote {
  max-width: 720px;
  margin: 4rem auto 1rem;
  padding: 0 2rem;
  text-align: center;
}
.quote .mark {
  font-family: var(--serif);
  font-size: 3.4rem;
  line-height: 1;
  color: var(--accent);
  opacity: .55;
}
.quote blockquote {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-style: italic;
  margin: .3rem 0 0;
  color: var(--fg);
}

/* ---------- Gallery (justified rows) ---------- */
.page-head {
  max-width: 760px;
  margin: 0 auto;
  padding: 4rem 1.4rem 1rem;
  text-align: center;
}
.page-head h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  margin: 0 0 .8rem;
}
.page-head p { color: var(--muted); margin: 0; }

.gallery {
  max-width: 1320px;
  margin: 2rem auto 0;
  padding: 0 1rem;
  position: relative;   /* items are positioned absolutely by gallery.js */
}
.gallery-item {
  margin: 0;
  position: absolute;
  top: 0;
  left: 0;
  width: 320px;         /* pre-JS placeholder; JS sets exact left/top/w/h */
  height: 240px;
  overflow: hidden;
  border-radius: 4px;
  cursor: zoom-in;
  background: var(--line);
}
/* Before JS runs, fall back to simple inline flow so it isn't all stacked at
   0,0. Once .gallery has an explicit height (JS ran) this no longer applies. */
.gallery:not([style*="height"]) .gallery-item {
  position: relative;
  display: inline-block;
  margin: 3px;
}
.gallery-open {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: inherit;
  background: none;
  cursor: inherit;
}
.gallery-open:focus-visible {
  outline: 3px solid var(--fg);
  outline-offset: -3px;
}
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: transform .5s ease, opacity .5s ease;
}
.gallery-item.loaded img { opacity: 1; }   /* fade in once the thumb decodes */
.gallery-item:hover img { transform: scale(1.04); }
.gallery-item .cap {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 1.4rem .8rem .6rem;
  color: #fff;
  font-size: .85rem;
  background: linear-gradient(to top, rgba(0,0,0,.6), transparent);
  opacity: 0;
  transition: opacity .3s ease;
  pointer-events: none;
}
.gallery-item:hover .cap, .gallery-item:focus-within .cap { opacity: 1; }

.empty-note {
  max-width: 560px;
  margin: 2rem auto 4rem;
  text-align: center;
  color: var(--muted);
  font-style: italic;
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  z-index: 90;
  background: rgba(10,9,8,.94);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 2rem;
}
.lightbox[open] { display: flex; }
.lightbox::backdrop { background: transparent; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.lightbox img {
  max-width: 92vw;
  max-height: 82vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.lightbox .lb-cap {
  color: #eee;
  margin-top: 1rem;
  font-family: var(--serif);
  font-size: 1.05rem;
  text-align: center;
  min-height: 1.2em;
}
.lb-btn {
  position: absolute;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 2.4rem;
  line-height: 1;
  padding: 1rem;
  opacity: .7;
  transition: opacity .2s;
  user-select: none;
}
.lb-btn:hover, .lb-btn:focus-visible { opacity: 1; }
.lb-btn:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }
.lb-close { top: .5rem; right: 1rem; font-size: 2rem; }
.lb-prev { left: .5rem; top: 50%; transform: translateY(-50%); }
.lb-next { right: .5rem; top: 50%; transform: translateY(-50%); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 5rem;
  padding: 2.5rem 1.4rem;
  text-align: center;
  color: var(--muted);
  font-size: .85rem;
}
.site-footer .fname {
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--fg);
  display: block;
  margin-bottom: .6rem;
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--fg); }

@media (max-width: 560px) {
  .nav-wrap { flex-wrap: wrap; }
  .nav-links { gap: .5rem 1.1rem; flex-wrap: wrap; }
  .cards { grid-template-columns: 1fr; }
  .hero { padding-top: 3.5rem; }
  .gallery { padding: 0 .5rem; }
  .lb-prev, .lb-next { font-size: 1.8rem; }
}

/* Film tools share a home here; their pages have their own visual theme. */
.project-teaser {
  max-width: 1136px;
  margin: 4rem auto;
  padding: 3rem 2rem;
  background: #e5ebdf;
  color: #263b30;
  text-align: center;
}
.project-teaser .teaser-label { text-transform: uppercase; letter-spacing: .12em; font-size: .7rem; }
.project-teaser h2 { font: italic 2.2rem/1.2 var(--serif); margin: 1rem 0; }
.project-teaser p { max-width: 560px; margin: 0 auto 1rem; font-size: .93rem; }
.project-teaser a { display: inline-block; border-bottom: 1px solid currentColor; font-size: .85rem; }
@media (max-width: 1180px) { .project-teaser { margin-inline: 1.4rem; } }
