/* =============================================================
   Orbe da Memória — Portuguese Azulejo Royal Maritime Stylesheet
   Palette: azulejo blue, ivory white, royal gold
   ============================================================= */

/* --- Design tokens --------------------------------------------------- */
:root {
  /* Portuguese Azulejo palette — aligned to Lusita design system */
  --azulejo:       #1640C8;     /* Primary Indigo (Lusita) */
  --royal:         #001B5E;     /* Deep Royal Blue */
  --white:         #FFFFFF;     /* Pure White */
  --ivory:         #FAF7F2;     /* Ivory White */
  --light-blue:    #E8F0FF;     /* Light Azulejo Blue */
  --gold:          #C9922A;     /* Gold Accent */
  --soft-blue:     #2B35C9;     /* Soft Border Blue */

  /* Functional shades */
  --ink:           #16203f;
  --ink-soft:      #1a3060;
  --ink-muted:     #516081;
  --border:        rgba(17, 28, 58, 0.12);
  --border-light:  rgba(17, 28, 58, 0.10);

  /* Functional surfaces */
  --bg:            #f7f8fb;
  --surface:       #ffffff;
  --surface-2:     #f2f5fb;
  --text:          var(--ink);
  --text-muted:    var(--ink-muted);
  --link:          var(--azulejo);
  --link-hover:    var(--royal);

  /* Region colours */
  --algarve:       #C9922A;
  --alentejo:      #7a5c1f;
  --centro:        #003DA5;

  /* Shadows — aligned to Lusita */
  --shadow-sm:     0 1px 3px rgba(19, 31, 64, .06), 0 1px 6px rgba(19, 31, 64, .03);
  --shadow-md:     0 4px 16px rgba(19, 31, 64, .08), 0 2px 6px rgba(19, 31, 64, .04);
  --shadow-lg:     0 8px 32px rgba(19, 31, 64, .10), 0 2px 8px rgba(19, 31, 64, .05);

  /* Typography */
  --serif: 'Cormorant Garamond', 'Times New Roman', Georgia, serif;
  --sans:  'Inter', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;

  /* Layout */
  --radius: 0.375rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1.125rem;
  --radius-full: 999px;
  --container: 1180px;
  --gutter: clamp(16px, 4vw, 40px);

  /* Transitions */
  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Dark mode — deep maritime night */
[data-theme="dark"] {
  --bg:            #0f1424;
  --surface:       #151c30;
  --surface-2:     #1a233b;
  --border:        rgba(225, 232, 255, 0.12);
  --border-light:  rgba(225, 232, 255, 0.09);
  --ink:           #edf2ff;
  --ink-soft:      #bbc7eb;
  --ink-muted:     #8e9abe;
  --text:          #edf2ff;
  --text-muted:    #8e9abe;
  --azulejo:       #7AA8FF;
  --royal:         #94B5FF;
  --gold:          #E5AA3C;
  --soft-blue:     #6b78ff;
  --light-blue:    #1a233b;
  --algarve:       #E5AA3C;
  --alentejo:      #c4993a;
  --centro:        #7AA8FF;
  --link:          var(--azulejo);
  --link-hover:    var(--gold);
  --shadow-sm:     0 2px 8px rgba(0,0,0,.25);
  --shadow-md:     0 12px 30px rgba(0,0,0,.35);
  --shadow-lg:     0 18px 50px rgba(0,0,0,.45);
}

/* --- Reset & base --------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(circle at top left, color-mix(in oklab, var(--azulejo) 7%, transparent) 0, transparent 35%),
    radial-gradient(circle at bottom right, color-mix(in oklab, var(--gold) 10%, transparent) 0, transparent 28%),
    var(--bg);
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden; /* prevent horizontal scroll on mobile */
}
img, svg { display: block; max-width: 100%; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; transition: color .15s; }
a:hover { color: var(--link-hover); }
button { font: inherit; cursor: pointer; }
:focus-visible {
  outline: 2px solid var(--azulejo);
  outline-offset: 2px;
  border-radius: var(--radius);
}
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: -9999px; top: 8px;
  background: var(--azulejo); color: #fff; padding: 8px 12px;
  border-radius: var(--radius); z-index: 2000;
}
.skip-link:focus { left: 8px; }

/* --- Top accent line — HIDDEN (unified design) --------------------- */
.top-accent { display: none; }

/* --- Azulejo ornamental separator — HIDDEN (unified design) -------- */
.azulejo-separator { display: none; }

/* --- Header — now handled by lusita-design-system.css --------------- */
/* Legacy classes (.header-inner, .site-nav, .nav-link, .logo-*) removed.
   Header uses .site-header > .container > .brand / .main-nav / .header-actions
   from the shared design system. Only Orbe-specific overrides below. */
.theme-toggle .theme-icon { font-size: 16px; }

/* --- Hero ----------------------------------------------------------- */
.hero {
  padding: clamp(32px, 5vw, 56px) var(--gutter) 0;
  background: transparent;
  position: relative;
  overflow: hidden;
}
.hero-inner {
  max-width: 680px;
  margin: 0 auto;
  text-align: center;
  position: relative;
}
.hero-text { position: relative; z-index: 1; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin: 0 0 20px;
  font-weight: 700;
}
.eyebrow::before {
  content: "";
  width: 1.75rem;
  height: 1px;
  background: currentColor;
  opacity: 0.55;
}
.hero-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--text-2xl);
  line-height: 1.04;
  letter-spacing: -.02em;
  margin: 0 0 var(--space-5);
  color: var(--color-text);
}
.hero-title em {
  font-style: italic;
  font-weight: 500;
  color: var(--color-gold);
}

/* --- Perguntar ao Orbe — unified Lusita design ---------------------- */

.ask-orbe-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-8);
  padding: var(--space-12) var(--gutter) var(--space-16);
  background: transparent;
  border-bottom: none;
}

.ask-orbe-inner {
  width: 100%;
  max-width: 680px;
  padding: var(--space-8);
  background: color-mix(in oklab, var(--color-surface) 80%, transparent);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.ask-orbe-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 1.2rem + 1.8vw, 2.4rem);
  font-weight: 400;
  color: var(--color-text);
  margin: 0 0 var(--space-3);
  line-height: 1.04;
}

.ask-orbe-lead {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text-muted);
  margin: 0 0 var(--space-6);
  line-height: 1.5;
  max-width: 52ch;
  margin-inline: auto;
}

/* Form */
.ask-orbe-form {
  margin: 0 0 var(--space-5);
}

.ask-orbe-input-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-5);
  background: var(--color-surface-2);
  border: 1.5px solid color-mix(in oklab, var(--color-primary) 35%, var(--color-border));
  border-radius: var(--radius-full);
  max-width: 580px;
  margin: 0 auto;
  cursor: text;
}

.ask-orbe-input {
  flex: 1;
  min-width: 0;
  padding: 0;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--color-text);
  background: transparent;
  border: none;
  outline: none;
  line-height: 1;
}

.ask-orbe-input::placeholder {
  color: var(--color-text-faint);
  font-style: normal;
}

.ask-orbe-input:focus {
  border-color: transparent;
  box-shadow: none;
}
.ask-orbe-input-wrap:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--color-primary) 12%, transparent);
}

