/* =========================================================================
   ELEVATION — brutalist / Japanese editorial, monochrome, mobile-first
   ========================================================================= */

:root {
  --ink: #0b0b0b;
  --paper: #f3f1ea;
  --paper-2: #e8e5db;
  --grey: #b8b4a8;
  --rule: rgba(11, 11, 11, 0.16);
  --rule-strong: rgba(11, 11, 11, 0.85);

  --sans: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, "SF Mono", "Roboto Mono", Menlo, monospace;

  --frame-w: 460px;
  --pad: 22px;
  --nav-h: 70px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #1a1a18;
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Buttons don't inherit text color by default — the UA stylesheet gives them
   their own (black on desktop, system blue on iOS). Force the page ink so
   inactive tabs/filters/back-button aren't blue on mobile. Explicit colors
   (active tab, .btn--solid, etc.) still win on specificity. */
button { font-family: inherit; cursor: pointer; color: inherit; -webkit-tap-highlight-color: transparent; }
img { display: block; }

/* ---- Frame: a centered mobile column ---------------------------------- */
.frame {
  position: relative;
  max-width: var(--frame-w);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--paper);
  border-left: 1px solid var(--rule-strong);
  border-right: 1px solid var(--rule-strong);
  overflow: hidden;
}

.app {
  min-height: 100vh;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}

@media (prefers-reduced-motion: no-preference) {
  .view { animation: fade 0.28s ease both; }
  @keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}

/* ---- Shared editorial atoms ------------------------------------------- */
.kicker {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.rule { border: 0; border-top: 1px solid var(--rule-strong); margin: 0; }
.rule--thin { border-top: 1px solid var(--rule); }

.meta-row {
  display: flex;
  align-items: stretch;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.meta-row > span {
  padding: 9px 0;
  flex: 1;
  border-right: 1px solid var(--rule);
  padding-right: 10px;
}
/* gap between each divider and the next cell's text (first cell stays flush) */
.meta-row > span + span { padding-left: 12px; }
.meta-row > span:last-child { border-right: 0; flex: 0 0 auto; }

/* ---- Masthead --------------------------------------------------------- */
.masthead { padding: calc(env(safe-area-inset-top) + 20px) var(--pad) 0; }
.masthead__top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding-bottom: 12px;
}
.wordmark {
  font-weight: 900;
  font-size: clamp(46px, 16vw, 70px);
  line-height: 0.82;
  letter-spacing: -0.03em;
  margin: 10px 0 8px;
  text-transform: uppercase;
}
.masthead__tag {
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
  line-height: 1.2;
  margin: 0 0 16px;
}

/* ---- Section header --------------------------------------------------- */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 14px var(--pad);
}
.section-head h2 {
  margin: 0;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.section-head .count {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
}

/* ---- Discover feed entry ---------------------------------------------- */
.entry {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--paper);
  border: 0;
  border-top: 1px solid var(--rule-strong);
  padding: 0;
  color: inherit;
}
.entry__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 12px var(--pad) 2px;
}
.entry__no { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; }
.entry__flag {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border: 1px solid var(--ink);
  padding: 2px 6px;
}
.entry__flag--ghost { border-style: dashed; opacity: 0.6; }

.figure {
  position: relative;
  margin: 8px var(--pad) 0;
  aspect-ratio: 4 / 5;
  background: var(--paper-2);
  overflow: hidden;
  border: 1px solid var(--rule-strong);
}
.figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.06) brightness(1.01);
}
.figure svg { width: 100%; height: 100%; display: block; }
.figure__tick {
  position: absolute;
  top: 0; right: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  padding: 5px 8px;
  text-transform: uppercase;
}

.entry__title {
  font-weight: 800;
  font-size: clamp(30px, 9vw, 40px);
  line-height: 0.94;
  letter-spacing: -0.02em;
  margin: 14px var(--pad) 10px;
  text-transform: uppercase;
}
.entry__byline {
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
  padding: 0 var(--pad);
  margin-bottom: 12px;
}
.entry__byline .yr { font-family: var(--mono); font-style: normal; font-size: 12px; letter-spacing: 0.08em; }
.entry__meta {
  margin: 0 var(--pad) 18px;
  border-top: 1px solid var(--rule);
}

/* ---- Detail view ------------------------------------------------------ */
.detail__hero {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--paper-2);
  border-bottom: 1px solid var(--rule-strong);
  overflow: hidden;
}
.detail__hero img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.06); }
.detail__hero svg { width: 100%; height: 100%; }
.backbtn {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 14px);
  left: 14px;
  background: var(--paper);
  border: 1px solid var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 9px 13px;
}
.detail__body { padding: 18px var(--pad) 40px; }
.detail__no { font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em; }
.detail__title {
  font-weight: 900;
  font-size: clamp(38px, 12vw, 56px);
  line-height: 0.9;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  margin: 8px 0 14px;
}

