/* Kuvat: a photographer's client gallery, quietly. */

@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url(/s/cormorant.woff2) format("woff2");
}
@font-face {
  font-family: "Cormorant Garamond";
  font-style: italic;
  font-weight: 300 700;
  font-display: swap;
  src: url(/s/cormorant-italic.woff2) format("woff2");
}
@font-face {
  font-family: "Jost";
  font-style: normal;
  font-weight: 300 600;
  font-display: swap;
  src: url(/s/jost.woff2) format("woff2");
}

:root {
  --paper: #faf8f5;
  --ink: #262421;
  --soft: #7a746c;
  --line: #e6e1d9;
  --tile: #ece7e0;
  --card: #ffffff;
  --danger: #9f3a30;
  --serif: "Cormorant Garamond", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Jost", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --row: 120px;
  --gap: 3px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #141311;
    --ink: #ece7df;
    --soft: #9b948a;
    --line: #2c2925;
    --tile: #211e1b;
    --card: #1b1916;
    --danger: #e0857a;
  }
}
@media (min-width: 600px) { :root { --row: 190px; --gap: 6px; } }
@media (min-width: 1100px) { :root { --row: 250px; --gap: 8px; } }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 300 16px/1.6 var(--sans);
  letter-spacing: .01em;
  -webkit-font-smoothing: antialiased;
}
body.noscroll { overflow: hidden; }
[hidden] { display: none !important; }
a { color: inherit; }
:focus-visible { outline: 1px solid currentColor; outline-offset: 3px; }
svg {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.3;
  stroke-linecap: round; stroke-linejoin: round;
}

.eyebrow {
  margin: 0;
  font: 400 .72rem/1.5 var(--sans);
  letter-spacing: .32em;
  text-transform: uppercase;
}

/* --- buttons ----------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 46px; padding: 0 24px;
  border: 1px solid var(--ink); border-radius: 0;
  background: transparent; color: var(--ink);
  font: 400 .72rem/1 var(--sans); letter-spacing: .24em; text-transform: uppercase;
  text-decoration: none; cursor: pointer;
  transition: background .25s, color .25s, border-color .25s;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn.solid { background: var(--ink); color: var(--paper); }
.btn.solid:hover { opacity: .86; }
.btn.quiet { border-color: var(--line); }
.btn.quiet:hover { border-color: var(--ink); }
.btn.danger { color: var(--danger); border-color: var(--line); }
.btn.danger:hover { background: var(--danger); border-color: var(--danger); color: var(--paper); }
.btn.small { min-height: 40px; padding: 0 14px; font-size: .66rem; letter-spacing: .2em; gap: 8px; }
.btn.small svg { width: 16px; height: 16px; }
.btn:disabled { opacity: .4; pointer-events: none; }

/* --- cover ------------------------------------------------------------- */