.ask-orbe-submit {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: var(--color-primary);
  color: var(--color-text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition-interactive), transform var(--transition-interactive);
}
.ask-orbe-submit svg { pointer-events: none; }

.ask-orbe-submit:hover {
  background: var(--color-primary-hover);
  transform: scale(1.06);
}

/* Quick suggestions */
.ask-orbe-suggestions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
  margin: 0 0 var(--space-5);
}

.ask-orbe-suggestion {
  display: inline-flex;
  align-items: center;
  padding: 10px 16px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-muted);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  cursor: pointer;
  min-height: 44px;
  white-space: nowrap;
  transition: background var(--transition-interactive),
              border-color var(--transition-interactive),
              color var(--transition-interactive);
}

.ask-orbe-suggestion:hover {
  background: var(--color-primary-highlight);
  border-color: color-mix(in oklab, var(--color-primary) 40%, var(--color-border));
  color: var(--color-primary);
}

/* Microcopy */
.ask-orbe-microcopy {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-style: italic;
  color: var(--color-text-faint);
  margin: 0;
}

/* Response container */
.ask-orbe-response {
  margin: 0 0 16px;
  min-height: 0;
  transition: min-height 0.3s;
}

.ask-orbe-response.is-visible {
  min-height: 40px;
}

/* Response card */
.ask-orbe-response-card {
  text-align: left;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin: 0 auto;
  max-width: 580px;
  box-shadow: var(--shadow-sm);
}

.ask-orbe-response-partial {
  border-color: var(--color-gold);
  border-style: dashed;
}

.ask-orbe-response-unknown {
  text-align: center;
}

.ask-orbe-eyebrow {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--color-gold);
  margin: 0 0 var(--space-2);
}

.ask-orbe-response-title {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 1rem + 1vw, 2rem);
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 var(--space-3);
  line-height: 1.15;
}

.ask-orbe-response-summary {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  line-height: 1.65;
  color: var(--color-text-muted);
  margin: 0 0 var(--space-3);
}

.ask-orbe-source-note {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  line-height: 1.5;
  color: var(--color-text-faint);
  margin: 0 0 var(--space-2);
  font-style: italic;
}

.ask-orbe-certainty-note {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  line-height: 1.5;
  color: var(--color-gold);
  margin: 0 0 var(--space-3);
  font-weight: 500;
}

/* Action buttons — pill design from design system */
.ask-orbe-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.ask-orbe-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.2rem;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  text-decoration: none;
  min-height: 44px;
  white-space: nowrap;
  cursor: pointer;
  transition: transform var(--transition-interactive),
              background var(--transition-interactive),
              border-color var(--transition-interactive),
              color var(--transition-interactive),
              box-shadow var(--transition-interactive);
}
.ask-orbe-action-btn:hover { transform: translateY(-1px); }

.ask-orbe-action-primary {
  color: var(--color-text-inverse);
  background: var(--color-primary);
  box-shadow: var(--shadow-md);
}

.ask-orbe-action-primary:hover {
  background: var(--color-primary-hover);
}

.ask-orbe-action-secondary {
  color: var(--color-text);
  background: var(--color-surface);
  border-color: var(--color-border);
  box-shadow: var(--shadow-sm);
}

.ask-orbe-action-secondary:hover {
  background: var(--color-surface-2);
  border-color: color-mix(in oklab, var(--color-primary) 24%, var(--color-border));
}

.ask-orbe-action-disabled {
  color: var(--color-text-faint);
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
  cursor: default;
  opacity: 0.6;
}

/* Mission conflict notice */
.ask-orbe-mission-notice {
  padding: var(--space-3) var(--space-4);
  margin: var(--space-3) 0 var(--space-1);
  background: var(--color-gold-soft);
  border: 1px solid color-mix(in oklab, var(--color-gold) 25%, transparent);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  line-height: 1.5;
  color: var(--color-text);
}

.ask-orbe-mission-notice p {
  margin: 0;
}

.ask-orbe-mission-notice strong {
  color: var(--color-gold);
}

/* Lusita speech component */
.ask-orbe-lusita-speech {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  margin: var(--space-4) 0;
  padding: var(--space-3) var(--space-4);
  background: var(--color-gold-soft);
  border-radius: var(--radius-md);
  border: 1px solid color-mix(in oklab, var(--color-gold) 15%, transparent);
}

.ask-orbe-lusita-avatar {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  background: color-mix(in oklab, var(--color-gold) 10%, transparent);
  border: 1.5px solid color-mix(in oklab, var(--color-gold) 20%, transparent);
}

.ask-orbe-lusita-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: 50% 15%;
}

.ask-orbe-lusita-bubble {
  flex: 1;
  min-width: 0;
}

.ask-orbe-lusita-label {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--color-gold);
  margin-bottom: 2px;
}

.ask-orbe-lusita-bubble p {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-style: italic;
  line-height: 1.5;
  color: var(--color-text-muted);
  margin: 0;
}

/* Certainty tags */
.ask-orbe-certainty-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: var(--space-2) 0 var(--space-3);
}

.ask-orbe-certainty-tag {
  display: inline-block;
  padding: 3px 10px;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-gold);
  background: var(--color-gold-soft);
  border: 1px solid color-mix(in oklab, var(--color-gold) 20%, transparent);
  border-radius: var(--radius-full);
  line-height: 1.4;
}

/* Status block (e.g. "Percurso em preparação") */
.ask-orbe-status-block {
  padding: var(--space-3) var(--space-4);
  margin: var(--space-3) 0;
  background: var(--color-gold-soft);
  border: 1px dashed color-mix(in oklab, var(--color-gold) 30%, transparent);
  border-radius: var(--radius-sm);
}

.ask-orbe-status-label {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--color-gold);
  margin: 0 0 var(--space-1);
}

.ask-orbe-status-text {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--color-text-muted);
  margin: 0;
}

/* Related paths — "Próximos caminhos" */
.ask-orbe-related-paths {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-divider);
}

.ask-orbe-related-paths-label {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--color-text-faint);
  margin: 0 0 var(--space-2);
}

.ask-orbe-related-paths-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.ask-orbe-path-chip {
  display: inline-block;
  padding: 6px 14px;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-muted);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition-interactive),
              border-color var(--transition-interactive),
              color var(--transition-interactive);
  line-height: 1.4;
}

.ask-orbe-path-chip:hover {
  background: var(--color-primary-highlight);
  border-color: color-mix(in oklab, var(--color-primary) 40%, var(--color-border));
  color: var(--color-primary);
}

.ask-orbe-path-deferred {
  color: var(--color-text-faint);
  background: var(--color-surface-2);
  border-color: var(--color-divider);
  border-style: dashed;
  cursor: default;
}

.ask-orbe-path-deferred:hover {
  background: var(--color-surface-2);
  border-color: var(--color-divider);
}

/* Fallback suggestions in unknown card */
.ask-orbe-fallback-suggestions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

/* --- Perguntar ao Orbe: dark mode ------------------------------------ */
/* Most tokens auto-switch via lusita-design-system.css [data-theme="dark"].
   Only component-specific overrides below. */

/* --- Perguntar ao Orbe: mobile --------------------------------------- */