/* brutalist key/value table */
.spec { border-top: 1px solid var(--rule-strong); margin: 6px 0 22px; }
.spec__row {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--rule);
}
.spec__k {
  flex: 0 0 96px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding-top: 3px;
}
.spec__v { flex: 1; font-family: var(--serif); font-style: italic; font-size: 19px; line-height: 1.25; }
.spec__v.num { font-family: var(--mono); font-style: normal; font-size: 16px; letter-spacing: 0.04em; }

.notes {
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.5;
  margin: 0 0 26px;
}
.notes--placeholder { opacity: 0.5; font-style: italic; }

/* action buttons */
.actions { display: grid; gap: 0; border: 1px solid var(--ink); }
.btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: var(--paper);
  color: var(--ink);
  border: 0;
  border-bottom: 1px solid var(--ink);
  padding: 18px 18px;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.btn:last-child { border-bottom: 0; }
.btn .arr { font-family: var(--mono); font-weight: 400; }
.btn--solid { background: var(--ink); color: var(--paper); }
.btn--danger { color: var(--ink); }
.btn:active { transform: translateY(1px); }

/* ---- Collection ------------------------------------------------------- */
.filters {
  display: flex;
  border-top: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule-strong);
}
.filter {
  flex: 1;
  background: var(--paper);
  border: 0;
  border-right: 1px solid var(--rule);
  padding: 13px 6px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.filter:last-child { border-right: 0; }
.filter[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

.coll-item {
  display: grid;
  grid-template-columns: 84px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px var(--pad);
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  width: 100%;
  text-align: left;
  border-top: 0; border-left: 0; border-right: 0;
  color: inherit;
}
.coll-thumb {
  width: 84px; height: 100px;
  background: var(--paper-2);
  border: 1px solid var(--rule-strong);
  overflow: hidden;
}
.coll-thumb img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.05); }
.coll-thumb svg { width: 100%; height: 100%; }
.coll-text { min-width: 0; }
.coll-text .t {
  font-weight: 800; font-size: 19px; line-height: 0.98;
  letter-spacing: -0.01em; text-transform: uppercase;
  margin-bottom: 5px;
}
.coll-text .s { font-family: var(--serif); font-style: italic; font-size: 14px; }
.coll-text .s .yr { font-family: var(--mono); font-style: normal; font-size: 11px; letter-spacing: 0.06em; }

.check {
  width: 30px; height: 30px;
  border: 1.5px solid var(--ink);
  background: var(--paper);
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  flex: 0 0 auto;
}
.check svg { width: 16px; height: 16px; }
.check[aria-pressed="true"] { background: var(--ink); }
.check[aria-pressed="true"] svg { stroke: var(--paper); }
.check[aria-pressed="false"] svg { display: none; }

/* empty states */
.empty {
  padding: 60px var(--pad);
  text-align: center;
}
.empty__mark { font-weight: 900; font-size: 64px; line-height: 1; letter-spacing: -0.04em; }
.empty__t { font-family: var(--serif); font-style: italic; font-size: 20px; margin: 16px 0 6px; }
.empty__s { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.6; }

/* ---- Add form --------------------------------------------------------- */
.form { padding: 4px var(--pad) 40px; }
.field { border-bottom: 1px solid var(--rule-strong); padding: 16px 0; }
.field > label {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.field input[type="text"],
.field input[type="number"],
.field textarea {
  width: 100%;
  border: 0;
  background: transparent;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 22px;
  color: var(--ink);
  padding: 0;
  resize: none;
}
.field textarea { font-family: var(--serif); font-weight: 400; font-size: 19px; line-height: 1.4; }
.field input::placeholder, .field textarea::placeholder { color: var(--grey); }
.field input:focus, .field textarea:focus { outline: none; }
.field--row { display: flex; gap: 14px; }
.field--row > .sub { flex: 1; }

.toggle {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em;
  text-transform: uppercase; margin-top: 10px;
  background: none; border: 0; padding: 0; color: var(--ink);
}
.toggle .box { width: 16px; height: 16px; border: 1.5px solid var(--ink); }
.toggle[aria-pressed="true"] .box { background: var(--ink); }

.photo-input { display: flex; align-items: stretch; gap: 0; border: 1px solid var(--ink); }
.photo-input .preview {
  width: 92px; height: 92px; flex: 0 0 auto;
  background: var(--paper-2); border-right: 1px solid var(--ink); overflow: hidden;
}
.photo-input .preview img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1); }
.photo-input .preview svg { width: 100%; height: 100%; }
.photo-input .pick {
  flex: 1; background: var(--paper); border: 0; text-align: left;
  padding: 0 16px; font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.12em; text-transform: uppercase;
}
.photo-input input[type="file"] { display: none; }

