/* NavigatOER · Laligator-Brand Stylesheet */

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

:root {
  /* Brand-Palette */
  --ink:       #142a2a;
  --lime:      #9ee64a;
  --grass:     #5cc13d;
  --emerald:   #168b58;
  --sun:       #ffd23f;
  --coral:     #ff6049;
  --earth:     #a87149;
  --sky:       #7ec8e3;
  --cream:     #fff6e2;
  --paper:     #fef7c4;
  --paper-2:   #faf2db;
  --muted:     #5a6b66;
  --border:    #142a2a;
  --shadow-hard: 4px 4px 0 var(--ink);
  --shadow-soft: 2px 2px 0 rgba(20, 42, 42, 0.18);

  /* Radii */
  --r-sm:    8px;
  --r-md:    14px;
  --r-lg:    20px;
  --r-pill:  999px;

  /* Fonts */
  --f-display: "Fredoka", "Baloo 2", system-ui, sans-serif;
  --f-chunky:  "Baloo 2", "Fredoka", system-ui, sans-serif;
  --f-ui:      "Space Grotesk", system-ui, -apple-system, sans-serif;
}

html, body { min-height: 100%; }
body {
  font-family: var(--f-ui);
  background:
    radial-gradient(900px 600px at 80% -10%, #ffe88a 0%, transparent 60%),
    radial-gradient(800px 500px at -10% 110%, #c8f08c 0%, transparent 55%),
    var(--paper);
  color: var(--ink);
  min-height: 100vh;
}

/* ─── Header ─────────────────────────────────────────────────────────── */
header {
  background: var(--sun);
  color: var(--ink);
  padding: 1.4rem 2rem;
  border-bottom: 4px solid var(--ink);
}
.brand { display: flex; align-items: center; gap: 1rem; max-width: 1080px; margin: 0 auto; }
.brand-mark { position: relative; width: 76px; height: 76px; flex: 0 0 auto; }
.brand-plate {
  position: absolute; inset: 0; background: var(--lime);
  border: 3px solid var(--ink); border-radius: 50%;
  box-shadow: var(--shadow-hard);
}
.brand-mascot {
  position: absolute; inset: 0;
  width: 88%; height: 88%; margin: auto;
  display: block;
}
.brand-text h1 {
  font-family: var(--f-display); font-weight: 700;
  font-size: 2rem; line-height: 0.95; letter-spacing: -0.02em;
}
.brand-text .oer { color: var(--coral); }
.brand-text .tagline {
  margin-top: 0.35rem;
  font-family: var(--f-ui);
  font-size: 0.92rem;
  font-weight: 500;
  opacity: 0.85;
}

/* ─── Main layout ────────────────────────────────────────────────────── */
main {
  max-width: 1080px;
  margin: 1.5rem auto;
  padding: 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ─── Reusable card ──────────────────────────────────────────────────── */
.card,
#clarification-box,
#search-profile,
.result-card,
#graph-canvas {
  background: var(--cream);
  border: 2.5px solid var(--ink);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-hard);
}

/* ─── Search ─────────────────────────────────────────────────────────── */
#search-form {
  display: flex; flex-direction: column; gap: 0.75rem;
  background: var(--cream);
  border: 2.5px solid var(--ink);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-hard);
  padding: 1.25rem 1.4rem;
}
.field-label {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 1.05rem;
}
textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 2px solid var(--ink);
  border-radius: var(--r-sm);
  font-size: 1rem;
  resize: vertical;
  background: white;
  font-family: var(--f-ui);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}
textarea::placeholder { color: var(--muted); }
textarea:focus { outline: none; border-color: var(--coral); box-shadow: var(--shadow-hard); }
.form-actions { display: flex; justify-content: flex-end; }

button {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.65rem 1.4rem;
  background: var(--coral);
  color: var(--cream);
  border: 2.5px solid var(--ink);
  border-radius: var(--r-pill);
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 0.98rem;
  cursor: pointer;
  box-shadow: var(--shadow-hard);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
button:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); }
button:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
button:disabled { background: var(--muted); cursor: not-allowed; transform: none; box-shadow: var(--shadow-hard); opacity: 0.6; }
.btn-icon { display: inline-flex; align-items: center; }