.hero {
  position: relative;
  min-height: 100vh; min-height: 100svh;
  display: grid; place-items: center;
  overflow: hidden;
  background: #1d1b18; color: #fff;
  text-align: center;
}
.hero-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transform: scale(1.05);
  transition: opacity 1.4s ease, transform 3s cubic-bezier(.2, .6, .2, 1);
}
.hero-img.ready { opacity: 1; transform: none; }
.hero::after {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 60% 45% at 50% 52%, rgba(0, 0, 0, .22), transparent 75%),
    linear-gradient(180deg, rgba(0, 0, 0, .28) 0%, rgba(0, 0, 0, .08) 38%,
                            rgba(0, 0, 0, .12) 60%, rgba(0, 0, 0, .5) 100%);
}
.hero-text {
  position: relative; z-index: 1;
  max-width: 60rem;
  padding: 0 24px;
  text-shadow: 0 1px 24px rgba(0, 0, 0, .25);
}
.hero h1 {
  margin: 1rem 0 .9rem;
  font: 300 clamp(2.7rem, 9vw, 6rem)/1.02 var(--serif);
  letter-spacing: .005em;
  text-wrap: balance;
}
.hero-meta {
  margin: 0;
  font: 400 .76rem/1.5 var(--sans); letter-spacing: .26em; text-transform: uppercase;
  opacity: .92;
}
.hero-cta {
  display: inline-flex; align-items: center;
  margin-top: 2.4rem; padding: 1rem 2.4rem;
  border: 1px solid rgba(255, 255, 255, .8);
  color: #fff; text-decoration: none; text-shadow: none;
  font: 400 .7rem/1 var(--sans); letter-spacing: .32em; text-transform: uppercase;
  transition: background .3s, color .3s;
}
.hero-cta:hover { background: #fff; color: #1d1b18; }
.hero.bare { min-height: 64vh; min-height: 64svh; background: var(--paper); color: var(--ink); }
.hero.bare::after { display: none; }
.hero.bare .hero-text { text-shadow: none; }
.hero.bare .hero-cta { border-color: var(--ink); color: var(--ink); }
.hero.bare .hero-cta:hover { background: var(--ink); color: var(--paper); }

/* --- the bar that stays ------------------------------------------------ */

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  height: 60px;
  padding: 0 max(8px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left));
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .topbar {
    background: color-mix(in srgb, var(--paper) 88%, transparent);
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
    backdrop-filter: saturate(1.4) blur(14px);
  }
}
.brand {
  flex: 1; min-width: 0;
  font: 400 1.45rem/1 var(--serif);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tools { display: flex; gap: 2px; }
.tool {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  height: 44px; min-width: 44px; padding: 0 10px;
  border: 0; background: none; color: var(--ink);
  font: 400 .68rem/1 var(--sans); letter-spacing: .22em; text-transform: uppercase;
  text-decoration: none; cursor: pointer;
  transition: opacity .2s;
}
@media (hover: hover) { .tool:hover { opacity: .55; } }
.tool span { display: none; }
@media (min-width: 820px) {
  .tool { padding: 0 14px; }
  .tool span { display: inline; }
}
.selecting #selbtn { text-decoration: underline; text-underline-offset: 6px; }

/* --- the photos -------------------------------------------------------- */

.gallery {
  max-width: 1680px; margin: 0 auto;
  padding: 28px var(--gap) 96px;
  scroll-margin-top: 60px;
}
@media (min-width: 600px) { .gallery { padding: 56px 28px 120px; } }

.note {
  margin: 0 auto 36px; max-width: 34rem;
  text-align: center; color: var(--soft);
  font: italic 300 1.2rem/1.4 var(--serif);
}
.day { margin-top: 56px; }
.day:first-child { margin-top: 0; }
.day h2 { margin: 0 0 22px; text-align: center; font-weight: 400; }
.day h2 small { display: block; color: var(--soft); }
.day h2 span {
  display: block; margin-top: .3rem;
  font: 300 clamp(1.7rem, 4vw, 2.3rem)/1.2 var(--serif);
}

/* Justified rows: each tile grows in proportion to its width, so a row's
   tiles end up one height and each photo keeps its own shape. */
.rows { display: flex; flex-wrap: wrap; gap: var(--gap); }
.rows::after { content: ""; flex-grow: 1000000; }
.tile {
  position: relative; display: block; overflow: hidden;
  background: var(--tile);
  -webkit-tap-highlight-color: transparent;
}
.tile i { display: block; }
.tile .open { position: absolute; inset: 0; cursor: zoom-in; }
.tile img, .tile video {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0;
  transition: opacity .7s ease, transform .9s cubic-bezier(.2, .7, .2, 1);
}
.tile .ready { opacity: 1; }
@media (hover: hover) {
  .tile:hover img, .tile:hover video { transform: scale(1.035); }
}
.badge {
  position: absolute; right: 8px; bottom: 8px;
  display: flex; align-items: center; gap: 5px;
  padding: 4px 9px 4px 7px; border-radius: 999px;
  background: rgba(0, 0, 0, .42); color: #fff;
  font: 400 .7rem/1 var(--sans); letter-spacing: .08em;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.badge svg { width: 10px; height: 10px; fill: #fff; stroke: none; }
.mark {
  position: absolute; top: 8px; right: 8px; z-index: 1;
  width: 26px; height: 26px; border-radius: 50%;
  display: none; place-items: center;
  border: 1.5px solid #fff; background: rgba(0, 0, 0, .16); color: #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, .25);
}
.mark svg { width: 15px; height: 15px; stroke-width: 2.2; opacity: 0; }
.selecting .tile .open { cursor: pointer; }
.selecting .mark { display: grid; }
.selecting .tile:hover img, .selecting .tile:hover video { transform: none; }
.tile.chosen .mark { background: #1d1b18; }
.tile.chosen .mark svg { opacity: 1; }
.tile.chosen img, .tile.chosen video,
.selecting .tile.chosen:hover img, .selecting .tile.chosen:hover video { transform: scale(.88); }

/* The heart: shown on hover where there is one, and always once given. */
.fav {
  position: absolute; left: 4px; bottom: 4px; z-index: 2;
  display: inline-flex; align-items: center; gap: 4px;
  min-width: 40px; height: 40px; padding: 0 8px;
  border: 0; background: none; color: #fff; cursor: pointer;
  font: 500 .78rem/1 var(--sans);
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .5));
  opacity: 0; transition: opacity .2s;
  -webkit-tap-highlight-color: transparent;
}
.fav svg { width: 22px; height: 22px; stroke-width: 1.6; }
.fav span:empty { display: none; }
.tile.faved .fav, .tile.counted .fav { opacity: 1; }
.tile.faved .fav svg { fill: #fff; }
@media (hover: hover) { .tile:hover .fav { opacity: 1; } }
.selecting .fav { display: none; }
.fav.pop svg, .vbtn.pop svg { animation: pop .45s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { 40% { transform: scale(1.35); } }

.tool b {
  display: inline-grid; place-items: center;
  min-width: 18px; height: 18px; padding: 0 5px; margin-left: -4px;
  border-radius: 9px;
  background: var(--ink); color: var(--paper);
  font: 500 .62rem/1 var(--sans); letter-spacing: 0;
}
.tool.on svg { fill: currentColor; }
.tool.on span { text-decoration: underline; text-underline-offset: 6px; }

.favhead { margin: 0 auto 40px; max-width: 40rem; text-align: center; }
.favhead .eyebrow { color: var(--soft); }
.tabs { display: flex; justify-content: center; gap: 4px 28px; flex-wrap: wrap; margin: .5rem 0 .4rem; }
.tabs button {
  padding: 0; border: 0; background: none; color: var(--soft); cursor: pointer;
  font: 300 clamp(1.9rem, 5vw, 2.6rem)/1.25 var(--serif);
}
.tabs button span { text-decoration-thickness: 1px; text-underline-offset: 10px; }
.tabs button[aria-selected="true"] { color: var(--ink); }
.tabs button[aria-selected="true"] span { text-decoration-line: underline; }
.tabs sup { margin-left: .2em; font: 400 .7rem var(--sans); letter-spacing: .1em; vertical-align: super; }
.favnote { margin: .6rem 0 1.4rem; color: var(--soft); }
.favactions { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }

.empty { padding: 10vh 16px 4vh; text-align: center; }
.empty p { margin: 0 0 1.8rem; font: italic 300 clamp(1.6rem, 4vw, 2.1rem)/1.3 var(--serif); }

.foot {
  padding: 56px 20px 72px;
  border-top: 1px solid var(--line);
  text-align: center; color: var(--soft);
  font-size: .82rem; letter-spacing: .04em;
}
.foot b { display: block; margin-bottom: .5rem; color: var(--ink); font: 300 1.8rem/1.2 var(--serif); }

/* --- selecting, sending, telling -------------------------------------- */

#selbar {
  position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); z-index: 8;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px;
  padding: 6px; padding-left: 20px;
  background: var(--ink); color: var(--paper);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .28);
  white-space: nowrap;
  animation: rise .3s ease;
}
#selbar .count { margin-right: 8px; font: 400 .7rem/1 var(--sans); letter-spacing: .22em; text-transform: uppercase; }
#selbar button {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 16px;
  border: 1px solid color-mix(in srgb, var(--paper) 35%, transparent);
  background: none; color: var(--paper);
  font: 400 .66rem/1 var(--sans); letter-spacing: .22em; text-transform: uppercase;
  cursor: pointer;
}
#selbar button svg { width: 16px; height: 16px; }
#selbar .go { background: var(--paper); color: var(--ink); border-color: var(--paper); }
#selbar .go:disabled { opacity: .45; }
@media (max-width: 420px) {
  #selbar { padding-left: 14px; gap: 4px; }
  #selbar .count { margin-right: 4px; letter-spacing: .14em; }
  #selbar button { padding: 0 12px; letter-spacing: .14em; }
}