@media (max-width: 768px) {
  .ask-orbe-section {
    padding: var(--space-8) var(--space-4) var(--space-10);
  }

  .ask-orbe-inner {
    padding: var(--space-5);
  }

  .ask-orbe-response-card {
    padding: var(--space-5);
  }

  .ask-orbe-actions {
    flex-direction: column;
  }

  .ask-orbe-action-btn {
    width: 100%;
    justify-content: center;
  }
}

/* --- Map section ---------------------------------------------------- */
.map-section { padding: 40px var(--gutter) 64px; max-width: var(--container); margin: 0 auto; }
.map-shell {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  position: relative;
}
@media (max-width: 900px) {
  .map-shell {
    gap: 12px;
  }
  /* Show map first, filters below on mobile — map visible immediately */
  .map-area { order: -1; }
  .map-section { padding: 20px var(--gutter) 40px; }
}

/* Filters — collapsed by default on all widths */
.filters {
  align-self: start;
}

/* Filter toggle — visible on all widths, controls filter panel */
.filters-toggle {
  display: flex;
  width: 100%;
  padding: var(--space-4);
  background: var(--color-primary-highlight);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-primary);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--text-sm);
  text-align: left;
  cursor: pointer;
  transition: background var(--transition-interactive), color var(--transition-interactive);
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}
.filters-toggle:hover { background: var(--color-surface-2); }
.filters-toggle-icon {
  font-size: 12px;
  transition: transform .25s;
}
.filters-toggle[aria-expanded="true"] .filters-toggle-icon {
  transform: rotate(90deg);
}

@media (max-width: 900px) {
  .filters {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 12px;
    box-shadow: var(--shadow-sm);
  }
  [data-theme="dark"] .filters { background: var(--surface); }
  .filters-toggle { margin-bottom: 0; min-height: 44px; }
  .filters-toggle[aria-expanded="true"] {
    margin-bottom: 0;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }
  /* Touch-friendly select inputs: 44px min height */
  .select-input, .text-input {
    min-height: 44px;
    padding: 10px 12px;
    font-size: 16px; /* prevents iOS zoom on focus */
  }
  /* Touch-friendly filter buttons */
  .btn-filter {
    min-height: 44px;
    padding: 10px 16px;
    font-size: 14px;
  }
  /* Chip touch targets */
  .chip {
    min-height: 36px;
    padding: 8px 14px;
  }
}
.section-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin: 0 0 var(--space-4);
  font-weight: 700;
}
.section-eyebrow::before {
  content: "";
  width: 1.75rem;
  height: 1px;
  background: currentColor;
  opacity: 0.55;
}
.filter-block { margin: 0 0 var(--space-5); border: 0; padding: 0; }
.filter-label {
  display: block;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--color-text-muted);
  margin: 0 0 var(--space-2);
}
.text-input, .select-input {
  width: 100%;
  font: inherit;
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: var(--text-sm);
  transition: border-color var(--transition-interactive), box-shadow var(--transition-interactive);
}
[data-theme="dark"] .text-input, [data-theme="dark"] .select-input {
  background: var(--color-surface-2);
}
.text-input:focus, .select-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--color-primary) 12%, transparent);
  outline: none;
}
.chip-row {
  display: flex; flex-wrap: wrap; gap: var(--space-2);
}
.chip {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font: inherit; font-family: var(--font-body); font-size: var(--text-xs); font-weight: 500;
  padding: 6px 11px;
  background: var(--color-bg);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition-interactive), color var(--transition-interactive), border-color var(--transition-interactive);
}
[data-theme="dark"] .chip { background: var(--color-surface-2); }
.chip[aria-pressed="true"] {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-color: var(--color-primary);
}
.chip:hover { border-color: var(--color-primary); }
.chip-themes .chip { font-size: var(--text-xs); }

.filter-actions {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 8px; padding-top: 14px;
  border-top: 1px dashed var(--border);
  gap: 12px;
}
.btn-filter {
  font: inherit; font-size: 13px; font-weight: 500;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-muted);
  transition: background .15s, color .15s, border-color .15s;
}
.btn-filter:hover, .btn-ghost:hover { background: var(--color-primary-highlight); color: var(--color-primary); border-color: var(--color-primary); }
[data-theme="dark"] .btn-filter:hover, [data-theme="dark"] .btn-ghost:hover { background: var(--color-surface-2); }
.result-count {
  font-size: 12px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}
/* Map area */
.map-area {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
#map {
  width: 100%;
  height: 260px;
  opacity: 0.72;
  background: var(--light-blue);
  /* Ensure touch gestures work */
  touch-action: pan-x pan-y;
  transition: height 350ms cubic-bezier(.32,.72,.32,1), opacity 350ms ease;
}
.map-section.map-expanded #map {
  height: clamp(500px, 70vh, 760px);
  opacity: 1;
}
/* Hide zoom controls in compact state */
.map-section:not(.map-expanded) .leaflet-control-zoom {
  opacity: 0;
  pointer-events: none;
}
.map-section.map-expanded .leaflet-control-zoom {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 200ms ease;
}
[data-theme="dark"] #map { background: #0f1528; }
@media (max-width: 600px) {
  .map-area { border-radius: var(--radius); }
  .map-section.map-expanded #map { height: clamp(400px, 60vh, 600px); }
  /* 16px prevents iOS auto-zoom on input focus; must come after base rules */
  .select-input, .text-input { font-size: 16px; padding: 10px 12px; }
}

.legend {
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px;
  padding: 10px 16px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--ink-muted);
}
[data-theme="dark"] .legend { background: var(--surface); }
.legend-spacer { flex: 1; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.dot {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 50%;
  border: 1.5px solid rgba(0, 27, 94, .3);
}
[data-theme="dark"] .dot { border-color: rgba(255,255,255,.2); }
.dot-algarve  { background: var(--algarve); }
.dot-alentejo { background: var(--alentejo); }
.dot-centro   { background: var(--centro); }
.dot-uncertain {
  background: transparent;
  border-style: dashed;
  border-color: var(--ink-muted);
}

/* Map markers */
.moura-marker-wrap { background: transparent !important; border: 0 !important; }
.moura-marker {
  display: block;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2.5px solid #fff;
  box-shadow: 0 1px 4px rgba(0,27,94,.35), 0 0 0 1px rgba(0,27,94,.15);
  position: relative;
  transition: transform .15s;
  cursor: pointer;
}
.moura-marker:hover { transform: scale(1.18); }
.moura-marker.is-uncertain {
  border-style: dashed;
  border-color: #fff;
}
.moura-marker.is-active {
  transform: scale(1.3);
  box-shadow: 0 0 0 4px rgba(0, 61, 165, .3), 0 2px 8px rgba(0,0,0,.3);
}
.moura-marker.r-algarve  { background: var(--algarve); }
.moura-marker.r-alentejo { background: var(--alentejo); }
.moura-marker.r-centro   { background: var(--centro); }

/* Leaflet styling */
.leaflet-container { font-family: var(--sans); }
.leaflet-tile-pane { filter: saturate(.88) brightness(1.02) contrast(.95); }
[data-theme="dark"] .leaflet-tile-pane { filter: invert(.92) hue-rotate(180deg) saturate(.5) brightness(.85) contrast(1.05); }
.leaflet-control-attribution {
  background: rgba(255, 255, 255, 0.9) !important; /* fallback */
  background: color-mix(in srgb, var(--bg) 90%, transparent) !important;
  color: var(--ink-muted) !important;
  font-size: 10px !important;
}
.leaflet-control-attribution a { color: var(--link) !important; }
.leaflet-control-zoom a {
  background: var(--bg) !important;
  color: var(--ink) !important;
  border-color: var(--border) !important;
  font-family: var(--sans) !important;
}
[data-theme="dark"] .leaflet-control-zoom a { background: var(--surface) !important; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: var(--bg) !important;
  color: var(--text) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-lg) !important;
}
.leaflet-popup-content { margin: 12px 14px !important; font-size: 13px; }
.popup-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 16px;
  margin: 0 0 4px;
  color: var(--ink);
}
.popup-meta { font-size: 11px; color: var(--ink-muted); margin: 0 0 8px; }
.popup-btn {
  display: inline-block; margin-top: 6px;
  font-size: 12px; font-weight: 600;
  padding: 6px 12px;
  background: var(--azulejo); color: #fff !important;
  border-radius: var(--radius);
  text-decoration: none;
  transition: background .15s;
}
.popup-btn:hover { background: var(--royal); color: #fff !important; }

/* --- Detail panel --------------------------------------------------- */
.detail-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 27, 94, .3);
  backdrop-filter: blur(3px);
  z-index: 1100;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.detail-overlay:not([hidden]) { opacity: 1; pointer-events: auto; }

