:root {
  --bg: #f7f7f2;
  --surface: #ffffff;
  --surface-2: #f0f3ee;
  --ink: #15221f;
  --muted: #61706b;
  --line: #dce3df;
  --primary: #0f5b4c;
  --primary-strong: #0a463b;
  --primary-soft: #e5f1ed;
  --accent: #b36a2e;
  --accent-soft: #f5e9dc;
  --danger: #9e3d35;
  --danger-soft: #f8e5e2;
  --warning: #8b6500;
  --warning-soft: #fff4cf;
  --shadow: 0 16px 50px rgba(19, 42, 35, .09);
  --radius: 14px;
  --radius-sm: 9px;
  --container: 1180px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font: 15.5px/1.62 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-strong); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
.container { width: min(var(--container), calc(100% - 40px)); margin-inline: auto; }
.muted { color: var(--muted); }
.eyebrow { color: var(--primary); font-weight: 750; letter-spacing: .08em; text-transform: uppercase; font-size: .78rem; }
.kicker { max-width: 730px; color: var(--muted); font-size: 1.08rem; }

.site-header {
  position: sticky; top: 0; z-index: 1000;
  background: rgba(247, 247, 242, .94);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(220, 227, 223, .8);
}
.site-header__inner { min-height: 72px; display: flex; align-items: center; gap: 28px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); min-width: 188px; }
.brand:hover { color: var(--ink); }
.brand__mark { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--primary); color: white; font-weight: 850; font-size: 1.08rem; }
.brand span:last-child { display: grid; line-height: 1.08; }
.brand strong { letter-spacing: .08em; }
.brand small { color: var(--muted); font-size: .68rem; margin-top: 5px; }
.site-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.site-nav__link { color: #394843; padding: 9px 11px; border-radius: 8px; font-weight: 650; font-size: .92rem; }
.site-nav__link:hover, .site-nav__link.is-active { background: var(--surface); color: var(--primary); }
.site-header__actions { display: flex; align-items: center; }
.mode-badge { border: 1px solid #d8c695; color: #775b0b; background: #fff9df; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; border-radius: 999px; padding: 6px 9px; }
.nav-toggle { display: none; margin-left: auto; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 10px; }

.hero { padding: 76px 0 48px; }
.hero__grid { display: grid; grid-template-columns: 1.15fr .85fr; align-items: center; gap: 58px; }
.hero h1 { font-size: clamp(2.55rem, 6vw, 5rem); letter-spacing: -.055em; line-height: .98; max-width: 780px; margin: 12px 0 22px; }
.hero h1 em { font-style: normal; color: var(--primary); }
.hero__copy { max-width: 680px; font-size: 1.12rem; color: var(--muted); }
.hero__visual { background: linear-gradient(145deg, #103b33, #0f5b4c 65%, #1b705e); color: white; min-height: 410px; border-radius: 28px; padding: 34px; position: relative; overflow: hidden; box-shadow: var(--shadow); }
.hero__visual::before, .hero__visual::after { content: ''; position: absolute; border: 1px solid rgba(255,255,255,.18); border-radius: 50%; }
.hero__visual::before { width: 340px; height: 340px; right: -130px; top: -80px; }
.hero__visual::after { width: 240px; height: 240px; left: -90px; bottom: -115px; }
.hero__visual h2 { font-size: 1.75rem; letter-spacing: -.03em; max-width: 340px; margin: 0 0 24px; position: relative; z-index: 2; }
.hero__visual-grid { display: grid; gap: 12px; position: relative; z-index: 2; }
.hero__visual-card { border: 1px solid rgba(255,255,255,.17); background: rgba(255,255,255,.08); border-radius: 14px; padding: 15px; backdrop-filter: blur(7px); }
.hero__visual-card strong { display: block; font-size: 1.03rem; }
.hero__visual-card span { color: rgba(255,255,255,.74); font-size: .88rem; }

.search-shell { margin-top: 30px; display: flex; gap: 10px; max-width: 720px; }
.search-shell input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 14px 16px; outline: none; box-shadow: 0 8px 26px rgba(19,42,35,.04); }
.search-shell input:focus { border-color: #82aa9e; box-shadow: 0 0 0 4px rgba(15,91,76,.1); }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; background: var(--primary); color: white; border-radius: 10px; padding: 11px 15px; font-weight: 750; min-height: 44px; }
.button:hover { color: white; background: var(--primary-strong); }
.button--secondary { color: var(--ink); background: var(--surface); border-color: var(--line); }
.button--secondary:hover { color: var(--primary); background: var(--surface-2); }
.button--ghost { color: var(--primary); background: transparent; border-color: var(--line); }
.button--disabled, .button:disabled { opacity: .55; cursor: not-allowed; }

.stats { padding: 0 0 34px; }
.stats__grid { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.stat { padding: 22px 26px; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat strong { display: block; font-size: 1.75rem; letter-spacing: -.035em; }
.stat span { color: var(--muted); }

.section { padding: 54px 0; }
.section--surface { background: #eef1ec; border-block: 1px solid var(--line); }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 24px; }
.section-head h2 { margin: 0; font-size: clamp(1.75rem, 3vw, 2.4rem); letter-spacing: -.04em; line-height: 1.1; }
.section-head p { margin: 8px 0 0; color: var(--muted); }

.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.card { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 21px; min-width: 0; }
.card--interactive { transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.card--interactive:hover { transform: translateY(-2px); border-color: #b9c9c3; box-shadow: 0 14px 36px rgba(19,42,35,.08); }
.card__topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 26px; }
.card h3 { margin: 12px 0 5px; font-size: 1.18rem; letter-spacing: -.02em; line-height: 1.25; }
.card__org { color: var(--primary); font-weight: 700; }
.card__description { color: var(--muted); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; min-height: 4.7em; }
.card__meta { display: flex; flex-wrap: wrap; gap: 8px 14px; color: var(--muted); font-size: .86rem; margin-top: 15px; }
.card__footer { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card__link { font-weight: 750; }

.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 9px; font-size: .72rem; font-weight: 780; background: var(--surface-2); color: #45534e; border: 1px solid var(--line); }
.badge--open { background: var(--primary-soft); color: var(--primary-strong); border-color: #c8ddd6; }
.badge--soon { background: var(--warning-soft); color: var(--warning); border-color: #eadb9a; }
.badge--closed { background: var(--danger-soft); color: var(--danger); border-color: #eac7c3; }
.badge--accent { background: var(--accent-soft); color: #784215; border-color: #e6c6a6; }

.page-hero { padding: 54px 0 28px; }
.page-hero h1 { margin: 9px 0 10px; font-size: clamp(2.4rem, 6vw, 4rem); letter-spacing: -.05em; line-height: 1; }
.page-hero__row { display: flex; align-items: end; justify-content: space-between; gap: 24px; }

.toolbar { display: grid; grid-template-columns: minmax(230px, 1.8fr) repeat(2, minmax(150px, .6fr)); gap: 10px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 12px; }
.toolbar--institutions { grid-template-columns: minmax(0, 1fr) auto; }
.field { display: grid; gap: 6px; }
.field label, .field__label { font-size: .76rem; color: var(--muted); font-weight: 700; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line); background: white; border-radius: 9px; padding: 10px 11px; color: var(--ink); outline: none; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: #82aa9e; box-shadow: 0 0 0 3px rgba(15,91,76,.09); }
.field textarea { min-height: 120px; resize: vertical; }
.result-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 23px 0 14px; color: var(--muted); }
.result-bar strong { color: var(--ink); }
.result-list { display: grid; gap: 12px; }
.list-card { display: grid; grid-template-columns: 1fr auto; gap: 24px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 20px; }
.list-card:hover { border-color: #bdcbc6; }
.list-card__main { min-width: 0; }
.list-card h2 { font-size: 1.18rem; margin: 7px 0 4px; letter-spacing: -.02em; }
.list-card__org { font-weight: 700; color: var(--primary); }
.list-card__desc { color: var(--muted); margin: 10px 0; max-width: 850px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.list-card__aside { width: 170px; display: grid; align-content: space-between; justify-items: end; text-align: right; }
.list-card__aside small { color: var(--muted); }

.empty-state, .error-state, .loading-state { border: 1px dashed #c9d3cf; border-radius: var(--radius); padding: 44px 24px; text-align: center; color: var(--muted); background: rgba(255,255,255,.55); }
.empty-state strong, .error-state strong { display: block; color: var(--ink); font-size: 1.08rem; margin-bottom: 5px; }
.loading-line { height: 10px; width: 140px; background: linear-gradient(90deg,#e3e8e5 20%,#f6f7f4 45%,#e3e8e5 70%); background-size: 240% 100%; animation: shimmer 1.2s linear infinite; border-radius: 999px; margin: 0 auto 10px; }
@keyframes shimmer { to { background-position: -240% 0; } }

.drawer-backdrop { position: fixed; inset: 0; z-index: 1200; background: rgba(9,22,18,.45); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
.drawer-backdrop.is-open { opacity: 1; pointer-events: auto; }
.drawer { position: absolute; right: 0; top: 0; height: 100%; width: min(620px, 95vw); background: var(--surface); box-shadow: -18px 0 60px rgba(0,0,0,.18); padding: 28px; overflow-y: auto; transform: translateX(100%); transition: transform .22s ease; }
.drawer-backdrop.is-open .drawer { transform: translateX(0); }
.drawer__close { position: sticky; top: 0; float: right; z-index: 3; border: 1px solid var(--line); background: white; border-radius: 999px; width: 38px; height: 38px; }
.drawer h2 { font-size: 2rem; letter-spacing: -.04em; line-height: 1.1; margin: 30px 48px 6px 0; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 28px; }
.detail-section { border-top: 1px solid var(--line); padding: 20px 0; }
.detail-section h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 8px; }
.detail-section p { white-space: pre-wrap; margin: 0; }
.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 28px; }

.event-card { display: grid; grid-template-columns: 72px 1fr; gap: 18px; }
.date-tile { width: 72px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; text-align: center; align-self: start; }
.date-tile span { display: block; background: var(--primary); color: white; font-size: .69rem; letter-spacing: .09em; text-transform: uppercase; padding: 5px; }
.date-tile strong { display: block; font-size: 1.55rem; padding: 8px 4px 7px; }

.institution-layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 18px; align-items: start; }
.institution-panel { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 10px; max-height: 640px; overflow: auto; }
.institution-group + .institution-group { margin-top: 8px; }
.institution-group__head { position: sticky; top: -10px; z-index: 2; width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; border: 0; border-radius: 10px; background: var(--surface-2); color: var(--ink); padding: 10px 12px; }
.institution-group__head:hover { background: #e6ebe5; }
.institution-group__dot { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.institution-group__title { display: grid; flex: 1; min-width: 0; line-height: 1.3; }
.institution-group__title small { color: var(--muted); font-size: .76rem; }
.institution-group__count { font-size: .74rem; font-weight: 780; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; }
.institution-group__chevron { width: 8px; height: 8px; margin: 0 4px 3px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s ease; }
.institution-group__head[aria-expanded="false"] .institution-group__chevron { transform: rotate(-45deg); margin-bottom: 0; }
.institution-group__body { padding: 4px 0 6px; }
.institution-item { border-bottom: 1px solid var(--line); padding: 12px 10px; }
.institution-item:last-child { border-bottom: 0; }
.institution-item:hover, .institution-item.is-active { background: var(--primary-soft); border-radius: 8px; }
.institution-item__locate { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 0; color: var(--ink); }
.institution-item__locate strong { display: block; }
.institution-item__locate span { color: var(--muted); font-size: .86rem; }
.institution-item__links, .map-popup__links { display: flex; flex-wrap: wrap; gap: 3px 14px; margin-top: 6px; font-size: .84rem; font-weight: 650; }
.map-legend { display: grid; gap: 4px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.94); color: var(--ink); font-size: .8rem; box-shadow: 0 5px 18px rgba(0,0,0,.08); }
.map-legend span { display: flex; align-items: center; gap: 7px; }
.map-legend i { width: 10px; height: 10px; border-radius: 50%; }
.map-shell { height: 640px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #dfe9e4; }
#institution-map { width: 100%; height: 100%; }
.map-shell { position: relative; }
.map-warning { position: absolute; z-index: 900; left: 14px; right: 14px; bottom: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.94); color: var(--muted); font-size: .86rem; box-shadow: 0 5px 18px rgba(0,0,0,.08); pointer-events: none; }

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form-grid .field--wide { grid-column: 1 / -1; }
.form-card { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 24px; }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; padding: 3px; background: var(--surface); }
.segmented button { border: 0; background: transparent; border-radius: 7px; padding: 8px 12px; font-weight: 700; color: var(--muted); }
.segmented button.is-active { background: var(--primary); color: white; }
.segmented--wrap { display: flex; flex-wrap: wrap; }
.segmented--wrap button { min-height: 38px; }
.segmented button small { margin-left: 3px; font-size: .74rem; opacity: .72; }

.field input[readonly] { background: var(--surface-2); color: var(--muted); }

.auth-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .75fr); gap: 18px; align-items: start; }
.auth-card { display: grid; gap: 18px; }
.auth-card > .segmented { justify-self: start; }
.auth-form { display: grid; gap: 14px; }
.auth-form .button { justify-self: start; }
.auth-note { margin: 0; font-size: .9rem; }
.auth-list { margin: 0 0 16px; padding-left: 20px; color: var(--muted); }
.link-button { justify-self: start; border: 0; background: none; padding: 0; color: var(--primary); font-weight: 650; }
.link-button:hover { color: var(--primary-strong); text-decoration: underline; }
.auth-message { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--surface-2); white-space: pre-line; overflow-wrap: anywhere; }
.auth-message--success { background: var(--primary-soft); border-color: #c8ddd6; color: var(--primary-strong); }
.auth-message--error { background: var(--danger-soft); border-color: #eac7c3; color: var(--danger); }
.auth-message .button { margin-top: 10px; }
.auth-gate h2 { margin: 8px 0 6px; }
.auth-gate p { max-width: 720px; }
.account-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 12px 14px; }
.account-bar__who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.account-bar__who > span:last-child { display: grid; min-width: 0; line-height: 1.3; }
.account-bar__who strong { overflow-wrap: anywhere; }
.account-bar__who small { color: var(--primary); font-weight: 700; }
.account-bar__avatar { width: 38px; height: 38px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: white; font-weight: 800; }

.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.about-card { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 24px; }
.about-card h2 { margin-top: 0; }
.code-note { background: #13221e; color: #d9eee7; border-radius: 12px; padding: 16px 18px; font: 13px/1.65 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-x: auto; }

.cta-band { border-radius: 22px; padding: 38px; background: #172a24; color: white; display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.cta-band h2 { margin: 0 0 6px; font-size: 2rem; letter-spacing: -.035em; }
.cta-band p { margin: 0; color: #b9cbc5; }

.site-footer { margin-top: 68px; border-top: 1px solid var(--line); padding: 34px 0 48px; background: #f0f2ed; }
.site-footer__grid { display: grid; grid-template-columns: 1.3fr .6fr .8fr; gap: 28px; }
.brand--footer { margin-bottom: 12px; }
.footer-links, .footer-meta { display: grid; align-content: start; gap: 8px; }
.footer-links a { color: var(--ink); }
.footer-meta span { color: var(--muted); font-size: .88rem; }

.toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 3000; display: grid; gap: 8px; max-width: min(380px, calc(100vw - 36px)); }
.toast { transform: translateY(10px); opacity: 0; transition: .2s ease; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 10px; padding: 12px 14px; box-shadow: var(--shadow); }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast--warning { border-color: #dfca87; background: #fff8dc; }

@media (max-width: 980px) {
  .hero__grid { grid-template-columns: 1fr; gap: 28px; }
  .hero__visual { min-height: auto; }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .institution-layout { grid-template-columns: 1fr; }
  .institution-panel { max-height: 360px; }
  .map-shell { height: 520px; }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .toolbar--institutions { grid-template-columns: 1fr; }
  .toolbar .field:first-child { grid-column: 1 / -1; }
  .site-footer__grid { grid-template-columns: 1fr 1fr; }
  .site-footer__grid > :first-child { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .container { width: min(100% - 28px, var(--container)); }
  .site-header__inner { min-height: 64px; gap: 12px; }
  .brand { min-width: 0; }
  .brand small { display: none; }
  .site-header__actions { display: none; }
  .nav-toggle { display: block; }
  .site-nav { display: none; position: absolute; left: 14px; right: 14px; top: 62px; flex-direction: column; align-items: stretch; border: 1px solid var(--line); background: var(--surface); padding: 8px; border-radius: 12px; box-shadow: var(--shadow); }
  .site-nav.is-open { display: flex; }
  .hero { padding-top: 52px; }
  .hero h1 { font-size: clamp(2.75rem, 14vw, 4.2rem); }
  .search-shell { flex-direction: column; }
  .stats__grid { grid-template-columns: 1fr; }
  .stat + .stat { border-left: 0; border-top: 1px solid var(--line); }
  .card-grid { grid-template-columns: 1fr; }
  .section-head, .page-hero__row, .cta-band { align-items: flex-start; flex-direction: column; }
  .toolbar { grid-template-columns: 1fr; }
  .toolbar .field:first-child { grid-column: auto; }
  .list-card { grid-template-columns: 1fr; }
  .list-card__aside { width: auto; justify-items: start; text-align: left; gap: 10px; }
  .form-grid, .about-grid, .auth-layout { grid-template-columns: 1fr; }
  .account-bar { flex-direction: column; align-items: stretch; }
  .form-grid .field--wide { grid-column: auto; }
  .site-footer__grid { grid-template-columns: 1fr; }
  .site-footer__grid > :first-child { grid-column: auto; }
  .drawer { width: 100%; padding: 22px; }
  .event-card { grid-template-columns: 60px 1fr; gap: 14px; }
  .date-tile { width: 60px; }
}