.toast {
  position: fixed; right: 18px; bottom: max(18px, env(safe-area-inset-bottom)); z-index: 9;
  width: min(360px, calc(100vw - 36px));
  padding: 16px 18px 18px;
  background: var(--card); color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 16px 48px rgba(0, 0, 0, .14);
  animation: rise .3s ease;
}
body.selecting .toast { bottom: 88px; }
.toast-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 28px;
  font: 400 .7rem/1.3 var(--sans); letter-spacing: .2em; text-transform: uppercase;
}
.track { height: 2px; margin: 12px 0 10px; background: var(--line); }
#fill { width: 0; height: 100%; background: var(--ink); transition: width .25s; }
.toast p { margin: 0; color: var(--soft); font-size: .85rem; line-height: 1.45; }

#notice {
  position: fixed; left: 50%; top: 76px; z-index: 50;
  transform: translate(-50%, -8px); opacity: 0;
  padding: 11px 20px;
  background: var(--ink); color: var(--paper);
  font: 400 .8rem/1.3 var(--sans); letter-spacing: .05em;
  transition: opacity .3s, transform .3s;
  pointer-events: none;
}
#notice.show { opacity: 1; transform: translate(-50%, 0); }

#drop {
  position: fixed; inset: 12px; z-index: 30;
  display: grid; place-items: center;
  border: 1px solid var(--ink);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
}
#drop p { margin: 0; padding: 0 24px; text-align: center; font: italic 300 clamp(1.6rem, 4vw, 2.4rem)/1.3 var(--serif); }

