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

/* ── Fonts & Palette ───────────────────────── */
:root {
  --kraft:    #c9a97a;
  --paper:    #fdf6e9;
  --paper2:   #f5ead4;
  --ink:      #2c1a0e;
  --ink-soft: #5c3d2e;
  --orange:   #d4622a;
  --green:    #4a7c4e;
  --red:      #b33030;
  --blue:     #2a5f8f;
  --purple:   #6b3fa0;
  --teal:     #1e7a72;
  --amber:    #c07c10;
}

body {
  font-family: 'Nunito', sans-serif;
  background-color: var(--kraft);
  background-image:
    repeating-linear-gradient(0deg,   transparent, transparent 28px, rgba(0,0,0,.04) 28px, rgba(0,0,0,.04) 29px),
    repeating-linear-gradient(90deg,  transparent, transparent 28px, rgba(0,0,0,.02) 28px, rgba(0,0,0,.02) 29px);
  color: var(--ink);
  min-height: 100vh;
}

/* ── Header ────────────────────────────────── */
header {
  background: var(--ink);
  color: var(--paper);
  text-align: center;
  padding: 2.5rem 1.5rem 2.25rem;
  position: relative;
  border-bottom: 6px solid var(--orange);
}
header::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(45deg, transparent, transparent 3px, rgba(255,255,255,.02) 3px, rgba(255,255,255,.02) 6px);
  pointer-events: none;
}
.eyebrow {
  font-family: 'Caveat', cursive;
  font-size: 1rem;
  letter-spacing: .1em;
  color: rgba(255,255,255,.5);
  margin-bottom: .4rem;
}
header h1 {
  font-family: 'Caveat', cursive;
  font-size: clamp(2.4rem, 7vw, 4rem);
  font-weight: 700;
  line-height: 1;
  color: var(--paper);
}
header h1 span { color: var(--orange); }
.subtitle {
  margin-top: .6rem;
  font-size: .95rem;
  color: rgba(255,255,255,.6);
}

/* ── Grid ──────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  max-width: 1200px;
  margin: 2.5rem auto 4rem;
  padding: 0 1.5rem;
}

/* ── Card (scrapbook style) ────────────────── */
.card {
  position: relative;
  background: var(--paper);
  border-radius: 3px;
  padding: 0 0 1rem;
  cursor: pointer;
  outline: none;
  /* Tape padding at top */
  padding-top: 14px;
  /* Paper shadow */
  box-shadow:
    2px 2px 0 rgba(0,0,0,.08),
    4px 4px 0 rgba(0,0,0,.05),
    6px 6px 12px rgba(0,0,0,.18);
  transition: transform .3s ease, box-shadow .3s ease;
}

/* Alternating slight rotations */
.card:nth-child(3n+1) { transform: rotate(-1deg); }
.card:nth-child(3n+2) { transform: rotate( .6deg); }
.card:nth-child(3n+3) { transform: rotate(-0.4deg); }

.card:hover,
.card:focus-visible {
  transform: rotate(0deg) translateY(-6px) scale(1.02);
  box-shadow: 0 16px 40px rgba(0,0,0,.28);
  z-index: 10;
}
.card:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; }

