/* sumika Explore. Indigo ink on paper; sakura only means "saved".
   Photos sit on a shared baseline; nothing sits on top of them. */

:root {
  --ai: #1e2a55;          /* ink: text, primary buttons */
  --ai-soft: #4b567a;     /* captions, secondary text */
  --ai-faint: #8a91a8;    /* placeholders, quiet counts */
  --paper: #f4f5f7;
  --plate: #e7e9ee;       /* empty photo plate while loading */
  --white: #ffffff;
  --line: #dde0e7;
  --sakura: #f6bfcb;
  --sakura-deep: #c8456b;
  --display: "Bodoni Moda", "Didot", "Bodoni 72", Georgia, serif;
  --ui: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --gutter: clamp(16px, 3.4vw, 48px);
  --lift: 0 22px 48px -24px rgba(30, 42, 85, 0.38);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  overflow-x: clip;
  background: var(--paper);
  color: var(--ai);
  font-family: var(--ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }

:focus-visible { outline: 2px solid var(--sakura-deep); outline-offset: 3px; }

.ex-visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ---------- Bar ---------- */

.ex-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 28px;
  padding: 14px var(--gutter);
  background: var(--paper);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.ex-bar.is-scrolled { border-bottom-color: var(--line); }

.ex-wordmark {
  font-family: var(--display);
  font-size: 27px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.ex-wordmark span {
  font-family: var(--ui);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--ai-soft);
  margin-left: 3px;
}

.ex-search {
  position: relative;
  max-width: 600px;
  width: 100%;
}

.ex-search input[type="search"] {
  width: 100%;
  height: 44px;
  padding: 0 52px 0 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s;
}

.ex-search input[type="search"]::placeholder { color: var(--ai-faint); }
.ex-search input[type="search"]:focus { border-color: var(--ai); }
.ex-search.is-dropping input[type="search"] { border-color: var(--sakura-deep); border-style: dashed; }

.ex-photo-button {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  cursor: pointer;
  color: var(--ai-soft);
}

.ex-photo-button:hover { background: var(--paper); color: var(--ai); }
.ex-photo-button:focus-within { outline: 2px solid var(--sakura-deep); outline-offset: 1px; }
.ex-photo-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }

:where(button, label) > svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

.ex-bar-end { display: flex; align-items: center; gap: 8px; }

.ex-search-toggle { display: none; }

/* Sticky taste bar (phones only, shown by script once the swatches scroll off) */
.ex-minibar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 25;
  background: rgba(244, 245, 247, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  transform: translateY(-100%);
  visibility: hidden; /* off-screen buttons stay out of the tab order */
  transition: transform 0.2s ease, visibility 0.2s;
}

.ex-minibar.is-on { transform: none; visibility: visible; }

.ex-minibar ul {
  display: flex;
  gap: 6px;
  margin: 0;
  padding: 8px var(--gutter);
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
}

.ex-minibar ul::-webkit-scrollbar { display: none; }
.ex-minibar li, .ex-swatches li { flex: none; }