.detail-panel {
  position: fixed; top: 0; right: 0;
  width: min(560px, 100vw);
  max-width: 100vw;
  height: 100vh;
  height: 100dvh; /* mobile safe viewport */
  box-sizing: border-box;
  background: var(--bg);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 40px rgba(0, 27, 94, .15);
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.32,.72,.32,1);
  z-index: 1150;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
}
[data-theme="dark"] .detail-panel { background: var(--surface); }
.detail-panel.is-open {
  transform: translateX(0);
}
.detail-close {
  position: absolute; top: 12px; right: 12px;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--ink);
  font-size: 22px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  z-index: 2;
  transition: background .15s;
}
.detail-close:hover { background: var(--light-blue); }
.detail-content { padding: 48px 32px 32px; }
@media (max-width: 600px) {
  .detail-content { padding: 56px 18px 32px; }
  /* 44px minimum touch target for close button on mobile */
  .detail-close {
    width: 44px; height: 44px;
    top: 10px; right: 10px;
    font-size: 24px;
  }
  /* Full-width panel on mobile */
  .detail-panel {
    width: 100vw;
    max-width: 100vw;
    border-left: none;
  }
}

.detail-tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.detail-region-tag {
  display: inline-block;
  font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 2px;
  color: #fff;
  font-weight: 700;
}
.detail-region-tag.r-algarve { background: var(--algarve); }
.detail-region-tag.r-alentejo { background: var(--alentejo); }
.detail-region-tag.r-centro { background: var(--centro); }
[data-theme="dark"] .detail-region-tag { color: #0a0f1e; }
.detail-ritual-tag { background: var(--gold); color: #001B5E; }

.detail-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--text-xl);
  line-height: 1.04;
  letter-spacing: -.01em;
  margin: 0 0 var(--space-2);
  color: var(--color-text);
}
.detail-place {
  font-size: 13px;
  color: var(--ink-muted);
  margin: 0 0 4px;
}
.detail-coord {
  font-size: 11.5px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  display: inline-flex; align-items: center; gap: 6px;
  margin: 0 0 18px;
}
.detail-coord .uncertain-flag {
  font-size: 10px;
  background: var(--gold);
  color: #001B5E;
  padding: 1px 6px;
  border-radius: 2px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.detail-section { margin: 22px 0; padding-top: 14px; border-top: 1px dashed var(--border); }
.detail-section:first-of-type { border-top: 0; padding-top: 0; }
.detail-section h3 {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--color-primary);
  margin: 0 0 var(--space-3);
}
[data-theme="dark"] .detail-section h3 { color: var(--color-gold); }
.detail-section p { margin: 0 0 10px; color: var(--ink-soft); }
.detail-section p:last-child { margin-bottom: 0; }
.detail-section .resumo {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  font-weight: 400;
}
.detail-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.detail-list li {
  font-size: 12.5px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--light-blue);
  color: var(--ink-soft);
}
[data-theme="dark"] .detail-list li { background: var(--surface-2); }
.protagonists li::before {
  content: "\00b7"; margin-right: 4px; color: var(--azulejo); font-weight: 700;
}

.sources {
  display: flex; flex-direction: column; gap: 12px;
  list-style: none; padding: 0; margin: 0;
}
.sources li {
  padding: 12px;
  background: var(--light-blue);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 13px;
}
[data-theme="dark"] .sources li { background: var(--surface-2); }
.sources .src-t { font-weight: 600; color: var(--ink); font-family: var(--serif); }
.sources .src-a { font-size: 12px; color: var(--ink-muted); margin: 2px 0; }
.sources .src-n { font-size: 12px; color: var(--ink-muted); font-style: italic; }
.sources a { word-break: break-word; font-size: 12px; }

/* --- Prose sections ------------------------------------------------- */
.prose-section {
  padding: clamp(48px, 8vw, 96px) var(--gutter);
  border-top: 1px solid var(--color-divider);
  background: var(--color-bg);
}
.prose-section-alt { background: var(--color-surface-offset); }
[data-theme="dark"] .prose-section-alt { background: var(--color-surface); }
.prose-inner { max-width: 880px; margin: 0 auto; }
.prose-inner h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--text-xl);
  line-height: 1.04;
  letter-spacing: -.01em;
  margin: 0 0 var(--space-6);
  color: var(--color-text);
}
.prose-inner .lede {
  font-family: var(--font-display);
  font-size: clamp(17px, 1.4vw, 20px);
  line-height: 1.55;
  color: var(--color-text-muted);
  max-width: 64ch;
  margin: 0 0 var(--space-10);
}
.prose-inner p { color: var(--color-text-muted); line-height: 1.7; }

.region-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-5);
  margin: var(--space-8) 0;
}
.region-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-interactive);
}
.region-card:hover { box-shadow: var(--shadow-md); }
.region-card[data-region="Algarve"]  { border-top: 3px solid var(--algarve); }
.region-card[data-region="Alentejo"] { border-top: 3px solid var(--alentejo); }
.region-card[data-region="Centro"]   { border-top: 3px solid var(--centro); }
.region-card-header { margin: 0 0 var(--space-3); }
.region-tag {
  display: inline-block;
  font-family: var(--font-body);
  font-size: var(--text-xs); letter-spacing: .14em; text-transform: uppercase;
  padding: 3px 9px; border-radius: var(--radius-sm);
  color: var(--color-text-inverse); font-weight: 700;
  margin-bottom: var(--space-2);
}
.region-tag-algarve  { background: var(--algarve); }
.region-tag-alentejo { background: var(--alentejo); }
.region-tag-centro   { background: var(--centro); }
.region-card h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.2rem, 1rem + 0.6vw, 1.5rem);
  line-height: 1.15;
  margin: 0;
  color: var(--color-text);
}
.region-card p { font-size: var(--text-sm); margin: 0 0 var(--space-4); color: var(--color-text-muted); }
.region-keys {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: var(--space-2);
  font-size: var(--text-sm);
}
.region-keys li { color: var(--color-text-muted); }
.region-keys span {
  display: inline-block; min-width: 80px;
  font-family: var(--font-body);
  font-size: var(--text-xs); font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--color-primary);
  margin-right: var(--space-2);
}
[data-theme="dark"] .region-keys span { color: var(--color-gold); }

