:root {
  --bg: #faf6f1;
  --bg-card: #ffffff;
  --ink: #1c1917;
  --ink-soft: #57534e;
  --ink-muted: #78716c;
  --line: #e7e0d8;
  --accent: #c45c26;
  --accent-soft: #f3e0d4;
  --accent-deep: #9a3f14;
  --badge: #1d6b4f;
  --badge-bg: #e6f3ed;
  --event: #5b4a8a;
  --event-bg: #eeeaf6;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(28, 25, 23, 0.04), 0 8px 24px rgba(28, 25, 23, 0.06);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: "DM Sans", system-ui, -apple-system, sans-serif;
  --display: "Fraunces", Georgia, serif;
  --content-max: 720px;
  --page-max: 1100px;
  --rail-width: 260px;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #f6e6d8 0%, transparent 55%),
    radial-gradient(900px 400px at 100% 0%, #efe8df 0%, transparent 50%),
    var(--bg);
  min-height: 100dvh;
  padding-bottom: calc(1.5rem + var(--safe-bottom));
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 100;
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  isolation: isolate;
  overflow: hidden;
  border-bottom: 1px solid rgba(231, 224, 216, 0.85);
  background: #f3ebe3;
}

.hero-banner {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.hero-banner-photo {
  position: absolute;
  inset: 0;
  background:
    url("../assets/hero-himalaya.jpg") center 42% / cover no-repeat;
  transform: scale(1.02);
  filter: saturate(0.82) contrast(0.95) brightness(0.92);
  opacity: 0.55;
}

.hero-banner-wash {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      105deg,
      rgba(250, 246, 241, 0.94) 0%,
      rgba(250, 246, 241, 0.78) 38%,
      rgba(244, 214, 188, 0.45) 68%,
      rgba(196, 92, 38, 0.22) 100%
    ),
    linear-gradient(
      to bottom,
      rgba(250, 246, 241, 0.35) 0%,
      rgba(250, 246, 241, 0.72) 100%
    );
}

.header-inner {
  position: relative;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0.95rem 1rem 0.85rem;
  min-height: 5.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.65rem;
}

.brand-mark {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.45rem;
  letter-spacing: -0.02em;
  color: var(--accent-deep);
  line-height: 1.1;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
}

.brand-sub {
  margin: 0.1rem 0 0;
  font-size: 0.8rem;
  color: #5c534c;
  font-weight: 500;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

.search-wrap {
  position: relative;
  display: block;
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-muted);
  pointer-events: none;
}

#search {
  width: 100%;
  border: 1px solid rgba(231, 224, 216, 0.95);
  background: rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  padding: 0.7rem 1rem 0.7rem 2.5rem;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  outline: none;
  box-shadow: var(--shadow);
}

#search:focus {
  border-color: #e0b89a;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

#search::placeholder { color: #a8a29e; }