.ex-mini {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px 0 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.ex-mini img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.ex-mini[aria-pressed="true"] { background: var(--ai); border-color: var(--ai); color: var(--white); }

.ex-area-button,
.ex-account-button {
  height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.ex-area-button { display: inline-flex; align-items: center; gap: 6px; max-width: 280px; }
.ex-area-button span { overflow: hidden; text-overflow: ellipsis; }
.ex-area-button svg { width: 18px; height: 18px; flex: none; }
.ex-area-button:hover, .ex-account-button:hover { background: var(--white); }
.ex-account-button { border: 1px solid var(--ai); }

/* ---------- Page ---------- */

.ex {
  padding: 0 var(--gutter) 120px;
}

/* ---------- Tastes: material-board swatches ---------- */

.ex-tastes {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 0 6px;
}

.ex-browse { flex: none; margin-top: 6px; text-decoration: underline; text-decoration-color: var(--ai-faint); text-underline-offset: 5px; }

.ex-swatches {
  position: relative; /* keeps the new-taste form's hidden label inside the row's scroll */
  display: flex;
  min-width: 0;
  gap: 26px;
  margin: 0;
  padding: 6px 4px 10px;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
}

.ex-swatches::-webkit-scrollbar { display: none; }

.ex-swatch {
  display: grid;
  gap: 9px;
  justify-items: start;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
}

.ex-swatch-board {
  width: 78px;
  height: 78px;
  display: grid;
  /* minmax(0, …): a portrait photo would otherwise stretch its row past the board. */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 2px;
  background: var(--paper);
  outline: 1.5px solid transparent;
  outline-offset: 4px;
  transition: outline-color 0.15s;
}

.ex-swatch-board img,
.ex-swatch-board i {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: cover;
  background: var(--plate);
}

.ex-swatch:hover .ex-swatch-board { outline-color: var(--line); }
.ex-swatch[aria-pressed="true"] .ex-swatch-board { outline-color: var(--ai); }
.ex-swatch:focus-visible { outline: none; }
.ex-swatch:focus-visible .ex-swatch-board { outline: 2px solid var(--sakura-deep); }

.ex-swatch-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  max-width: 112px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ex-swatch-count {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--ai-soft);
  margin-top: 2px;
}

.ex-swatch[aria-pressed="false"] .ex-swatch-name { color: var(--ai-soft); }

.ex-swatch-new .ex-swatch-board {
  display: grid;
  place-items: center;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  border: 1px dashed var(--ai-faint);
  background: transparent;
  color: var(--ai-soft);
  font-size: 26px;
  font-weight: 300;
}

.ex-swatch-new:hover .ex-swatch-board { border-color: var(--ai); color: var(--ai); outline-color: transparent; }

.ex-new-taste {
  display: grid;
  gap: 9px;
  align-content: start;
}

.ex-new-taste input {
  width: 150px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--ai);
  border-radius: 999px;
  background: var(--white);
  font-size: 13px;
}

/* ---------- Trail ---------- */

.ex-trail { padding: 14px 0 0; }

.ex-trail ol {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 -4px;
  padding: 4px;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
}

.ex-trail li { display: flex; align-items: center; gap: 10px; flex: none; }
.ex-trail li + li::before { content: "›"; color: var(--ai-faint); font-size: 18px; line-height: 1; }

.ex-crumb {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--ai-soft);
  cursor: pointer;
}

.ex-crumb img { width: 44px; height: 44px; object-fit: cover; outline: 1.5px solid transparent; outline-offset: 2px; }
.ex-crumb:hover { color: var(--ai); }
.ex-crumb:hover img { outline-color: var(--line); }
.ex-crumb[aria-current="step"] { color: var(--ai); }
.ex-crumb[aria-current="step"] img { outline-color: var(--ai); }

/* ---------- First visit: style index ---------- */

.ex-library { padding: 44px 0 0; }

.ex-library-intro { max-width: 820px; margin-bottom: 36px; }

.ex-library-intro h1 {
  margin: 0 0 12px;
  font-family: var(--display);
  font-style: italic;
  font-weight: 500;
  font-variation-settings: "opsz" 14;
  font-size: clamp(44px, 6vw, 84px);
  line-height: 0.98;
  letter-spacing: -0.02em;
}

.ex-library-intro p { margin: 0; font-size: 17px; color: var(--ai-soft); max-width: 46ch; }

.ex-index {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.72fr);
  gap: clamp(24px, 5vw, 80px);
  align-items: start;
}

.ex-index-list { margin: 0; padding: 0; list-style: none; }

.ex-index-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  width: 100%;
  padding: 6px 0;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
  transition: opacity 0.18s;
}

.ex-index-name {
  font-family: var(--display);
  font-style: italic;
  font-weight: 500;
  font-variation-settings: "opsz" 14;
  font-size: clamp(30px, 3.6vw, 52px);
  line-height: 1.08;
  letter-spacing: -0.015em;
}

.ex-index-thumb { display: none; }