.comparative-table { margin: 32px 0 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); }
[data-theme="dark"] .comparative-table { background: var(--surface); }
.comparative-table summary {
  padding: 14px 20px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  list-style: none;
}
.comparative-table summary::before { content: "\25B8 "; color: var(--azulejo); margin-right: 4px; }
.comparative-table[open] summary::before { content: "\25BE "; }
.table-wrap { padding: 0 20px 20px; overflow-x: auto; }
.comparative-table table {
  width: 100%; border-collapse: collapse;
  font-size: 13.5px;
}
.comparative-table th, .comparative-table td {
  text-align: left; padding: 10px 12px;
  border-bottom: 1px dashed var(--border);
  vertical-align: top;
}
.comparative-table thead th {
  font-family: var(--font-display); font-weight: 600;
  color: var(--color-text); border-bottom: 2px solid var(--color-primary);
}
.comparative-table tbody th {
  font-weight: 600; color: var(--ink-soft);
}

.method-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-5);
  margin: var(--space-8) 0;
}
.method-item {
  padding: var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  border-left: 3px solid var(--color-primary);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-interactive);
}
.method-item:hover { box-shadow: var(--shadow-md); }
.method-item h3 {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 0.9rem + 0.5vw, 1.4rem);
  font-weight: 600;
  margin: 0 0 var(--space-2);
  color: var(--color-text);
}
.method-item p { font-size: var(--text-sm); margin: 0; }

.callout {
  padding: var(--space-6);
  background: var(--color-primary-highlight);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-gold);
  border-radius: var(--radius-lg);
  margin-top: var(--space-8);
}
[data-theme="dark"] .callout { background: var(--color-surface-2); }
.callout p { margin: 0 0 var(--space-3); font-weight: 600; color: var(--color-text); }
.callout ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: var(--space-2); }
.callout li { font-size: var(--text-sm); line-height: 1.5; color: var(--color-text-muted); }
.tag {
  display: inline-block;
  font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 2px; font-weight: 700;
  margin-right: 6px;
  color: #fff;
}
[data-theme="dark"] .tag { color: #0a0f1e; }
.tag-high { background: #1a6b3a; }
.tag-mid  { background: var(--gold); color: #001B5E; }
.tag-low  { background: var(--azulejo); }

.sources-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 18px; }
.sources-list li {
  padding-left: 18px; border-left: 2px solid var(--azulejo);
}
[data-theme="dark"] .sources-list li { border-left-color: var(--gold); }

/* --- Footer --------------------------------------------------------- */
.site-footer {
  background: var(--color-text);
  padding: clamp(32px, 5vw, 56px) var(--gutter);
  color: rgba(255,255,255,.8);
}
[data-theme="dark"] .site-footer { background: #060a16; }
.footer-inner {
  max-width: var(--content-default);
  margin: 0 auto;
  text-align: center;
}
.footer-brand {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 1rem + 0.5vw, 1.5rem);
  font-weight: 500;
  color: var(--color-gold);
  margin: 0 0 var(--space-3);
}
.footer-text {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: rgba(255,255,255,.75);
  margin: 0 0 var(--space-4);
  max-width: 52ch;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}
.footer-small {
  font-size: 11.5px;
  color: rgba(255,255,255,.45);
  margin: 0;
}
.footer-small a { color: rgba(255,255,255,.6); }
.footer-small a:hover { color: #fff; }

/* --- Knowledge Panel (Entity side panel) ---------------------------- */
.entity-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 27, 94, .25);
  backdrop-filter: blur(2px);
  z-index: 1100;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.entity-overlay:not([hidden]) { opacity: 1; pointer-events: auto; }

.entity-panel {
  position: fixed; top: 0; right: 0;
  width: min(520px, 100vw);
  max-width: 100vw;
  height: 100vh;
  height: 100dvh; /* mobile safe viewport */
  box-sizing: border-box;
  background: var(--bg);
  border-left: 3px solid var(--azulejo);
  box-shadow: -8px 0 40px rgba(0, 27, 94, .12);
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.32,.72,.32,1);
  z-index: 1150;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
}
[data-theme="dark"] .entity-panel {
  background: var(--surface);
  border-left-color: var(--gold);
}
.entity-panel.is-open { transform: translateX(0); }

.entity-panel-close {
  position: sticky; top: 0; float: right;
  width: 40px; height: 40px;
  margin: 12px 12px 0 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--ink);
  font-size: 22px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  z-index: 2;
  cursor: pointer;
  transition: background .15s;
}
.entity-panel-close:hover { background: var(--light-blue); }
[data-theme="dark"] .entity-panel-close { background: var(--surface-2); }

.entity-panel-content { padding: 20px 28px 40px; clear: both; }
@media (max-width: 600px) {
  .entity-panel-content { padding: 20px 18px 40px; }
  .entity-panel { width: 100vw; max-width: 100vw; border-left: none; }
  .entity-panel-close { width: 44px; height: 44px; font-size: 24px; }
}

/* Entity panel header */
.ep-type {
  display: inline-block;
  font-size: 10px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
  padding: 3px 10px;
  background: var(--azulejo);
  color: #fff;
  border-radius: 999px;
  margin-bottom: 14px;
}
[data-theme="dark"] .ep-type { background: var(--gold); color: #0a0f1e; }

.ep-name {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--text-xl);
  line-height: 1.04;
  letter-spacing: -.01em;
  margin: 0 0 var(--space-4);
  color: var(--color-text);
}

.ep-description {
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink-soft);
  margin: 0 0 24px;
  padding-bottom: 20px;
  border-bottom: 1px dashed var(--border);
}

/* Key facts */
.ep-facts {
  list-style: none; padding: 0; margin: 0 0 24px;
  display: flex; flex-direction: column; gap: 0;
}
.ep-facts li {
  display: flex; gap: 8px;
  font-size: 13.5px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  color: var(--ink-soft);
}
.ep-facts li:last-child { border-bottom: 0; }
.ep-fact-label {
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--azulejo);
  min-width: 100px;
  flex-shrink: 0;
  padding-top: 2px;
}
[data-theme="dark"] .ep-fact-label { color: var(--gold); }

/* Sections */
.ep-section {
  margin: 24px 0; padding-top: 18px;
  border-top: 1px dashed var(--border);
}
.ep-section:first-of-type { border-top: 0; padding-top: 0; }
.ep-section h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg); font-weight: 600;
  margin: 0 0 var(--space-3);
  color: var(--color-text);
}
.ep-section p {
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--ink-soft);
  margin: 0;
}
.ep-section p + p { margin-top: 12px; } /* breathing space between multi-paragraph biography <p>s */

/* Sources */
.ep-sources-title {
  font-family: var(--font-body);
  font-size: var(--text-xs); font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--color-text-faint);
  margin: var(--space-8) 0 var(--space-3);
}
.ep-sources {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 6px;
}
.ep-sources li {
  font-size: 12.5px;
  color: var(--ink-muted);
  padding-left: 14px;
  position: relative;
  line-height: 1.5;
}
.ep-sources li::before {
  content: "";
  position: absolute; left: 0; top: 7px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--gold);
}

