/* =====================================================
   YMSQ AI Mirror — Shared styles
   Aesthetic: 觀塘下町商店街 × 街市印刷
   ===================================================== */

:root {
  --ink-black: #1a1a1a;
  --paper-cream: #faf6e9;
  --paper-white: #fefcf5;
  --stamp-red: #d63333;
  --stall-yellow: #f4b727;
  --soft-line: #d4cdb6;
  --muted-ink: #5a5a5a;
  --link-blue: #1a4d8c;

  --font-display: "Noto Serif TC", "PMingLiU", "新細明體", serif;
  --font-body: "Noto Sans TC", "Microsoft JhengHei", "微軟正黑體", sans-serif;
  --font-mono: "JetBrains Mono", "Courier New", monospace;
}

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;500;700&family=Noto+Serif+TC:wght@500;700;900&family=JetBrains+Mono:wght@400;700&display=swap');

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink-black);
  background: var(--paper-cream);
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent 0,
      transparent 28px,
      rgba(0,0,0,0.018) 28px,
      rgba(0,0,0,0.018) 29px
    ),
    radial-gradient(circle at 25% 15%, rgba(214, 51, 51, 0.025) 0%, transparent 40%),
    radial-gradient(circle at 75% 80%, rgba(244, 183, 39, 0.04) 0%, transparent 50%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---- Layout ---- */
.wrap { max-width: 880px; margin: 0 auto; padding: 32px 20px; }
.wrap-wide { max-width: 1080px; margin: 0 auto; padding: 32px 20px; }

/* ---- Top banner (報頭式) ---- */
.banner {
  border-top: 4px solid var(--ink-black);
  border-bottom: 1px solid var(--ink-black);
  padding: 14px 0 12px;
  text-align: center;
  margin-bottom: 36px;
  position: relative;
}
.banner::after {
  content: '';
  display: block;
  border-bottom: 4px solid var(--ink-black);
  margin-top: 4px;
  position: absolute;
  width: 100%;
  bottom: -6px;
}
.banner-kicker {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.4em;
  color: var(--muted-ink);
  margin-bottom: 4px;
}
.banner-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(28px, 5vw, 44px);
  letter-spacing: 0.05em;
  color: var(--ink-black);
}
.banner-issue {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted-ink);
  margin-top: 6px;
}

/* ---- Headlines ---- */
h1.lead {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(32px, 6vw, 52px);
  line-height: 1.15;
  color: var(--ink-black);
  margin: 24px 0 12px;
  letter-spacing: -0.01em;
}
h2.section {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 24px;
  margin: 40px 0 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--ink-black);
  position: relative;
}
h2.section::before {
  content: '■';
  margin-right: 8px;
  color: var(--stamp-red);
}
h3.shoplabel {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  margin: 24px 0 8px;
}

p { margin-bottom: 14px; }

/* ---- Stamp / labels ---- */
.stamp {
  display: inline-block;
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  background: var(--stamp-red);
  color: #fff;
  transform: rotate(-1deg);
  border-radius: 2px;
}
.stamp-yellow {
  background: var(--stall-yellow);
  color: var(--ink-black);
}
.stamp-outline {
  background: none;
  color: var(--stamp-red);
  border: 1.5px solid var(--stamp-red);
}

/* ---- Stall list (directory cards) ---- */
.stall-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
  margin: 24px 0;
}
.stall-card {
  background: var(--paper-white);
  border: 1.5px solid var(--ink-black);
  padding: 18px 20px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none;
  color: var(--ink-black);
  position: relative;
  display: block;
}
.stall-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 var(--ink-black);
}
.stall-card .stall-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted-ink);
  letter-spacing: 0.1em;
  display: block;
  margin-bottom: 4px;
}
.stall-card .stall-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}
.stall-card .stall-tag {
  font-size: 14px;
  color: var(--muted-ink);
  line-height: 1.5;
}
.stall-card .stall-pill {
  display: inline-block;
  background: var(--stall-yellow);
  color: var(--ink-black);
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 2px 8px;
  margin-top: 10px;
  letter-spacing: 0.08em;
}

/* ---- Info table ---- */
.info-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  padding: 10px 0;
  border-bottom: 1px dashed var(--soft-line);
  gap: 12px;
}
.info-row dt {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--muted-ink);
  font-size: 14px;
}
.info-row dd { font-size: 16px; }

/* ---- Callout (event highlight) ---- */
.callout {
  background: var(--ink-black);
  color: var(--paper-white);
  padding: 24px 28px;
  margin: 32px 0;
  position: relative;
  border-left: 6px solid var(--stamp-red);
}
.callout-kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--stall-yellow);
  margin-bottom: 8px;
}
.callout-headline {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 24px;
  line-height: 1.3;
  margin-bottom: 10px;
}

/* ---- Buttons ---- */
.btn {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  padding: 12px 24px;
  background: var(--stamp-red);
  color: #fff;
  border: 2px solid var(--ink-black);
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 var(--ink-black);
}
.btn-light {
  background: var(--paper-white);
  color: var(--ink-black);
}

/* ---- Breadcrumb ---- */
.crumb {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted-ink);
  margin-bottom: 16px;
  letter-spacing: 0.05em;
}
.crumb a { color: var(--muted-ink); text-decoration: none; }
.crumb a:hover { color: var(--stamp-red); }

/* ---- Footer ---- */
.footer {
  margin-top: 80px;
  padding: 32px 20px;
  border-top: 4px double var(--ink-black);
  font-size: 14px;
  color: var(--muted-ink);
  text-align: center;
}
.footer a { color: var(--ink-black); text-decoration: underline; text-underline-offset: 3px; }