@media (hover: hover) {
  .ex-index-list:hover .ex-index-item { opacity: 0.32; }
  .ex-index-list:hover .ex-index-item:hover { opacity: 1; }
}
.ex-index-list .ex-index-item:focus-visible { opacity: 1; }

.ex-index-preview {
  position: sticky;
  top: 96px;
  margin: 8px 0 0;
}

.ex-index-preview img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  background: var(--plate);
}

.ex-index-preview figcaption { margin-top: 10px; font-size: 13px; color: var(--ai-soft); }

/* Desktop: the style index fits the window, so every style and the whole photo show at once.
   The styles share the height left under the intro, and their type is sized from it (cqh).
   The photo is a 4:5 plate beside the list, centred with space around it, like a magazine page.
   Short windows scroll instead of squashing. */
@media (min-width: 721px) {
  body:has(.ex-library:not([hidden])) { display: flex; flex-direction: column; height: 100dvh; }
  body:has(.ex-library:not([hidden])) .ex {
    flex: 1 1 auto;
    min-height: 560px;
    display: flex;
    flex-direction: column;
    padding-bottom: clamp(20px, 3.5dvh, 40px);
  }
  body:has(.ex-library:not([hidden])) .ex > * { flex-shrink: 0; }

  .ex-library:not([hidden]) {
    flex: 1 1 0;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.72fr);
    grid-template-rows: auto minmax(0, 1fr);
    column-gap: clamp(24px, 5vw, 80px);
    padding-top: clamp(16px, 3.5dvh, 44px);
  }
  .ex-index { display: contents; }
  .ex-library-intro { grid-column: 1; grid-row: 1; margin-bottom: clamp(10px, 2.6dvh, 32px); }
  .ex-library-intro h1 { font-size: clamp(40px, min(6vw, 8.5dvh), 84px); }

  .ex-index-list {
    grid-column: 1;
    grid-row: 2;
    min-height: 0;
    container-type: size;
    display: grid;
    grid-auto-rows: minmax(0, 1fr);
  }
  .ex-index-list li { display: flex; min-height: 0; }
  .ex-index-item { align-items: center; padding: 0; }
  /* 12 rows share the list's height; the longest name is about 12em wide. */
  .ex-index-name { font-size: clamp(18px, min(6.2cqh, 8cqw), 56px); line-height: 1.05; }

  .ex-index-preview {
    grid-column: 2;
    grid-row: 2;
    position: static;
    min-height: 0;
    margin: 0;
    container-type: size;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* As large as the space allows, leaving room for the caption. */
    --plate: min(100cqw, (100cqh - 34px) * 0.8);
  }
  .ex-index-preview img { flex: none; width: var(--plate); height: auto; aspect-ratio: 4 / 5; }
  .ex-index-preview figcaption { width: var(--plate); }
}

/* ---------- Feed ---------- */

.ex-feed { padding: 30px 0 0; }

.ex-feed-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}

.ex-feed-heading { min-width: 0; }