/* Related entities */
.ep-related-title {
  font-family: var(--font-body);
  font-size: var(--text-xs); font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--color-text-faint);
  margin: var(--space-6) 0 var(--space-3);
}
.ep-related {
  display: flex; flex-wrap: wrap; gap: 6px;
  list-style: none; padding: 0; margin: 0;
}
.ep-related li {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  padding: 6px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background var(--transition-interactive), color var(--transition-interactive), border-color var(--transition-interactive);
  font-weight: 500;
}
.ep-related li:hover {
  background: var(--color-primary-highlight);
  color: var(--color-primary);
  border-color: color-mix(in oklab, var(--color-primary) 40%, var(--color-border));
}
[data-theme="dark"] .ep-related li:hover { background: var(--color-primary-highlight); color: var(--color-primary); border-color: var(--color-primary); }

/* --- Empty state ---------------------------------------------------- */
.empty-state {
  padding: 32px;
  text-align: center;
  color: var(--ink-muted);
  font-size: 14px;
}
.empty-state strong { color: var(--ink); display: block; margin-bottom: 4px; font-family: var(--serif); font-size: 16px; }
.empty-state p { font-size: 13px; color: var(--ink-muted); margin-top: 8px; }

/* --- Colecções do Orbe (compact cards) ----------------------------- */
.coleccoes-orbe-section {
  padding: clamp(40px, 6vw, 72px) var(--gutter);
  background: var(--color-surface-offset);
  border-top: 1px solid var(--color-divider);
}
[data-theme="dark"] .coleccoes-orbe-section {
  background: var(--color-surface);
}
.coleccoes-orbe-inner {
  max-width: var(--content-default);
  margin: 0 auto;
  text-align: center;
}
.coleccoes-orbe-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--text-xl);
  line-height: 1.04;
  letter-spacing: -.01em;
  margin: 0 0 var(--space-8);
  color: var(--color-text);
}
.coleccoes-orbe-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  max-width: 800px;
  margin: 0 auto;
}
@media (max-width: 600px) {
  .coleccoes-orbe-grid { grid-template-columns: 1fr; }
}
.coleccao-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-interactive), border-color var(--transition-interactive);
}
.coleccao-card:hover {
  box-shadow: var(--shadow-md);
  border-color: color-mix(in oklab, var(--color-primary) 40%, var(--color-border));
}
.coleccao-card-icon {
  color: var(--color-primary);
  margin-bottom: var(--space-4);
}
[data-theme="dark"] .coleccao-card-icon { color: var(--color-gold); }
.coleccao-card-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.2rem, 1rem + 0.5vw, 1.5rem);
  margin: 0 0 var(--space-3);
  color: var(--color-text);
}
.coleccao-card-desc {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
  margin: 0 0 var(--space-5);
}
.coleccao-card-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.2rem;
  background: var(--color-primary);
  color: var(--color-text-inverse);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-full);
  text-decoration: none;
  min-height: 44px;
  box-shadow: var(--shadow-md);
  transition: background var(--transition-interactive), transform var(--transition-interactive);
}
.coleccao-card-cta:hover {
  background: var(--color-primary-hover);
  transform: translateY(-1px);
}

/* --- Map section header -------------------------------------------- */
.map-section-header {
  text-align: center;
  max-width: var(--container);
  margin: 0 auto;
  padding-bottom: 24px;
}
.map-section-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--text-xl);
  line-height: 1.04;
  letter-spacing: -.01em;
  margin: 0 0 var(--space-3);
  color: var(--color-text);
}
.map-section-subtitle {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text-muted);
  margin: 0;
  line-height: 1.6;
}

/* --- Ensaios e contextos ------------------------------------------- */
.ensaios-section {
  padding: clamp(48px, 8vw, 96px) var(--gutter);
  background: var(--color-surface-offset);
  border-top: 1px solid var(--color-divider);
}
[data-theme="dark"] .ensaios-section {
  background: var(--color-surface);
}
.ensaios-inner {
  max-width: var(--container);
  margin: 0 auto;
}
.ensaios-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--text-xl);
  line-height: 1.04;
  letter-spacing: -.01em;
  margin: 0 0 var(--space-8);
  color: var(--color-text);
}
.ensaios-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
@media (max-width: 760px) {
  .ensaios-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}
.ensaio-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  border-left: 3px solid var(--color-gold);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-interactive);
}
.ensaio-card:hover {
  box-shadow: var(--shadow-md);
}
.ensaio-card-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-lg);
  line-height: 1.15;
  margin: 0 0 var(--space-3);
  color: var(--color-text);
}
.ensaio-card-desc {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: 0 0 var(--space-5);
  line-height: 1.6;
}
.ensaio-cta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: none;
}
.ensaio-cta:hover {
  color: var(--color-primary-hover);
}

/* --- Lusita nas redes (Phase 1H.4 P5) -------------------------------- */
.lusita-social-section {
  padding: clamp(40px, 6vw, 64px) var(--gutter);
  background: var(--bg);
  border-top: 1px solid var(--border-light);
}
.lusita-social-inner {
  max-width: 920px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 32px;
}
.lusita-social-copy {
  flex: 1 1 0%;
}
.lusita-social-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--text-xl);
  line-height: 1.04;
  letter-spacing: -.01em;
  margin: 0 0 var(--space-3);
  color: var(--color-text);
}
.lusita-social-text {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.55;
  color: var(--color-text-muted);
  max-width: 48ch;
  margin: 0 0 var(--space-4);
}
.lusita-social-signature {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-sm);
  color: var(--color-text-faint);
  margin: 0;
}

/* Social links */
.lusita-social-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
  padding-top: 6px;
}
.lusita-social-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  text-decoration: none;
  padding: 0.85rem 1.2rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  transition: background var(--transition-interactive),
              border-color var(--transition-interactive),
              transform var(--transition-interactive);
  min-height: 44px;
  white-space: nowrap;
}
.lusita-social-link:hover {
  background: var(--color-surface-2);
  border-color: color-mix(in oklab, var(--color-primary) 24%, var(--color-border));
  transform: translateY(-1px);
}
.lusita-social-icon {
  flex-shrink: 0;
}

/* Lusita avatar */
.lusita-social-avatar {
  flex-shrink: 0;
  width: 150px;
  height: 150px;
  overflow: hidden;
  align-self: center;
}
.lusita-social-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, .08));
}
[data-theme="dark"] .lusita-social-avatar-img {
  filter: drop-shadow(0 4px 16px rgba(0, 0, 0, .3));
}

/* Mobile: stack vertically */
@media (max-width: 700px) {
  .lusita-social-inner {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 20px;
  }
  .lusita-social-copy {
    order: 1;
  }
  .lusita-social-avatar {
    order: 2;
    width: 120px;
    height: 120px;
  }
  .lusita-social-links {
    order: 3;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
  }
  .lusita-social-link {
    flex: 1 1 calc(50% - 5px);
    justify-content: center;
    min-width: 0;
  }
}

