@import url("https://fonts.googleapis.com/css2?family=Silkscreen:wght@400;700&family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,700;1,9..40,400&display=swap");
@import "./reset.css";

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  overflow-x: hidden;
}

:root {
  --bg: #fff5ee;
  --bg-panel: #ffede4;
  --bg-card: #ffffff;
  --bg-hover: #fff0e8;
  --border: #e0b0b8;
  --border-bright: #c87888;
  --text: #3c1828;
  --text-dim: #8a5868;
  --text-bright: #2a0e18;
  --list-title-bg: #e6f8e2;
  --accent: #ff6888;
  --accent-dim: #ff769b;
  --pixel-border: #3c1828;
  --shadow: 3px 3px 0 #3c1828;
  --shadow-sm: 2px 2px 0 #3c1828;

  --tag-other: #a89098;

  --font-body: "DM Sans", "Helvetica Neue", sans-serif;
  --font-pixel: "Silkscreen", "Courier New", monospace;

  --tab-accent: #fff3d0;
  --tab-accent: var(--bg-panel);
  --tab-text: #705010;
  --tab-text-dim: #b0a070;
  --tab-active-bg: rgba(112, 80, 16, 0.1);
  --header-pad: 1.25rem;

  @media (max-width: 768px) {
    header-pad: 0.5rem;
  }

  /* font sizes */
  --size-xs: 0.75rem;
  --size-sm: 0.875rem;
  --size-base: 1rem;
  --size-lg: 1.125rem;
  --size-xl: 1.25rem;
  --size-2xl: 1.5rem;
  --size-3xl: 1.875rem;
  --size-4xl: 2.25rem;
  --size-5xl: 3rem;
}

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  display: grid;
  grid-template-rows: auto auto 1fr;
  grid-template-columns: minmax(0, 1fr) 0; /* was 1fr 0 */
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* ── SCROLLBAR ───────────────────────────────────────── */
::-webkit-scrollbar {
  width: 0.5rem;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border: 2px solid var(--pixel-border);
  border-radius: 0;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* ── BUTTON ──────────────────────────────────────────── */

.btn {
  border: 2px solid var(--pixel-border);
  background: var(--bg-card);
  color: var(--text);
  padding: 0 0.75rem;
  height: 1.9rem;
  border-radius: 4px;
  font-family: var(--font-pixel);
  font-size: var(--size-base);
  cursor: pointer;
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
  text-transform: lowercase;
  letter-spacing: 1px;
  box-shadow: var(--shadow-sm);
  transition: all 0.1s;
  text-decoration: none;
  align-items: center;
  justify-content: center;

  &:hover {
    background: var(--accent);
    color: #fff;
  }

  &:active {
    box-shadow: none;
    transform: translate(2px, 2px);
  }
}

.copy-btn {
  display: block;
}

/* ── HEADER ──────────────────────────────────────────── */
header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem var(--header-pad) 0;
  background: var(--bg-panel);
  position: relative;
  grid-column: 1/-1;
  min-width: 0;
}

header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: repeating-linear-gradient(90deg, var(--accent) 0 8px, #ffb0c8 8px 16px, #a870d8 16px 24px, #48b898 24px 32px, #d8b840 32px 40px);
  image-rendering: pixelated;
}
header a {
  color: inherit;
  text-decoration: none;
}

header h1 {
  font-family: var(--font-pixel);
  font-size: clamp(1.15rem, 0.7rem + 3.4vw, 3.25rem);
  margin: 0 0 1.7rem;
  letter-spacing: 1px;
  line-height: 1.18;
  font-weight: 700;
  color: var(--accent);
  text-transform: lowercase;
  text-shadow: 2px 2px 0 rgba(60, 24, 40, 0.1);

  flex: 1 1 auto;
  min-width: 0;

  @media (max-width: 768px) {
    margin: 0.4rem 0 1rem;
  }
}

