/* Nala Pups: warm golden Cocker Spaniel colours, rounded type, paw prints. */
:root {
  --cream: #fff8ee;
  --paper: #fffaf2;
  --gold: #d9923b;
  --gold-light: #f3c98a;
  --liver: #8a4b2a;
  --ink: #3b2416;
  --muted: #8b6f5c;
  --tongue: #f28c9b;
  --leaf: #6f9a5b;
  --radius: 18px;
  --shadow: 0 6px 20px rgba(107, 58, 32, 0.14);
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", system-ui, -apple-system, "Segoe UI", sans-serif;
  --pad: max(16px, env(safe-area-inset-left));
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background-color: var(--cream);
  /* faint paw prints */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 64 64'%3E%3Cg fill='%23d9923b' fill-opacity='0.08' transform='rotate(-20 32 32) scale(.5) translate(20 20)'%3E%3Cellipse cx='32' cy='42' rx='13' ry='11'/%3E%3Cellipse cx='15' cy='26' rx='6' ry='8'/%3E%3Cellipse cx='27' cy='17' rx='6' ry='8'/%3E%3Cellipse cx='41' cy='17' rx='6' ry='8'/%3E%3Cellipse cx='51' cy='27' rx='6' ry='8'/%3E%3C/g%3E%3C/svg%3E");
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
body.no-scroll { overflow: hidden; }
a { color: var(--liver); }
h1, h2 { line-height: 1.15; margin: 0 0 .3em; }
h1 { font-size: clamp(1.7rem, 4vw + 1rem, 2.8rem); color: var(--liver); letter-spacing: -.01em; }
[hidden] { display: none !important; }

/* ---------- buttons ---------- */
.btn {
  appearance: none; border: 0; cursor: pointer; text-decoration: none;
  font: inherit; font-weight: 700; font-size: 1rem;
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  min-height: 44px; padding: .55em 1.2em; border-radius: 999px;
  background: #fff; color: var(--liver); box-shadow: inset 0 0 0 2px var(--gold-light);
  transition: transform .12s ease, background .12s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .6; cursor: default; }
.btn-primary { background: var(--gold); color: #fff; box-shadow: 0 3px 0 var(--liver); }
.btn-primary:hover { background: #c98330; }
.btn-ghost { background: transparent; box-shadow: none; }
.btn-small { min-height: 36px; font-size: .9rem; padding: .3em .9em; }
:focus-visible { outline: 3px solid var(--tongue); outline-offset: 2px; }

/* ---------- header and footer ---------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) var(--pad) 10px;
  background: rgba(255, 244, 227, .9);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 2px dashed var(--gold-light);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; font-size: 1.35rem; color: var(--liver); }
.brand img { transition: transform .3s; }
.brand:hover img { transform: rotate(-10deg); }
.who { display: flex; align-items: center; gap: 6px; font-size: .95rem; color: var(--muted); min-width: 0; }
.who-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
#view { flex: 1; width: 100%; max-width: 1400px; margin: 0 auto; padding: 20px var(--pad) 40px; outline: none; }
.site-footer { text-align: center; color: var(--muted); font-size: .9rem; padding: 20px var(--pad) max(20px, env(safe-area-inset-bottom)); }

.loading, .empty { text-align: center; padding: 60px 0; color: var(--muted); font-size: 1.1rem; }

/* ---------- home ---------- */
.hero { text-align: center; max-width: 640px; margin: 10px auto 30px; }
.hero p { font-size: 1.1rem; color: var(--muted); margin: 0; }
.albums { display: grid; gap: 22px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.album-card {
  display: block; text-decoration: none; color: inherit; background: var(--paper);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease;
}
.album-card:hover { transform: translateY(-4px) rotate(-.5deg); box-shadow: 0 12px 28px rgba(107, 58, 32, .2); }
.album-cover { position: relative; aspect-ratio: 4 / 3; background: var(--gold-light); }
.album-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.album-empty { display: grid; place-items: center; height: 100%; color: var(--liver); font-weight: 700; }
.album-year {
  position: absolute; top: 12px; left: 12px; background: var(--tongue); color: #fff;
  font-weight: 800; padding: 4px 12px; border-radius: 999px; transform: rotate(-4deg); box-shadow: 0 2px 0 #d96a7b;
}
.album-meta { padding: 14px 18px 18px; }
.album-meta h2 { font-size: 1.25rem; color: var(--liver); }
.album-meta p { margin: 0; color: var(--muted); }
.album-count { font-weight: 700; color: var(--gold) !important; margin-top: 6px !important; }

/* ---------- album grid ---------- */
.crumbs { margin-bottom: 8px; }
.crumbs a { text-decoration: none; font-weight: 700; display: inline-block; padding: 8px 0; }
.album-head { margin-bottom: 18px; }
.album-head p { margin: 0; color: var(--muted); }
.grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 4px;
  grid-template-columns: repeat(3, 1fr);   /* iPhone: three across, like the Photos app */
}
@media (min-width: 600px) { .grid { gap: 8px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); } }
@media (min-width: 1100px) { .grid { gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); } }
.tile { position: relative; display: block; aspect-ratio: 1; overflow: hidden; border-radius: 6px; background: var(--gold-light); }
@media (min-width: 600px) { .tile { border-radius: 12px; } }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s ease; }
.tile:hover img { transform: scale(1.05); }
.tile-badges {
  position: absolute; right: 6px; bottom: 6px; background: rgba(59, 36, 22, .7); color: #fff;
  font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px;
}

