:root {
  --ink: #101418;
  --ink-2: #4b555f;
  --paper: rgba(255, 255, 255, 0.86);
  --paper-solid: #ffffff;
  --line: rgba(16, 20, 24, 0.1);
  --accent: #e8962a;
  --accent-ink: #7a4a0c;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(15, 25, 35, 0.18), 0 1px 2px rgba(15, 25, 35, 0.08);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Fraunces', Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #dde8f2; color: var(--ink); font-family: var(--font); font-size: 14px; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
button { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
.muted { color: var(--ink-2); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.15); }

/* loading */
/* loading: the aerial panorama of the site (assets/img/loading.jpg) with the logotype on it */
#loading { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: #24384a url(assets/img/loading.jpg) center / cover no-repeat; transition: opacity 0.8s ease; }
#loading::before { content: ''; position: absolute; inset: 0; z-index: 1; background: radial-gradient(ellipse at 50% 45%, rgba(0,0,0,0.38) 0%, rgba(0,0,0,0.12) 45%, rgba(0,0,0,0) 75%); pointer-events: none; }
#loading.done { opacity: 0; pointer-events: none; }
.ld-slides { position: absolute; inset: 0; z-index: 0; overflow: hidden; }
.ld-slide { position: absolute; inset: 0; background-position: center; background-size: cover; background-repeat: no-repeat; opacity: 0; transition: opacity 1s ease; }
.ld-slide.on { opacity: 1; }
.loading-card { position: relative; z-index: 2; text-align: center; width: min(52vw, 440px); }
.loading-card p { color: rgba(255,255,255,0.88); margin-top: 14px; font-size: 13px; text-shadow: 0 1px 6px rgba(0,0,0,0.6); }
/* text loader under the logotype (cssloaders.github.io, 'text'): one word every 1.2 s, five equal steps so
   the last word is shown as long as the others; the site font instead of Arial */
.loader { display: inline-block; font-family: 'Montserrat', var(--font); font-weight: 500; font-size: clamp(24px, 5vw, 44px); letter-spacing: 2px; line-height: 1.2; color: #fff; text-shadow: 0 2px 16px rgba(0,0,0,0.6); box-sizing: border-box; min-height: 1.2em; }
/* Gran Reserva (user text, 2026-09-12): "CARREGANDO.. SEU... NOVO... LAR... AGUARDE...."; English when the page is in EN */
.loader::before { content: 'CARREGANDO...'; animation: animloader 7.5s steps(1) infinite; }
@keyframes animloader {
  0% { content: 'CARREGANDO...'; }
  20% { content: 'SEU...'; }
  40% { content: 'NOVO...'; }
  60% { content: 'LAR...'; }
  80% { content: 'AGUARDE...'; }
}
html[lang^="en"] .loader::before { content: 'LOADING...'; animation-name: animloaderEn; }
@keyframes animloaderEn {
  0% { content: 'LOADING...'; }
  20% { content: 'YOUR...'; }
  40% { content: 'NEW...'; }
  60% { content: 'HOME...'; }
  80% { content: 'PLEASE WAIT...'; }
}
/* logotype (assets/logo.png: black ink on transparent, inverted at night) */
.brand-logo { display: block; width: 168px; height: auto; user-select: none; -webkit-user-drag: none; }
.brand-logo.large { width: 100%; margin: 0 auto 24px; filter: drop-shadow(0 8px 28px rgba(0,0,0,0.55)); }   /* Gran Reserva: the logotype is gold on transparent, never inverted */

/* top bar */
#topbar { position: fixed; top: 14px; left: 14px; right: 14px; z-index: 20; display: flex; align-items: flex-start; gap: 14px; pointer-events: none; }
#topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; padding: 10px 16px 9px; background: var(--paper); backdrop-filter: blur(14px); border-radius: var(--radius); box-shadow: var(--shadow); }
.brand-block { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.brand p { font-size: 11px; color: var(--ink-2); letter-spacing: 0.02em; text-align: center; white-space: nowrap; }
.search-wrap { position: relative; flex: 0 1 300px; }
#search { width: 100%; height: 44px; border: 0; border-radius: var(--radius); padding: 0 16px; background: var(--paper); backdrop-filter: blur(14px); box-shadow: var(--shadow); font: inherit; color: var(--ink); outline: none; }
#search:focus { box-shadow: var(--shadow), 0 0 0 3px rgba(232,150,42,0.35); }
#search-results { display: none; position: absolute; top: 50px; left: 0; right: 0; background: var(--paper-solid); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
#search-results.show { display: block; }
#search-results > div { padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--line); }
#search-results > div:hover { background: #fff5e6; }
#search-results > div:last-child { border-bottom: 0; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.counter { padding: 0 14px; height: 44px; display: flex; align-items: center; gap: 4px; background: var(--paper); backdrop-filter: blur(14px); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--ink-2); white-space: nowrap; }
.counter b { color: var(--ink); font-weight: 600; }
.btn { height: 44px; padding: 0 16px; border: 0; border-radius: var(--radius); background: var(--paper); backdrop-filter: blur(14px); box-shadow: var(--shadow); cursor: pointer; font-weight: 500; transition: transform 0.12s ease, background 0.12s ease; white-space: nowrap; }
.btn:hover { transform: translateY(-1px); background: #fff; }
.btn.active { background: var(--ink); color: #fff; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: #d9871e; }
.btn.ghost { background: rgba(255,255,255,0.65); }
.icon-btn { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgba(16,20,24,0.55); color: #fff; font-size: 20px; line-height: 1; cursor: pointer; z-index: 2; }
.icon-btn:hover { background: rgba(16,20,24,0.8); }

/* legend */
#legend { position: fixed; left: 14px; bottom: 78px; z-index: 20; width: 280px; padding: 14px; background: var(--paper); backdrop-filter: blur(14px); border-radius: var(--radius); box-shadow: var(--shadow); }
#legend h2 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-2); margin-bottom: 8px; }
/* collapsible legend: a handle at the top of the card; collapsed = handle (+ credits on phones) only */
.legend-handle { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; height: 18px; margin: -6px 0 6px; padding: 0; border: 0; background: none; color: var(--ink-2); font: inherit; font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; cursor: pointer; }
.legend-handle:hover { color: var(--ink); }
.legend-handle .lh-chev { display: inline-block; font-size: 15px; line-height: 1; transform: rotate(180deg); transition: transform 0.2s; }
#legend.collapsed .legend-handle .lh-chev { transform: none; }
#legend:not(.collapsed) .lh-label { display: none; }
#legend.collapsed .legend-handle { margin-bottom: 0; }
#legend.collapsed > :not(.legend-handle):not(#unk-link):not(#credits) { display: none; }
#legend #credits { position: static; font-size: 9px; color: var(--ink-2); text-shadow: none; padding: 5px 0 0; text-align: center; line-height: 1.3; }
#legend-items { display: flex; flex-direction: column; gap: 4px; }
/* developer logo: its own card right below the legend (the legend is fixed, so the absolute child hangs from it) */
#unk-link { position: absolute; left: 0; right: 0; top: calc(100% + 10px); height: 54px; display: flex; align-items: center; justify-content: center; background: var(--paper); backdrop-filter: blur(14px); border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none; }
#unk-link:hover .unk-logo { opacity: 0.65; }
.unk-logo { display: block; height: 36px; width: auto; transition: opacity 0.15s; user-select: none; -webkit-user-drag: none; }
.chip { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: 0; border-radius: 10px; background: transparent; text-align: left; cursor: pointer; transition: background 0.12s ease, opacity 0.12s ease; }
.chip:hover { background: rgba(16,20,24,0.06); }
.chip.off { opacity: 0.4; }
.chip .dot { margin: 0; width: 12px; height: 12px; }
.chip-label { font-weight: 500; }
.chip-sub { font-size: 11.5px; color: var(--ink-2); }
.chip-count { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 30px; text-align: right; }
.chip.all { display: block; text-align: center; font-size: 12px; color: var(--ink-2); margin-top: 4px; padding: 6px; }
.hint { font-size: 11.5px; color: var(--ink-2); margin-top: 10px; line-height: 1.4; }

/* compass + hint */
#compass-wrap { position: fixed; right: 14px; bottom: 54px; z-index: 20; width: 44px; height: 44px; border-radius: 50%; background: var(--paper); backdrop-filter: blur(14px); box-shadow: var(--shadow); display: grid; place-items: center; }
#compass { width: 30px; height: 30px; position: relative; }
#compass::before { content: ''; position: absolute; left: 50%; top: 2px; width: 0; height: 0; margin-left: -6px; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 12px solid #d33; }
#compass span { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); font-size: 10px; font-weight: 700; }
#controls-hint { position: fixed; right: 14px; bottom: 14px; z-index: 20; font-size: 11.5px; color: var(--ink-2); background: rgba(255,255,255,0.7); padding: 6px 10px; border-radius: 8px; backdrop-filter: blur(8px); }
#credits { position: fixed; right: 14px; bottom: 44px; z-index: 20; font-size: 10px; color: rgba(255,255,255,0.85); text-shadow: 0 1px 2px rgba(0,0,0,0.6); padding: 2px 6px; }

/* tooltip */
#tooltip { position: fixed; z-index: 30; pointer-events: none; padding: 9px 12px; background: rgba(16,20,24,0.88); color: #fff; border-radius: 10px; font-size: 12.5px; line-height: 1.45; opacity: 0; transform: translateY(4px); transition: opacity 0.12s ease, transform 0.12s ease; max-width: 280px; }
#tooltip.show { opacity: 1; transform: translateY(0); }
#tooltip .muted { color: rgba(255,255,255,0.7); }

/* detail panel */
#panel { position: fixed; top: 74px; right: 14px; bottom: 14px; z-index: 25; width: 380px; max-width: calc(100vw - 28px); display: flex; flex-direction: column; background: var(--paper-solid); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; transform: translateX(calc(100% + 30px)); transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1); }
#panel.open { transform: none; }
#panel figure { margin: 0; position: relative; aspect-ratio: 4 / 3; background: #dfe6ec; flex: none; overflow: hidden; touch-action: pan-y; }
#panel figure img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; user-select: none; -webkit-user-drag: none; }
#panel figcaption { position: absolute; left: 10px; bottom: 10px; font-size: 11px; padding: 4px 8px; border-radius: 6px; background: rgba(16,20,24,0.6); color: #fff; }
.panel-head { padding: 16px 18px 6px; }
.panel-head h2 { font-family: var(--serif); font-weight: 500; font-size: 26px; letter-spacing: -0.01em; }
.panel-head p { color: var(--ink-2); margin-top: 4px; }
#panel-body { padding: 8px 18px 12px; overflow: auto; flex: 1; }
.facts { display: flex; flex-direction: column; }
.fact { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.fact .k { color: var(--ink-2); font-size: 12.5px; }
.fact .k small { font-size: 11px; }
.fact .v { text-align: right; font-weight: 500; }
.fact .v em { display: block; font-style: normal; font-weight: 400; color: var(--ink-2); font-size: 12px; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 6px; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.12); }
.source { font-size: 11px; color: var(--ink-2); line-height: 1.45; margin-top: 12px; }
.panel-actions { display: flex; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid var(--line); flex: none; }
.panel-actions .btn { height: 40px; padding: 0 12px; box-shadow: none; }
.panel-actions .primary { flex: 1; }

@media (max-width: 900px) {
  #topbar { flex-wrap: wrap; }
  .search-wrap { order: 3; flex: 1 1 100%; }
  .counter { display: none; }
  #legend { width: 240px; }
  #controls-hint { display: none; }
}
@media (max-width: 640px) {
  /* phone layout: two-row header, chip strip for the legend, bottom sheet for the details */
  #topbar { top: 8px; left: 8px; right: 8px; gap: 6px; }
  .brand { padding: 7px 10px 6px; border-radius: 12px; }
  .brand p { display: none; }
  .brand-logo { width: 104px; }
  .search-wrap { order: 3; flex: 1 1 100%; }
  #search { height: 36px; font-size: 14px; border-radius: 12px; padding: 0 12px; }
  #search-results { top: 42px; }
  .topbar-right { margin-left: auto; gap: 5px; flex-wrap: nowrap; }
  .btn { height: 27px; padding: 0 7px; font-size: 11px; border-radius: 9px; letter-spacing: 0; }   /* GRANRESERVA-MAIN10: smaller on phones */
  .btn.ghost { padding: 0 6px; }
  .topbar-right { gap: 4px; }
  #btn-ao { display: none; }
  #legend { left: 8px; right: 8px; bottom: 8px; width: auto; padding: 6px 8px; border-radius: 12px; }
  #unk-link { position: static; height: auto; background: none; box-shadow: none; backdrop-filter: none; border-radius: 0; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }
  .unk-logo { height: 32px; }
  #legend.collapsed #unk-link { display: none; }
  #legend h2 { display: none; }
  #legend-items { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .chip { grid-template-columns: auto 1fr auto; gap: 6px; width: auto; flex: 1 1 44%; padding: 5px 8px; border-radius: 8px; }
  .chip-sub { display: none; }
  .chip-label { font-size: 12px; white-space: nowrap; }
  .chip-count { min-width: 0; font-size: 12px; }
  .chip.all { flex: 1 1 100%; padding: 3px; margin-top: 0; font-size: 11px; }
  .hint { display: none; }
  #compass-wrap { top: 156px; bottom: auto; right: 8px; width: 34px; height: 34px; }
  #compass { width: 24px; height: 24px; }
  #compass span { top: 11px; font-size: 9px; }
  #credits { right: 8px; left: 8px; bottom: 100px; font-size: 9px; padding: 0; text-align: right; }
  #panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-width: none; max-height: 52vh; border-radius: 18px 18px 0 0; transform: translateY(calc(100% + 30px)); }
  #panel figure { aspect-ratio: auto; height: 96px; }
  .icon-btn { top: 8px; right: 8px; width: 30px; height: 30px; font-size: 18px; }
  .panel-head { padding: 10px 14px 2px; }
  .panel-head h2 { font-size: 20px; }
  .panel-head p { font-size: 13px; margin-top: 2px; }
  #panel-body { padding: 2px 14px 6px; }
  .fact { padding: 5px 0; gap: 8px; }
  .fact .k { font-size: 12px; }
  .fact .v { font-size: 13px; }
  .fact .v em { font-size: 11px; }
  .source { display: none; }
  .panel-actions { padding: 8px 12px calc(10px + env(safe-area-inset-bottom)); gap: 6px; }
  .panel-actions .btn { height: 36px; font-size: 13px; }
}
/* text fallback when the project has no logotype yet */
.brand-text { font-family: var(--serif); font-weight: 500; font-size: 22px; line-height: 1.1; margin: 0; }
.brand-text.large { color: #fff; font-size: 44px; text-shadow: 0 4px 24px rgba(0,0,0,0.5); margin: 0 0 20px; }
.plan-section[hidden] { display: none; }

body.night .brand-logo { filter: none; }   /* gold logotype stays gold at night */