.ex-feed-head h2 {
  margin: 0;
  font-family: var(--display);
  font-style: italic;
  font-weight: 500;
  font-variation-settings: "opsz" 14;
  font-size: clamp(40px, 5.4vw, 76px);
  line-height: 1;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.ex-feed-head h2 img {
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  object-fit: cover;
  vertical-align: -0.08em;
  margin-left: 0.18em;
}

.ex-feed-note { margin: 10px 0 0; font-size: 14px; color: var(--ai-soft); }
.ex-taste-tools { display: flex; gap: 16px; margin-top: 4px; }
.ex-taste-tools .ex-text-button { padding: 2px 0; font-size: 13px; font-weight: 500; color: var(--ai-faint); }
.ex-taste-tools .ex-text-button:hover { color: var(--ai); }
.ex-rename input {
  width: min(100%, 12em);
  padding: 0 0 2px;
  border: 0;
  border-bottom: 1px solid var(--ai);
  background: transparent;
  font-style: italic;
  outline: none;
}

.ex-feed-area {
  flex: none;
  padding: 6px 0;
  border: 0;
  background: none;
  font-size: 14px;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
  text-decoration-color: var(--ai-faint);
  cursor: pointer;
}

.ex-feed-area:hover { text-decoration-color: var(--ai); }

.ex-feed-empty {
  max-width: 520px;
  padding: 20px 0 40px;
  font-size: 16px;
  color: var(--ai-soft);
}

.ex-feed-empty p { margin: 0 0 14px; }

/* Rows share a baseline: each row is one height, photos keep their proportions. */
.ex-rows { transition: opacity 0.15s ease; }
.ex-rows.is-swapping { opacity: 0; }
.ex-rows.is-loading { opacity: 0.45; }

.ex-row {
  display: flex;
  gap: 8px;
  margin-bottom: 22px;
}

.ex-tile { flex: none; min-width: 0; }

.ex-plate {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: var(--plate);
  cursor: zoom-in;
  overflow: hidden;
}

.ex-plate img { width: 100%; height: 100%; object-fit: cover; }
.ex-plate:focus-visible { outline-offset: 2px; }

.ex-cap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-height: 34px;
  padding-top: 8px;
  font-size: 13px;
  line-height: 1.3;
}

.ex-cap-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ex-cap-text b { font-weight: 600; }
.ex-cap-text span { color: var(--ai-soft); }

.ex-cap-actions { display: flex; gap: 12px; flex: none; }

.ex-cap-button {
  padding: 0;
  border: 0;
  background: none;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ai);
  cursor: pointer;
  white-space: nowrap;
}

.ex-cap-button:hover { text-decoration: underline; text-underline-offset: 3px; }

.ex-cap-button[aria-pressed="true"] { color: var(--sakura-deep); }
.ex-cap-button[aria-pressed="true"]::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--sakura-deep);
  vertical-align: 1px;
}

/* On pointers, actions wait until the photo is in play. Saved stays visible. */
@media (hover: hover) {
  .ex-cap-button { opacity: 0; transition: opacity 0.12s; }
  .ex-tile:hover .ex-cap-button,
  .ex-tile:focus-within .ex-cap-button,
  .ex-cap-button[aria-pressed="true"] { opacity: 1; }
  .ex-tile:not(:hover):not(:focus-within) .ex-cap-similar { display: none; }
}

/* Home-level feeds: each home is a pair, front and inside, held tighter together than the gap between homes */

.ex-more {
  display: flex;
  justify-content: center;
  padding: 18px 0 0;
}

/* ---------- Buttons ---------- */

.ex-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border: 1px solid var(--ai);
  border-radius: 999px;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.ex-button:hover { background: var(--white); }
.ex-button-primary { background: var(--ai); color: var(--white); }
.ex-button-primary:hover { background: #121a38; }
.ex-button-primary.is-saved { background: var(--sakura); border-color: var(--sakura); color: var(--ai); }

.ex-text-button {
  padding: 8px 4px;
  border: 0;
  background: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--ai-soft);
  cursor: pointer;
}

.ex-text-button:hover { color: var(--ai); }

/* ---------- Open a photo: the whole home ---------- */

dialog { color: var(--ai); }
dialog::backdrop { background: rgba(18, 26, 56, 0.28); }

.ex-home {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--paper);
}

.ex-home[open] { animation: ex-rise 0.22s ease; }

@keyframes ex-rise { from { opacity: 0; transform: translateY(10px); } }

.ex-home-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  grid-template-rows: minmax(0, 1fr);
  height: 100%;
}

/* Fixed-size rows so the photo's max-height has something to hold to:
   a tall photo shrinks to fit the screen instead of making it scroll. */
.ex-home-photo {
  margin: 0;
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  padding: clamp(16px, 3vw, 44px);
  min-height: 0;
  overflow: hidden;
}

.ex-home-photo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Phones swipe through the home's photos; desktop shows one at a time. */
.ex-home-track, .ex-home-count { display: none; }