/* ─── Clarification ──────────────────────────────────────────────────── */
#clarification-box {
  padding: 1.25rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.clarify-head {
  display: flex; align-items: center; gap: 0.75rem;
}
.clarify-icon {
  flex: 0 0 auto;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 2.5px solid var(--ink);
  background: var(--lime);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--f-display); font-weight: 700; font-size: 1.15rem;
  box-shadow: var(--shadow-soft);
}
#clarification-question {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 1.1rem;
  line-height: 1.3;
}
#clarification-options { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.option-btn {
  padding: 0.4rem 0.9rem;
  background: var(--lime);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: var(--r-pill);
  font-family: var(--f-display);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink);
  align-self: auto;
}
.option-btn:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); }
.option-btn.selected { background: var(--coral); color: var(--cream); }
#clarification-free {
  padding: 0.7rem 0.9rem;
  border: 2px solid var(--ink);
  border-radius: var(--r-sm);
  font-size: 0.95rem;
  font-family: var(--f-ui);
  background: white;
  box-shadow: var(--shadow-soft);
}
#clarification-free:focus { outline: none; border-color: var(--coral); }
#clarification-submit { align-self: flex-end; }

/* ─── Profile ────────────────────────────────────────────────────────── */
#search-profile {
  padding: 0.75rem 1.1rem;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  gap: 0.5rem 0.85rem;
  align-items: start;
}
#persona-avatar {
  grid-row: 1 / 3;
  grid-column: 1;
  align-self: center;
}
.profile-text {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  grid-row: 1;
  grid-column: 2;
}
#profile-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.provider-badge {
  display: inline-block;
  margin-top: 1rem;
}
.profile-label {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
}
.provider-badge {
  margin-left: auto;
  font-family: var(--f-ui);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--sun);
  border: 2px solid var(--ink);
  border-radius: var(--r-pill);
  padding: 0.2rem 0.65rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 2px 2px 0 var(--ink);
}
.profile-tag {
  background: var(--paper-2);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: var(--r-pill);
  padding: 0.18rem 0.65rem;
  font-family: var(--f-ui);
  font-size: 0.8rem;
  font-weight: 500;
}
.profile-tag:nth-child(3n+1) { background: var(--lime); }
.profile-tag:nth-child(3n+2) { background: var(--sky); }
.profile-tag:nth-child(3n)   { background: var(--sun); }

/* ─── Persona avatar ─────────────────────────────────────────────────── */
#persona-avatar {
  flex: 0 0 auto;
  width: 60px; height: 60px;
  border-radius: 50%;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  border: 2.5px solid var(--ink);
  background: var(--lime);
  box-shadow: var(--shadow-soft);
}
#persona-avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
#persona-avatar.persona-unknown { background: var(--paper-2); color: var(--ink); }
.persona-fallback {
  font-family: var(--f-display);
  font-size: 1.55rem; font-weight: 700;
  line-height: 1;
}

/* ─── Results ────────────────────────────────────────────────────────── */
#view-selector { display: flex; align-items: center; gap: 0.5rem; padding: 0 0.25rem; }
#view-label {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
}
#view-label::before {
  content: "";
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--coral);
  margin-right: 0.5rem;
  vertical-align: middle;
}

#results-container { display: flex; flex-direction: column; gap: 1rem; }

/* List view */
.result-card {
  padding: 1rem 1.25rem;
  display: flex; flex-direction: column; gap: 0.45rem;
  position: relative;
  transition: opacity 0.25s ease, transform 0.25s ease, box-shadow 0.15s ease;
}
.result-card:hover { transform: translate(-1px, -1px); box-shadow: 6px 6px 0 var(--ink); }
.result-card.removing {
  opacity: 0.3;
  transform: scale(0.97);
  pointer-events: none;
}
.card-remove {
  position: absolute;
  top: 0.5rem; right: 0.6rem;
  width: 1.8rem; height: 1.8rem;
  padding: 0; margin: 0;
  background: var(--cream);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 50%;
  font-size: 1.05rem; line-height: 1;
  font-weight: 700;
  cursor: pointer;
  align-self: auto;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 2px 2px 0 var(--ink);
  font-family: var(--f-display);
}
.card-remove:hover {
  background: var(--coral);
  color: var(--cream);
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--ink);
}
.result-card h3 {
  font-family: var(--f-display);
  font-size: 1.08rem;
  font-weight: 600;
  line-height: 1.25;
  padding-right: 2.4rem;
}
.result-card h3 a { color: var(--ink); text-decoration: none; }
.result-card h3 a:hover { color: var(--emerald); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.result-card .desc {
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.5;
}
.result-card .meta { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.3rem; }
.meta-tag {
  background: var(--paper-2);
  color: var(--ink);
  border: 1.5px solid var(--ink);
  border-radius: var(--r-pill);
  padding: 0.15rem 0.6rem;
  font-family: var(--f-ui);
  font-size: 0.78rem;
  font-weight: 500;
}
.meta-tag:nth-of-type(2) { background: var(--lime); }
.meta-tag:nth-of-type(3) { background: var(--sky); }

/* Cards grid view */
#results-container.cards-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.result-card.card-style { justify-content: space-between; }

/* Faceted view */
#faceted-wrapper { display: flex; gap: 1.25rem; }
#facet-sidebar {
  width: 220px;
  flex-shrink: 0;
  display: flex; flex-direction: column; gap: 0.85rem;
  background: var(--cream);
  border: 2.5px solid var(--ink);
  border-radius: var(--r-md);
  padding: 1rem;
  box-shadow: var(--shadow-hard);
  align-self: flex-start;
}
.facet-group h4 {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink);
  margin-bottom: 0.45rem;
  padding-bottom: 0.3rem;
  border-bottom: 2px solid var(--ink);
}
.facet-item {
  display: flex; align-items: center; gap: 0.5rem;
  font-family: var(--f-ui);
  font-size: 0.88rem;
  cursor: pointer;
  padding: 0.2rem 0;
}
.facet-item input[type="checkbox"] { accent-color: var(--coral); width: 16px; height: 16px; }
#faceted-results { flex: 1; display: flex; flex-direction: column; gap: 0.85rem; }

