/* =====================================================================
   lectures.nz — stylesheet
   Clean, minimal, responsive. Dark/light via prefers-color-scheme.
   ===================================================================== */

/* ----- CSS custom properties ---------------------------------------- */
:root {
  --bg: #ffffff;
  --bg2: #f7f7f5;
  --bg3: #ededea;
  --fg: #111110;
  --fg2: #6f6e69;
  --fg3: #a8a49e;
  --accent: #1a6b3a;
  --accent-light: #d4edde;
  --border: #e4e4e1;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08);
  --radius: 8px;
  --radius-sm: 4px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
  --max-w: 860px;
  --header-h: 56px;
  --transition: 150ms ease;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111110;
    --bg2: #1a1a18;
    --bg3: #232320;
    --fg: #f0efec;
    --fg2: #9b9a95;
    --fg3: #62615c;
    --accent: #4ade80;
    --accent-light: #0d2b1a;
    --border: #2a2a27;
    --shadow: 0 1px 3px rgba(0,0,0,.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,.4);
  }
}

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

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul, ol {
  list-style: none;
}

/* ----- Utility ------------------------------------------------------- */
.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;
}

/* ----- Header -------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1rem;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--fg);
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
  flex-shrink: 0;
}

.site-logo:hover {
  text-decoration: none;
  color: var(--accent);
}

.logo-mark {
  color: var(--accent);
  font-size: 0.75rem;
}

.header-search {
  flex: 1;
  max-width: 380px;
}

#search {
  width: 100%;
  height: 36px;
  padding: 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--bg2);
  color: var(--fg);
  font-size: 0.9rem;
  font-family: var(--font);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

#search::placeholder {
  color: var(--fg3);
}

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

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  flex-shrink: 0;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--fg2);
  font-size: 0.875rem;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}

.nav-link:hover {
  color: var(--fg);
  background: var(--bg2);
  text-decoration: none;
}

/* ----- City pill & picker -------------------------------------------- */
.city-pill {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  font-family: var(--font);
  color: var(--fg2);
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.city-pill:hover {
  color: var(--fg);
  border-color: var(--accent);
}

.city-pill--active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-light);
}

.city-picker {
  position: absolute;
  top: calc(var(--header-h) - 2px);
  right: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-width: 180px;
  z-index: 200;
  overflow: hidden;
}

.city-picker-header {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--fg3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.6rem 0.85rem 0.4rem;
}

.city-picker-option {
  display: block;
  width: 100%;
  text-align: left;
  font-size: 0.9rem;
  font-family: var(--font);
  color: var(--fg);
  background: none;
  border: none;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  transition: background var(--transition);
}

.city-picker-option:hover {
  background: var(--bg2);
}

.city-picker-option--active {
  color: var(--accent);
  font-weight: 600;
}

/* ----- Main ---------------------------------------------------------- */
.site-main {
  flex: 1;
  max-width: var(--max-w);
  margin: 0 auto;
  width: 100%;
  padding: 0 1rem 3rem;
}

/* ----- Hero ---------------------------------------------------------- */
.index-hero {
  padding: 2.5rem 0 2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.hero-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--fg);
  margin-bottom: 0.75rem;
}

.hero-sub {
  font-size: 1.05rem;
  color: var(--fg2);
  max-width: 520px;
  margin-bottom: 1.5rem;
}

.hero-hosts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.host-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--fg2);
  font-size: 0.8rem;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.host-chip:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.host-chip--active {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* ----- Date groups --------------------------------------------------- */
.date-group {
  margin-bottom: 2rem;
}

.date-heading {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg3);
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.25rem;
}

/* ----- Lecture list -------------------------------------------------- */
.lecture-list {
  display: flex;
  flex-direction: column;
}

.lecture-item {
  border-bottom: 1px solid var(--border);
}

.lecture-item:last-child {
  border-bottom: none;
}

.lecture-link {
  display: grid;
  grid-template-columns: 80px 1fr 24px;
  gap: 1rem;
  padding: 0.875rem 0;
  color: var(--fg);
  text-decoration: none;
  transition: background var(--transition);
  align-items: start;
  border-radius: var(--radius-sm);
}

.lecture-link:hover {
  text-decoration: none;
  background: var(--bg2);
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  margin: 0 -0.5rem;
}

.lecture-time {
  font-size: 0.8rem;
  color: var(--fg2);
  font-variant-numeric: tabular-nums;
  padding-top: 0.1rem;
  text-align: right;
}

.lecture-date-day {
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 0.1rem;
}

.lecture-title {
  font-size: 0.975rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--fg);
  margin-bottom: 0.3rem;
}

.lecture-summary {
  font-size: 0.85rem;
  color: var(--fg2);
  line-height: 1.5;
  margin-bottom: 0.4rem;
  /* Clamp to 2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lecture-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.lecture-meta span {
  font-size: 0.75rem;
  color: var(--fg3);
}

.lecture-meta span::before {
  content: "· ";
}

.lecture-meta span:first-child::before {
  content: "";
}

.meta-free {
  color: var(--accent) !important;
  font-weight: 600;
}

.meta-host {
  text-transform: capitalize;
}

.lecture-arrow {
  color: var(--fg3);
  font-size: 1rem;
  padding-top: 0.1rem;
  transition: transform var(--transition), color var(--transition);
}

.lecture-link:hover .lecture-arrow {
  transform: translateX(3px);
  color: var(--accent);
}

/* Compact variant for "more from host" */
.lecture-list--compact .lecture-title {
  font-size: 0.875rem;
}

.lecture-list--compact .lecture-link {
  grid-template-columns: 60px 1fr 24px;
  padding: 0.6rem 0;
}

/* ----- No results ---------------------------------------------------- */
.no-results {
  padding: 3rem 0;
  text-align: center;
  color: var(--fg2);
}

.no-results button {
  margin-top: 1rem;
  padding: 0.5rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg2);
  color: var(--fg);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition);
}

