/* v2 components. Every colour is a --c-* token (see base.css). The styleguide page,
 * /def/v/styleguide/ on a developer's machine, shows each one. */

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 22px; border-radius: var(--r-m); border: 1px solid transparent;
  font: 600 15px/1 var(--font-ui); white-space: nowrap; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
  text-decoration: none;
}
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--c-primary); color: var(--c-on-primary); }
.btn-primary:hover { background: var(--c-primary-dark); color: var(--c-on-primary); }
.btn-accent { background: var(--c-accent-strong); color: #fff; }
.btn-accent:hover { background: color-mix(in srgb, var(--c-accent-strong) 85%, #000); color: #fff; }
.btn-outline { background: var(--c-surface); color: var(--c-primary); border-color: var(--c-outline-strong); }
.btn-outline:hover { border-color: var(--c-primary); color: var(--c-primary-dark); }
.btn-quiet { background: var(--c-surface); color: var(--c-text); border-color: var(--c-outline); }
.btn-quiet:hover { background: var(--c-surface-2); color: var(--c-text); }
.btn-ghost { background: transparent; color: var(--c-text); }
.btn-ghost:hover { background: var(--c-surface-2); color: var(--c-text); }
.btn-glass { background: rgb(255 255 255 / .16); color: #fff; border-color: rgb(255 255 255 / .45); }
.btn-glass:hover { background: rgb(255 255 255 / .26); color: #fff; }
.btn-white { background: #fff; color: var(--c-primary); }
.btn-white:hover { background: var(--c-primary-container); color: var(--c-primary-dark); }
.btn-soft { background: var(--c-accent-container); color: var(--c-on-accent-container); border-color: color-mix(in srgb, var(--c-accent) 25%, transparent); }
.btn-soft:hover { background: color-mix(in srgb, var(--c-accent-container) 80%, var(--c-accent)); color: var(--c-on-accent-container); }
.btn-danger { background: var(--c-error); color: #fff; }
.btn-sm { height: 40px; padding: 0 16px; font-size: 14px; border-radius: 12px; }
.btn-lg { height: 56px; padding: 0 28px; font-size: 16px; }
.btn-block { width: 100%; }
.icon-btn {
  width: 44px; height: 44px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px; border: 1px solid var(--c-outline); background: var(--c-surface); color: var(--c-text);
}
.icon-btn:hover { background: var(--c-surface-2); color: var(--c-text); }
.icon-btn.round { border-radius: 50%; }
.icon-btn.float { border: 0; box-shadow: var(--shadow-1); }

/* ---- store badges ---- */
.store-badge { display: inline-flex; align-items: center; gap: 10px; height: 52px; padding: 0 18px; border-radius: var(--r-m); background: var(--c-text); color: #fff; }
.store-badge:hover { color: #fff; background: color-mix(in srgb, var(--c-text) 85%, #fff); }
.store-badge small { display: block; font-size: 11px; opacity: .75; line-height: 1.1; }
.store-badge b { display: block; font-size: 16px; line-height: 1.15; }

/* ---- chips and badges ---- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px;
  border-radius: 999px; font-size: 13px; font-weight: 500; white-space: nowrap;
  background: var(--c-surface); color: var(--c-text); border: 1px solid var(--c-outline-strong);
}
a.chip:hover, button.chip:hover { border-color: var(--c-primary); color: var(--c-primary-dark); }
.chip.is-on, .chip[aria-pressed="true"] { background: var(--c-primary); border-color: var(--c-primary); color: var(--c-on-primary); }
.chip.soft { background: var(--c-primary-container); border-color: transparent; color: var(--c-primary-dark); }
.chip .dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.chip .x { opacity: .7; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }

.lvl { display: inline-flex; align-items: center; height: 24px; font-size: 12px; font-weight: 600; padding: 0 10px; border-radius: 999px; white-space: nowrap; }
.lvl-1 { background: var(--c-lvl1-bg); color: var(--c-lvl1-fg); }
.lvl-2 { background: var(--c-lvl2-bg); color: var(--c-lvl2-fg); }
.lvl-3 { background: var(--c-lvl3-bg); color: var(--c-lvl3-fg); }
.badge { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--c-surface); color: var(--c-text); }
.badge.recommended { color: var(--c-error); }
.badge.on-photo { position: absolute; left: 12px; top: 12px; box-shadow: var(--shadow-1); }
.count-pill { position: absolute; right: 10px; bottom: 10px; background: rgb(0 0 0 / .62); color: #fff; border-radius: 8px; padding: 3px 8px; font-size: 12px; }

/* ---- cards ---- */
.card { background: var(--c-surface); border: 1px solid var(--c-outline); border-radius: var(--r-l); overflow: hidden; }
.card-pad { padding: 24px; }
a.card { display: flex; flex-direction: column; color: var(--c-text); transition: box-shadow .2s, transform .2s; }
a.card:hover { color: var(--c-text); box-shadow: var(--shadow-2); transform: translateY(-2px); }
.card-media { position: relative; aspect-ratio: 16 / 11; background: var(--c-surface-2); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 10px; flex-grow: 1; }
.card-title { font-weight: 700; font-size: 17px; line-height: 1.3; }
.card-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: auto; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14px; color: var(--c-text-2); }
.meta span { display: inline-flex; align-items: center; gap: 5px; }

/* a photo tile with its caption laid over the lower edge */
.tile { position: relative; display: block; border-radius: var(--r-l); overflow: hidden; color: #fff; aspect-ratio: 4 / 5; background: var(--c-primary-dark); }
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.tile:hover img { transform: scale(1.04); }
.tile-caption { position: absolute; inset: auto 0 0 0; padding: 22px; background: linear-gradient(0deg, rgb(0 0 0 / .68), rgb(0 0 0 / 0)); }
.tile-caption b { display: block; font-size: 22px; }
.tile-caption span { font-size: 14px; opacity: .92; }
.tile:hover { color: #fff; }

/* a compact row: thumbnail + text, used in lists, the map panel and sidebars */
.list-row { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: var(--r-m); color: var(--c-text); }
a.list-row:hover { background: var(--c-surface-2); color: var(--c-text); }
.list-row.is-active { background: var(--c-primary-container); box-shadow: inset 3px 0 0 var(--c-primary); }
.list-row img { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.list-row .grow { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.list-row b { font-size: 15px; }
.icon-tile { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--c-surface-2); color: var(--c-text); }
.icon-tile.water { background: var(--c-info-bg); color: var(--c-info-fg); }
.icon-tile.green { background: var(--c-lvl1-bg); color: var(--c-lvl1-fg); }
.icon-tile.warm { background: var(--c-lvl2-bg); color: var(--c-lvl2-fg); }

/* ---- stats ---- */
.stats { display: flex; align-items: stretch; background: var(--c-surface); border: 1px solid var(--c-outline); border-radius: var(--r-l); padding: 22px 0; flex-wrap: wrap; }
.stat { display: flex; flex-direction: column; gap: 4px; padding: 0 28px; border-left: 1px solid var(--c-outline); }
.stat:first-child { border-left: 0; }
.stat b { font-size: 24px; font-weight: 800; line-height: 1.2; }
.stat span { font-size: 13px; color: var(--c-text-2); }
.stat-tiles { display: grid; grid-template-columns: repeat(var(--tiles, 3), minmax(0, 1fr)); gap: 8px; text-align: center; }
.stat-tiles > div { background: var(--c-surface-2); border-radius: 12px; padding: 10px 4px; }
.stat-tiles b { font-size: 17px; }
.stat-tiles span { display: block; font-size: 12px; color: var(--c-text-2); }
@media (max-width: 860px) {
  .stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 0; padding: 16px 0; }
  .stat { border-left: 0; padding: 0 18px; }
}

/* ---- forms ---- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 14px; font-weight: 600; }
.field .hint { font-size: 13px; color: var(--c-text-2); }
.field .error-text { font-size: 13px; color: var(--c-error); }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--c-outline-strong); background: var(--c-surface); color: var(--c-text);
  font-size: 15px; transition: border-color .15s, box-shadow .15s;
}
.textarea { padding: 12px 14px; min-height: 120px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2356645C' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--c-primary); box-shadow: var(--focus); }
.input::placeholder, .textarea::placeholder { color: var(--c-text-2); opacity: .85; }
.is-invalid { border-color: var(--c-error) !important; }
.check { display: flex; align-items: center; gap: 10px; font-size: 15px; min-height: 32px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--c-primary); margin: 0; }
.search-field {
  display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 8px 0 16px;
  background: var(--c-surface); border: 1px solid var(--c-outline-strong); border-radius: var(--r-m);
}
.search-field:focus-within { border-color: var(--c-primary); box-shadow: var(--focus); }
.search-field input { flex-grow: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 16px; }
.search-field .icon { color: var(--c-text-2); }
.segmented { display: inline-flex; border: 1px solid var(--c-outline-strong); border-radius: 12px; overflow: hidden; background: var(--c-surface); }
.segmented > * { height: 40px; padding: 0 16px; display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; color: var(--c-text); border: 0; background: none; }
.segmented > .is-on, .segmented > [aria-pressed="true"], .segmented > [aria-current] { background: var(--c-primary); color: var(--c-on-primary); font-weight: 600; }

/* ---- tabs ---- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--c-outline); overflow-x: auto; scrollbar-width: none; }
.tabs a, .tabs button { padding: 12px 12px; font-weight: 500; font-size: 15px; color: var(--c-text-2); border: 0; background: none; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover, .tabs button:hover { color: var(--c-text); }
.tabs [aria-current], .tabs [aria-selected="true"] { color: var(--c-primary-dark); font-weight: 600; border-bottom-color: var(--c-primary); }

/* ---- pagination ---- */
.pagination { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; padding-block: 16px; }
.pagination a, .pagination span { min-width: 42px; height: 42px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; border: 1px solid var(--c-outline-strong); background: var(--c-surface); color: var(--c-text); font-weight: 500; }
.pagination a:hover { border-color: var(--c-primary); color: var(--c-primary); }
.pagination [aria-current] { background: var(--c-primary); border-color: var(--c-primary); color: var(--c-on-primary); }
.pagination .gap { border: 0; background: none; }

/* ---- photo grid (a gallery head: one large, four small) ---- */
.photo-grid { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(2, clamp(140px, 16vw, 220px)); gap: 10px; border-radius: var(--r-l); overflow: hidden; }
.photo-grid > a, .photo-grid > img { display: block; width: 100%; height: 100%; }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; }
.photo-grid > :first-child { grid-column: span 2; grid-row: span 2; }
.photo-grid .btn { position: absolute; right: 16px; bottom: 16px; }
@media (max-width: 700px) {
  .photo-grid { grid-template-columns: 1fr; grid-template-rows: 260px; }
  .photo-grid > :not(:first-child):not(.btn) { display: none; }
  .photo-grid > :first-child { grid-column: auto; grid-row: auto; }
}
.thumbs { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); gap: 10px; }
.thumbs img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 14px; }
@media (max-width: 560px) { .thumbs { --cols: 3; gap: 6px; } }

/* ---- dialog ---- */
.modal { border: 0; padding: 0; border-radius: var(--r-l); background: var(--c-surface); color: var(--c-text); width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); box-shadow: var(--shadow-2); }
.modal::backdrop { background: rgb(8 20 14 / .5); }
.modal[open] { animation: modal-in .18s ease-out; }
@keyframes modal-in { from { transform: translateY(12px); opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 20px 0 24px; }
.modal-head h2 { font: 600 22px/1.25 var(--font-serif); }
.modal-body { padding: 16px 24px 24px; display: flex; flex-direction: column; gap: 16px; }
.divider-text { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--c-text-2); }
.divider-text::before, .divider-text::after { content: ""; flex: 1; border-top: 1px solid var(--c-outline); }
.social-logins { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.social-logins .btn { height: 44px; font-weight: 500; }

/* ---- toast ---- */
.toast-area { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--c-text); color: #fff; padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow-2); font-size: 14px; pointer-events: auto; animation: modal-in .2s ease-out; }

/* ---- empty state, skeleton ---- */
.empty { text-align: center; padding: 48px 16px; color: var(--c-text-2); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.skeleton { background: linear-gradient(90deg, var(--c-surface-2) 25%, color-mix(in srgb, var(--c-surface-2) 60%, #fff) 50%, var(--c-surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---- panels on photos: the hero ---- */
.hero { position: relative; border-radius: var(--r-xl); overflow: hidden; min-height: clamp(520px, 44vw, 640px); color: #fff; display: flex; }
.hero > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, var(--c-hero-scrim) 0%, rgb(8 26 18 / .42) 42%, rgb(8 26 18 / 0) 70%); pointer-events: none; }
.hero-content { position: relative; z-index: 1; width: 100%; padding: clamp(28px, 5vw, 64px); display: flex; flex-direction: column; justify-content: flex-end; gap: 22px; }
.hero h1 { font: 800 clamp(34px, 4.6vw, 60px)/1.02 var(--font-ui); text-transform: uppercase; letter-spacing: -.01em; max-width: 640px; }
.hero p { font-size: clamp(16px, 1.4vw, 19px); line-height: 1.5; max-width: 520px; color: rgb(255 255 255 / .92); }
@media (max-width: 700px) {
  .hero { border-radius: var(--r-l); }
  .hero::after { background: linear-gradient(0deg, var(--c-hero-scrim) 0%, rgb(8 26 18 / .35) 60%, rgb(8 26 18 / .1) 100%); }
}

/* ---- photos and comments (_outer/v2/photos.htm, comments.htm; public/js/v2/comments.js) ---- */
.cm-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.cm-photo { position: relative; margin: 0; aspect-ratio: 1; border-radius: var(--r-m); overflow: hidden; background: var(--c-surface-2); }
.cm-photo a { display: block; width: 100%; height: 100%; }
.cm-photo img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.cm-photo a:hover img { transform: scale(1.04); }
.cm-photo-default { position: absolute; right: 6px; top: 6px; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgb(255 255 255 / .85); color: var(--c-text-2); }
.cm-photo-default.is-on { background: var(--c-success); color: #fff; }
.cm-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.cm-item { display: grid; grid-template-columns: 40px 1fr; gap: 14px; padding: 16px 0; border-top: 1px solid var(--c-outline); }
.cm-item:first-child { border-top: 0; padding-top: 0; }
.cm-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--c-primary-container); color: var(--c-primary-dark); display: flex; align-items: center; justify-content: center; font-weight: 700; text-transform: uppercase; }
.cm-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.cm-meta time { color: var(--c-text-2); font-size: 13px; }
.cm-edit.icon-btn { width: 30px; height: 30px; border: 0; background: none; color: var(--c-text-2); }
.cm-text { margin-top: 4px; line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }
.cm-attach { display: inline-block; margin-top: 10px; border-radius: var(--r-m); overflow: hidden; }
.cm-attach img { width: 200px; max-width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.cm-empty { padding: 8px 0; }
.cm-viewer { width: min(1100px, calc(100vw - 24px)); background: #0c120f; color: #fff; }
.cm-viewer-stage { position: relative; display: flex; align-items: center; justify-content: center; background: #000; min-height: 240px; }
.cm-viewer-stage img { max-width: 100%; max-height: calc(100dvh - 170px); object-fit: contain; }
.cm-viewer-prev, .cm-viewer-next, .cm-viewer-close { position: absolute; background: rgb(255 255 255 / .85); border: 0; }
.cm-viewer-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.cm-viewer-next { right: 12px; top: 50%; transform: translateY(-50%); }
.cm-viewer-close { right: 12px; top: 12px; }
.cm-viewer-foot { display: flex; gap: 12px; align-items: center; padding: 12px 16px; flex-wrap: wrap; }
.cm-viewer-foot .muted, .cm-viewer-foot a:not(.btn) { color: rgb(255 255 255 / .75); }
.cm-viewer-foot .btn-quiet { color: #fff; }
.cm-license .check { font-weight: 500; }
/* a card that is a row: a.card stacks by default, and outranks .list-row */
a.card.list-row { flex-direction: row; align-items: center; text-align: left; }