.ex-home-side {
  position: relative;
  overflow-y: auto;
  padding: 40px 36px 40px;
  background: var(--white);
  border-left: 1px solid var(--line);
}

.ex-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.ex-close:hover { background: var(--paper); }

.ex-home-side h2 {
  margin: 18px 50px 6px 0;
  font-size: 26px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.ex-home-address { margin: 0; font-size: 14px; color: var(--ai-soft); }
.ex-home-facts { margin: 4px 0 0; font-size: 14px; color: var(--ai-soft); }

.ex-home-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr); /* a long taste name shortens to "…" instead of widening the panel */
  gap: 10px;
  margin: 26px 0 34px;
}

.ex-save-split { display: flex; }
/* Block, not flex, so a long taste name ends in "…" while short ones stay centred. */
.ex-save-split .ex-button-primary { flex: 1; min-width: 0; display: block; line-height: 42px; text-align: center; border-radius: 999px 0 0 999px; overflow: hidden; text-overflow: ellipsis; }

.ex-save-choose { position: relative; display: flex; }

.ex-save-choose select {
  appearance: none;
  width: 48px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--ai);
  border-left-color: rgba(255, 255, 255, 0.3);
  border-radius: 0 999px 999px 0;
  background: var(--ai);
  color: transparent;
  cursor: pointer;
}

.ex-save-choose::after {
  content: "";
  position: absolute;
  top: 17px;
  left: 18px;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--white);
  border-bottom: 1.5px solid var(--white);
  transform: rotate(45deg);
  pointer-events: none;
}

.ex-save-choose select option { color: var(--ai); background: var(--white); }
.ex-save-choose select:focus-visible { outline: 2px solid var(--sakura-deep); outline-offset: 2px; }

.ex-home-domain {
  justify-self: start;
  padding: 8px 0;
  font-size: 14px;
  font-weight: 600;
  text-underline-offset: 4px;
  text-decoration-color: var(--ai-faint);
}

.ex-home-sheet-title {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
}

.ex-home-sheet {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ex-home-sheet button {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  background: var(--plate);
  cursor: pointer;
  outline: 1.5px solid transparent;
  outline-offset: 2px;
}

.ex-home-sheet img { width: 100%; height: 100%; object-fit: cover; }
.ex-home-sheet button[aria-current="true"] { outline-color: var(--ai); }
.ex-home-sheet button:focus-visible { outline-color: var(--sakura-deep); }

/* ---------- Area ---------- */

.ex-area,
.ex-account {
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100dvh - 96px);
  margin: 76px var(--gutter) auto auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--lift);
  overflow: visible;
}

.ex-account { margin: auto; }
.ex-area[open], .ex-account[open] { animation: ex-rise 0.18s ease; }

.ex-area-inner,
.ex-account-inner { display: grid; gap: 18px; padding: 24px; }

.ex-area-head { position: relative; }
.ex-area-head h2 {
  margin: 0;
  padding-right: 48px;
  font-family: var(--display);
  font-style: italic;
  font-weight: 500;
  font-variation-settings: "opsz" 14;
  font-size: 30px;
  line-height: 1.1;
}

.ex-area-head .ex-close { top: -8px; right: -8px; }

.ex-anywhere { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14px; cursor: pointer; }
.ex-anywhere input { width: 18px; height: 18px; accent-color: var(--ai); }

.ex-suburb { position: relative; z-index: 10; display: grid; gap: 6px; }
.ex-suburb label, .ex-radius legend { font-size: 13px; font-weight: 600; }

.ex-suburb input,
.ex-account-inner input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
  font-size: 15px;
  outline: none;
}

.ex-suburb input:focus, .ex-account-inner input:focus { border-color: var(--ai); }

.ex-suburb ul {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 5;
  margin: 4px 0 0;
  padding: 4px;
  list-style: none;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--lift);
  max-height: 240px;
  overflow-y: auto;
}

.ex-suburb li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 10px;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
}