@keyframes rise { from { opacity: 0; translate: 0 10px; } }
@keyframes fade { from { opacity: 0; } }

/* --- one photo at a time ---------------------------------------------- */

#viewer {
  position: fixed; inset: 0; z-index: 40;
  display: flex; flex-direction: column;
  background: #0e0d0c; color: #f1ede6;
  animation: fade .25s ease;
}
.vbar {
  display: flex; align-items: center; gap: 2px;
  padding: max(8px, env(safe-area-inset-top)) max(6px, env(safe-area-inset-right)) 8px 20px;
}
#vcount { flex: 1; font: 400 .7rem/1 var(--sans); letter-spacing: .24em; opacity: .75; }
.vbtn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px;
  border: 0; background: none; color: inherit;
  opacity: .8; cursor: pointer; text-decoration: none;
  transition: opacity .2s;
}
.vbtn:hover { opacity: 1; }
.vbtn.on svg { fill: currentColor; }
.vbtn.wide { display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: auto; min-width: 44px; padding: 0 10px; font: 400 .78rem/1 var(--sans); }
#vfav.on { color: #fff; opacity: 1; }
.vbtn.small { width: 28px; height: 28px; color: var(--soft); }
.vbtn.small svg { width: 16px; height: 16px; }
#stage {
  flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  touch-action: pan-y pinch-zoom;
}
@media (min-width: 760px) { #stage { padding: 0 76px; } }
#stage img, #stage video { max-width: 100%; max-height: 100%; object-fit: contain; }
#stage img { opacity: 0; transition: opacity .35s ease; }
#stage img.ready { opacity: 1; }
#vcap {
  margin: 0; padding: 12px 16px max(16px, env(safe-area-inset-bottom));
  text-align: center;
  font: 400 .68rem/1.4 var(--sans); letter-spacing: .24em; text-transform: uppercase;
  opacity: .6;
}
.vnav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 60px; height: 110px;
  display: grid; place-items: center;
  border: 0; background: none; color: #fff;
  opacity: .5; cursor: pointer; transition: opacity .2s;
}
.vnav svg { width: 34px; height: 34px; stroke-width: .9; }
.vnav:hover { opacity: 1; }
#vprev { left: 8px; }
#vnext { right: 8px; }
@media (hover: none) { .vnav { display: none; } }