/* ---- Misc ---- */
a.inline { color: var(--link-blue); text-decoration: underline; text-underline-offset: 3px; }
hr.dotted { border: none; border-top: 2px dotted var(--soft-line); margin: 32px 0; }

ul.bullet-cmyk { list-style: none; padding-left: 0; }
ul.bullet-cmyk li {
  padding-left: 24px;
  position: relative;
  margin-bottom: 8px;
}
ul.bullet-cmyk li::before {
  content: '▸';
  color: var(--stamp-red);
  position: absolute;
  left: 0;
  font-size: 14px;
  top: 4px;
}

.kbd {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--paper-white);
  padding: 2px 6px;
  border: 1px solid var(--soft-line);
  border-radius: 2px;
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
  .wrap, .wrap-wide { padding: 20px 16px; }
  .info-row { grid-template-columns: 90px 1fr; gap: 8px; }
  body { font-size: 16px; }
}

/* ---- Print (點心紙 fallback) ---- */
@media print {
  body { background: white; }
  .stall-card { break-inside: avoid; }
}

/* ===========================================
   v1.2 — Interactive widgets
   =========================================== */

/* Intro paragraph */
.intro {
  font-size: 18px;
  line-height: 1.8;
  max-width: 720px;
}

/* Search bar */
.ymsq-search-bar {
  margin: 16px 0 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
#ymsq-search-input {
  flex: 1 1 320px;
  min-width: 240px;
  font-family: var(--font-body);
  font-size: 16px;
  padding: 12px 14px;
  border: 2px solid var(--ink-black);
  background: var(--paper-white);
  color: var(--ink-black);
  border-radius: 0;
  outline: none;
}
#ymsq-search-input:focus {
  border-color: var(--stamp-red);
  box-shadow: 3px 3px 0 var(--soft-line);
}
#ymsq-search-results-meta {
  font-size: 13px;
  color: var(--muted-ink);
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
}

/* Filter pills */
.ymsq-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 24px;
}
.ymsq-pill {
  font-family: var(--font-body);
  font-size: 13px;
  padding: 6px 14px;
  border: 1.5px solid var(--ink-black);
  background: var(--paper-white);
  color: var(--ink-black);
  cursor: pointer;
  font-weight: 500;
  border-radius: 0;
  transition: all 120ms ease;
}
.ymsq-pill:hover {
  background: var(--stall-yellow);
}
.ymsq-pill.active {
  background: var(--ink-black);
  color: var(--paper-white);
}

/* Floor plan grid: 10 cols */
.ymsq-floor-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
  margin: 16px 0 28px;
  border: 2px solid var(--ink-black);
  padding: 6px;
  background: var(--paper-white);
}
.ymsq-cell {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  text-align: left;
  padding: 6px 5px;
  min-height: 64px;
  border: 1px solid var(--soft-line);
  background: var(--paper-cream);
  font-family: var(--font-body);
  font-size: 11px;
  cursor: pointer;
  overflow: hidden;
  transition: transform 100ms ease, box-shadow 100ms ease, background 100ms ease;
  color: var(--ink-black);
  border-radius: 0;
}
.ymsq-cell:hover:not(.empty) {
  background: var(--stall-yellow);
  transform: translate(-1px, -1px);
  box-shadow: 2px 2px 0 var(--ink-black);
  z-index: 2;
}
.ymsq-cell.anchor {
  background: #fff8d8;
  border-color: var(--stamp-red);
  border-width: 2px;
}
.ymsq-cell.anchor:hover {
  background: var(--stamp-red);
  color: white;
}
.ymsq-cell.empty {
  background: repeating-linear-gradient(
    45deg, var(--paper-cream),
    var(--paper-cream) 4px,
    rgba(0,0,0,0.04) 4px,
    rgba(0,0,0,0.04) 8px
  );
  cursor: default;
  color: var(--muted-ink);
  opacity: 0.6;
}
.cell-num {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--stamp-red);
  display: block;
  margin-bottom: 2px;
}
.ymsq-cell.anchor:hover .cell-num { color: white; }
.cell-name {
  font-size: 11px;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-all;
}

/* Modal */
.ymsq-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ymsq-modal[hidden] { display: none; }
.ymsq-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 26, 26, 0.65);
}
.ymsq-modal-card {
  position: relative;
  max-width: 480px;
  width: calc(100% - 40px);
  max-height: 86vh;
  overflow-y: auto;
  background: var(--paper-white);
  border: 3px solid var(--ink-black);
  box-shadow: 8px 8px 0 var(--ink-black);
  padding: 28px 26px 24px;
  margin: 20px;
}
.ymsq-modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: var(--ink-black);
  line-height: 1;
  padding: 4px 8px;
}
.ymsq-modal-close:hover {
  color: var(--stamp-red);
}

/* Full-text directory */
.ymsq-fulltext-directory {
  margin: 36px 0 24px;
  border: 1px dashed var(--soft-line);
  padding: 16px 20px;
  background: var(--paper-white);
}
.ymsq-fulltext-directory summary {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.04em;
}
.ymsq-fulltext-directory[open] summary {
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px dotted var(--soft-line);
}
.ymsq-fulltext-directory ol {
  font-size: 13px;
  line-height: 1.6;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .ymsq-floor-grid {
    grid-template-columns: repeat(5, 1fr);
  }
  .ymsq-fulltext-directory ol {
    columns: 1 !important;
  }
}
@media (max-width: 480px) {
  .ymsq-floor-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .ymsq-cell {
    min-height: 58px;
    font-size: 10px;
    padding: 4px 3px;
  }
  .cell-name { font-size: 10px; -webkit-line-clamp: 2; }
}
