/* By the Sea — palette taken from the Zatoka Pucka: fog, slate water, reed gold */
:root {
  --fog:   #E4E7E2;   /* page background: overcast bay */
  --foam:  #F5F6F2;   /* raised surfaces */
  --slate: #1E2B30;   /* ink: deep water */
  --sea:   #3D5A63;   /* secondary text */
  --reed:  #8E6B2C;   /* accent: dry reeds (AA on fog) */
  --line:  #C5CCC6;
  --shade: #10191C;   /* lightbox / hero overlay */

  --font: "Archivo", system-ui, sans-serif;
  --wide: "wdth" 125;
  --narrow: "wdth" 82;

  --s1: .25rem; --s2: .5rem; --s3: 1rem; --s4: 1.5rem; --s5: 2.5rem; --s6: 4rem; --s7: 7rem;
  --gutter: clamp(1rem, 4vw, 3rem);
  --measure: 38rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fog: #121C1F; --foam: #1A2629; --slate: #DCE2DD; --sea: #9DB2B5;
    --reed: #C9A45E; --line: #2C3B3F; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --fog: #121C1F; --foam: #1A2629; --slate: #DCE2DD; --sea: #9DB2B5;
  --reed: #C9A45E; --line: #2C3B3F; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fog); color: var(--slate);
  font: 400 1.0625rem/1.6 var(--font); font-variation-settings: "wdth" 100;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--reed); outline-offset: 3px; }

.skip { position: absolute; left: -999px; top: var(--s3); background: var(--slate); color: var(--fog); padding: var(--s2) var(--s3); z-index: 50; }
.skip:focus { left: var(--s3); }

h2 {
  font-size: clamp(2rem, 5vw, 3.25rem); line-height: 1; margin: 0;
  font-weight: 800; font-variation-settings: var(--wide); letter-spacing: -.01em;
}

/* ── Hero: the photo, a horizon line, the name sitting on it ── */
.hero {
  position: relative; min-height: 100svh; display: grid;
  grid-template-rows: auto 1fr auto; color: #F2F4EF; background: var(--shade);
  overflow: hidden;
}
.hero-photo {
  position: absolute; inset: 0; background: #2B3F45 center / cover no-repeat;
  transition: opacity 1.2s ease; opacity: 0;
}
.hero-photo.is-loaded { opacity: 1; }
.hero-photo::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(16,25,28,.45) 0%, rgba(16,25,28,0) 22%, rgba(16,25,28,0) 50%, rgba(16,25,28,.82) 100%);
}
.nav {
  position: relative; z-index: 2; display: flex; align-items: center; gap: var(--s4);
  padding: var(--s3) var(--gutter);
}
.nav-brand { font-weight: 800; font-variation-settings: var(--wide); text-decoration: none; font-size: 1.05rem; margin-right: auto; }
.nav-links { display: flex; gap: var(--s4); list-style: none; margin: 0; padding: 0; }
.nav-links a { text-decoration: none; font-variation-settings: var(--narrow); font-size: 1rem; opacity: .9; }
.nav-links a:hover { opacity: 1; text-decoration: underline; text-underline-offset: 6px; text-decoration-color: #C9A45E; }
.theme-btn { background: none; border: 0; padding: var(--s2); cursor: pointer; color: inherit; display: grid; }

.hero-text { position: relative; z-index: 2; grid-row: 3; padding: 0 var(--gutter) var(--s5); }
.hero-coords { margin: 0 0 var(--s2); font-variation-settings: var(--narrow); font-size: .95rem; opacity: .85; }
.hero-title {
  margin: 0; font-weight: 900; font-variation-settings: var(--wide);
  font-size: clamp(3.4rem, 14.5vw, 13rem); line-height: .82; letter-spacing: -.035em;
  padding-bottom: .06em; border-bottom: 1px solid #C9A45E;   /* the horizon */
}
.hero-lede { margin: var(--s3) 0 0; max-width: 34rem; font-size: clamp(1rem, 1.6vw, 1.2rem); opacity: .92; }
.hero-caption {
  position: absolute; z-index: 2; right: var(--gutter); bottom: var(--s5); margin: 0;
  font-variation-settings: var(--narrow); font-size: .85rem; opacity: .75; text-align: right; max-width: 16rem;
}
.hero-title, .hero-coords, .hero-lede { animation: rise 1s cubic-bezier(.2,.7,.2,1) both; }
.hero-coords { animation-delay: .15s; }
.hero-lede { animation-delay: .3s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ── Sections ── */
main > section { padding: var(--s7) var(--gutter) 0; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s3) var(--s5); margin-bottom: var(--s5); }
.text-link { color: var(--sea); text-underline-offset: 4px; }
.text-link:hover { color: var(--reed); }

/* Gallery */
.filters { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); }
.filter {
  background: none; border: 0; padding: var(--s1) 0; cursor: pointer; color: var(--sea);
  font-variation-settings: var(--narrow); font-size: 1.05rem; border-bottom: 2px solid transparent;
}
.filter:hover { color: var(--slate); }
.filter.is-active { color: var(--slate); border-bottom-color: var(--reed); }
.filter sup { font-size: .7em; margin-left: 2px; color: var(--sea); }