/* --- the plain page ---------------------------------------------------- */

.plain {
  min-height: 100vh; min-height: 100svh;
  display: grid; place-content: center;
  max-width: 38rem; margin: 0 auto; padding: 24px;
  text-align: center;
}
.plain h1 { margin: .9rem 0 1rem; font: 300 clamp(2.3rem, 7vw, 3.4rem)/1.1 var(--serif); }
.plain p:last-child { margin: 0; color: var(--soft); }

/* --- the admin page ---------------------------------------------------- */

.admin-head { max-width: 46rem; margin: 0 auto; padding: 64px 20px 8px; text-align: center; }
.admin-head h1 { margin: .7rem 0 .6rem; font: 300 clamp(2.6rem, 8vw, 4rem)/1.05 var(--serif); }
.admin-head > p:not(.eyebrow) { margin: 0; color: var(--soft); }
.flash {
  margin: 24px auto 0; padding: 12px 16px;
  border-left: 2px solid var(--ink); background: var(--card);
  text-align: left;
}
.create { display: flex; flex-wrap: wrap; gap: 8px; margin: 32px auto 0; max-width: 38rem; }
.field {
  flex: 1; min-width: 14rem; min-height: 46px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 0;
  background: var(--card); color: var(--ink);
  font: 300 1rem var(--sans);
}
.field:focus { outline: none; border-color: var(--ink); }
.albums {
  display: grid; gap: 28px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  max-width: 76rem; margin: 48px auto 0; padding: 0 20px 96px;
}
.none { grid-column: 1 / -1; text-align: center; color: var(--soft); font: italic 300 1.4rem var(--serif); }
.album { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); }
.album-cover { position: relative; display: block; aspect-ratio: 3 / 2; overflow: hidden; background: var(--tile); }
.album-cover img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .9s cubic-bezier(.2, .7, .2, 1); }
.album-cover:hover img { transform: scale(1.03); }
.album-cover em {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--soft); font: italic 300 1.3rem var(--serif);
}
.album-body { flex: 1; display: flex; flex-direction: column; gap: 14px; padding: 22px 22px 24px; }
.album h2 { margin: 0; font: 400 1.8rem/1.15 var(--serif); }
.facts { margin: -8px 0 0; color: var(--soft); font-size: .85rem; letter-spacing: .03em; }
.tag {
  display: inline-block; margin-left: 6px; padding: 3px 8px; vertical-align: 1px;
  border: 1px solid currentColor;
  font: 400 .6rem/1 var(--sans); letter-spacing: .2em; text-transform: uppercase;
}
.linkrow { display: flex; gap: 8px; }
.linkrow .field { min-width: 0; min-height: 40px; font-size: .82rem; color: var(--soft); }
.album .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.album .actions form { display: contents; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
