:root {
  --bg: #eef3f6;
  --surface: #ffffff;
  --panel-bg: rgba(255, 255, 255, 0.94);
  --panel-border: rgba(15, 30, 45, 0.08);
  --ink: #16232f;
  --ink-soft: #52626f;
  --accent: #4a7c59;
  --accent-soft: #e3efe6;
  --chip-bg: #eef3f6;
  --chip-ink: #2f4658;
  --shadow: 0 12px 32px rgba(20, 40, 60, 0.12);
  --label-bg: rgba(255, 255, 255, 0.85);
  --accent-ink: #1f3326;
  --radius: 16px;
  font-size: 16px;
}

:root[data-theme="dark"] {
  --bg: #0b0d10;
  --surface: #161b22;
  --panel-bg: rgba(20, 24, 32, 0.86);
  --panel-border: rgba(255, 255, 255, 0.08);
  --ink: #edf1f5;
  --ink-soft: #a7b3c2;
  --accent: #7fc794;
  --accent-soft: rgba(127, 199, 148, 0.18);
  --chip-bg: rgba(255, 255, 255, 0.06);
  --chip-ink: #d7e6ea;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  --label-bg: rgba(20, 24, 32, 0.85);
  --accent-ink: #c9ecd3;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  scroll-behavior: smooth;
  transition: background 0.5s ease, color 0.5s ease;
}

h1, h2, h3 { margin: 0; line-height: 1.2; }
p { margin: 0; }
a { color: inherit; }
button { font-family: inherit; cursor: pointer; }

/* ---------- 3D scene layer ---------- */

#scene-root {
  position: fixed;
  inset: 0;
  z-index: 0;
}

#scene-root canvas { display: block; }

.label2d {
  pointer-events: none;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink);
  background: var(--label-bg);
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 4px 10px rgba(20, 40, 60, 0.15);
  transform: translate(-50%, -140%);
  transition: background 0.5s ease, color 0.5s ease;
}

.theme-toggle {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 5;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  transition: background 0.5s ease, transform 0.2s ease;
}

.theme-toggle:hover { transform: scale(1.06); }

/* ---------- foreground UI (hero) ---------- */

#ui {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(220px, 340px) minmax(280px, 360px);
  grid-template-areas: "intro district interviewer";
  justify-content: space-between;
  align-content: start;
  gap: 16px;
  padding: 28px;
  pointer-events: none;
}

.panel {
  pointer-events: auto;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  padding: 20px 22px;
  transition: background 0.5s ease, border-color 0.5s ease;
}

.panel-intro { grid-area: intro; }
.panel-district { grid-area: district; align-self: start; }
.panel-interviewer {
  grid-area: interviewer;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 56px);
}

.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 6px;
}

#city-name {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.tagline {
  margin-top: 10px;
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.5;
}

.pills, .open-to {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pills li, .open-to li {
  background: var(--chip-bg);
  color: var(--chip-ink);
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
}

.panel-district h2 {
  font-size: 16px;
  font-weight: 700;
}

.panel-district p {
  margin-top: 8px;
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.5;
}

.overview-button {
  margin-top: 14px;
  border: 1px solid var(--panel-border);
  background: var(--surface);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 10px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

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

.panel-interviewer h2 {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-interviewer h2::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.interviewer-intro {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--ink-soft);
}

.transcript {
  margin-top: 12px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 40px;
  max-height: 220px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
}

.msg {
  font-size: 13px;
  line-height: 1.45;
  padding: 9px 12px;
  border-radius: 12px;
  max-width: 96%;
}

.msg-user {
  align-self: flex-end;
  background: var(--chip-bg);
  color: var(--chip-ink);
  border-bottom-right-radius: 4px;
}

.msg-answer {
  align-self: flex-start;
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-bottom-left-radius: 4px;
}

.signal-line {
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--ink-soft);
}

.signal-label {
  font-weight: 700;
  color: var(--accent);
}

.preset-questions {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.preset-questions button {
  text-align: left;
  border: 1px solid var(--panel-border);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  padding: 9px 12px;
  border-radius: 10px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.preset-questions button:hover {
  border-color: var(--accent);
}

.preset-questions button.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.ask-form {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}

.ask-form input {
  flex: 1;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
  background: var(--surface);
  color: var(--ink);
}

.ask-form input:focus { outline: 2px solid var(--accent-soft); }

.ask-form button {
  border: none;
  background: var(--ink);
  color: var(--bg);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 10px;
}

.scroll-hint {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--panel-bg);
  padding: 7px 14px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  pointer-events: none;
  animation: bob 2.4s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, 6px); }
}

/* ---------- below-the-fold content ---------- */

#content {
  position: relative;
  z-index: 3;
  background: var(--bg);
  padding: 60px 8vw 90px;
  transition: background 0.5s ease;
}

.section { max-width: 980px; margin: 0 auto 70px; }
.section:last-child { margin-bottom: 0; }

.section-title {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 26px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  transition: background 0.5s ease, border-color 0.5s ease;
}

.card h3 { font-size: 18px; font-weight: 700; }

.card .subtitle {
  margin-top: 4px;
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
}

.card p.desc {
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-soft);
}

.card .tags {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.card .tags span {
  background: var(--chip-bg);
  color: var(--chip-ink);
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 999px;
}

.card .links {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.card .links a {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
}

.card .links a:hover { text-decoration: underline; }

.card .note {
  margin-top: 10px;
  font-size: 12px;
  color: var(--ink-soft);
  font-style: italic;
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-left: 2px solid var(--panel-border);
  padding-left: 26px;
}

.timeline-entry {
  position: relative;
  padding-bottom: 34px;
}

.timeline-entry:last-child { padding-bottom: 0; }

.timeline-entry::before {
  content: "";
  position: absolute;
  left: -32px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.timeline-entry h3 { font-size: 16px; font-weight: 700; }

.timeline-entry .meta {
  margin-top: 3px;
  font-size: 13px;
  color: var(--ink-soft);
  font-weight: 500;
}

.timeline-entry ul {
  margin: 12px 0 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.timeline-entry li {
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
}

.timeline-compact .timeline-entry { padding-bottom: 20px; }

.cert-detail {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-soft);
}

.open-to { margin-bottom: 22px; }

.beyond-the-code {
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin-bottom: 18px;
  max-width: 640px;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.contact-links a {
  text-decoration: none;
  background: var(--ink);
  color: var(--bg);
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 10px;
}

.contact-links a.secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--panel-border);
}

.footer-note {
  margin-top: 30px;
  font-size: 12px;
  color: var(--ink-soft);
}

/* ---------- responsive ---------- */

@media (max-width: 980px) {
  #ui {
    grid-template-columns: 1fr;
    grid-template-areas: "intro" "district" "interviewer";
    padding: 16px;
    min-height: auto;
  }

  .panel-interviewer { max-height: 420px; }

  #city-name { font-size: 26px; }

  .scroll-hint { position: static; margin: 10px auto 0; transform: none; animation: none; }

  #content { padding: 40px 6vw 70px; }
}