header h1::after {
  content: " ~";
  color: #d8b840;

  @media (max-width: 768px) {
    content: "";
  }
}
.title-tail {
  white-space: nowrap;
}

.header-tools {
  flex: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tool-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2rem;
  border: 2px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  border-radius: 4px;
  box-shadow: none;
  transition: all 0.1s;
}

.tool-icon:hover {
  border-color: var(--pixel-border);
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.tool-icon:active {
  box-shadow: none;
  transform: translate(2px, 2px);
}

.tool-icon:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 104, 136, 0.25);
}

.tool-icon:active {
  box-shadow: none;
  transform: translate(2px, 2px);
}

.tool-icon svg {
  width: 1.6rem;
  height: 1.6rem;
}

.tool-icon svg,
.h-search .mag {
  shape-rendering: crispEdges;
}

.h-search {
  display: inline-flex;
  align-items: center;
}

.h-search-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 2.5rem;
  height: 2rem;
  padding: 0 0.45rem;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 4px;
  box-shadow: none;
  cursor: text;
  overflow: hidden;
  transition: all 0.1s;
}

.h-search-box:focus-within {
  width: auto;
}

.h-search-box:hover {
  border-color: var(--pixel-border);
  box-shadow: var(--shadow-sm);
}

.h-search-box:active {
  box-shadow: none;
  transform: translate(2px, 2px);
}

.h-search-box:focus-within {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 104, 136, 0.25);
}

.h-search-box:hover .mag {
  color: var(--accent);
}

.h-search .mag {
  flex: none;
  width: 1.3rem;
  height: 1.3rem;
  color: var(--text-dim);
  transform: none;
}

.h-search input {
  width: 0;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  font-family: var(--font-pixel);
  font-size: var(--size-sm);
  color: var(--text);
  opacity: 0;
  transition:
    width 0.18s,
    opacity 0.18s,
    margin-left 0.18s;
}

.h-search input::placeholder {
  color: var(--tab-text-dim);
}

.h-search input:focus {
  outline: none;
}

.h-search input:focus,
.h-search input:not(:placeholder-shown) {
  width: 10rem;
  margin-left: 0.45rem;
  opacity: 1;
}

@media (max-width: 768px) {
  header {
    padding: 0.95rem 0.9rem 0;
  }

  .header-tools {
    gap: 0.3rem;
  }

  .h-search-box,
  .tool-icon {
    height: 1.6rem;
  }
  .h-search-box,
  .tool-icon {
    width: 2rem;
  }
  .h-search-box:focus-within {
    width: auto;
  }
  .h-search-box {
    padding: 0 0.3rem;
  }

  .h-search .mag,
  .tool-icon svg {
    width: 1rem;
    height: 1rem;
  }

  .h-search input:focus,
  .h-search input:not(:placeholder-shown) {
    width: 6rem;
    margin-left: 0.3rem;
  }
}

/* ── NAV ──────────────────────────────────────────── */
nav {
  background: var(--bg-panel);
  grid-column: 1/-1;
}

.tab-label-mobile {
  display: none;
}
.tab-label-full {
  display: inline;
}

@media (max-width: 768px) {
  .tab-label-full {
    display: none;
  }
  .tab-label-mobile {
    display: inline;
  }
}

nav .top-tabs {
  display: flex;
  padding: 0 var(--header-pad);
  gap: 2px;
  position: relative;
  z-index: 1;
  list-style: none;
}

nav .top-tabs a[aria-current="page"] {
  background: var(--tab-accent);
  color: var(--tab-text);
  margin-bottom: -2px;
  padding-bottom: calc(0.5rem + 2px);
}