.tabs {
  position: sticky;
  top: 0;
  z-index: 35;
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0.55rem 1rem 0.65rem;
  background: rgba(250, 246, 241, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

/* Keep tabs under header: JS sets --tabs-sticky-top; fallback works if unset */
.tabs { top: var(--tabs-sticky-top, 0px); }

.tabs::-webkit-scrollbar { display: none; }

.tabs button {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.tabs button[aria-selected="true"] {
  background: var(--accent);
  color: #fff;
}

.tabs button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.page-layout {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 1rem;
}

.main {
  max-width: none;
  margin: 0;
  padding: 1rem 0 2rem;
}

.tagline {
  margin: 0 0 1rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 1rem;
}

.subnav button {
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
}

.subnav button[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: #e0b89a;
  color: var(--accent-deep);
}

.section-block { margin-bottom: 1.5rem; }

.section-title {
  margin: 0 0 0.65rem;
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.card-grid {
  display: grid;
  gap: 0.75rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.05rem;
  box-shadow: var(--shadow);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}

.card-name {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.badge {
  flex: 0 0 auto;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--badge);
  background: var(--badge-bg);
  border-radius: 999px;
  padding: 0.28rem 0.55rem;
  white-space: nowrap;
}

.meta {
  margin: 0.25rem 0 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.meta a {
  color: var(--accent-deep);
  text-decoration: none;
  word-break: break-word;
}

.meta a:hover { text-decoration: underline; }

.notes {
  margin: 0.45rem 0 0;
  font-size: 0.84rem;
  color: var(--ink-muted);
}

.card-actions {
  margin-top: 0.7rem;
}

.card-edit-link {
  display: inline-block;
  padding: 0.15rem 0;
  color: var(--ink-muted);
  font-size: 0.76rem;
  line-height: 1.3;
  text-decoration: none;
}

.card-edit-link:hover {
  color: var(--accent-deep);
  text-decoration: underline;
}

.card-edit-link:focus-visible {
  border-radius: 3px;
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.event-card .event-dates {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--event);
  background: var(--event-bg);
  border-radius: 999px;
  padding: 0.28rem 0.65rem;
}

.empty-state {
  background: var(--bg-card);
  border: 1px dashed #d6cdc2;
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  text-align: center;
  color: var(--ink-muted);
  font-size: 0.95rem;
}

.search-status {
  margin: 0 0 0.85rem;
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.associations-strip {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.associations-strip h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 600;
}

.assoc-note {
  margin: 0.25rem 0 0.85rem;
  font-size: 0.82rem;
  color: var(--ink-muted);
}

.associations-strip.hidden-by-search { display: none; }

/* Right rail — hidden on small screens (mobile stays as before) */
.right-rail {
  display: none;
}

.rail-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.05rem;
  box-shadow: var(--shadow);
}

.rail-card + .rail-card {
  margin-top: 0.85rem;
}

.rail-heading {
  margin: 0 0 0.65rem;
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.rail-events-list {
  display: grid;
  gap: 0.55rem;
}

.rail-event {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fbf9f6;
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color 0.15s, background 0.15s;
}

.rail-event:hover,
.rail-event:focus-visible {
  border-color: #d4c0ef;
  background: var(--event-bg);
  outline: none;
}

.rail-event-name {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.rail-event-dates {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--event);
}

.rail-event-venue {
  margin: 0.3rem 0 0;
  font-size: 0.78rem;
  color: var(--ink-muted);
  line-height: 1.3;
}

.rail-empty {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.rail-suggest-copy {
  margin: 0 0 0.85rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
  line-height: 1.4;
}

.rail-suggest-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.6rem 0.85rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 650;
  text-decoration: none;
  text-align: center;
  transition: background 0.15s;
}

.rail-suggest-btn:hover {
  background: var(--accent-deep);
}

.rail-suggest-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.site-footer {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0.5rem 1rem 2rem;
  text-align: center;
  color: var(--ink-muted);
  font-size: 0.85rem;
}

.site-footer p { margin: 0.2rem 0; }

.domain {
  color: var(--accent-deep);
  font-weight: 600;
}

.footer-fine { font-size: 0.78rem; opacity: 0.9; }

.footer-credit {
  margin-top: 0.55rem !important;
  font-size: 0.72rem;
  opacity: 0.85;
}
.footer-credit a {
  color: var(--accent-deep);
  text-decoration: none;
}
.footer-credit a:hover { text-decoration: underline; }


@media (min-width: 640px) {
  .header-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .search-wrap { width: min(280px, 42vw); }
  .brand-mark { font-size: 1.6rem; }
}


@media (min-width: 960px) {
  .header-inner {
    min-height: 7.25rem;
    padding-top: 1.15rem;
    padding-bottom: 1.05rem;
  }
  .hero-banner-photo {
    opacity: 0.62;
    background-position: center 38%;
  }
}

/* Desktop: widen shell + show right rail; tabs stay on top */
@media (min-width: 960px) {
  .header-inner,
  .tabs,
  .page-layout,
  .site-footer {
    max-width: var(--page-max);
  }

  .page-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--rail-width);
    gap: 1.25rem;
    align-items: start;
    padding-top: 0.25rem;
  }

  .main {
    padding-top: 1rem;
  }

  .right-rail {
    display: block;
    position: sticky;
    top: calc(var(--tabs-sticky-top, 0px) + 3.25rem);
    padding: 1rem 0 2rem;
  }
}


.home-panel {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.2rem 1.35rem;
}
.home-title {
  margin: 0 0 0.65rem;
  font-family: var(--display);
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
}
.home-lead {
  font-size: 1.02rem;
  color: var(--ink);
}
.home-panel p {
  margin: 0 0 0.85rem;
  color: var(--ink-soft);
  line-height: 1.5;
}
.home-actions {
  margin: 1.1rem 0 0.75rem !important;
}
.home-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.1rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 650;
  text-decoration: none;
}
.home-cta:hover { background: var(--accent-deep); }
.home-cta:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.home-hint {
  margin-bottom: 0 !important;
  font-size: 0.88rem;
  color: var(--ink-muted) !important;
}
