header, main {
  max-width: 1440px;
}

header .pet-brand {
  grid-column: 1;
}

.pet-brand h1 {
  white-space: normal;
}

header .header-actions {
  grid-column: 2;
  grid-row: 1;
}

.event-filters {
  background: #fff;
  border: 1px solid #dce5dd;
  border-radius: 14px;
  padding: 12px;
}

.primary-filters {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1.3fr);
  gap: 8px;
}

.primary-filters > *, .advanced-fields > * {
  width: 100%;
  min-width: 0;
}

.filter-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-top: 6px;
}

.quick {
  padding: 0;
}

.quick button {
  font-size: 14px;
  padding: 8px 12px;
}

.advanced-filters {
  margin-inline-start: auto;
}

.advanced-filters[open] {
  flex: 1 0 100%;
}

.advanced-filters summary, .map-tools summary {
  width: fit-content;
  cursor: pointer;
  padding: 11px 4px;
  font-size: 14px;
  font-weight: 600;
}

summary:focus-visible, select:focus-visible, input:focus-visible {
  outline: 3px solid #d19a42;
  outline-offset: 2px;
}

#advanced-count {
  display: inline-block;
  margin-inline-start: 7px;
  min-width: 1.5em;
  text-align: center;
  border-radius: 1em;
  background: #246b56;
  color: #fff;
}

.advanced-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 165px), 1fr));
  gap: 8px;
  padding: 8px 0 2px;
  border-top: 1px solid #dce5dd;
}

.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 12px 0 8px;
}

.view-controls {
  display: flex;
  gap: 6px;
}

.view-controls button {
  white-space: nowrap;
  font-size: 14px;
}

#status {
  margin: 3px 0;
  font-size: 14px;
}

#unmapped {
  margin-bottom: 8px;
  text-align: left;
  font-size: 14px;
}

.map-tools {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0 12px;
  margin-top: 6px;
}

.map-tools details {
  flex: 1 1 180px;
}

.map-tools details p {
  font-size: 13px;
}

#loc {
  font-size: 14px;
}

#loc-status {
  display: block;
}

.daily-panel {
  margin: 14px 0 0;
}

@media (max-width: 700px) {
  header .pet-brand h1 {
    font-size: clamp(17px, 5vw, 25px);
  }

  .event-filters {
    padding: 8px;
  }

  .primary-filters {
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  }

  .primary-filters #search {
    grid-column: 1 / -1;
  }

  .primary-filters select, .advanced-fields select {
    font-size: 14px;
    padding-inline: 6px;
  }

  .filter-row .quick {
    flex: 1 0 100%;
  }

  .quick button {
    font-size: 13px;
    padding-inline: 2px;
  }

  .advanced-filters {
    flex: 1 0 100%;
  }

  .advanced-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.header-update {
  grid-column: 1 / -1;
  margin: 0;
  color: #52645a;
  font-size: 13px;
  line-height: 1.5;
}

.header-update strong {
  margin-inline-end: 0.3em;
  color: #246b56;
}

/* Picture-book colors and tactile, low-contrast surfaces. */
:root {
  --ink: #4b3429;
  --muted-ink: #6f5748;
  --paper: #fcf6ea;
  --surface: #fffaf0;
  --edge: #d8bda3;
  --rose: #f6d9d8;
  --honey: #faeac2;
  --sage: #e8ebcf;
  --sky: #e1edf1;
  --lavender: #eeddeb;
  --peach: #f8e1cf;
  --focus: #895062;
}

body {
  background:
    url("./assets/paper.webp") repeat,
    radial-gradient(ellipse at top, #fffdf3, var(--paper) 75%);
  color: var(--ink);
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic", system-ui, sans-serif;
  line-height: 1.5;
}

header, main {
  max-width: 1160px;
}

header {
  padding-block: 17px 7px;
}

.pet-brand h1 {
  display: flex;
  align-items: center;
  gap: .35em;
  font-size: clamp(17px, 4.5vw, 31px);
  line-height: 1.2;
  letter-spacing: -.025em;
}

.sketch-icon {
  width: 1.5em;
  height: 1.5em;
  flex: none;
  vertical-align: -.35em;
}

.header-update {
  color: var(--muted-ink);
  padding: 4px 0;
}

.header-update strong {
  color: #8a4b4e;
}

small {
  color: var(--muted-ink);
}

.story-home {
  margin-bottom: clamp(16px, 2.5vw, 28px);
}

.story-picture, .story-picture img {
  display: block;
  width: 100%;
}

.story-picture {
  border-radius: 22px 26px 20px 25px;
  overflow: hidden;
  border: 1px solid var(--edge);
  background: var(--paper);
}

.story-picture img {
  aspect-ratio: 1280 / 427;
  object-fit: cover;
  height: auto;
}

.story-shortcuts {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 9px;
  margin-top: 12px;
}

.shortcut {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 88px;
  padding: 7px 4px;
  text-align: center;
  text-decoration: none;
  font-size: clamp(12px, 1.55vw, 16px);
  font-weight: 700;
  line-height: 1.3;
  border: 1px solid var(--edge);
  border-radius: 22px 25px 21px 26px;
  box-shadow: inset 0 0 0 3px #fff9ed86, 0 2px 0 #99755316;
}

.shortcut .sketch-icon {
  width: 35px;
  height: 35px;
}

.story-shortcuts .shortcut-map { background-color: var(--rose); }
.story-shortcuts .shortcut-weekend { background-color: var(--honey); }
.story-shortcuts .shortcut-next { background-color: var(--sage); }
.story-shortcuts .shortcut-search { background-color: var(--sky); }
.story-shortcuts .shortcut-favorites { background-color: var(--lavender); }
.story-shortcuts .shortcut-notice { background-color: var(--peach); }

button, select, input, .pet-upload {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--edge);
  border-radius: 16px;
}