/* Washi tape strip */
.tape {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  width: 70px;
  height: 22px;
  border-radius: 2px;
  opacity: .82;
  z-index: 5;
}
.card:nth-child(11n+1)  .tape { background: #7fb069; transform: translateX(-50%) rotate(-2deg); }
.card:nth-child(11n+2)  .tape { background: #4a90d9; transform: translateX(-50%) rotate( 1.5deg); }
.card:nth-child(11n+3)  .tape { background: #e8c93f; transform: translateX(-50%) rotate(-1deg); }
.card:nth-child(11n+4)  .tape { background: #e07b39; transform: translateX(-50%) rotate( 2deg); }
.card:nth-child(11n+5)  .tape { background: #a86cc1; transform: translateX(-50%) rotate(-1.5deg); }
.card:nth-child(11n+6)  .tape { background: #d4b896; transform: translateX(-50%) rotate( 1deg); }
.card:nth-child(11n+7)  .tape { background: #e05252; transform: translateX(-50%) rotate(-2deg); }
.card:nth-child(11n+8)  .tape { background: #3cc4a8; transform: translateX(-50%) rotate( 1.5deg); }
.card:nth-child(11n+9)  .tape { background: #5b9bd5; transform: translateX(-50%) rotate(-1deg); }
.card:nth-child(11n+10) .tape { background: #f0a500; transform: translateX(-50%) rotate( 2deg); }
.card:nth-child(11n+11) .tape { background: #5aaa60; transform: translateX(-50%) rotate(-1.5deg); }

/* Image area */
.card-image {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  margin: 0 8px;
  border: 1px solid rgba(0,0,0,.08);
}
.card-image img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
  transition: transform .4s ease, filter .4s ease;
}
.card:hover .card-image img,
.card:focus-visible .card-image img {
  transform: scale(1.06);
  filter: brightness(.45) sepia(.2);
}

/* Hover overlay */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.1rem;
  background: linear-gradient(to top, rgba(20,10,5,.9) 0%, rgba(20,10,5,.4) 60%, transparent 100%);
  opacity: 0;
  transition: opacity .35s ease;
  pointer-events: none;
}
.card:hover .overlay,
.card:focus-visible .overlay { opacity: 1; pointer-events: auto; }

.overlay h2 {
  font-family: 'Caveat', cursive;
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.15;
  margin-bottom: .25rem;
}
.overlay-meta { font-size: .7rem; color: rgba(255,255,255,.6); margin-bottom: .5rem; }
.overlay-desc {
  font-size: .8rem; color: rgba(255,255,255,.88); line-height: 1.5;
  margin-bottom: .75rem;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.overlay-btn {
  align-self: flex-start;
  background: var(--orange); color: #fff;
  font-size: .78rem; font-weight: 600;
  padding: .4rem .85rem; border-radius: 3px; cursor: pointer;
  font-family: 'Caveat', cursive; font-size: .95rem; letter-spacing: .03em;
}

/* Card footer label */
.card-label {
  padding: .7rem 1rem .4rem;
}
.card-label h3 {
  font-family: 'Caveat', cursive;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}
.card-label p { font-size: .72rem; color: var(--ink-soft); margin-top: .15rem; }

/* ── Modal ─────────────────────────────────── */
#modal { display: none; }
#modal:not([hidden]) {
  display: flex;
  position: fixed; inset: 0; z-index: 999;
  align-items: center; justify-content: center;
  padding: 1rem;
}
#modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,8,3,.88);
  backdrop-filter: blur(5px);
}
.modal-box {
  position: relative; z-index: 1;
  background: var(--paper);
  border-radius: 4px;
  overflow: hidden;
  max-width: 960px; width: 100%; max-height: 90vh;
  display: flex; flex-direction: row;
  box-shadow: 6px 6px 0 rgba(0,0,0,.12), 0 20px 60px rgba(0,0,0,.55);
  animation: popIn .28s ease;
  /* top tape strip on modal */
  border-top: 6px solid var(--orange);
}
@keyframes popIn {
  from { opacity: 0; transform: scale(.93) translateY(16px) rotate(-.5deg); }
  to   { opacity: 1; transform: scale(1)   translateY(0)    rotate(0deg); }
}
#modal-close {
  position: absolute; top: .75rem; right: .75rem; z-index: 10;
  background: var(--ink); border: none; color: var(--paper);
  width: 32px; height: 32px; border-radius: 50%;
  font-size: 1.2rem; cursor: pointer; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
#modal-close:hover { background: var(--orange); }

/* Modal image pane */
.modal-img-pane {
  flex: 0 0 42%;
  position: relative;
  background: var(--paper2);
  overflow: hidden;
}
.modal-img-pane img {
  width: 100%; height: 100%;
  object-fit: contain; object-position: top center;
  display: block;
}
#modal-fullscreen {
  position: absolute; bottom: .75rem; right: .75rem;
  display: flex; align-items: center; gap: .35rem;
  background: rgba(15,8,3,.7); color: #fff; border: none;
  padding: .4rem .7rem; border-radius: 4px; cursor: pointer;
  font-size: .75rem; font-family: 'Nunito', sans-serif;
  transition: background .2s;
}
#modal-fullscreen:hover { background: var(--orange); }
#modal-fullscreen svg { width: 14px; height: 14px; }

/* Modal info pane */
.modal-info-pane {
  flex: 1; padding: 1.75rem 1.75rem 1.25rem;
  overflow-y: auto; display: flex; flex-direction: column;
  background: var(--paper);
  /* lined paper look */
  background-image: repeating-linear-gradient(
    transparent, transparent 27px,
    rgba(100,70,50,.1) 27px, rgba(100,70,50,.1) 28px
  );
  background-size: 100% 28px;
}
#modal-type {
  font-family: 'Caveat', cursive;
  font-size: .9rem; letter-spacing: .08em;
  color: var(--orange); font-weight: 600; margin-bottom: .3rem;
  text-transform: uppercase;
}
#modal-title {
  font-family: 'Caveat', cursive;
  font-size: 1.8rem; font-weight: 700; color: var(--ink); line-height: 1.15;
  margin-bottom: .3rem;
}
#modal-date { font-size: .78rem; color: var(--ink-soft); margin-bottom: 1rem; }

/* Tabs */
.modal-tabs {
  display: flex; gap: .5rem; margin-bottom: .75rem;
  border-bottom: 2px solid var(--paper2);
  padding-bottom: .5rem;
}
.tab-btn {
  font-family: 'Caveat', cursive;
  font-size: 1rem; font-weight: 600;
  background: none; border: none; cursor: pointer;
  color: var(--ink-soft); padding: .3rem .7rem;
  border-radius: 4px 4px 0 0;
  transition: color .2s, background .2s;
}
.tab-btn.active { color: var(--paper); background: var(--orange); }
.tab-btn:not(.active):hover { background: var(--paper2); color: var(--ink); }

.tab-panel { display: none; flex: 1; }
.tab-panel.active { display: block; }

.modal-rule {
  border: none; height: 2px; width: 48px;
  background: linear-gradient(90deg, var(--orange), var(--amber));
  border-radius: 2px; margin-bottom: 1rem;
}
#modal-desc { font-size: .9rem; color: var(--ink); line-height: 1.75; }

/* Business list */
.business-list {
  list-style: none;
  display: flex; flex-direction: column; gap: .5rem;
  padding-top: .5rem;
}
.business-list li {
  display: flex; align-items: flex-start; gap: .6rem;
  background: var(--paper2);
  border-left: 3px solid var(--orange);
  border-radius: 0 4px 4px 0;
  padding: .5rem .75rem;
  transition: border-color .2s;
}
.business-list li:hover { border-color: var(--green); }
.biz-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: .05rem; }
.biz-name {
  font-family: 'Caveat', cursive;
  font-size: 1rem; font-weight: 600; color: var(--ink); display: block;
}
.biz-desc { font-size: .75rem; color: var(--ink-soft); line-height: 1.4; }

/* Fullscreen override (iOS Safari fallback) */
.modal-img-pane.fullscreen-css {
  position: fixed; inset: 0; z-index: 2000;
  width: 100%; height: 100%;
  background: #000;
  display: flex; align-items: center; justify-content: center;
  flex: none;
}
.modal-img-pane.fullscreen-css img { object-fit: contain; width: 100%; height: 100%; }

/* ── Footer ────────────────────────────────── */
footer {
  text-align: center; padding: 1.5rem;
  font-family: 'Caveat', cursive;
  font-size: .95rem; color: rgba(44,26,14,.6);
  border-top: 1px dashed rgba(44,26,14,.25);
}

/* ── Responsive: Tablet ────────────────────── */
@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 1.75rem; }
}

/* ── Responsive: Mobile ────────────────────── */
@media (max-width: 600px) {
  .grid {
    grid-template-columns: 1fr;
    gap: 1.5rem; padding: 0 1rem;
    margin: 1.5rem auto 2.5rem;
  }
  .card:nth-child(n) { transform: rotate(0deg); } /* no rotation on mobile */
  .card-image { aspect-ratio: 4 / 3; }
  .card-label h3 { font-size: 1.25rem; }

  .modal-box { flex-direction: column; max-height: 94vh; border-radius: 6px; }
  .modal-img-pane { flex: 0 0 220px; }
  .modal-info-pane { padding: 1.1rem; }
  #modal-title { font-size: 1.4rem; }
  .modal-tabs { gap: .35rem; }
  .tab-btn { font-size: .9rem; }
}

/* Disable sticky hover on touch devices */
@media (hover: none) {
  .card:hover .card-image img { transform: none; filter: none; }
  .card:hover .overlay { opacity: 0; }
}