/* ---------- photo viewer: photo first, details on request ---------- */
.viewer { position: fixed; inset: 0; z-index: 100; background: #000; display: flex; color: #fff; }
.viewer-main { position: relative; flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.viewer-stage {
  position: relative; flex: 1 1 auto; min-height: 0; display: grid; place-items: center; overflow: hidden;
  grid-template-rows: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr);
  padding: max(8px, env(safe-area-inset-top)) max(0px, env(safe-area-inset-right)) 0 max(0px, env(safe-area-inset-left));
  touch-action: none; /* app.js handles pinch, pan, double-tap and swipe */
}
.viewer-img { width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-select: none; -webkit-user-drag: none; transform-origin: 0 0; }
.viewer.is-zoomed .viewer-img { cursor: grab; }
.viewer-img.is-loading { opacity: .92; }
.viewer-close, .viewer-nav, .panel-close {
  position: absolute; z-index: 2; border: 0; cursor: pointer; color: #fff; background: rgba(0, 0, 0, .45);
  width: 44px; height: 44px; border-radius: 50%; font-size: 1.3rem; line-height: 1; display: grid; place-items: center;
}
.viewer-close { top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)); }
.viewer-nav { top: 50%; transform: translateY(-50%); font-size: 2rem; display: none; }
.viewer-nav.prev { left: 14px; } .viewer-nav.next { right: 14px; }
.viewer-nav:disabled { opacity: 0; pointer-events: none; }
@media (hover: hover) and (min-width: 700px) { .viewer-nav { display: grid; } }
.viewer-count {
  position: absolute; z-index: 2; top: max(20px, calc(env(safe-area-inset-top) + 12px)); left: 0; right: 0;
  text-align: center; font-size: .85rem; color: rgba(255, 255, 255, .85); pointer-events: none; text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
}

.viewer-bar {
  flex: 0 0 auto; display: flex; align-items: center; gap: 4px;
  padding: 6px max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}
.viewer-bar-title { flex: 1; min-width: 0; margin: 0; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: rgba(255, 255, 255, .9); }
.vb {
  display: inline-flex; align-items: center; gap: 4px; min-width: 44px; height: 44px; padding: 0 8px; justify-content: center;
  border: 0; background: none; color: #fff; font: inherit; font-weight: 700; cursor: pointer; border-radius: 12px; text-decoration: none;
}
.vb svg { width: 26px; height: 26px; }
.paw-btn svg g { fill: none; stroke: currentColor; stroke-width: 4; }
.paw-btn[aria-pressed="true"] svg g { fill: var(--tongue); stroke: var(--tongue); }
.paw-btn[aria-pressed="true"] svg { animation: wag .4s ease; }
@keyframes wag { 0%, 100% { transform: rotate(0) } 30% { transform: rotate(-20deg) scale(1.2) } 60% { transform: rotate(15deg) } }