.submit {
  width: 100%; margin-top: 26px;
  background: var(--ink); color: var(--paper);
  border: 0; padding: 20px;
  font-weight: 800; font-size: 15px; letter-spacing: 0.06em; text-transform: uppercase;
  display: flex; justify-content: space-between; align-items: center;
}
.submit .arr { font-family: var(--mono); font-weight: 400; }
.submit:disabled { opacity: 0.4; }

/* ---- Tab bar ---------------------------------------------------------- */
.tabbar {
  position: fixed;
  bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: var(--frame-w);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  background: var(--paper);
  border-top: 1px solid var(--rule-strong);
  z-index: 40;
}
.tab {
  flex: 1;
  background: transparent;
  border: 0;
  border-right: 1px solid var(--rule);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
}
.tab:last-child { border-right: 0; }
.tab__no { font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; opacity: 0.45; }
.tab__label { font-weight: 800; font-size: 12px; letter-spacing: 0.02em; text-transform: uppercase; }
.tab[aria-current="true"] { background: var(--ink); color: var(--paper); }
.tab[aria-current="true"] .tab__no { opacity: 0.7; }

.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px);
  left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--paper);
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  padding: 11px 18px; z-index: 60; white-space: nowrap;
  animation: toast 2.4s ease both;
}
@keyframes toast {
  0% { opacity: 0; transform: translate(-50%, 8px); }
  12%, 80% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, 8px); }
}

/* ---- Discover controls (search / sort / view) ------------------------- */
.controls {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--paper);
  border-bottom: 1px solid var(--rule-strong);
}
.search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px var(--pad);
  border-top: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule);
}
.search__icon { display: flex; align-items: center; color: var(--ink); opacity: 0.5; }
.search__icon svg { width: 20px; height: 20px; display: block; }
.search__map {
  flex: 0 0 auto;
  background: transparent;
  border: 0;
  padding: 0;
  display: flex; align-items: center; justify-content: center;
  width: 24px; height: 24px;
  color: var(--ink);
  opacity: 0.5;
}
.search__map svg { width: 20px; height: 20px; display: block; }
.search__map[aria-pressed="true"] { opacity: 1; }
.search input {
  flex: 1;
  border: 0;
  background: transparent;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
  color: var(--ink);
  padding: 0;
}
.search input::placeholder { color: var(--grey); }
.search input:focus { outline: none; }
.search__clear {
  border: 0; background: transparent;
  font-family: var(--mono); font-size: 14px; color: var(--ink);
  padding: 0 2px; line-height: 1;
}

.sortrow {
  display: flex;
  align-items: stretch;
}
.chips {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  background: transparent;
  border: 0;
  border-right: 1px solid var(--rule);
  padding: 11px 13px;
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.1em; text-transform: uppercase;
  white-space: nowrap;
  color: var(--ink);
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); }


.no-results {
  padding: 50px var(--pad);
  text-align: center;
}
.no-results .empty__mark { font-size: 48px; }

/* ---- Map -------------------------------------------------------------- */
.map {
  height: calc(100vh - var(--nav-h) - 138px);
  min-height: 360px;
  width: 100%;
  background: var(--paper-2);
}
/* push tiles to monochrome to match the editorial system */
.map .leaflet-tile-pane { filter: grayscale(1) contrast(1.05) brightness(1.02); }
.leaflet-container { background: var(--paper-2); font-family: var(--mono); }
.leaflet-control-zoom a {
  background: var(--paper) !important;
  color: var(--ink) !important;
  border: 1px solid var(--ink) !important;
  border-radius: 0 !important;
  font-weight: 700;
}
.leaflet-control-attribution {
  background: rgba(243, 241, 234, 0.85) !important;
  font-size: 9px !important;
}
.leaflet-bar { border-radius: 0 !important; box-shadow: none !important; }

.pin {
  width: 26px; height: 26px;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  color: var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
}
.pin--visited { background: var(--ink); color: var(--paper); }

.leaflet-popup-content-wrapper {
  background: var(--paper) !important;
  border: 1px solid var(--ink) !important;
  border-radius: 0 !important;
  box-shadow: 3px 3px 0 var(--ink) !important;
}
.leaflet-popup-tip { background: var(--paper) !important; border: 1px solid var(--ink) !important; }
.leaflet-popup-content { margin: 12px 14px !important; }
.popup__t { font-weight: 800; font-size: 16px; text-transform: uppercase; line-height: 1; letter-spacing: -0.01em; }
.popup__s { font-family: var(--serif); font-style: italic; font-size: 13px; margin-top: 4px; }
.popup__go {
  display: inline-block; margin-top: 9px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  border-bottom: 1px solid var(--ink); cursor: pointer;
}

:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