nav .top-tabs a {
  background: var(--bg-card);
  font-family: var(--font-pixel);
  border: 2px solid var(--pixel-border);
  border-bottom: none;
  color: var(--text-dim);
  border-radius: 6px 6px 0 0;
  text-transform: lowercase;
  letter-spacing: 1px;
  text-decoration: none;
  display: inline-block;
  position: relative;
  padding: 0.5rem clamp(0.55rem, 2vw, 1rem);
  font-size: clamp(0.92rem, 0.55rem + 0.7vw, 1rem);
  white-space: nowrap;
  transition:
    transform 0.15s ease-out,
    color 0.15s,
    background 0.15s;
}

nav .top-tabs a::after {
  content: "";
  position: absolute;
  left: -2px;
  right: -2px;
  bottom: -3px;
  height: 3px;
  background: var(--bg-hover);
  border-left: 2px solid var(--pixel-border);
  border-right: 2px solid var(--pixel-border);
  opacity: 0;
  transition: opacity 0.1s;
  pointer-events: none;
}

nav .top-tabs a:not([aria-current="page"]):hover {
  transform: translateY(-3px);
  background: var(--bg-hover);
  color: var(--accent);
}

nav .top-tabs a:not([aria-current="page"]):hover::after {
  opacity: 1;
}

nav .sub-tabs {
  background: var(--tab-accent);
  border-top: 2px solid var(--pixel-border);
  padding: 0.6rem var(--header-pad);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
}

.sub-tabs .zone-date {
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
  white-space: nowrap;
  margin-top: 0.3rem;
}

.sub-tabs .zone-date time {
  font-family: var(--font-pixel);
  font-size: var(--size-lg);
  color: var(--accent);
  letter-spacing: 1px;
  min-width: 13rem;
  text-align: center;
  white-space: nowrap; 
}

.sub-tabs .date-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  color: var(--text);
  border-radius: 50%;
  flex: none;
  transition:
    background 0.12s,
    color 0.12s;

  @media (max-width: 768px) {
    width: 2.6rem;
    height: 2.6rem;
  }
}
.sub-tabs .date-arrow svg {
  width: 1.65rem;
  height: 1.65rem;
}
.sub-tabs .date-arrow:hover {
  background: var(--tab-active-bg);
  color: var(--accent);
}
.sub-tabs .date-arrow:active {
  background: var(--accent);
  color: #fff;
}

.sub-tabs .date-today {
  font-family: var(--font-pixel);
  font-size: var(--size-xs);
  color: var(--tab-text-dim);
  text-transform: lowercase;
  letter-spacing: 1px;
  padding: 0.3rem 0.45rem;
  border-radius: 4px;
  margin-left: 0.5rem;
  text-decoration: none;
}

.sub-tabs .date-today:hover {
  background: var(--tab-active-bg);
  color: var(--tab-text);
}

.date-short {
  display: none;
}

@media (max-width: 768px) {
  .date-full {
    display: none;
  }
  .date-short {
    display: inline;
  }
}

.sub-tabs .zone-tools {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  white-space: nowrap;

  @media (max-width: 768px) {
    gap: 3px;
  }
}

.sub-tabs .view-switcher {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
}

.sub-tabs .tab {
  background: transparent;
  border: none;
  padding: 0.35rem 0.7rem;
  font-family: var(--font-pixel);
  font-size: var(--size-sm);
  color: var(--tab-text-dim);
  text-transform: lowercase;
  letter-spacing: 1px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  border-radius: 4px;
}

.sub-tabs .tab[aria-current="page"],
.sub-tabs .tab:hover {
  background: var(--tab-active-bg);
  color: var(--tab-text);
}

.sub-tabs .view-select {
  display: none;
  font-family: var(--font-pixel);
  font-size: var(--size-sm);
  color: var(--tab-text);
  text-transform: lowercase;
  letter-spacing: 1px;
  background: var(--bg-card);
  border: 1px solid var(--pixel-border);
  border-radius: 4px;
  padding: 0.3rem 1.7rem 0.3rem 0.6rem;
  cursor: pointer;
  transition: all 0.1s;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23705010'><path d='M7 10l5 5 5-5z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.3rem center;
  background-size: 1.1rem;
}