/* --- Footer editorial ---------------------------------------------- */
.footer-tagline {
  font-family: var(--serif);
  font-size: 14px;
  font-style: italic;
  color: rgba(255,255,255,.6);
  margin: 0 0 20px;
}
.footer-nav {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.footer-link {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  transition: color .15s;
}
.footer-link:hover {
  color: var(--gold);
}
.footer-transparency {
  font-size: 12px;
  color: rgba(255,255,255,.5);
  margin: 0 0 16px;
  max-width: 52ch;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
  font-style: italic;
}

/* --- Motion preferences --------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --- Trust line (Phase 1L) ------------------------------------------- */
.trust-line {
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft, #888);
  padding: 20px 24px;
  font-family: var(--sans, 'Inter', sans-serif);
  line-height: 1.6;
}
.trust-line-link {
  color: var(--azulejo, #003DA5);
  text-decoration: none;
  white-space: nowrap;
}
.trust-line-link:hover { text-decoration: underline; }

/* ============================================
   Phase 1K — Advanced Filters Drawer
   ============================================ */

/* Drawer container */
#adv-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100dvh;
  width: 320px;
  background: var(--bg, #fff);
  box-shadow: -4px 0 24px rgba(0, 27, 94, 0.10);
  z-index: 800;
  display: flex;
  flex-direction: column;
  transform: translateX(320px);
  transition: transform 220ms cubic-bezier(.32,.72,.32,1);
  overflow: hidden;
}
#adv-drawer[aria-hidden="false"] {
  transform: translateX(0);
}
[data-theme="dark"] #adv-drawer {
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.40);
}

/* Map compression on desktop */
@media (min-width: 768px) {
  .map-section {
    transition: margin-right 220ms cubic-bezier(.32,.72,.32,1);
  }
  body.adv-drawer-open .map-section {
    margin-right: 320px;
  }
}