button {
  background: var(--honey);
  font-weight: 600;
}

button:disabled {
  opacity: .7;
  cursor: wait;
}

button.active, .pet-primary, .feedback-link {
  background: #8a515a;
  color: #fffaf0;
  border-color: #8a515a;
}

.feedback-link:hover {
  background: #77424b;
}

button:focus-visible, a:focus-visible, summary:focus-visible,
select:focus-visible, input:focus-visible, .pet-upload:focus-within {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.pet-avatar, #pet-preview {
  background: var(--rose);
  border-color: var(--edge);
}

#pet-preview .sketch-icon {
  width: 65px;
  height: 65px;
}

a {
  color: #775065;
  text-underline-offset: .18em;
}

.event-filters, .daily-panel, .event, .map-tools, footer details {
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: 20px 24px 21px 23px;
}

.event-filters, .event {
  box-shadow: 0 3px 0 #99755313;
}

#filter-heading {
  margin: 0 0 9px;
  font-size: 17px;
}

#filter-heading .sketch-icon {
  margin-inline-end: .4em;
}

.advanced-fields {
  border-color: var(--edge);
}

#advanced-count {
  background: #8a515a;
}

#map {
  border: 1px solid var(--edge);
  border-radius: 20px 23px 23px 19px;
  background: #eee8d8;
}

.leaflet-bar a,
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: var(--surface);
  color: var(--ink);
}

.map-tools {
  padding: 6px 9px;
}

#loc, .event-actions button, .v10-actions button {
  background: var(--sage);
}

#unmapped, #share-app {
  background: var(--sky);
}

.event {
  border-inline-start: 4px solid #c4c596;
}

.event h3 {
  line-height: 1.45;
}

.weather, .v10-tag {
  background: var(--sage);
  color: var(--ink);
}

#pet-dialog, .extra-dialog {
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: 22px 26px 23px 27px;
  box-shadow: 0 12px 35px #4b342943;
}

.extra-dialog {
  max-height: 90dvh;
  overflow: auto;
}

#pet-dialog::backdrop, .extra-dialog::backdrop {
  background: #4937298c;
}

footer details {
  padding: 8px 13px;
}

footer summary {
  min-height: 36px;
  align-content: center;
}

@media (hover: hover) {
  button:not(:disabled):hover, .shortcut:hover {
    box-shadow: 0 2px 4px #76503930;
  }
}

@media (prefers-reduced-motion: no-preference) {
  button, .shortcut {
    transition: transform .24s cubic-bezier(.23, 1.55, .53, 1), box-shadow .16s ease;
  }

  button:active:not(:disabled), .shortcut:active {
    transform: scale(.95);
    transition-duration: .08s;
  }
}

@media (max-width: 700px) {
  header {
    padding: 10px 12px 4px;
  }

  header .pet-brand h1 {
    font-size: clamp(15px, 4.6vw, 24px);
  }

  .header-update {
    font-size: 12px;
  }

  .story-shortcuts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-top: 8px;
  }

  .shortcut {
    min-height: 62px;
    border-radius: 17px 19px 16px 20px;
  }

  .shortcut .sketch-icon {
    width: 26px;
    height: 26px;
  }

  .story-picture {
    border-radius: 15px 18px 14px 19px;
  }
}

.story-banner {
  position: relative;
}

.story-caption {
  position: absolute;
  top: 50%;
  right: 3%;
  width: 43%;
  transform: translateY(-55%) rotate(-3deg);
  margin: 0;
  color: #52392c;
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic", system-ui, sans-serif;
  font-size: clamp(15px, 3.85vw, 49px);
  font-weight: 800;
  line-height: 1.38;
  text-align: center;
  text-shadow: 0 1px #fff9ec;
}

.story-caption::after {
  display: block;
  width: 72%;
  height: .3em;
  margin: .1em auto 0;
  border-radius: 50%;
  border-bottom: .09em solid #b96575;
  content: "";
}

@media (max-width: 390px) {
  .story-caption {
    right: 2%;
    width: 44%;
    font-size: clamp(12px, 3.9vw, 15px);
  }
}

.top-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-bottom: 10px;
  padding: 4px 10px;
  border: 1px solid var(--edge);
  border-radius: 16px;
  background: var(--surface);
  font-size: 13px;
}

.top-weather {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  min-width: 0;
}

.top-weather small, .top-weather button {
  font-size: inherit;
}

.top-weather button {
  background: var(--sky);
  padding: 4px 10px;
}

.top-info #visitor-count {
  grid-area: auto;
  padding: 3px 6px;
  background: var(--sage);
  color: var(--ink);
}