.sub-tabs .view-select:hover {
  background-color: var(--bg-hover);
  border-color: var(--border-bright);
}
.sub-tabs .view-select:focus {
  outline: none;
  border-color: var(--accent);
}
.sub-tabs .view-select:active {
  /* box-shadow: none; */
  transform: translate(2px, 2px);
}

.sub-tabs .view-select option {
  background: var(--bg-card);
  color: var(--text);
  font-family: var(--font-pixel);
}

.sub-tabs .map-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  flex: none;
}
.sub-tabs .map-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: #2f8468;
  padding: 0.35rem;
  border-radius: 4px;
}
.sub-tabs .map-toggle svg {
  width: 1.1rem;
  height: 1.1rem;
}
.sub-tabs .map-toggle:hover {
  color: #23624f;
}
.sub-tabs .map-toggle.active {
  background: #2f8468;
  color: #fff;
}

.sub-tabs .filter-toggle,
.sub-tabs .filter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2rem;
  padding: 0;
  background: var(--bg-card);
  color: var(--text-dim);
  border: 2px solid var(--border);
  border-radius: 4px;
  box-shadow: none;
  cursor: pointer;
  transition: all 0.1s;
}
.sub-tabs .filter-toggle:hover,
.sub-tabs .filter-btn:hover {
  border-color: var(--pixel-border);
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.sub-tabs .filter-toggle:active,
.sub-tabs .filter-btn:active {
  box-shadow: none;
  transform: translate(2px, 2px);
}
.sub-tabs .filter-toggle:focus-visible,
.sub-tabs .filter-btn:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 104, 136, 0.25);
}
.sub-tabs .filter-toggle svg,
.sub-tabs .filter-btn svg {
  width: 1.1rem;
  height: 1.1rem;
}
.sub-tabs .filter-toggle.has-filters {
  background: var(--accent);
  color: #fff;
  border-color: var(--pixel-border);
}

@media (max-width: 768px) {
  nav .sub-tabs {
    padding: 0.5rem 0.9rem;
    gap: 0.5rem;
  }
  .sub-tabs .zone-date time {
    min-width: 0;
    font-size: var(--size-sm);
  }
  .sub-tabs .date-today {
    display: none;
  }

  .sub-tabs .view-switcher {
    display: none;
  }
  .sub-tabs .view-select {
    display: inline-block;
  }
  .sub-tabs .filter-toggle,
  .sub-tabs .filter-btn {
    width: 2rem;
    height: 1.6rem;
  }
  .sub-tabs .filter-toggle svg,
  .sub-tabs .filter-btn svg {
    width: 1rem;
    height: 1rem;
  }
}

.sub-tabs .drawer-toggle .icon-close {
  display: none;
}

body.drawer-open .sub-tabs .drawer-toggle .icon-open {
  display: none;
}
body.drawer-open .sub-tabs .drawer-toggle .icon-close {
  display: inline-flex;
}
body.drawer-open .sub-tabs .drawer-toggle {
  background: var(--accent);
  color: #fff;
  border-color: var(--pixel-border);
}

.ics-ui {
  display: flex;
  align-items: center;
  padding: 0.6rem var(--header-pad);
}

#ics-url {
  height: 2rem;
  padding: 0 0.6rem;
  margin: 0 0.6rem;

  font-family: var(--font-pixel);
  font-size: var(--size-sm);
  color: var(--text);
  background: var(--bg-card);
  border: 2px solid var(--pixel-border);
  border-radius: 4px;
  box-shadow: var(--shadow-sm);
  max-width: 50rem;
}