/* the details panel: a bottom sheet on phones, a side column on iPad landscape and desktop */
.viewer-panel {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; max-height: 70dvh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: #fff; color: var(--ink); border-radius: 22px 22px 0 0; box-shadow: 0 -10px 30px rgba(0, 0, 0, .3);
  padding: 18px var(--pad) max(16px, env(safe-area-inset-bottom));
  transform: translateY(105%); transition: transform .28s ease; visibility: hidden;
}
.viewer.show-panel .viewer-panel { transform: none; visibility: visible; }
.panel-close { top: 8px; right: 8px; background: var(--cream); color: var(--liver); width: 44px; height: 44px; font-size: 1rem; }
.viewer-title { font-size: 1.15rem; color: var(--liver); margin: 0 44px 0 0; }
.viewer-caption { margin: 4px 0 0; }
.comments-title { font-size: 1rem; color: var(--liver); margin: 18px 0 4px; }
.comments { list-style: none; margin: 0; padding: 0; }
.comments li { padding: 8px 0; border-bottom: 1px solid #f1e6d6; }
.comments li p { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.comments .muted { color: var(--muted); border: 0; }
.c-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.c-head time { color: var(--muted); font-size: .85rem; }
.c-del { margin-left: auto; background: none; border: 0; color: var(--muted); font: inherit; font-size: .85rem; cursor: pointer; text-decoration: underline; padding: 4px; }
.comment-form { display: flex; gap: 8px; margin-top: 10px; align-items: flex-end; }
.comment-form textarea {
  flex: 1; font: inherit; font-size: 16px; padding: 10px 14px; border-radius: 22px; border: 1.5px solid #e6d8c4; background: #fff; resize: none; min-height: 44px;
}
.comment-form textarea:focus { border-color: var(--gold); outline: none; }
@media (min-width: 900px) {
  .viewer-panel {
    position: relative; flex: 0 0 0; max-height: none; border-radius: 0; box-shadow: none; transform: none; padding: 0;
    overflow: hidden; transition: flex-basis .28s ease, padding .28s ease;
  }
  .viewer.show-panel .viewer-panel { flex-basis: 380px; padding: max(20px, env(safe-area-inset-top)) 22px 22px; overflow-y: auto; }
}

/* ---------- login ---------- */
.login-page { display: grid; place-items: center; padding: 24px var(--pad); }
.login-card {
  width: 100%; max-width: 420px; background: var(--paper); border-radius: 28px; box-shadow: var(--shadow);
  padding: 28px 26px 30px; text-align: center; position: relative; margin-top: 50px;
}
.spaniel-badge { width: 140px; height: 140px; margin: -90px auto 4px; display: block; filter: drop-shadow(0 6px 10px rgba(107, 58, 32, .25)); animation: bob 3s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-3deg); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.tagline { color: var(--muted); margin: 0 0 20px; }
#login { display: grid; gap: 14px; text-align: left; }
#login label { font-weight: 700; color: var(--liver); display: grid; gap: 6px; }
#login .hint { font-weight: 400; color: var(--muted); font-size: .85rem; }
#login input { font: inherit; font-size: 16px; padding: 12px 16px; border-radius: 14px; border: 2px solid var(--gold-light); background: #fff; min-height: 48px; }
#login input:focus { border-color: var(--gold); outline: none; }
#login .btn { margin-top: 6px; font-size: 1.1rem; min-height: 52px; }
.error { color: #b3261e; margin: 0; text-align: center; font-weight: 700; }

/* small phones: keep the header on one line */
.brand span, .who .btn { white-space: nowrap; }
@media (max-width: 420px) {
  .brand { font-size: 1.15rem; gap: 6px; }
  .brand img { width: 36px; height: 36px; }
  .who-name { max-width: 30vw; font-size: .85rem; }
}

/* ---------- titles and tags ---------- */
.viewer-title { font-size: 1.2rem; color: var(--liver); margin: 14px 0 0; }
.viewer-title + .viewer-caption { margin-top: 4px; }
.viewer-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.viewer-tags:empty { display: none; }
.tag-bar {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 12px; margin: 0 calc(-1 * var(--pad)) 6px; padding-inline: var(--pad);
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.tag-bar::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; font: inherit; font-size: .9rem; font-weight: 700; cursor: pointer; white-space: nowrap;
  min-height: 36px; padding: 4px 14px; border-radius: 999px; border: 2px solid var(--gold-light);
  background: #fff; color: var(--liver); -webkit-tap-highlight-color: transparent;
}
.chip span { color: var(--muted); font-weight: 400; margin-left: 2px; }
.chip[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: #fff; }
.chip[aria-pressed="true"] span { color: #fff; }
@media (hover: hover) { .chip:hover { border-color: var(--gold); } }

/* ---------- visitor name tags ---------- */
.chip-wrap { display: inline-flex; align-items: center; }
.chip-wrap { border: 1.5px solid var(--gold-light); border-radius: 999px; background: #fff; }
.chip-wrap .chip { border: 0; padding-right: 2px; background: none; }
.chip-x {
  font: inherit; font-weight: 700; cursor: pointer; min-height: 36px; min-width: 36px; padding: 0 10px;
  border: 0; border-radius: 0 999px 999px 0; background: none; color: var(--muted); min-width: 32px; padding: 0 10px 0 4px;
}
.chip-x:hover { color: #b3261e; }
.chip-add { border-style: dashed; color: var(--gold); }
.tag-form { display: flex; gap: 6px; width: 100%; }
.tag-form input { flex: 1; min-width: 0; font: inherit; font-size: 16px; padding: 6px 12px; border-radius: 999px; border: 2px solid var(--gold-light); }
.tag-form input:focus { border-color: var(--gold); outline: none; }


/* ---------- album page: bright, photo-first feed ---------- */
body { background-color: #fffdf9; }
body:not(.login-page) { background-image: none; }
.site-header { background: rgba(255, 255, 255, .92); border-bottom: 1px solid #f1e6d6; }
#view.layout-feed, #view.layout-grid { padding-top: 8px; }
.album-head { text-align: center; max-width: 640px; margin: 6px auto 10px; }
.album-head .back { display: inline-block; font-weight: 700; text-decoration: none; font-size: .95rem; padding: 6px 0; }
.album-head h1 { font-size: clamp(1.4rem, 3vw + .8rem, 2.2rem); margin: 2px 0 4px; }
.album-head p { margin: 0; color: var(--muted); font-size: .95rem; }
.album-tools {
  position: sticky; top: var(--header-h, 64px); z-index: 5; display: flex; align-items: center; gap: 8px;
  max-width: 640px; margin: 0 auto 10px; padding: 8px 0; background: rgba(255, 253, 249, .94);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.layout-grid .album-tools { max-width: none; }
.album-tools .tag-bar { flex: 1; min-width: 0; margin: 0; padding: 2px 0; }
.chip { min-height: 34px; padding: 3px 12px; border-width: 1.5px; font-size: .85rem; }
.layout-switch { flex: 0 0 auto; display: flex; background: #f6ede0; border-radius: 12px; padding: 3px; }
.layout-switch button { border: 0; background: none; width: 38px; height: 34px; border-radius: 9px; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.layout-switch button svg { width: 20px; height: 20px; }
.layout-switch button[aria-pressed="true"] { background: #fff; color: var(--liver); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

.feed { max-width: 640px; margin: 0 auto; display: grid; gap: 26px; }
.post { background: #fff; }
.post-photo { touch-action: pan-x pan-y; position: relative; display: block; width: 100%; background: #f3ece2; overflow: hidden; -webkit-tap-highlight-color: transparent; }
.post-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.burst { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; opacity: 0; }
.burst svg { width: 110px; height: 110px; fill: #fff; filter: drop-shadow(0 4px 14px rgba(0,0,0,.35)); }
.post-photo.pop .burst { animation: burst .8s ease; }
@keyframes burst { 0% { opacity: 0; transform: scale(.4); } 25% { opacity: 1; transform: scale(1.1); } 60% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1); } }
.post-body { padding: 6px 12px 4px; }
.post-actions { display: flex; align-items: center; gap: 2px; margin-left: -8px; }
.act {
  display: inline-flex; align-items: center; gap: 4px; min-width: 44px; height: 44px; padding: 0 8px; justify-content: center;
  border: 0; background: none; color: var(--ink); font: inherit; font-weight: 700; font-size: .95rem; cursor: pointer; text-decoration: none;
}
.act svg { width: 26px; height: 26px; }
.act-paw svg g { fill: none; stroke: currentColor; stroke-width: 4; }
.act-paw[aria-pressed="true"] svg g { fill: var(--tongue); stroke: var(--tongue); }
.act-dl { margin-left: auto; }
.post-title { font-size: 1rem; margin: 0; color: var(--ink); }
.post-caption { margin: 2px 0 0; color: #4a3a2e; }
.post-credit, .viewer-credit { margin: 4px 0 0; font-size: .88rem; color: var(--muted); }
.post-tags { margin: 4px 0 0; line-height: 1.6; }
.tag-link { border: 0; background: none; padding: 0; font: inherit; font-size: .92rem; color: #b06a24; cursor: pointer; }
.post-more { border: 0; background: none; padding: 4px 0; font: inherit; color: var(--muted); cursor: pointer; }
@media (max-width: 639px) {
  /* phones: photos run edge to edge, like Instagram */
  #view.layout-feed { padding-left: 0; padding-right: 0; }
  .layout-feed .album-head, .layout-feed .album-tools { padding-left: var(--pad); padding-right: var(--pad); }
  .layout-feed .post-photo { border-radius: 0; }
  /* get to the photos sooner: a compact album heading on phones */
  .album-head { margin: 0 auto 4px; }
  .album-head .back { padding: 4px 0; font-size: .9rem; }
  .album-head h1 { font-size: 1.3rem; margin: 0 0 2px; }
  .album-head p { font-size: .85rem; }
  .feed { gap: 18px; }
}
@media (min-width: 640px) {
  .post { border-radius: 16px; overflow: hidden; box-shadow: 0 2px 14px rgba(107, 58, 32, .08); }
  .post-body { padding: 8px 16px 12px; }
}
@media (min-width: 1100px) { .feed, .album-head, .album-tools { max-width: 720px; } }
.site-footer { margin-top: 10px; }

/* ---------- zoom hint, full-size loading pill, download toast ---------- */
.viewer-hint, .viewer-hd {
  position: absolute; z-index: 3; left: 50%; transform: translateX(-50%); pointer-events: none; white-space: nowrap;
  background: rgba(0, 0, 0, .6); color: #fff; font-size: .9rem; font-weight: 700; padding: 8px 16px; border-radius: 999px;
}
.viewer-hint { bottom: 18px; animation: hint 3s ease forwards; }
.viewer-hd { top: max(56px, calc(env(safe-area-inset-top) + 48px)); font-size: .8rem; padding: 5px 12px; }
@keyframes hint { 0% { opacity: 0; } 12%, 80% { opacity: 1; } 100% { opacity: 0; } }
.toast {
  position: fixed; z-index: 200; left: 50%; transform: translateX(-50%);
  bottom: max(76px, calc(env(safe-area-inset-bottom) + 68px)); width: max-content; max-width: calc(100vw - 32px);
  display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 18px; min-height: 52px;
  background: #2b1b10; color: #fff; border-radius: 999px; box-shadow: 0 8px 24px rgba(0, 0, 0, .3); font-weight: 700; font-size: .95rem;
}
.toast:not(:has(.toast-btn:not([hidden]))) { padding-right: 18px; }
.toast .btn { min-height: 44px; box-shadow: none; flex: 0 0 auto; }

/* ---------- closing photo: the farewell at the end of each year's album ---------- */
.closing { max-width: 900px; margin: 46px auto 30px; text-align: center; }
.closing-head { padding: 0 var(--pad) 18px; }
.closing-paws { display: inline-flex; gap: 6px; color: var(--tongue); }
.closing-paws svg { width: 20px; height: 20px; fill: currentColor; }
.closing-paws svg:nth-child(2) { transform: translateY(-5px) rotate(8deg); }
.closing-paws svg:nth-child(3) { transform: rotate(16deg); }
.closing-head h2 { font-size: clamp(1.5rem, 2.6vw + 1rem, 2.4rem); margin: 6px 0 2px; color: var(--liver); }
.closing-head p { margin: 0; color: var(--muted); font-size: 1rem; }
.closing-feed { max-width: 900px; text-align: left; }
.closing .post { border-radius: 18px; overflow: hidden; box-shadow: 0 10px 34px rgba(90, 50, 20, .16); }
.closing-foot { margin: 22px var(--pad) 0; font-weight: 700; color: var(--liver); font-size: 1.05rem; }
@media (max-width: 639px) {
  .closing { margin-top: 36px; }
  .closing .post { border-radius: 0; box-shadow: none; }
}