.no-results button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ----- Host page ----------------------------------------------------- */
.host-header {
  padding: 2rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.host-header-inner {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.host-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  background: var(--bg3);
}

.host-name {
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.host-description {
  color: var(--fg2);
  font-size: 0.95rem;
  max-width: 560px;
  margin-bottom: 1rem;
}

.host-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.host-links a {
  font-size: 0.875rem;
  color: var(--fg2);
  transition: color var(--transition);
}

.host-links a:hover {
  color: var(--accent);
}

/* ----- Lecture detail page ------------------------------------------ */
.page-lecture {
  padding-top: 1.5rem;
}

.breadcrumb {
  font-size: 0.8rem;
  color: var(--fg3);
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--fg2);
}

.breadcrumb a:hover {
  color: var(--accent);
}

.lecture-detail {
  max-width: 680px;
}

.lecture-detail-header {
  margin-bottom: 2.5rem;
}

.lecture-image {
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1.5rem;
  aspect-ratio: 16/7;
}

.lecture-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lecture-host-badge {
  margin-bottom: 0.75rem;
}

.lecture-host-badge a {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
}

.lecture-detail-title {
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 1.25rem;
}

.lecture-detail-when,
.lecture-detail-where {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--fg2);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.lecture-detail-cost {
  margin-top: 1rem;
}

.badge {
  display: inline-flex;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.badge-free {
  background: var(--accent-light);
  color: var(--accent);
}

.badge-cost {
  background: var(--bg2);
  color: var(--fg2);
  border: 1px solid var(--border);
}

/* Speakers */
.lecture-speakers {
  margin-bottom: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.lecture-speakers h2 {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg3);
  margin-bottom: 1rem;
}

.speakers-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.speaker-name {
  font-size: 0.95rem;
}

.speaker-bio {
  font-size: 0.85rem;
  color: var(--fg2);
  margin-top: 0.15rem;
}

/* Summary */
.lecture-summary-section {
  margin-bottom: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.lecture-summary-section h2 {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg3);
  margin-bottom: 1rem;
}

.lecture-body-text {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--fg);
}

.lecture-body-text p + p {
  margin-top: 1em;
}

/* Detail footer */
.lecture-detail-footer {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--transition);
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  opacity: 0.88;
  text-decoration: none;
}

.btn-secondary {
  background: var(--bg2);
  color: var(--fg);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

/* ----- Calendar picker ----------------------------------------------- */
.cal-picker {
  position: relative;
  display: inline-block;
}

.cal-picker summary {
  list-style: none;
  cursor: pointer;
}

.cal-picker summary::-webkit-details-marker { display: none; }

.cal-picker-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-width: 200px;
  z-index: 100;
  overflow: hidden;
}

.cal-picker-list li a {
  display: block;
  padding: 0.6rem 1rem;
  color: var(--fg);
  font-size: 0.9rem;
  transition: background var(--transition);
}

.cal-picker-list li a:hover {
  background: var(--bg2);
  text-decoration: none;
}

/* More from host */
.lecture-more {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.lecture-more h2 {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg3);
  margin-bottom: 0.5rem;
}

/* ----- Empty state --------------------------------------------------- */
.empty-state {
  padding: 3rem 0;
  color: var(--fg2);
  text-align: center;
}

/* ----- Footer -------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1rem;
  background: var(--bg2);
}

.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-inner p {
  font-size: 0.8rem;
  color: var(--fg3);
}

.footer-inner a {
  color: var(--fg2);
}

.footer-inner a:hover {
  color: var(--accent);
}

.footer-hosts a {
  margin-right: 0.5rem;
}

.sponsor-link {
  color: var(--fg2);
  font-size: 0.875rem;
}
.sponsor-link:hover {
  color: #e05d7a;
  text-decoration: none;
}

/* ----- Responsive ---------------------------------------------------- */
@media (max-width: 640px) {
  .header-inner {
    gap: 0.5rem;
  }

  .header-search {
    max-width: none;
  }

  .header-nav {
    display: none;
  }

  .lecture-link {
    grid-template-columns: 60px 1fr 20px;
    gap: 0.75rem;
  }

  .lecture-time {
    font-size: 0.75rem;
  }

  .host-header-inner {
    flex-direction: column;
  }

  .lecture-detail-footer {
    flex-direction: column;
  }

  .btn {
    justify-content: center;
  }
}

/* ----- Animations ---------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .lecture-item {
    animation: fadeSlide 0.2s ease both;
  }

  @keyframes fadeSlide {
    from {
      opacity: 0;
      transform: translateY(4px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

/* Filtered/hidden state */
.lecture-item[hidden],
.date-group[hidden] {
  display: none;
}