/* ── CONTENT ─────────────────────────────────────────── */
.calendar-body {
  overflow: hidden;
  position: relative;
  overflow-y: auto;

  .view {
    width: 100%;
    display: none;
    position: absolute;
    -webkit-overflow-scrolling: touch;

    &.active {
      display: block;
    }
  }

  .empty {
    color: var(--text-dim);
    padding: 3.75rem 0;
    text-align: center;
    font-family: var(--font-pixel);
    font-size: var(--size-sm);
    letter-spacing: 1px;
  }
}

/* ── LIST ────────────────────────────────────────────── */

.list-view {
  /* TODO: remove this 100vw hack */

h2 {
    font-family: var(--font-pixel);
    color: var(--accent);
    letter-spacing: 2px;
    background-color: var(--bg);
    z-index: 1;

    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.9rem 1.25rem 0.5rem;

    top: 0;
    position: sticky;
  }

  h2::before {
    content: "";
    flex: none;
    width: 1rem;
    height: 1rem;
    image-rendering: pixelated;
    background: repeating-linear-gradient(
      180deg,
      var(--accent) 0 5px,
      #ffb0c8 5px 10px,
      #a870d8 10px 15px,
      #48b898 15px 20px,
      #d8b840 20px 25px
    );
  }

  li {
    display: grid;
    grid-template-columns: 6.25rem 1fr;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid #f0e0dd;
    cursor: pointer;
    align-items: start;
    transition: all 0.15s ease;
    color: var(--text-dim);
    font-size: var(--size-sm);

    @media (max-width: 768px) {
      grid-template-columns: 4.5rem 1fr;
    }

    &:hover {
      background: var(--bg-hover);
    }
  }

  .list-event-time span {
    white-space: nowrap;
  }

  .list-event-info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
  }

  h3 {
    font-size: var(--size-base);
    font-weight: 600;
    color: var(--text-bright);
  }

  .list-event-tag-dot {
    width: 0.5rem;
    height: 0.5rem;
    display: inline-block;
    border-radius: 2px;
    margin-right: 0.25rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
  }

  .list-event-price {
    font-family: var(--font-pixel);
    font-size: var(--size-xs);
    color: #48b898;
  }

 section {
    position: relative;
  }

  /* section::before {
    content: "";
    position: absolute;
    left: 0.6rem;
    top: 0.5rem;
    bottom: 0.5rem;
    width: 4px;
    border-radius: 2px;
    z-index: 2;
    background: repeating-linear-gradient(
      180deg,
      var(--accent) 0 8px,
      #ffb0c8 8px 16px,
      #a870d8 16px 24px,
      #48b898 24px 32px,
      #d8b840 32px 40px
    );
  } */
}

/* ── LIST EXPAND (hover preview) ─────────────────────── */
/* TODO: not using this but maybe we should?? */
.list-event-expand {
  display: grid;
  grid-template-rows: 0fr;
  transition:
    grid-template-rows 0.2s ease-out,
    opacity 0.15s ease-out;
  opacity: 0;
  grid-column: 1 / -1;
}

.list-event-expand > div {
  overflow: hidden;
}

.list-event.previewing .list-event-expand {
  grid-template-rows: 1fr;
  opacity: 1;
}

.list-event.previewing {
  background: var(--bg-hover);
}

.list-expand-inner {
  padding: 0.25rem 0 0.4rem 7rem;
  font-size: var(--size-sm);
  line-height: 1.5;
}

.list-expand-desc {
  color: var(--text-dim);
  margin-top: 0.25rem;
  max-height: 3.1rem;
  overflow: hidden;
}

.list-expand-tags {
  display: flex;
  gap: 0.25rem;
  margin-top: 0.25rem;
}

.list-expand-tag {
  font-family: var(--font-pixel);
  font-size: var(--size-xs);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  color: #fff;
  font-weight: 400;
}

/* ── MAP ─────────────────────────────────────────────── */
#map-container {
  position: absolute;
  inset: 0;
  display: none;
  z-index: 3;
}

#map-container.active {
  display: block;
}

#map {
  width: 100%;
  height: 100%;
}