.ex-suburb li span { color: var(--ai-soft); font-size: 12px; }
.ex-suburb li[aria-selected="true"], .ex-suburb li:hover { background: var(--paper); }

.ex-radius { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; border: 0; }
.ex-radius legend { margin-bottom: 8px; padding: 0; }
.ex-radius label { position: relative; cursor: pointer; }
.ex-radius input { position: absolute; opacity: 0; inset: 0; }

.ex-radius span {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.ex-radius input:checked + span { background: var(--ai); border-color: var(--ai); color: var(--white); }
.ex-radius input:focus-visible + span { outline: 2px solid var(--sakura-deep); outline-offset: 2px; }
.ex-radius.is-off { opacity: 0.4; pointer-events: none; }

.ex-area-map { height: 170px; border-radius: 6px; background: var(--paper); overflow: hidden; isolation: isolate; }
.ex-area-map .leaflet-tile-pane { filter: grayscale(1) contrast(0.82) brightness(1.06); } /* map in pencil, the circle in ink */
.ex-area-map.is-off { opacity: 0.45; }
.ex-area-apply { width: 100%; }

/* ---------- Keep your tastes ---------- */

.ex-keep {
  position: fixed;
  left: var(--gutter);
  bottom: 24px;
  z-index: 30;
  width: min(340px, calc(100vw - 32px));
  padding: 22px 22px 16px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--lift);
  animation: ex-rise 0.25s ease;
}

.ex-keep h2 {
  margin: 0 0 6px;
  font-family: var(--display);
  font-style: italic;
  font-weight: 500;
  font-variation-settings: "opsz" 14;
  font-size: 26px;
  line-height: 1.1;
}

.ex-keep p { margin: 0 0 16px; font-size: 14px; color: var(--ai-soft); }
.ex-keep-actions { display: flex; align-items: center; gap: 10px; }

.ex-account-inner label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; }
.ex-account-note { margin: -8px 0 0; font-size: 14px; color: var(--ai-soft); }
.ex-account-inner small { font-size: 12.5px; font-weight: 400; color: var(--ai-faint); }
.ex-form-error { margin: -6px 0 0; font-size: 13.5px; color: var(--sakura-deep); }
.ex-form-error:empty { display: none; }
.ex-account-switch { margin: -4px 0 0; font-size: 14px; color: var(--ai-soft); }

/* ---------- Toast ---------- */

.ex-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 40;
  transform: translate(-50%, 16px);
  padding: 11px 18px;
  border-radius: 999px;
  background: var(--ai);
  color: var(--white);
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
  white-space: nowrap;
}

.ex-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Leaflet in ink ---------- */

.leaflet-container { font-family: var(--ui); background: var(--paper); }
.leaflet-control-attribution { font-size: 9px; }

/* ---------- Tablet ---------- */

@media (max-width: 960px) {
  .ex-bar { gap: 16px; }
  .ex-home-inner { grid-template-columns: minmax(0, 1fr) 340px; }
  .ex-home-side { padding: 32px 24px; }
}

/* ---------- Phone ---------- */

