/* Aroostook County Events Calendar — clean, calm, readable */

:root {
  --bg: #f7f5f0;
  --panel: #ffffff;
  --ink: #222a24;
  --muted: #68746b;
  --line: #e4e0d6;
  --green: #2f6b3f;
  --green-dk: #234e30;
  --amber: #e0a12e;
  --amber-bg: #fbf1dc;
  --chip: #eef2ec;
  --chip-line: #d5e0d3;
  --red: #b4433a;
  --shadow: 0 1px 2px rgba(34,42,36,.05), 0 8px 24px rgba(34,42,36,.07);
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.shell { max-width: 1080px; margin: 0 auto; padding: 16px 20px 64px; }

a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- header ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 10px 0 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none !important; }
.brand-mark {
  display: grid; place-items: center;
  width: 42px; height: 42px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--green), var(--green-dk));
  color: #fff; font-weight: 800; font-size: 21px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { color: var(--ink); font-size: 17px; }
.brand-text small { color: var(--muted); font-size: 12.5px; }
.brand-mark-img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 11px; }
.nav { display: flex; gap: 6px; flex-wrap: wrap; }
.nav a {
  padding: 6px 12px; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: 14px;
  transition: background .15s, color .15s;
}
.nav a:hover { background: var(--chip); color: var(--ink); text-decoration: none; }
.nav a.on { background: var(--green); color: #fff; }
.nav a.aroostook-btn {
  margin-left: 4px; padding: 6px 14px;
  border: 1px solid var(--green); color: var(--green);
  display: inline-flex; align-items: center; gap: 5px;
}
.nav a.aroostook-btn:hover { background: var(--green); color: #fff; }
.nav a.aroostook-btn .brand-mark { width: 18px; height: 18px; font-size: 11px; border-radius: 5px; }

/* ---------- hero ---------- */
.hero { margin: 0 0 22px; }
.hero-card {
  background: linear-gradient(180deg, #ffffff, #fdfbf3 58%, #f8f2de);
  border: 1px solid var(--line); border-radius: 18px;
  padding: 26px 28px 22px; box-shadow: var(--shadow);
}
.hero h1 { font-size: clamp(26px, 4vw, 40px); margin: 0 0 6px; letter-spacing: -0.02em; }
.hero h1 em { color: var(--green); font-style: normal; }
.hero-sub { color: var(--muted); margin: 0; max-width: 60ch; }
.hero-stats { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 0; }
.stat-chip {
  display: inline-flex; align-items: baseline; gap: 7px;
  background: #fff; border: 1px solid var(--chip-line); border-radius: 999px;
  padding: 6px 15px; font-size: 13.5px; color: var(--muted);
  box-shadow: 0 1px 2px rgba(34, 42, 36, .05);
}
.stat-chip b { color: var(--green); font-size: 18px; line-height: 1; }
.stat-chip.soft b { color: var(--ink); }
.pill {
  display: inline-block; margin-left: 8px; padding: 2px 10px; border-radius: 999px;
  background: var(--amber-bg); color: #8a6217; font-weight: 700; font-size: 13px;
}

/* ---------- filters ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 20px; }
.filters input[type=search], .filters select {
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel);
  font-size: 14.5px; color: var(--ink); outline: none; min-width: 0;
}
.filters input[type=search] { flex: 2 1 220px; }
.filters select { flex: 1 1 140px; }
.filters input:focus, .filters select:focus { border-color: var(--green); }
.btn {
  display: inline-block; border: 0; cursor: pointer;
  background: var(--green); color: #fff; font-weight: 700; font-size: 14.5px;
  padding: 9px 18px; border-radius: 10px; text-decoration: none !important;
  transition: background .15s, transform .05s;
}
.btn:hover { background: var(--green-dk); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--green); border: 1px solid var(--green); }
.btn.ghost:hover { background: var(--chip); }
.btn.small { padding: 5px 12px; font-size: 13px; }

/* ---------- month nav & views ---------- */
.month-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 14px; }
.mobile-month-nav { display: none; }
.month-label { font-size: 20px; margin: 0; }
.mn { color: var(--green); font-weight: 700; padding: 6px 10px; border-radius: 8px; }
.mn:hover { background: var(--chip); text-decoration: none; }
.day-nav { display: flex; gap: 10px; margin: 14px 0 22px; }
.views { display: inline-flex; gap: 2px; padding: 3px; margin-bottom: 14px; background: var(--chip); border: 1px solid var(--line); border-radius: 11px; }
.view-btn {
  background: transparent; border: 0; color: var(--muted);
  padding: 7px 18px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 14px;
  transition: background .15s, color .15s, box-shadow .15s;
}
.view-btn:hover { color: var(--ink); }
.view-btn.active { background: #fff; color: var(--green); box-shadow: var(--shadow); }

/* ---------- calendar grid ---------- */
.calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.dow {
  padding: 10px 8px; text-align: center; font-size: 12px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted); background: #fbfaf7; border-bottom: 1px solid var(--line);
}
.day {
  min-height: 104px; padding: 6px 6px 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: #fff;
}
.day:nth-child(7n) { border-right: 0; }
.day.out { background: #faf8f3; }
.day.out .date-num { color: #b9b3a6; }
.day.today { background: #fffdf4; box-shadow: inset 0 0 0 2px rgba(224, 161, 46, .4); }
.day.out { background: #faf8f3; }
.day.out .date-num { color: #b9b3a6; }
.day.today .date-num {
  background: var(--amber); color: #fff; border-radius: 50%; width: 24px; height: 24px;
  display: grid; place-items: center; font-weight: 800;
}
.date-num { font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 5px; display: inline-block; padding: 0 2px; text-decoration: none; }
.date-num:hover { background: var(--chip-line); border-radius: 4px; }
.day.today .date-num:hover { background: #d99a1d; }
.events-cell { display: flex; flex-direction: column; gap: 3px; }
.evt {
  font-size: 11.5px; line-height: 1.25; padding: 2px 5px 2px 3px; border-radius: 5px; cursor: pointer;
  background: var(--chip); border: 1px solid var(--chip-line); border-left: 3px solid var(--acc, var(--green));
  color: var(--ink); overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.evt:hover { border-color: var(--green); background: #e6eee4; }
.evt .t { color: var(--green); font-weight: 700; }
.evt.small { color: var(--muted); font-style: italic; }
.more-list { display: none; flex-direction: column; gap: 3px; }
.day.open .more-list, .mday.open .more-list { display: flex; }
.more {
  font-size: 11px; color: var(--green); font-weight: 700; padding: 1px 5px; text-align: left;
  font: inherit; font-weight: 700; background: none; border: 0; cursor: pointer; border-radius: 4px;
}
.more:hover { background: var(--chip-line); }
.more-day {
  font-size: 11px; color: var(--muted); font-weight: 600; text-decoration: none; padding: 1px 5px;
  border-radius: 4px; white-space: nowrap;
}
.more-day:hover { background: var(--chip-line); color: var(--green); }

/* ---------- agenda list ---------- */
.agenda { display: grid; gap: 10px; margin-top: 18px; }
.a-item {
  background: var(--panel); border: 1px solid var(--line); border-left-width: 3px; border-left-color: var(--acc, var(--green));
  border-radius: var(--radius); padding: 14px 16px;
  box-shadow: var(--shadow); display: flex; gap: 14px; align-items: flex-start;
  transition: transform .12s ease, box-shadow .12s ease;
}
.a-item:hover { transform: translateY(-1px); box-shadow: 0 2px 3px rgba(34,42,36,.06), 0 12px 28px rgba(34,42,36,.10); }
.a-date { flex: 0 0 74px; text-align: center; border-right: 1px solid var(--line); padding-right: 12px; }
.a-date .d { font-size: 26px; font-weight: 800; color: var(--green); line-height: 1; }
.a-date.time .d { font-size: 14px; font-weight: 800; color: var(--green); line-height: 1.2; white-space: nowrap; margin-top: 2px; }
.a-date .m { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.a-body { flex: 1; min-width: 0; }
.a-title { font-weight: 700; font-size: 16px; color: var(--ink); text-decoration: none; }
.a-title:hover { color: var(--green); text-decoration: underline; }
.a-meta { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.a-tag { display: inline-block; font-size: 11.5px; font-weight: 700; color: #8a6217; background: var(--amber-bg); border-radius: 999px; padding: 1px 8px; margin-left: 6px; }
.a-tag + .a-tag { margin-left: 4px; }

.hidden { display: none !important; }

/* ---------- detail page ---------- */
.detail { max-width: 760px; }
.back { display: inline-block; margin: 6px 0 18px; color: var(--muted); font-weight: 600; }
.detail-cat {
  display: inline-block; color: #8a6217; background: var(--amber-bg); font-weight: 700; font-size: 12.5px;
  text-transform: uppercase; letter-spacing: .06em; padding: 3px 10px; border-radius: 999px;
}
.detail h1 { font-size: clamp(26px, 4vw, 38px); margin: 12px 0 18px; }
.detail-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px; margin: 0 0 18px; }
.dm { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.dm dt { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.dm dd { margin: 3px 0 0; font-size: 15px; }
.detail-img { width: 100%; max-height: 340px; object-fit: cover; border-radius: var(--radius); margin: 0 0 18px; }
.detail-desc { white-space: pre-line; font-size: 16px; color: #333c35; }

/* ---------- prose pages ---------- */
.prose { max-width: 820px; }
.prose h1 { font-size: clamp(26px, 4vw, 36px); margin: 6px 0 8px; }
.prose h2 { margin: 36px 0 10px; font-size: 21px; color: var(--green-dk); }
.prose p { margin: 10px 0; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin: 6px 0; }
.prose code { background: var(--chip); border: 1px solid var(--chip-line); border-radius: 5px; padding: 1px 6px; font-size: 13px; }
.muted { color: var(--muted); font-size: 14px; }

.src-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.src-table th, .src-table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.src-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.td-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.td-note { color: var(--muted); font-size: 13px; }
.badge { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: #ece9e2; color: #7a7468; }
.badge.ok { background: #e2efe4; color: #2f6b3f; }
.badge.wait { background: var(--amber-bg); color: #8a6217; }
.badge.err { background: #fbe7e5; color: #8c332c; }

/* ---------- event accent colors (by topic) ---------- */
.a-music  { --acc: #7c5cbf; }
.a-art    { --acc: #2a7f84; }
.a-food   { --acc: #b06a1f; }
.a-sport  { --acc: #2266b5; }
.a-fest   { --acc: #b03663; }
.a-fam    { --acc: #bf5c2f; }
.a-holi   { --acc: #8a3f8f; }
.a-char   { --acc: #2f8f6b; }
.a-edu    { --acc: #3d6fae; }
.a-comm   { --acc: #6a7f4f; }
.a-other  { --acc: var(--green); }

.form { margin: 10px 0 28px; }
.form .f { display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.form input, .form textarea, .form select {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 15px; color: var(--ink);
  background: var(--panel); outline: none; font-family: inherit;
}
.form input:focus, .form textarea:focus { border-color: var(--green); }
.grid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 16px; margin-bottom: 16px; }
.span2 { grid-column: span 2; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } .span2 { grid-column: span 1; } }

.flash { padding: 12px 16px; border-radius: 10px; font-weight: 600; margin: 14px 0; }
.flash.ok { background: #e2efe4; color: #2b5d38; border: 1px solid #c2ddc6; }
.flash.err { background: #fbe7e5; color: #8c332c; border: 1px solid #f0cfcc; }

.copybox { background: #10150f; color: #d7e8d8; padding: 14px 16px; border-radius: 10px; overflow-x: auto; font-size: 13.5px; }

/* ---------- admin ---------- */
.pending { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 14px 0; box-shadow: var(--shadow); }
.pending h3 { margin: 0 0 6px; }
.pending .inline-actions { display: flex; gap: 8px; margin-top: 10px; }
.btn.danger { color: #a13b32; border-color: #c98f88; }
.btn.danger:hover { background: #fbe9e7; border-color: #a13b32; }
.admin-table { width: 100%; border-collapse: collapse; margin: 10px 0 26px; font-size: 13.5px; }
.admin-table th, .admin-table td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table th { color: var(--muted); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.4px; }
.admin-table .small { font-size: 12.5px; }
.pagination { display: flex; align-items: center; gap: 14px; margin: 8px 0 26px; font-size: 13.5px; }
.duplicate-card { margin: 10px 0; }
.duplicate-pair { display: grid; grid-template-columns: 1fr auto 1fr; gap: 18px; align-items: center; }
.duplicate-match { text-align: center; color: var(--green-dk); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.duplicate-match b { font-size: 17px; letter-spacing: 0; }
.duplicate-actions { margin-top: 12px; }
@media (max-width: 680px) {
  .duplicate-pair { grid-template-columns: 1fr; gap: 8px; }
  .duplicate-match { text-align: left; }
}
@media (max-width: 720px) { .admin-table td:nth-child(3), .admin-table th:nth-child(3) { display: none; } }

/* ---------- footer ---------- */
.foot { margin-top: 44px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13.5px; }
.foot-cta { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.foot-cta .powered-mark { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink); font-size: 15px; }
.foot-cta .powered-mark .brand-mark { width: 26px; height: 26px; font-size: 14px; }
.foot-cta p { margin: 4px 0 0; }
.foot-credit { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.powered-stamp { margin: 6px 0 0; text-align: center; color: var(--muted); font-size: 12.5px; }

@media (max-width: 720px) {
  .shell { padding: 12px 12px 48px; }
  .topbar { padding: 8px 0 14px; margin-bottom: 14px; gap: 10px; }
  .hero h1 { font-size: 27px; }
  .hero-sub { font-size: 14.5px; }
  .hero-card { padding: 20px 18px 18px; border-radius: 14px; }
  .stat-chip { padding: 5px 12px; font-size: 12.5px; }
  .stat-chip b { font-size: 16px; }
  .month-nav { margin: 4px 0 10px; }
  .mobile-month-nav { display: flex; margin: 14px 0 22px; }
  .mobile-month-nav .mn { background: var(--panel); border: 1px solid var(--line); font: inherit; cursor: pointer; }
  .month-label { font-size: 18px; }
  .views .view-btn { flex: 1; }

  /* mobile month view = vertical day list */
  .calendar.mobile { display: block; background: none; border: 0; box-shadow: none; }
  .calendar.mobile .mday {
    display: flex; align-items: flex-start; gap: 12px;
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 10px 12px; margin-bottom: 10px; box-shadow: var(--shadow);
  }
  .calendar.mobile .mday.today { border-color: var(--amber); box-shadow: 0 0 0 2px rgba(224,161,46,.35), var(--shadow); }
  .m-num {
    flex: 0 0 46px; display: flex; flex-direction: column; align-items: center; gap: 1px;
    text-decoration: none !important; border-right: 1px solid var(--line); padding: 2px 0;
  }
  .m-num .m-wd { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
  .m-num .m-d { font-size: 25px; font-weight: 800; color: var(--green); line-height: 1.05; }
  .mday.today .m-num .m-wd { color: #b97e12; }
  .calendar.mobile .events-cell { flex: 1; min-width: 0; gap: 5px; }
  .calendar.mobile .evt { font-size: 13.5px; line-height: 1.3; padding: 5px 9px; white-space: normal; }
  .calendar.mobile .more { font-size: 12.5px; padding: 4px 6px; }
  .calendar.mobile .more-day { font-size: 12.5px; padding: 4px 6px; }
  .calendar.mobile .more-list { gap: 5px; }

  .a-item { flex-direction: column; }
  .a-date { border-right: 0; border-bottom: 1px solid var(--line); padding: 0 0 8px; text-align: left; }
  .src-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .foot { margin-top: 28px; }
}

@media (max-width: 480px) {
  .filters input[type=search], .filters select { flex: 1 1 100%; }
  .brand-mark { width: 38px; height: 38px; font-size: 19px; }
}