.map-popup-title {
  font-weight: 600;
  font-size: var(--size-sm);
  margin-bottom: 0.25rem;
  color: var(--text-bright);
}

.map-popup-time {
  font-size: var(--size-sm);
  color: var(--text-dim);
}

.map-popup-loc {
  font-size: var(--size-xs);
  color: var(--text-dim);
  margin-top: 0.15rem;
}

/* ── MODAL ───────────────────────────────────────────── */

.modal {
  background: var(--bg-card);
  border: 3px solid var(--pixel-border);
  border-radius: 12px;
  padding: 1.5rem 1.75rem;
  max-width: 36rem;
  width: 100%;
  position: relative;
  box-shadow:
    4px 4px 0 var(--pixel-border),
    0 8px 24px rgba(60, 24, 40, 0.1);
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
  margin: auto;

  @media(max-width: 480px) {
    position: fixed;
    max-height: 60vh;
  }

  &.month-modal {
    max-width: 20rem;
  }

  .modal-x {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    background: var(--bg-panel);
    border: 2px solid var(--pixel-border);
    font-size: var(--size-lg);
    cursor: pointer;
    color: var(--text);
    font-family: var(--font-pixel);
    width: 2rem;
    height: 2rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    box-shadow: var(--shadow-sm);
    transition: all 0.1s;
  }

  .modal-x:hover {
    background: var(--accent);
    color: #fff;
  }

  .modal-x:active {
    box-shadow: none;
    transform: translate(2px, 2px);
  }

  .modal-tags {
    display: flex;
    gap: 0.3rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
  }

  .modal-row {
    /* so that links don't overflow */
    word-break: break-word;
  }

  .modal-tag {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-family: var(--font-pixel);
    font-size: var(--size-xs);
    color: #fff;
    text-transform: lowercase;
    letter-spacing: 1px;
    border: 1px solid rgba(0, 0, 0, 0.1);
  }

  h2,
  h3 {
    font-family: var(--font-pixel);
    font-weight: 400;
    color: var(--text-bright);
    letter-spacing: 0.5px;
    line-height: 1.4;
  }

  h2 {
    font-size: var(--size-lg);
    padding-right: 2.25rem;
    margin-bottom: 1rem;
  }

  h3 {
    font-size: var(--size-sm);
    margin: 0.25rem 0;
  }

  .star-form {
    display: inline;
  }

  .star-btn {
    display: inline;
    background: none;
    border: none;
    padding: 0;
    margin-right: 0.25rem;
    cursor: pointer;
    font-size: 1em;
    color: #d8b840;
    vertical-align: baseline;
  }

  .modal-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    font-size: var(--size-sm);
    color: var(--text);
  }

  .modal-label {
    font-family: var(--font-pixel);
    color: var(--text-dim);
    min-width: 3.25rem;
    font-size: var(--size-xs);
    text-transform: lowercase;
    padding-top: 0.15rem;
    letter-spacing: 1px;
  }

  .modal-row a {
    color: #358a72;
    text-decoration: none;
    font-weight: 500;
  }

  .modal-row a:hover {
    text-decoration: underline;
  }

  .modal-desc {
    margin-top: 0.9rem;
    font-size: var(--size-sm);
    color: var(--text-dim);
    line-height: 1.7;
  }

  .modal-video {
    margin-top: 0.9rem;
    aspect-ratio: 16 / 9;
    width: 100%;
  }

  .modal-video iframe {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 8px;
  }

  .modal-link-previews {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 0.6rem;
  }

  .modal-link-preview {
    display: flex;
    gap: 0.6rem;
    padding: 0.5rem 0.6rem;
    border: 2px solid var(--border);
    border-radius: 6px;
    text-decoration: none;
    color: var(--text);
    transition: all 0.1s;
    overflow: hidden;
  }

  .modal-link-preview:hover {
    background: var(--bg-hover);
    border-color: var(--border-bright);
  }

  .modal-link-preview-img {
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg-panel);
  }

  .modal-link-preview-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.1rem;
  }

  .modal-link-preview-title {
    font-size: var(--size-sm);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-bright);
  }

  .modal-link-preview-domain {
    font-size: var(--size-xs);
    color: var(--text-dim);
  }

  .modal-link-preview-desc {
    font-size: var(--size-xs);
    color: var(--text-dim);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  @media (max-width: 768px) {
    .modal-bg {
      padding: 0;
      align-items: flex-end;
    }

    .modal-x {
      top: 0.5rem;
      right: 0.5rem;
      width: 2.1rem;
      height: 2.1rem;
    }

    .modal h2 {
      font-size: var(--size-sm);
    }
  }
}