/* Graph / D3 canvas */
#graph-canvas {
  width: 100%;
  height: 70vh;
  min-height: 480px;
  background:
    radial-gradient(circle at 50% 50%, var(--cream) 0%, var(--paper-2) 100%);
  border: 2.5px solid var(--ink);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-hard);
  cursor: grab;
}
#graph-canvas:active { cursor: grabbing; }
#graph-hint {
  font-family: var(--f-ui);
  font-size: 0.78rem;
  color: var(--ink);
  text-align: center;
  margin-top: 0.5rem;
  opacity: 0.7;
}
.node circle { stroke: var(--ink); stroke-width: 2.5px; }
.node text { font-family: var(--f-display); font-weight: 600; font-size: 11px; fill: var(--ink); }
.link { stroke: var(--ink); stroke-width: 2px; stroke-dasharray: 4 4; opacity: 0.5; }

/* ─── Loading ────────────────────────────────────────────────────────── */
#loading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--ink);
  padding: 0.85rem 1rem;
  font-family: var(--f-display);
  font-weight: 600;
}
.loading-mascot { position: relative; width: 36px; height: 36px; }
.loading-spinner {
  width: 36px; height: 36px;
  animation: lali-spin 1.4s linear infinite;
  transform-origin: 50% 50%;
}
@keyframes lali-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Error ──────────────────────────────────────────────────────────── */
#error-banner {
  background: #fff0ed;
  border: 2.5px solid var(--coral);
  color: var(--ink);
  border-radius: var(--r-md);
  padding: 0.85rem 1.1rem;
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 0.95rem;
  box-shadow: 4px 4px 0 var(--coral);
}

/* ─── Footer ─────────────────────────────────────────────────────────── */
footer {
  max-width: 1080px;
  margin: 1.5rem auto 2.5rem;
  padding: 0 1.5rem;
  font-family: var(--f-ui);
  font-size: 0.82rem;
  color: var(--ink);
  opacity: 0.6;
  text-align: center;
}

/* ─── Tab bar ────────────────────────────────────────────────────────── */
#tab-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.tab-btn {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.45rem 1.1rem;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: background 0.15s, color 0.15s;
}

.tab-btn:hover:not(:disabled) { background: var(--lime); }
.tab-btn.active { background: var(--ink); color: #fff; }
.tab-btn:disabled { opacity: 0.35; cursor: default; }

.tab-count {
  background: var(--lime);
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0 0.45rem;
  line-height: 1.5;
}

.tab-btn.active .tab-count { background: #fff; color: var(--ink); }

.view-label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

/* ─── Events panel ───────────────────────────────────────────────────── */
.event-card { position: relative; overflow: hidden; }
.event-card::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 8px;
  background: var(--lime);
  border-right: 2.5px solid var(--ink);
}
.event-card h3 a { color: var(--ink); text-decoration: none; }
.event-card h3 a:hover { color: var(--emerald); text-decoration: underline; }
.meta-tag.event-date { background: var(--lime); }
.meta-tag.event-loc  { background: var(--sky); }

#events-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* ─── Utility ────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ─── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  header { padding: 1rem 1.1rem; }
  .brand-text h1 { font-size: 1.65rem; }
  .brand-mark { width: 60px; height: 60px; }
  main { padding: 0 1rem; }
  #search-form { padding: 1rem; }
  #faceted-wrapper { flex-direction: column; }
  #facet-sidebar { width: 100%; }
}