/* Drawer header */
.adv-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(0, 61, 165, 0.10);
  flex-shrink: 0;
}
.adv-drawer-title {
  font-family: var(--serif, 'Cormorant Garamond', serif);
  font-size: 17px;
  font-weight: 600;
  color: var(--royal, #003DA5);
  letter-spacing: -0.01em;
}
.adv-drawer-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(0, 61, 165, 0.18);
  background: transparent;
  color: var(--ink-soft, #666);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.adv-drawer-close:hover { background: rgba(0, 61, 165, 0.06); }

/* Drawer body (scrollable) */
.adv-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

/* Groups */
.adv-group {
  border-bottom: 1px solid rgba(0, 61, 165, 0.06);
}
.adv-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  cursor: default;
}
.adv-group--collapsible .adv-group-header {
  cursor: pointer;
}
.adv-group-title {
  font-family: var(--sans, 'Inter', sans-serif);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft, #888);
}
.adv-group-badge {
  background: var(--azulejo, #003DA5);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}
.adv-group-badge[hidden] { display: none !important; }
.adv-group-toggle-icon {
  font-size: 10px;
  color: var(--ink-muted, #aaa);
  margin-left: 6px;
  transition: transform 200ms;
}
.adv-group--collapsible[aria-expanded="false"] .adv-group-toggle-icon {
  transform: rotate(-90deg);
}
.adv-group-body {
  padding: 4px 20px 12px;
}
.adv-group--collapsed .adv-group-body {
  display: none;
}

/* Footer */
.adv-drawer-footer {
  padding: 12px 20px;
  border-top: 1px solid rgba(0, 61, 165, 0.10);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.adv-footer-metodo {
  font-size: 12px;
  color: var(--azulejo, #003DA5);
  text-decoration: none;
  margin-right: auto;
}
.adv-footer-metodo:hover { text-decoration: underline; }
.adv-btn-secondary {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  transition: background var(--transition-interactive), border-color var(--transition-interactive);
}
.adv-btn-secondary:hover {
  background: var(--color-surface-2);
  border-color: color-mix(in oklab, var(--color-primary) 24%, var(--color-border));
}
.adv-btn-primary {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-full);
  border: none;
  background: var(--color-primary);
  color: var(--color-text-inverse);
  cursor: pointer;
  transition: background var(--transition-interactive);
}
.adv-btn-primary:hover {
  background: var(--color-primary-hover);
}

/* aside.filters contains only the drawer trigger button —
   must remain visible on all screen sizes */
aside.filters {
  display: block;
}

/* Mobile: bottom sheet */
@media (max-width: 768px) {
  #adv-drawer {
    width: 100%;
    height: 65dvh;
    top: auto;
    bottom: 0;
    right: 0;
    transform: translateY(65dvh);
    transition: transform 220ms cubic-bezier(.32,.72,.32,1);
    border-radius: 16px 16px 0 0;
  }
  #adv-drawer[aria-hidden="false"] {
    transform: translateY(0);
  }
  body.adv-drawer-open .map-section {
    margin-right: 0;
  }
}

[data-theme="dark"] .adv-btn-secondary {
  border-color: rgba(255,255,255,0.2);
  color: #fff;
}

/* === Logo compass rose classes === */
.orbe-b  { fill: #185FA5; }
.orbe-g  { fill: #C9922A; }
.orbe-rb { fill: none; stroke: #185FA5; }
.orbe-rg { fill: none; stroke: #C9922A; }

[data-theme="dark"] .orbe-b  { fill: #85B7EB; }
[data-theme="dark"] .orbe-g  { fill: #EF9F27; }
[data-theme="dark"] .orbe-rb { stroke: #85B7EB; }
[data-theme="dark"] .orbe-rg { stroke: #EF9F27; }

/* Nav logo — now handled by lusita-design-system.css (.brand, .brand-name) */

/* Hero watermark */
.hero-watermark {
  position: absolute;
  right: -3%;
  top: 50%;
  transform: translateY(-50%);
  width: clamp(160px, 28vw, 260px);
  height: auto;
  opacity: 0.05;
  pointer-events: none;
}
@media (max-width: 600px) {
  .hero-watermark { display: none; }
}

/* ============================================================
   Castelos e Fortificações — detail card (Part B)
   Two colours only: azulejo + ouro. Scoped under .castelo-card.
   ============================================================ */
.castelo-card { display: flex; flex-direction: column; }

/* Image area — 16/9 */
.castelo-card-img {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 12px;
  background: var(--surface-2);
}
.castelo-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.castelo-card-img--fallback {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #1a3a5a, #185FA5);
}
.castelo-card-img--fallback svg { width: 40%; height: auto; }
.castelo-card-attr {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-family: var(--sans);
  font-size: 10px;
  line-height: 1.3;
  padding: 4px 8px;
}

/* Body */
.castelo-card-body { padding: 16px 2px 4px; }
.castelo-card-kicker {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--sans);
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 6px;
}
.castelo-card-kicker-icon { display: inline-flex; width: 16px; height: 18px; }
.castelo-card-kicker-icon svg { width: 100%; height: 100%; }
.castelo-card-title {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 600;
  font-size: 28px;
  line-height: 1.15;
  color: var(--ink);
  margin: 0 0 4px;
}
.castelo-card-year {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-muted);
  margin: 0 0 12px;
}
.castelo-card-summary {
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0;
}
.castelo-card-hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0 12px; }
.castelo-card-fios-label {
  font-family: var(--sans);
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0 0 10px;
}

/* Fio rows */
.castelo-fio {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--surface-2);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 8px;
}
.castelo-fio.is-clickable { cursor: pointer; transition: background 0.15s ease; }
.castelo-fio.is-clickable:hover,
.castelo-fio.is-clickable:focus-visible {
  background: var(--border-light);
  outline: 2px solid var(--azulejo);
  outline-offset: 1px;
}
.castelo-fio-icon {
  flex: 0 0 auto;
  width: 24px; height: 24px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
}
.castelo-fio-icon svg { width: 15px; height: 15px; }
.castelo-fio-icon--lenda { background: transparent; border: 1.5px solid var(--azulejo); }
.castelo-fio-icon--figura { background: var(--azulejo); }
.castelo-fio-icon--tempo { background: var(--gold); }
.castelo-fio-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.castelo-fio-label {
  font-family: var(--sans);
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase;
}
.castelo-fio-label.is-azulejo { color: var(--azulejo); }
.castelo-fio-label.is-ouro { color: var(--gold); }
.castelo-fio-note {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-soft);
}

@media (max-width: 600px) {
  .castelo-card-title { font-size: 24px; }
  .castelo-fio { padding: 12px; }   /* icon + text keeps row ≥44px tall */
}

/* Map-action highlight — brief, panel-free emphasis when "show on map"
   flies to a single item (RULE 1). Pulses + gold glow, then clears. */
@keyframes orbe-marker-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.32); }
}
.padrao-marker.is-highlighted {
  transform-origin: 50% 100%;
  animation: orbe-marker-pulse 0.9s ease-in-out 3;
  filter: drop-shadow(0 0 5px var(--gold));
}

/* Mouras detail image — ported from the Castelos image component.
   Roxo (mouras) fallback gradient behind the photo; caption top-left,
   attribution band bottom (same as castelos). */
.moura-detail-img {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 0 0 18px;
  overflow: hidden;
  border-radius: 12px;
  background: linear-gradient(160deg, #2e1a47, #5c3a8f); /* roxo fallback */
}
.moura-detail-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  display: block;
}
.moura-detail-caption {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(46, 26, 71, 0.82); /* roxo, translucent */
  color: #fff;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 4px 11px;
  border-radius: 999px;
}
.moura-detail-attr {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-family: var(--sans);
  font-size: 10px;
  line-height: 1.3;
  padding: 4px 8px;
}

/* =============================================================
   Expanded card — layers 4–7 (Castelos-first, data-driven)
   Scoped under .castelo-card. Two colours only: azulejo + gold.
   Body text = Inter (--sans). Cormorant italic (--serif) is used
   ONLY in the Lusita note (voice, not information).
   ============================================================= */

/* Layer 4 — Historical context (expandable, collapsed by default) */
.castelo-card-history { margin-top: 18px; }
.castelo-history-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  background: none; border: 0; cursor: pointer;
  padding: 8px 0;
  font-family: var(--sans);
  font-size: 14px; font-weight: 600;
  color: var(--azulejo);
}
.castelo-history-toggle:focus-visible {
  outline: 2px solid var(--azulejo); outline-offset: 2px; border-radius: 4px;
}
.castelo-history-chevron { font-size: 14px; line-height: 1; transition: transform 0.2s ease; }
.castelo-history-toggle.is-open .castelo-history-chevron { transform: rotate(180deg); }
.castelo-history-body { margin-top: 6px; }
.castelo-history-body p {
  font-family: var(--sans);
  font-size: 15px; line-height: 1.6;
  color: var(--ink-soft);
  margin: 0 0 12px;
}
.castelo-history-body p:last-child { margin-bottom: 0; }

/* Layer 5 — Sources grouped by perspective */
.castelo-card-sources {
  margin-top: 22px; padding-top: 16px;
  border-top: 1px solid var(--border);
}
.castelo-sources-head {
  font-family: var(--sans);
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0 0 14px;
}
.castelo-source-group { margin-bottom: 16px; }
.castelo-source-group:last-child { margin-bottom: 0; }
.castelo-source-grouplabel {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--sans);
  font-size: 12px; font-weight: 700; letter-spacing: 0.03em;
  color: var(--ink);
  margin: 0 0 8px;
}
.castelo-source-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; display: inline-block; }
.castelo-source-dot.is-crista   { background: var(--azulejo); }
.castelo-source-dot.is-andaluza { background: var(--gold); }
.castelo-source-dot.is-critica  { background: transparent; border: 1.5px solid var(--azulejo); }
.castelo-source-dot.is-tradicao-oral { background: transparent; border: 1.5px solid var(--gold); }
.castelo-source-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.castelo-source-item { padding-left: 17px; border-left: 2px solid var(--border); }
.castelo-source-title { font-family: var(--sans); font-size: 14px; font-weight: 600; color: var(--ink); margin: 0; line-height: 1.4; }
.castelo-source-meta  { font-family: var(--sans); font-size: 12px; color: var(--ink-muted); margin: 2px 0 0; }
.castelo-source-note  { font-family: var(--sans); font-size: 12px; color: var(--ink-muted); font-style: italic; margin: 4px 0 0; line-height: 1.45; }
.castelo-source-link {
  display: inline-flex; align-items: center; min-height: 24px; margin-top: 6px;
  font-family: var(--sans); font-size: 13px; font-weight: 600;
  color: var(--azulejo); text-decoration: none;
}
.castelo-source-link:hover, .castelo-source-link:focus-visible { text-decoration: underline; }
.castelo-source-ref {
  display: inline-block; margin-top: 6px;
  font-family: var(--sans); font-size: 11px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-muted);
}

/* Layer 6 — The honest absence (dashed soft-gold, italic; honesty-as-strength) */
.castelo-honest-absence {
  margin-top: 18px; padding: 14px 16px;
  border: 1.5px dashed color-mix(in oklab, var(--gold) 55%, transparent);
  border-radius: 12px;
  background: color-mix(in oklab, var(--gold) 6%, transparent);
}
.castelo-honest-text {
  font-family: var(--sans);
  font-size: 13.5px; line-height: 1.55; font-style: italic;
  color: var(--ink-soft);
  margin: 0;
}

/* Layer 7 — Lusita note (closes the card; voice, not information) */
.castelo-lusita {
  display: flex; gap: 12px; align-items: flex-start;
  margin-top: 20px; padding: 14px 16px;
  background: color-mix(in oklab, var(--gold) 10%, transparent);
  border-left: 3px solid var(--gold);
  border-radius: 0 12px 12px 0;
}
.castelo-lusita-avatar {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; overflow: hidden;
  background: color-mix(in oklab, var(--gold) 12%, transparent);
  border: 1.5px solid color-mix(in oklab, var(--gold) 22%, transparent);
}
.castelo-lusita-avatar img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; display: block; }
.castelo-lusita-body { flex: 1; min-width: 0; }
.castelo-lusita-label {
  display: inline-block;
  font-family: var(--sans);
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--gold);
  margin-bottom: 3px;
}
.castelo-lusita-text {
  font-family: var(--serif);
  font-size: 17px; font-style: italic; line-height: 1.5;
  color: var(--ink);
  margin: 0;
}

@media (max-width: 600px) {
  .castelo-lusita-text { font-size: 16px; }
  .castelo-source-link, .castelo-source-ref { min-height: 28px; }
}