/* ── DRAWERS (filter + festival) ── */
body {
  grid-template-columns: minmax(0, 1fr) 0;
  transition: grid-template-columns 0.2s ease;
}
body.drawer-open {
  grid-template-columns: minmax(0, 1fr) fit-content(15rem);
}

.drawer {
  grid-row: 3;
  grid-column: 2;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-card);
  border-left: 2px solid var(--pixel-border);
  padding: 1rem 0.85rem;
  display: none;
  background-color: var(--bg-panel);
}
.drawer.open {
  display: block;
}

.drawer h2 {
  font-family: var(--font-pixel);
  font-size: var(--size-base);
  text-transform: lowercase;
  color: var(--text-dim);
  margin-bottom: 0.6rem;
  letter-spacing: 2px;
}



/* filter chips */
.filter-panel .filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.7rem;
  border-radius: 4px;
  border: 2px solid var(--border);
  font-family: var(--font-pixel);
  font-size: var(--size-sm);
  cursor: pointer;
  white-space: nowrap;
  background: var(--bg-card);
  color: var(--text);
  transition: all 0.1s;
  user-select: none;
  margin: 0 0.25rem 0.3rem 0;
  text-transform: lowercase;
  text-decoration: none;
}
.filter-panel .filter-chip:hover {
  background: var(--bg-hover);
  border-color: var(--border-bright);
}
.filter-panel .filter-chip.active {
  color: #fff !important;
  border-color: transparent !important;
}

/* festival list */
.festival-sidebar {
  gap: 0.125rem;
  overflow: clip;
}
.festival-sidebar-item {
  display: block;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: var(--size-xs);
  font-family: var(--font-pixel);
  color: var(--text);
  text-decoration: none;
}
.festival-sidebar-item:hover {
  background: var(--bg-hover);
}
.festival-sidebar-item.active {
  background: var(--accent);
  color: #fff;
}

.drawer-backdrop {
  display: none;
}

@media (max-width: 768px) {
  body,
  body.drawer-open {
    grid-template-columns: minmax(0, 1fr);
  }
  .calendar-body {
    grid-row: 3;
    grid-column: 1;
  }

  .drawer {
    grid-row: 3;
    grid-column: 1;
    width: 100%;
    z-index: 60;
    display: block;
    transform: translateX(100%);
    transition: transform 0.22s ease;
    border-left: none;
    padding: 1rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
      background-color: var(--bg-panel);

  }
  .drawer.open {
    transform: translateX(0);
  }

  .drawer-backdrop.open {
    display: none;
  }

  body.drawer-open {
    overflow: hidden;
  }
}