.grid { columns: 3 22rem; column-gap: var(--s4); }
.tile { break-inside: avoid; margin: 0 0 var(--s5); }
.tile button { display: block; width: 100%; padding: 0; border: 0; background: var(--line); cursor: zoom-in; }
.tile img { width: 100%; height: auto; }
.tile figcaption { display: flex; justify-content: space-between; gap: var(--s3); padding-top: var(--s2); font-size: .95rem; }
.tile-title { font-weight: 600; }
.tile-place { color: var(--sea); font-variation-settings: var(--narrow); text-align: right; }
.grid-empty { color: var(--sea); max-width: var(--measure); }
.tile a { display: block; background: var(--line); cursor: zoom-in; }
.btn-more { display: block; margin: 0 auto; }
.btn-more[hidden] { display: none; }

/* ── Single photo page (/zdjecie/:id) ── */
.photo-page { background: var(--shade); color: #E4E7E2; min-height: 100vh; display: flex; flex-direction: column; }
.photo-page main { flex: 1; padding: 0 var(--gutter) var(--s5); }
.photo-nav { color: #E4E7E2; }
.photo-nav .text-link { color: #9DB2B5; }
.photo-figure { margin: 0 auto; max-width: 1400px; }
.photo-figure img { width: 100%; height: auto; max-height: 80vh; object-fit: contain; }
.photo-figure figcaption { max-width: 46rem; margin: var(--s4) auto 0; text-align: center; }
.photo-title { margin: 0; font-weight: 800; font-variation-settings: var(--wide); font-size: clamp(1.6rem, 4vw, 2.6rem); line-height: 1.05; }
.photo-meta { margin: var(--s2) 0 0; color: #9DB2B5; font-variation-settings: var(--narrow); }
.photo-exif { display: block; font-size: .9rem; }
.photo-desc { margin: var(--s3) 0 0; color: #C3CCC6; }
.photo-credit { margin: var(--s4) 0 0; font-size: .9rem; color: #9DB2B5; }
.photo-credit a { color: #C9A45E; }
.photo-pager { display: flex; justify-content: space-between; gap: var(--s4); max-width: 1400px; margin: var(--s5) auto 0; }
.photo-pager a { color: #E4E7E2; text-decoration: none; font-variation-settings: var(--narrow); }
.photo-pager a:hover { color: #C9A45E; }
.photo-page .footer { border-top-color: #2C3B3F; color: #9DB2B5; }

/* Place filter (set from the map) */
.place-filter { margin: calc(-1 * var(--s4)) 0 var(--s4); color: var(--sea); }
.place-filter strong { color: var(--slate); }
.text-btn { background: none; border: 0; padding: 0 0 0 var(--s2); color: var(--reed); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* Map */
.section-note { margin: 0; color: var(--sea); font-variation-settings: var(--narrow); }
.map { height: clamp(22rem, 60vh, 36rem); background: var(--line); }
.leaflet-container { font: inherit; }
.leaflet-popup-content { margin: .6rem .7rem; }
.pin { display: grid; gap: .3rem; width: 160px; }
.pin img { width: 160px; height: 107px; object-fit: cover; }
.pin span { color: #3D5A63; font-size: .85rem; }
.pin button { justify-self: start; background: #1E2B30; color: #E4E7E2; border: 0; border-radius: 3px; padding: .35rem .7rem; cursor: pointer; }

/* Films */
.reel { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(11rem, 15rem); gap: var(--s4); overflow-x: auto; padding-bottom: var(--s3); scroll-snap-type: x mandatory; }
.short { scroll-snap-align: start; margin: 0; }
.short-frame { position: relative; aspect-ratio: 9 / 16; background: var(--shade); overflow: hidden; }
.short-frame button { position: absolute; inset: 0; border: 0; padding: 0; background: none; cursor: pointer; }
.short-frame img { width: 100%; height: 100%; object-fit: cover; }
.short-frame .play {
  position: absolute; left: 50%; top: 50%; translate: -50% -50%; width: 3.2rem; height: 3.2rem; border-radius: 50%;
  background: rgba(16,25,28,.6); display: grid; place-items: center;
}
.short-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.short figcaption { padding-top: var(--s2); font-size: .9rem; font-variation-settings: var(--narrow); }

/* About */
.about { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: var(--s5); }
.about-body { max-width: var(--measure); }
.about-lead { font-size: clamp(1.2rem, 2vw, 1.45rem); line-height: 1.45; margin-top: 0; }
.facts { margin: var(--s5) 0 0; border-top: 1px solid var(--line); }
.facts div { display: grid; grid-template-columns: 5rem 1fr; gap: var(--s3); padding: var(--s3) 0; border-bottom: 1px solid var(--line); }
.facts dt { color: var(--sea); font-variation-settings: var(--narrow); }
.facts dd { margin: 0; }

/* Contact */
.contact { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: var(--s5); padding-bottom: var(--s7); }
.contact-body { max-width: 40rem; }
.contact-body > p:first-child { margin-top: 0; font-size: 1.15rem; }
.contact-mail {
  display: inline-block; font-weight: 800; font-variation-settings: var(--wide);
  font-size: clamp(1.2rem, 3vw, 2rem); text-decoration-color: var(--reed); text-underline-offset: 6px; word-break: break-all;
  margin: var(--s2) 0 var(--s4);
}
.contact-form { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); margin-top: var(--s4); }
.contact-form label { display: grid; gap: var(--s1); font-size: .95rem; color: var(--sea); }
.contact-form .wide { grid-column: 1 / -1; }
input, select, textarea {
  width: 100%; padding: .65rem .75rem; background: var(--foam); border: 1px solid var(--line); border-radius: 3px; color: var(--slate);
}
textarea { resize: vertical; }
.form-note { grid-column: 1 / -1; margin: 0; font-size: .85rem; color: var(--sea); }
.btn {
  justify-self: start; background: var(--slate); color: var(--fog); border: 0; border-radius: 3px;
  padding: .7rem 1.2rem; cursor: pointer; font-weight: 600;
}
.btn:hover { background: var(--sea); }
.btn:disabled { opacity: .5; cursor: progress; }
.profiles { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); list-style: none; padding: 0; margin: var(--s5) 0 0; }
.profiles a { text-underline-offset: 4px; color: var(--sea); }
.profiles a:hover { color: var(--reed); }

/* Footer */
.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s3); padding: var(--s4) var(--gutter); border-top: 1px solid var(--line); font-size: .9rem; color: var(--sea); }
.footer p { margin: 0; }
.footer-admin { background: none; border: 0; padding: 0; color: var(--sea); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ── Lightbox ── */
.lightbox {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: var(--shade); color: #E4E7E2;
}
.lightbox::backdrop { background: var(--shade); }
.lb-figure { height: 100%; margin: 0; display: grid; grid-template-rows: 1fr auto; }
.lb-figure img { width: 100%; height: 100%; object-fit: contain; min-height: 0; padding: var(--s5) var(--s6) 0; }
.lb-figure figcaption { padding: var(--s3) var(--gutter) var(--s4); display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); align-items: baseline; justify-content: center; text-align: center; }
.lb-title { font-weight: 700; font-variation-settings: var(--wide); }
.lb-meta { color: #9DB2B5; font-variation-settings: var(--narrow); }
.lb-exif { color: #9DB2B5; font-variation-settings: var(--narrow); font-size: .9rem; }
.lb-exif:empty { display: none; }
.lb-share { background: none; border: 1px solid rgba(228,231,226,.3); color: inherit; border-radius: 3px; padding: .25rem .7rem; cursor: pointer; font-size: .9rem; }
.lb-share:hover { border-color: #C9A45E; }
.lb-desc { flex-basis: 100%; color: #C3CCC6; max-width: 46rem; margin: 0 auto; font-size: .95rem; }
.lb-desc:empty { display: none; }
.lb-btn {
  position: absolute; background: rgba(228,231,226,.08); border: 0; color: inherit; cursor: pointer;
  width: 2.75rem; height: 2.75rem; border-radius: 50%; font-size: 1.4rem; line-height: 1; display: grid; place-items: center;
}
.lb-btn:hover { background: rgba(228,231,226,.18); }
.lb-close { top: var(--s3); right: var(--s3); font-size: 1rem; }
.lb-prev { left: var(--s3); top: 50%; translate: 0 -50%; }
.lb-next { right: var(--s3); top: 50%; translate: 0 -50%; }
.lb-count { position: absolute; top: var(--s4); left: var(--s4); font-size: .85rem; color: #9DB2B5; font-variation-settings: var(--narrow); }

/* ── Admin panel ── */
.admin {
  width: min(60rem, 100vw); max-height: 92dvh; border: 1px solid var(--line); border-radius: 6px;
  background: var(--fog); color: var(--slate); padding: 0;
}
.admin::backdrop { background: rgba(16,25,28,.6); }
.admin-head { display: flex; justify-content: space-between; align-items: center; padding: var(--s4) var(--s4) 0; }
.admin-head h2 { font-size: 1.6rem; }
.admin-close { position: static; background: var(--line); color: var(--slate); }
.admin-key { display: flex; flex-wrap: wrap; align-items: end; gap: var(--s3); padding: var(--s4); border-bottom: 1px solid var(--line); }
.admin-key label { display: grid; gap: var(--s1); flex: 1 1 16rem; font-size: .9rem; color: var(--sea); }
.key-status { font-size: .9rem; color: var(--sea); }
.admin-main { padding: var(--s4); }
.tabs { display: flex; gap: var(--s4); border-bottom: 1px solid var(--line); margin-bottom: var(--s4); }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: var(--s2) 0; cursor: pointer; color: var(--sea); }
.tab.is-active { color: var(--slate); border-bottom-color: var(--reed); }
.drop {
  display: grid; gap: var(--s1); place-items: center; text-align: center; padding: var(--s5) var(--s3);
  border: 1.5px dashed var(--sea); border-radius: 6px; cursor: pointer; background: var(--foam);
}
.drop.is-over { border-color: var(--reed); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop small { color: var(--sea); }
.pending, .lib { display: grid; gap: var(--s3); margin-top: var(--s4); }
.item {
  display: grid; grid-template-columns: 7.5rem 1fr; gap: var(--s3); padding: var(--s3);
  background: var(--foam); border: 1px solid var(--line); border-radius: 4px;
}
.item img { width: 7.5rem; height: 7.5rem; object-fit: cover; background: var(--line); }
.item-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s2); }
.item-fields label { display: grid; gap: 2px; font-size: .8rem; color: var(--sea); }
.item-fields .span2 { grid-column: span 2; }
.item-fields .span4 { grid-column: 1 / -1; }
.item-fields .check { display: flex; align-items: center; gap: var(--s2); }
.item-fields .check input { width: auto; }
.item-fields input, .item-fields select, .item-fields textarea { padding: .4rem .5rem; font-size: .9rem; }
.item-actions { grid-column: 1 / -1; display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; }
.item-state { font-size: .85rem; color: var(--sea); }
.btn-quiet { background: none; border: 1px solid var(--line); border-radius: 3px; padding: .4rem .8rem; cursor: pointer; }
.btn-quiet:hover { border-color: var(--sea); }
.btn-danger { color: #A23B2B; }
.pending-actions { display: flex; align-items: center; gap: var(--s3); margin-top: var(--s4); }
.upload-status { color: var(--sea); font-size: .9rem; }
.storage { color: var(--sea); font-size: .9rem; margin: 0; }
.meter { display: block; height: 6px; background: var(--line); border-radius: 3px; margin-top: var(--s2); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--sea); }

.places-admin { display: grid; grid-template-columns: 15rem 1fr; gap: var(--s3); margin-top: var(--s3); }
.place-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s1); align-content: start; max-height: 26rem; overflow: auto; }
.place-btn { width: 100%; text-align: left; display: grid; background: var(--foam); border: 1px solid var(--line); border-radius: 3px; padding: .45rem .6rem; cursor: pointer; }
.place-btn small { color: var(--sea); }
.place-btn.is-active { border-color: var(--reed); box-shadow: inset 3px 0 0 var(--reed); }
.map-admin { height: 26rem; }

.toast {
  position: fixed; left: 50%; bottom: var(--s4); translate: -50% calc(100% + 3rem); background: var(--slate); color: var(--fog);
  padding: .65rem 1.1rem; border-radius: 4px; transition: translate .3s ease, visibility .3s; z-index: 100; max-width: calc(100vw - 2rem);
  visibility: hidden;
}
.toast:empty { display: none; }
.toast.is-on { translate: -50% 0; visibility: visible; }

/* ── Responsive ── */
@media (max-width: 760px) {
  .nav { flex-wrap: wrap; row-gap: var(--s1); }
  .nav-links { order: 3; width: 100%; gap: var(--s3); overflow-x: auto; }
  .photo-nav { flex-wrap: nowrap; }
  .hero-caption { display: none; }
  .about, .contact { grid-template-columns: 1fr; gap: var(--s4); }
  .contact-form { grid-template-columns: 1fr; }
  .lb-figure img { padding: var(--s6) 0 0; }
  .lb-prev, .lb-next { top: auto; bottom: var(--s3); translate: none; }
  .item { grid-template-columns: 1fr; }
  .item img { width: 100%; height: 10rem; }
  .item-fields { grid-template-columns: 1fr 1fr; }
  .places-admin { grid-template-columns: 1fr; }
  .place-list { max-height: 12rem; }
  main > section { padding-top: var(--s6); }
}

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