@media (max-width: 720px) {
  .ex-bar {
    position: static;
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 10px;
    padding-top: 10px;
    padding-bottom: 4px;
  }
  .ex-wordmark { font-size: 25px; }
  .ex-search { display: none; grid-column: 1 / -1; grid-row: 2; max-width: none; }
  .ex-bar.is-searching .ex-search { display: block; }
  .ex-search-toggle {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
  }
  .ex-search-toggle[aria-expanded="true"] { background: var(--white); }
  .ex-area-button { display: none; } /* the feed heading carries the area on phones */
  .ex-account-button { height: 36px; font-size: 13px; }

  .ex-tastes { flex-direction: column; gap: 0; padding-top: 14px; }
  .ex-browse { margin-top: 0; padding: 6px 0; font-size: 13px; }
  /* Stretch to the screen and scroll inside; sized to its content, many tastes widened the whole page
     and iOS Safari zoomed out to fit it. */
  .ex-swatches { align-self: stretch; gap: 18px; margin: 0 calc(var(--gutter) * -1); padding-left: var(--gutter); padding-right: var(--gutter); }
  .ex { overflow-x: clip; } /* safety net: nothing may widen the page on a phone */
  /* iOS Safari zooms in on any text box under 16px when it's tapped, and stays zoomed. */
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]) { font-size: max(16px, 1em); }
  /* A taste card is exactly as wide as its board; a long name ends in "…" at the board's edge. */
  .ex-swatch { width: 68px; }
  .ex-swatch-board { width: 68px; height: 68px; }
  .ex-swatch-name { min-width: 0; max-width: 100%; font-size: 12px; }
  .ex-new-taste input { width: 128px; }

  .ex-library { padding-top: 26px; }
  .ex-index { grid-template-columns: 1fr; }
  .ex-index-preview { display: none; }
  .ex-index-item { align-items: center; padding: 10px 0; }
  .ex-index-name { flex: 1 1 auto; min-width: 0; font-size: 32px; }
  /* Never shrinks: the name wraps instead, so every photo sits at the right edge. */
  .ex-index-thumb { flex: none; display: block; width: 56px; height: 56px; object-fit: cover; background: var(--plate); }

  .ex-feed { padding-top: 14px; }
  .ex-feed-head { flex-direction: column; align-items: flex-start; gap: 4px; margin-bottom: 16px; }
  .ex-feed-head h2 { font-size: 42px; }
  .ex-feed-note { margin-top: 6px; font-size: 13px; }
  .ex-feed-area { order: 3; padding: 2px 0; font-size: 13px; }

  /* Phones: photos run edge to edge, alternating one full-width plate and a pair. */
  .ex-rows { margin: 0 calc(var(--gutter) * -1); }
  .ex-row { gap: 3px; margin-bottom: 18px; }
  .ex-row-pair { margin-top: -6px; }
  .ex-cap { min-height: 28px; padding-top: 7px; font-size: 12px; }
  .ex-row-full .ex-cap { padding-left: var(--gutter); padding-right: var(--gutter); font-size: 13px; }
  .ex-row-pair .ex-tile:first-child .ex-cap { padding-left: var(--gutter); padding-right: 6px; }
  .ex-row-pair .ex-tile:last-child .ex-cap { padding-left: 6px; padding-right: var(--gutter); }
  .ex-row-pair .ex-cap-text span { display: none; } /* pairs keep just the suburb */
  .ex-cap-actions { display: none; } /* phones: tap opens the home, save lives there */

  .ex-home-inner { display: block; overflow-y: auto; height: 100%; }
  .ex-home-photo { position: relative; display: block; padding: 0; height: 58dvh; background: var(--plate); }
  .ex-home-photo img { width: 100%; height: 100%; object-fit: cover; max-height: none; }
  .ex-home-photo.has-track > img { display: none; }
  .ex-home-photo.has-track .ex-home-track {
    display: flex;
    width: 100%; /* the desktop place-items: center would otherwise shrink it */
    height: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }
  .ex-home-track::-webkit-scrollbar { display: none; }
  .ex-home-track img { flex: none; scroll-snap-align: start; scroll-snap-stop: always; -webkit-user-drag: none; }
  .ex-home-photo.has-track .ex-home-count {
    display: block;
    position: absolute;
    right: 12px;
    bottom: 12px;
    margin: 0;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    font-size: 12px;
    font-weight: 600;
    pointer-events: none;
  }
  .ex-home-side { overflow: visible; border-left: 0; padding: 22px 16px 40px; }
  .ex-home-side h2 { margin-top: 0; }
  .ex-home .ex-close { position: fixed; top: 12px; right: 12px; background: rgba(255, 255, 255, 0.92); }

  .ex-area {
    width: 100vw;
    max-width: none;
    max-height: 92dvh;
    margin: auto 0 0;
    border-radius: 14px 14px 0 0;
    overflow-y: auto;
  }
  .ex-keep { left: 16px; bottom: 16px; }
}

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