/* ═══════════════════════════════════════════════════════
MOBILE RESPONSIVE
═══════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  body {
    overflow-x: hidden;
    overflow-y: auto;
    grid-template-rows: auto auto 1fr;
  }

  .calendar-body {
    overflow: visible;
    min-height: calc(100vh - 7.5rem);
    position: relative;
  }

  .view {
    position: static;
    overflow: visible;
  }

  /* #view-week,
  #view-month {
    display: none !important;
  } */

  .month-cell {
    min-height: 3.5rem;
    padding: 0.1rem 0.2rem;
  }

  .month-dow {
    font-size: var(--size-xs);
    padding: 0.4rem 0;
  }

  .day-num {
    font-size: var(--size-sm);
    width: 1.4rem;
    height: 1.4rem;
  }

  .event-pill {
    font-size: var(--size-xs);
    padding: 0 0.25rem;
    border-left-width: 2px;
  }

  .month-more {
    font-size: var(--size-xs);
  }

  .week-scroll-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    min-width: 100%;
  }

  .week-scroll-wrapper .week-header,
  .week-scroll-wrapper .week-body {
    /* min-width: 40rem; */
  }

  .day-allday {
    padding: 0.4rem 0.75rem 0.4rem 3.5rem;
  }

  .day-date-banner {
    padding-left: 3.5rem;
  }

  .day-timeline {
    grid-template-columns: 3rem;
  }

  .day-hour {
    font-size: var(--size-xs);
    padding: 0 0.25rem;
  }

  .day-event-block {
    padding: 0.2rem 0.4rem;
    font-size: var(--size-sm);
    margin-right: 4px;
  }

  .day-event-block .ev-time {
    font-size: var(--size-xs);
  }

  #map-container {
    position: relative;
    height: 60vh;
    min-height: 18.75rem;
  }

  @media (max-width: 480px) {
    .month-more {
      display: none;
    }

    .month-cell {
      min-height: 3rem;
      padding: 0.1rem;
      cursor: pointer;
      -webkit-tap-highlight-color: rgba(255, 104, 136, 0.1);
    }

    .month-cell:active {
      background: var(--bg-hover);
    }

    .day-num {
      width: 1.25rem;
      height: 1.25rem;
      font-size: var(--size-xs);
    }

    .month-dow {
      font-size: var(--size-xs);
    }

    .list-event {
      grid-template-columns: 4rem 1fr;
      gap: 0.4rem;
      padding: 0.6rem 0.75rem;
    }

    .list-event-time {
      font-size: var(--size-sm);
    }

    .list-event-title {
      font-size: var(--size-sm);
      gap: 0.25rem;
    }

    .list-event-tag-dot {
      width: 0.4rem;
      height: 0.4rem;
    }

    .list-event-loc {
      font-size: var(--size-xs);
    }

    .list-expand-inner {
      padding: 0.25rem 0 0.4rem 4.4rem;
    }

    .day-timeline {
      grid-template-columns: 2.75rem;
    }

    .day-allday {
      padding: 0.4rem 0.5rem 0.4rem 3rem;
    }

    .day-date-banner {
      padding-left: 3rem;
      font-size: var(--size-xs);
    }
  }

  @media (max-width: 768px) {
    .view.swiping-left {
      animation: swipeHintLeft 0.3s ease-out;
    }

    .view.swiping-right {
      animation: swipeHintRight 0.3s ease-out;
    }

    @keyframes swipeHintLeft {
      from {
        transform: translateX(0);
        opacity: 1;
      }

      to {
        transform: translateX(-30px);
        opacity: 0.6;
      }
    }

    @keyframes swipeHintRight {
      from {
        transform: translateX(0);
        opacity: 1;
      }

      to {
        transform: translateX(30px);
        opacity: 0.6;
      }
    }
  }

  @media (pointer: coarse) {
    .event-pill {
      padding: 0.2rem 0.4rem;
      line-height: 1.6;
    }

    .list-event {
      min-height: 3rem;
    }

    .day-allday-chip {
      padding: 0.3rem 0.6rem;
    }

    .day-event-block {
      padding: 0.3rem 0.5rem;
      min-height: 1.75rem;
    }
  }

  @media (max-height: 500px) and (max-width: 900px) {
    header {
      padding: 0.25rem 0.75rem 0;
    }

    .modal {
      max-height: 90vh;
    }

    #map-container {
      height: 50vh;
    }
  }
}
