/* Ecomic Digital Library — app styles */
/* Generated from index.html — do not edit inline */

.skip-link {
      position: absolute; top: -9999px; left: -9999px;
      background: #6546F3; color: #fff; padding: 10px 16px;
      font-family: 'Titillium Web', Geneva, Tahoma, sans-serif; font-size: 14px; font-weight: 600;
      z-index: 9999; border-radius: 0 0 4px 0; text-decoration: none;
    }
    .skip-link:focus { top: 0; left: 0; }

/* ─── TOKENS ──────────────────────────────────────────────────── */
    :root {
      /* Alias sui token di assets/css/theme.css — non ridefinire i colori
         qui: per cambiare palette/tema modifica solo theme.css. */
      --viola:        var(--theme-primary);
      --viola-dark:   var(--theme-primary-dark);
      --ossidiana:    var(--theme-secondary);
      --ossidiana-lt: var(--theme-secondary-light);
      --viola-lt:     var(--theme-primary-light);
      --off-black:    var(--theme-ink);
      --gray-70:      var(--theme-gray-70);
      --gray-40:      var(--theme-gray-40);
      --gray-10:      var(--theme-gray-10);
      --gray-05:      var(--theme-gray-05);
      --white:        var(--theme-white);
      --focus-ring:   0 0 0 3px var(--theme-primary), 0 0 0 5px var(--theme-white);

      /* Layout (non colori) */
      --header-h:     84px;
      --nav-h:        44px;
      --panel-w:      280px;
      --toolbar-h:    48px;
      --container-w:  1280px;
      --lightbox-w:   1200px;
      --lightbox-h:   82vh;
    }

    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
    html { font-size: 16px; -webkit-text-size-adjust: 100%; height: 100%; }
    body {
      font-family: 'Titillium Web', Geneva, Tahoma, sans-serif;
      font-size: 1rem; line-height: 1.5;
      background: var(--gray-05); color: var(--off-black);
      min-height: 100dvh;
      display: flex; flex-direction: column;
      overflow-x: hidden;
    }

    :focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 3px; }

/* ─── PRE-HEADER ──────────────────────────────────────────────────── */
    .pre-header {
      background: var(--theme-secondary); flex-shrink: 0;
      display: flex; align-items: center; padding: 6px 24px;
    }
    .pre-header-label {
      font-family: "Titillium Web", Geneva, Tahoma, sans-serif;
      font-size: 12.5px; font-weight: 600; color: var(--white); letter-spacing: 0.02em;
    }

/* ─── HEADER ──────────────────────────────────────────────────────── */
    .site-header {
      height: var(--header-h);
      background: var(--white);
      border-bottom: 1px solid var(--gray-10);
      flex-shrink: 0; z-index: 200;
      box-shadow: 0 1px 4px rgba(0,0,0,0.06);
      padding: 0 24px;
    }
    .header-inner {
      max-width: var(--container-w); margin: 0 auto; height: 100%;
      display: flex; align-items: center; gap: 16px;
    }
    .pre-header-inner {
      width: var(--container-w);
      margin: 0 auto;
    }
    .header-logo { display: flex; align-items: center; text-decoration: none; flex-shrink: 0; }
    .header-logo-img { display: block; height: 40px; width: auto; }
    .header-app-divider { width: 1px; height: 40px; background: var(--gray-10); flex-shrink: 0; }
    .header-app-info { display: flex; flex-direction: column; justify-content: center; gap: 3px; min-width: 0; flex: 1 1 auto; overflow: hidden; }
    .header-app-name { font-size: 15px; font-weight: 700; color: var(--ossidiana); letter-spacing: -0.01em; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .header-app-subtitle { font-size: 11px; font-weight: 400; color: var(--gray-40); letter-spacing: 0.01em; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

    /* Main nav */
    .header-nav-link {
      font-family: 'Titillium Web', Geneva, Tahoma, sans-serif; font-size: 13px; font-weight: 600;
      color: var(--gray-70); background: transparent; border: none;
      padding: 8px 12px; border-radius: 4px; cursor: pointer;
      white-space: nowrap; transition: color 0.15s, background 0.15s;
    }
    .header-nav-link:hover { color: var(--viola); background: rgba(0,56,130,0.06); }
    .header-nav-link.active { color: var(--viola); font-weight: 700; }
    .header-nav-link:focus-visible { box-shadow: var(--focus-ring); outline: none; }

    /* Dark blue band under the header, menu left-aligned (museitoscana.cultura.gov.it style) */
    .header-nav-band { 
      background: var(--theme-secondary-light); flex-shrink: 0; 
    }
    .header-nav-band-inner {
      max-width: var(--container-w); margin: 0 auto;
      display: flex; align-items: center; gap: 2px; padding: 0 20px;
    }
    .header-nav-band .header-nav-link { color: rgba(255,255,255,0.82); padding: 13px 24px; font-size: 14px;}
    .header-nav-band .header-nav-link:hover { color: var(--white); text-decoration: underline; }
    .header-nav-band .header-nav-link.active { color: var(--white); background: none; }

    .header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

    .header-nav-toggle {
      display: none; align-items: center; justify-content: center;
      width: 36px; height: 36px; border-radius: 4px; border: 1px solid var(--gray-10);
      background: transparent; color: var(--off-black); cursor: pointer; flex-shrink: 0;
    }
    .header-nav-toggle:hover { border-color: var(--viola); color: var(--viola); }
    .header-nav-toggle:focus-visible { box-shadow: var(--focus-ring); outline: none; }

    .header-nav-mobile {
      display: none; flex-direction: column;
      background: var(--white); border-bottom: 1px solid var(--gray-10);
      padding: 6px 12px; flex-shrink: 0; z-index: 199;
    }
    .header-nav-mobile:not([hidden]) { display: flex; }
    .header-nav-mobile .header-nav-link { text-align: left; padding: 12px; }

    /* ─── PREFOOTER ───────────────────────────────────────────────────── */
    .prefooter {
      display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
      gap: 20px; padding: 20px 24px; background: var(--gray-05);
      border-top: 1px solid var(--gray-10); flex-shrink: 0;
    }
    .prefooter-logo { height: 36px; width: auto; display: block; }
    .prefooter-sep { width: 1px; height: 32px; background: var(--gray-10); flex-shrink: 0; }
    .prefooter-madewith { display: flex; align-items: center; gap: 10px; }
    .prefooter-madewith-label { font-size: 11px; font-weight: 600; color: var(--gray-40); white-space: nowrap; }
    .prefooter-madewith-logo { height: 48px; width: auto; display: block; }
    @media (max-width: 480px) {
      .prefooter-sep { display: none; }
    }

    /* ─── FOOTER ──────────────────────────────────────────────────────── */
    .site-footer {
      background: var(--white);
      color: var(--off-black);
      border-top: 1px solid var(--gray-10);
      flex-shrink: 0; z-index: 100;
    }
    .footer-inner { max-width: var(--container-w); margin: 0 auto; padding: 28px 24px; }
    .footer-top {
      display: flex; flex-wrap: wrap; align-items: center;
      justify-content: space-between; gap: 20px 40px;
    }
    .footer-brand-title { font-size: 15px; font-weight: 700; color: var(--ossidiana); }
    .footer-brand-subtitle { font-size: 12px; color: var(--gray-40); margin-top: 2px; }
    .footer-version { color: var(--gray-40); }
    .footer-logos { display: flex; flex-wrap: wrap; align-items: center; gap: 22px; }
    .footer-logo-img { height: 34px; width: auto; max-width: 140px; object-fit: contain; display: block; }
    .footer-logo-img--ecomic { height: 30px; }

    /* Banda blu scura in fondo al footer, menu a sinistra con separatori
       (stile museitoscana.cultura.gov.it) */
    .footer-bottom-band { background: var(--theme-secondary); }
    .footer-bottom-inner { max-width: var(--container-w); margin: 0 auto; padding: 10px 24px; }
    .footer-menu { display: flex; flex-wrap: wrap; align-items: center; }
    .footer-menu-link {
      font-family: 'Titillium Web', Geneva, Tahoma, sans-serif; font-size: 12px; font-weight: 600;
      color: rgba(255,255,255,0.82); background: none; border: none;
      border-right: 1px solid rgba(255,255,255,0.25);
      padding: 6px 16px; margin: 4px 0; cursor: pointer; transition: color 0.15s;
      line-height: 1;
    }
    .footer-menu-link:first-child { padding-left: 0; }
    .footer-menu-link:last-child { border-right: none; }
    .footer-menu-link:hover { color: var(--white); text-decoration: underline; }
    .footer-menu-link:focus-visible { box-shadow: var(--focus-ring); outline: none; border-radius: 2px; }

    /* ─── LAYOUT ──────────────────────────────────────────────────── */
    /* Generic app "page" — Home / Catalogo / Placeholder toggle between
       these; only one is visible (not [hidden]) at a time. Sized to its own
       content (not clipped) so the page — and the footer below it — scroll
       naturally instead of being pinned to the viewport. */
    .app-view { flex: 1 0 auto; display: flex; flex-direction: column; overflow-x: hidden; }
    .app-view[hidden] { display: none; }

    /* ─── CATALOGO PAGE — search/filter toolbar + card grid + pagination ── */
    .catalog-page { max-width: var(--container-w); margin: 0 auto; padding: 32px 24px 56px; width: 100%; }
    .catalog-page-toolbar { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
    .catalog-page-toolbar .sidebar-search { flex: 1 1 260px; }
    .catalog-page-toolbar .sidebar-filter-select { flex: 0 1 220px; }

    .sidebar-search {
      display: flex; align-items: center; gap: 8px;
      border: 1.5px solid var(--gray-10); border-radius: 4px;
      padding: 8px 10px; background: var(--white); color: var(--gray-40);
      transition: border-color 0.15s;
    }
    .sidebar-search:focus-within { border-color: var(--viola); }
    .sidebar-search-input {
      flex: 1; min-width: 0; border: none; outline: none; background: none;
      font-family: 'Titillium Web', Geneva, Tahoma, sans-serif; font-size: 12.5px; color: var(--off-black);
    }
    .sidebar-search-input::placeholder { color: var(--gray-40); }
    .sidebar-search-input::-webkit-search-cancel-button { cursor: pointer; }
    .sidebar-filter-select {
      border: 1.5px solid var(--gray-10); border-radius: 4px;
      padding: 7px 10px; background: var(--white); color: var(--off-black);
      font-family: 'Titillium Web', Geneva, Tahoma, sans-serif; font-size: 12px; font-weight: 600;
      cursor: pointer; transition: border-color 0.15s;
    }
    .sidebar-filter-select:hover, .sidebar-filter-select:focus-visible { border-color: var(--viola); outline: none; }

    /* API error / loading / empty state, reused inside any grid */
    .api-status {
      grid-column: 1 / -1;
      padding: 16px 20px; font-size: 12px; color: var(--gray-40); line-height: 1.6;
      display: flex; flex-direction: column; gap: 8px;
    }
    .api-status .spinner {
      width: 20px; height: 20px; border: 2px solid var(--gray-10);
      border-top-color: var(--viola); border-radius: 50%;
      animation: spin 0.8s linear infinite; flex-shrink: 0;
    }
    .api-status.error { color: #c0392b; }
    .api-retry-btn {
      padding: 6px 12px; border-radius: 3px; border: 1.5px solid var(--viola);
      background: transparent; color: var(--viola); font-family: 'Titillium Web', Geneva, Tahoma, sans-serif;
      font-size: 11px; font-weight: 700; cursor: pointer;
      transition: all 0.15s; width: fit-content;
    }
    .api-retry-btn:hover { background: var(--viola); color: var(--white); }

    /* ─── PROJECT CARD (Home gallery + Catalogo grid) ────────────────── */
    .catalog-grid {
      display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
      gap: 18px;
    }
    .catalog-grid .placeholder-msg { grid-column: 1 / -1; }

    .project-card {
      display: flex; flex-direction: column;
      background: var(--white); border: 1px solid var(--gray-10); border-radius: 4px;
      overflow: hidden; cursor: pointer; text-align: left;
      transition: border-color 0.15s, box-shadow 0.15s;
    }
    .project-card:hover { border-color: var(--viola); box-shadow: 0 2px 10px rgba(0,34,79,0.08); }
    .project-card:focus-visible { box-shadow: var(--focus-ring); outline: none; }

    .project-card-thumb {
      position: relative; aspect-ratio: 4 / 3; background: var(--ossidiana);
      display: flex; align-items: center; justify-content: center; overflow: hidden;
    }
    .project-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
    /* No real thumbnail yet — temporary placeholder: institutional logo on a
       light ground, shown in full (not cropped) rather than the dark cover fill. */
    .project-card-thumb--placeholder { background: var(--gray-05); }
    .project-card-thumb--placeholder img { object-fit: contain; padding: 18%; }
    .project-card-embed-btn {
      position: absolute; top: 8px; right: 8px;
      display: inline-flex; align-items: center; justify-content: center;
      width: 28px; height: 28px; border-radius: 5px; border: none;
      background: rgba(0,34,79,0.55); color: var(--white); cursor: pointer;
      backdrop-filter: blur(2px); transition: background 0.15s;
    }
    .project-card-thumb--placeholder .project-card-embed-btn { background: rgba(0,34,79,0.14); color: var(--theme-secondary); }
    .project-card-embed-btn:hover { background: var(--viola); color: var(--white); }
    .project-card-embed-btn:focus-visible { box-shadow: var(--focus-ring); outline: none; }

    .project-card-body { padding: 10px 12px 12px; }
    .project-card-name { font-size: 13px; font-weight: 700; color: var(--off-black); line-height: 1.35; }
    .project-card-meta { font-size: 11px; color: var(--gray-40); margin-top: 3px; font-style: italic; }
    .project-card-cta {
      display: flex; align-items: center; gap: 5px;
      font-size: 11.5px; font-weight: 700; color: var(--viola);
      margin-top: 10px;
    }
    .project-card:hover .project-card-cta { text-decoration: underline; }

    /* ─── PAGINATION ──────────────────────────────────────────────────── */
    .catalog-pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 32px; }
    .pagination-btn {
      width: 32px; height: 32px; border-radius: 4px; border: 1.5px solid var(--gray-10);
      background: var(--white); color: var(--off-black); font-size: 15px; cursor: pointer;
      transition: all 0.15s;
    }
    .pagination-btn:hover:not(:disabled) { border-color: var(--viola); color: var(--viola); }
    .pagination-btn:disabled { opacity: 0.35; cursor: default; }
    .pagination-btn:focus-visible { box-shadow: var(--focus-ring); outline: none; }
    .pagination-status { font-size: 12px; font-weight: 600; color: var(--gray-40); }

    /* ─── VIEWER ──────────────────────────────────────────────────── */
    .viewer-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

    .viewer-toolbar {
      height: var(--toolbar-h); background: var(--white);
      border-bottom: 1px solid var(--gray-10);
      display: flex; align-items: center;
      padding: 0 12px; gap: 6px; flex-shrink: 0;
      overflow-x: auto; -webkit-overflow-scrolling: touch;
      scrollbar-width: none;
    }
    .viewer-toolbar::-webkit-scrollbar { display: none; }

    .toolbar-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--gray-40); white-space: nowrap; flex-shrink: 0; }
    .layer-toggle {
      display: flex; align-items: center; gap: 5px;
      padding: 6px 10px; min-height: 36px; border-radius: 3px;
      border: 1.5px solid var(--gray-10); cursor: pointer;
      font-size: 11px; font-weight: 600; color: var(--gray-70);
      background: var(--white); white-space: nowrap; flex-shrink: 0;
      font-family: 'Titillium Web', Geneva, Tahoma, sans-serif; transition: all 0.15s;
    }
    .layer-toggle:hover { border-color: var(--viola-lt); }
    .layer-toggle.active { background: var(--ossidiana); border-color: var(--ossidiana); color: var(--white); }
    .layer-toggle:focus-visible { box-shadow: var(--focus-ring); outline: none; }
    .layer-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
    .toolbar-sep { width: 1px; height: 22px; background: var(--gray-10); margin: 0 2px; flex-shrink: 0; }

    .viewer-btn {
      padding: 6px 10px; min-height: 36px; border-radius: 3px;
      border: 1.5px solid var(--gray-10); cursor: pointer;
      font-size: 11px; font-weight: 700; color: var(--gray-70);
      background: var(--white); font-family: 'Titillium Web', Geneva, Tahoma, sans-serif;
      white-space: nowrap; flex-shrink: 0; transition: border-color 0.15s, color 0.15s;
    }
    .viewer-btn:hover { border-color: var(--viola); color: var(--viola); }
    .viewer-btn.on { border-color: var(--viola); color: var(--viola); background: rgba(0,56,130,0.06); }
    .viewer-btn:focus-visible { box-shadow: var(--focus-ring); outline: none; }

    #canvas-container {
      flex: 1; position: relative; background: var(--theme-viewer-bg);
      overflow: hidden; cursor: grab; touch-action: none;
    }
    #canvas-container:active { cursor: grabbing; }
    #three-canvas { display: block; width: 100%; height: 100%; }

    /* ─── LOADING ─────────────────────────────────────────────────── */
    .loading-overlay {
      position: absolute; inset: 0; background: rgba(13,27,42,0.96);
      display: flex; flex-direction: column;
      align-items: center; justify-content: center;
      gap: 14px; z-index: 10;
    }
    .loading-overlay.hidden { display: none; }
    /* Loader — the Conspectus bowl from the favicon, pulsing inside a
       spinning ring: reads as "loading" (classic ring) while carrying the
       app's own icon rather than a generic spinner. */
    .loader-badge { position: relative; width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; }
    .loader-ring-svg { position: absolute; inset: 0; width: 100%; height: 100%; animation: spin 1.1s linear infinite; }
    .loader-ring-svg circle {
      fill: none; stroke: rgba(91,133,184,0.22); stroke-width: 3;
      stroke-dasharray: 120 56; stroke-linecap: round;
    }
    .loader-cup { width: 26px; height: 26px; color: var(--viola-lt); animation: cup-pulse 1.6s ease-in-out infinite; }
    @keyframes spin { to { transform: rotate(360deg); } }
    @keyframes cup-pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(0.85); opacity: 0.7; } }
    .loading-text { font-size: 12px; font-weight: 600; color: var(--viola-lt); letter-spacing: 0.06em; }
    .loading-detail { font-size: 11px; color: rgba(91,133,184,0.5); text-align: center; padding: 0 16px; }
    .loading-progress { width: 180px; height: 2px; background: rgba(255,255,255,0.1); border-radius: 1px; overflow: hidden; }
    .loading-progress-bar { height: 100%; background: var(--viola); border-radius: 1px; width: 0%; transition: width 0.2s ease; }

    /* ─── EMPTY & ERROR ───────────────────────────────────────────── */
    .empty-state {
      position: absolute; inset: 0; display: flex; flex-direction: column;
      align-items: center; justify-content: center;
      gap: 16px; color: rgba(255,255,255,0.2); pointer-events: none;
    }
    .empty-state.hidden { display: none; }
    .empty-state p { font-size: 13px; font-weight: 500; text-align: center; padding: 0 24px; }
    .empty-state.is-error { color: rgba(255,120,100,0.7); }

    /* ─── HUD ─────────────────────────────────────────────────────── */
    .model-hud {
      position: absolute; top: 12px; right: 12px;
      background: rgba(0,34,79,0.9); backdrop-filter: blur(8px);
      border: 1px solid rgba(255,255,255,0.08); border-radius: 4px;
      padding: 8px 12px; pointer-events: none;
      min-width: 130px; max-width: calc(100% - 24px);
    }
    .model-hud.hidden { display: none; }
    .model-hud-title { font-size: 13px; font-weight: 700; color: var(--white); margin-bottom: 3px; }
    .model-hud-sub { font-size: 10px; color: rgba(91,133,184,0.7); }
    .model-hud-layers { margin-top: 8px; display: flex; flex-direction: column; gap: 3px; }
    .hud-layer-row { display: flex; align-items: center; gap: 6px; font-size: 10px; color: rgba(255,255,255,0.5); }
    .hud-layer-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
    .hud-layer-row.inactive { opacity: 0.3; }
    .camera-info { position: absolute; bottom: 10px; left: 10px; font-size: 10px; color: rgba(255,255,255,0.2); pointer-events: none; font-variant-numeric: tabular-nums; }

    /* ─── RIGHT PANEL ─────────────────────────────────────────────── */
    .right-panel {
      width: var(--panel-w); background: var(--white);
      border-left: 1px solid var(--gray-10);
      display: flex; flex-direction: column; flex-shrink: 0; overflow: hidden;
    }
    .panel-tabs-row { display: flex; align-items: center; gap: 6px; padding: 6px 8px 6px 0; border-bottom: 1px solid var(--gray-10); }
    .panel-tabs-row .settings-toggle { margin: 0 2px; }
    .panel-tabs { display: flex; flex: 1; min-width: 0; }
    .panel-tab {
      flex: 1; padding: 12px 8px; min-height: 44px;
      font-size: 11px; font-weight: 700; text-transform: uppercase;
      letter-spacing: 0.08em; text-align: center; cursor: pointer;
      color: var(--gray-40); border-bottom: 2px solid transparent;
      border: none; background: transparent; font-family: 'Titillium Web', Geneva, Tahoma, sans-serif;
      transition: color 0.15s, border-color 0.15s;
    }
    .panel-tab[aria-selected="true"] { color: var(--viola); border-bottom: 2px solid var(--viola); }
    .panel-tab:focus-visible { box-shadow: inset var(--focus-ring); outline: none; }
    .panel-content { flex: 1; overflow-y: auto; }
    .panel-content[hidden] { display: none; }

    /* ─── METADATA ────────────────────────────────────────────────── */
    .meta-section { padding: 14px 14px 6px; }
    .meta-section-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--viola); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
    .meta-section-title::after { content: ''; flex: 1; height: 1px; background: rgba(0,56,130,0.15); }
    .meta-row { display: flex; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--gray-05); align-items: flex-start; }
    .meta-row:last-child { border-bottom: none; }
    .meta-key { font-size: 11px; font-weight: 600; color: var(--gray-40); width: 100px; flex-shrink: 0; padding-top: 1px; line-height: 1.4; }
    .meta-val { font-size: 11px; color: var(--off-black); flex: 1; line-height: 1.4; word-break: break-word; }
    .meta-val.hi { color: var(--viola); font-weight: 700; }

    /* ─── DXF PANEL ───────────────────────────────────────────────── */
    .dxf-panel { padding: 10px; display: flex; flex-direction: column; gap: 8px; }
    .dxf-info-box { padding: 10px 12px; background: rgba(0,56,130,0.06); border-left: 3px solid var(--viola-lt); font-size: 11px; color: var(--gray-70); line-height: 1.6; border-radius: 0 2px 2px 0; }
    .dxf-item { border: 1px solid var(--gray-10); border-radius: 4px; overflow: hidden; }
    .dxf-item-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; background: var(--white); gap: 8px; }
    .dxf-item-label { font-size: 12px; font-weight: 700; color: var(--off-black); }
    .dxf-item-sub { font-size: 10px; color: var(--gray-40); margin-top: 1px; }
    .dxf-actions { display: flex; gap: 5px; flex-shrink: 0; }
    .dxf-btn {
      font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
      padding: 6px 8px; min-height: 32px; border-radius: 2px;
      border: 1.5px solid var(--viola); color: var(--viola); background: transparent;
      cursor: pointer; font-family: 'Titillium Web', Geneva, Tahoma, sans-serif; transition: all 0.15s;
      text-decoration: none; display: inline-flex; align-items: center;
    }
    .dxf-btn:hover { background: var(--viola); color: var(--white); }
    .dxf-btn:focus-visible { box-shadow: var(--focus-ring); outline: none; }
    .dxf-viewer-wrap { border-top: 1px solid var(--gray-10); background: #0a1622; position: relative; }
    .dxf-viewer-wrap[hidden] { display: none; }
    .dxf-canvas { display: block; width: 100%; height: 180px; }
    .dxf-viewer-label { position: absolute; bottom: 5px; left: 8px; font-size: 9px; color: rgba(255,255,255,0.25); letter-spacing: 0.06em; text-transform: uppercase; pointer-events: none; }

    /* ─── SCROLLBAR ───────────────────────────────────────────────── */
    ::-webkit-scrollbar { width: 4px; }
    ::-webkit-scrollbar-track { background: transparent; }
    ::-webkit-scrollbar-thumb { background: var(--gray-10); border-radius: 2px; }
    ::-webkit-scrollbar-thumb:hover { background: var(--gray-40); }
    .placeholder-msg { padding: 20px 16px; color: var(--gray-40); font-size: 12px; line-height: 1.7; }

    /* ─── RESPONSIVE ──────────────────────────────────────────────── */
    @media (max-width: 1023px) {
      .header-nav-band { display: none; }
      .header-nav-toggle { display: inline-flex; }
      /* Lightbox: viewer + panel stack instead of sitting side by side. */
      .lightbox-body { flex-direction: column; }
      .viewer-area { flex: 0 0 auto; height: 50vh; min-height: 320px; }
      .right-panel { width: 100%; border-left: none; border-top: 1px solid var(--gray-10); flex: 1; min-height: 240px; }
    }
    @media (max-width: 767px) {
      :root { --header-h: 64px; }
      .site-header { padding: 0 16px; gap: 10px; }
      .header-app-divider { height: 32px; }
      .header-logo-img { height: 32px; }
      .header-app-subtitle { display: none; }
      .header-app-name { font-size: 13px; }
      .layer-toggle-label { display: none; }
      .layer-toggle { padding: 6px 8px; }
    }
    @media (max-width: 480px) {
      /* Not enough room for logo + app name + lang switch + icons — the
         logo alone still carries the brand. */
      .header-app-divider, .header-app-info { display: none; }
      .footer-top { flex-direction: column; align-items: flex-start; }
      .footer-logos { gap: 16px; }
      .footer-logo-img { height: 26px; }
      .prefooter-logo { height: 28px; }
    }
    @media (forced-colors: active) {
      .layer-toggle.active { border: 2px solid ButtonText; }
      .project-card:focus-visible { outline: 2px solid Highlight; }
    }
    @media (prefers-reduced-motion: reduce) {
      *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
      .loader-ring-svg, .loader-cup { animation: none; }
      .api-status .spinner { animation: none; }
    }

/* ─── LANGUAGE SWITCHER ──────────────────────────────────────────── */
.lang-switcher {
  display: flex;
  gap: 2px;
  margin-right: 4px;
}
.lang-btn {
  font-family: 'Titillium Web', Geneva, Tahoma, sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 7px;
  border-radius: 2px;
  border: 1px solid var(--gray-10);
  background: transparent;
  color: var(--gray-40);
  cursor: pointer;
  transition: all 0.15s;
  min-height: 24px;
}
.lang-btn:hover { border-color: var(--viola); color: var(--viola); }
.lang-btn.active { background: var(--viola); border-color: var(--viola); color: var(--white); }
.lang-btn:focus-visible { box-shadow: var(--focus-ring); outline: none; }

/* ─── SETTINGS BUTTON (viewer toolbar only) ────────────────────────── */
.settings-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; min-height: 36px; border-radius: 3px; border: 1.5px solid var(--gray-10);
  background: var(--white); color: var(--gray-70); cursor: pointer; transition: all 0.15s;
  flex-shrink: 0; margin-left: auto;
}
.settings-toggle:hover { border-color: var(--viola); color: var(--viola); }
.settings-toggle.active { background: var(--viola); border-color: var(--viola); color: var(--white); }
.settings-toggle:focus-visible { box-shadow: var(--focus-ring); outline: none; }

/* ─── SETTINGS PANEL ─────────────────────────────────────────────────
   Scoped to #canvas-container (position:relative) — the overlay/panel
   only cover the 3D viewer, never the sidebar, header or footer. */
.settings-overlay {
  position: absolute; inset: 0; background: rgba(30,30,30,0.45);
  z-index: 20;
}
.settings-panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: 320px; max-width: 92%;
  background: var(--white);
  box-shadow: -4px 0 24px rgba(0,0,0,0.15);
  z-index: 21;
  display: flex; flex-direction: column;
  transform: translateX(0);
}
.settings-panel[hidden], .settings-overlay[hidden] { display: none; }

.settings-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--gray-10); flex-shrink: 0;
}
.settings-panel-title { font-size: 16px; font-weight: 700; color: var(--ossidiana); }
.settings-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 4px; border: none;
  background: transparent; color: var(--gray-40); cursor: pointer;
}
.settings-close:hover { color: var(--viola); }
.settings-close:focus-visible { box-shadow: var(--focus-ring); outline: none; }

.settings-panel-body { flex: 1; overflow-y: auto; padding: 20px; }

.settings-section { margin-bottom: 28px; }
.settings-section:last-child { margin-bottom: 0; }
.settings-section-title-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
}
.settings-section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--gray-40); margin-bottom: 10px;
}
.settings-section-hint { font-size: 12px; color: var(--gray-40); margin: -4px 0 12px; }
.settings-reset-all {
  font-size: 11px; font-weight: 600; color: var(--viola); background: none; border: none;
  cursor: pointer; padding: 0; text-decoration: underline;
}
.settings-reset-all:hover { color: var(--viola-dark); }
.settings-reset-all:focus-visible { box-shadow: var(--focus-ring); outline: none; border-radius: 2px; }

.settings-layer-colors { display: flex; flex-direction: column; gap: 10px; }
.settings-layer-color-row {
  display: flex; align-items: center; gap: 10px;
}
.settings-layer-color-label {
  flex: 1; font-size: 13px; font-weight: 600; color: var(--off-black);
}
.settings-layer-color-input {
  -webkit-appearance: none; appearance: none;
  width: 30px; height: 30px; border: 1.5px solid var(--gray-10); border-radius: 6px;
  padding: 0; cursor: pointer; background: none;
}
.settings-layer-color-input::-webkit-color-swatch-wrapper { padding: 2px; }
.settings-layer-color-input::-webkit-color-swatch { border: none; border-radius: 4px; }
.settings-layer-color-reset {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 4px; border: none;
  background: transparent; color: var(--gray-40); cursor: pointer;
}
.settings-layer-color-reset:hover { color: var(--viola); }
.settings-layer-color-reset:focus-visible { box-shadow: var(--focus-ring); outline: none; }

.settings-apply-colors {
  margin-top: 12px; width: 100%;
  font-family: 'Titillium Web', Geneva, Tahoma, sans-serif; font-size: 12.5px; font-weight: 700;
  color: var(--white); background: var(--viola); border: none; border-radius: 5px;
  padding: 9px 0; cursor: pointer; transition: background 0.15s;
}
.settings-apply-colors:hover { background: var(--viola-dark); }
.settings-apply-colors:focus-visible { box-shadow: var(--focus-ring); outline: none; }

/* ═══════════════════════════════════════════════════════════════════════
   HOME — hero banner + "come funziona"
   ═══════════════════════════════════════════════════════════════════ */
.view-home { background: var(--white); }

.hero-banner { background: var(--ossidiana); padding: 48px 24px 40px; }
.hero-banner-grid {
  max-width: var(--container-w); margin: 0 auto;
  display: grid; grid-template-columns: repeat(12, 1fr);
  gap: 32px; align-items: center;
}
.hero-text { grid-column: span 4; }
.hero-title {
  font-size: clamp(22px, 3vw, 34px); font-weight: 700; color: var(--white);
  line-height: 1.25; letter-spacing: -0.01em; margin-bottom: 14px;
}
.hero-subtitle { font-size: 14px; color: rgba(255,255,255,0.7); line-height: 1.7; max-width: 62ch; }
.hero-cover { grid-column: span 8; }
.hero-cover-img {
  display: block; width: 100%; height: auto; border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.35); object-fit: cover; background: var(--ossidiana);
}
.hero-cta-row { display: flex; justify-content: center; margin-top: 36px; }
.hero-cta-btn {
  font-family: 'Titillium Web', Geneva, Tahoma, sans-serif; font-size: 14px; font-weight: 700;
  color: var(--white); background: var(--viola); border: none;
  padding: 13px 30px; border-radius: 6px; cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}
.hero-cta-btn:hover { background: var(--viola-dark); }
.hero-cta-btn:active { transform: translateY(1px); }
.hero-cta-btn:focus-visible { box-shadow: var(--focus-ring); outline: none; }

.how-it-works { max-width: var(--container-w); margin: 0 auto; padding: 44px 24px 56px; width: 100%; }
.how-it-works-title {
  font-size: 20px; font-weight: 800; color: var(--ossidiana);
  text-align: center; margin-bottom: 32px;
}
.how-it-works-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px;
}
.how-card { text-align: center; padding: 0 12px; }
.how-icon {
  width: 56px; height: 56px; margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: rgba(0,56,130,0.08); color: var(--viola);
}
.how-card-title { font-size: 14.5px; font-weight: 700; color: var(--off-black); margin-bottom: 6px; }
.how-card-sub { font-size: 12.5px; color: var(--gray-40); line-height: 1.6; }

@media (max-width: 900px) {
  .hero-text, .hero-cover { grid-column: span 12; }
  .hero-cover { order: -1; max-width: 280px; margin: 0 auto; }
  .how-it-works-grid { grid-template-columns: 1fr; gap: 32px; }
}

/* ═══════════════════════════════════════════════════════════════════════
   VIEW PLACEHOLDER — Termini e condizioni / Policy (non ancora redatti)
   ═══════════════════════════════════════════════════════════════════ */
.view-placeholder {
  align-items: center; justify-content: center; text-align: center;
  gap: 8px; padding: 40px 24px; background: var(--white);
}
.view-placeholder-title { font-size: 20px; font-weight: 800; color: var(--ossidiana); }
.view-placeholder-text { font-size: 13px; color: var(--gray-40); max-width: 42ch; }

/* ═══════════════════════════════════════════════════════════════════════
   CONTENT PAGES — Progetto / Tutorial / Crediti
   ═══════════════════════════════════════════════════════════════════ */
.content-view { background: var(--white); }
.content-page { max-width: var(--container-w); margin: 0 auto; padding: 48px 24px 64px; width: 100%; }
.content-eyebrow { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--viola); margin-bottom: 8px; }
.content-title { font-size: 26px; font-weight: 800; color: var(--ossidiana); letter-spacing: -0.01em; margin-bottom: 6px; }
.content-meta { font-size: 12px; color: var(--gray-40); margin-bottom: 20px; }
.content-intro { font-size: 15px; color: var(--gray-70); line-height: 1.7; margin: 14px 0 8px; }
.content-note { font-size: 12px; color: var(--gray-40); margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--gray-10); }

.content-section { margin-top: 32px; }
.content-section h2 { font-size: 16px; font-weight: 700; color: var(--ossidiana); margin-bottom: 10px; }
.content-section h3 { font-size: 13.5px; font-weight: 700; color: var(--off-black); margin-bottom: 4px; }
.content-section p { font-size: 13.5px; color: var(--gray-70); line-height: 1.75; margin-bottom: 12px; }
.content-section p:last-child { margin-bottom: 0; }

.content-arch-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 16px; }
.content-arch-card { padding: 16px; border: 1px solid var(--gray-10); border-radius: 6px; background: var(--gray-05); }
.content-arch-card p { margin-bottom: 0; }

.content-steps-title { font-size: 16px; font-weight: 700; color: var(--ossidiana); margin: 8px 0 18px; }
.content-steps { list-style: none; display: flex; flex-direction: column; }
.content-step { display: flex; gap: 16px; padding: 18px 0; border-top: 1px solid var(--gray-10); }
.content-step:first-child { border-top: none; }
.content-step-num {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%;
  background: rgba(0,56,130,0.1); color: var(--viola);
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 800;
}
.content-step h3 { font-size: 14px; font-weight: 700; color: var(--off-black); margin-bottom: 4px; }
.content-step p { font-size: 13px; color: var(--gray-70); line-height: 1.65; margin: 0; }

@media (max-width: 640px) {
  .content-arch-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .settings-panel { width: 100%; max-width: 100%; }
}

/* ═══════════════════════════════════════════════════════════════════════
   HOME — gallery of the latest projects
   ═══════════════════════════════════════════════════════════════════ */
.gallery-section { background: #ECEFF1; width: 100%; }
.gallery-section-inner { max-width: var(--container-w); margin: 0 auto; padding: 40px 24px 56px; width: 100%; }
.gallery-title { font-size: 20px; font-weight: 800; color: var(--ossidiana); text-align: center; margin-bottom: 24px; }
.gallery-cta-row { display: flex; justify-content: center; margin-top: 28px; }
.gallery-showall-btn {
  font-family: 'Titillium Web', Geneva, Tahoma, sans-serif; font-size: 13.5px; font-weight: 700;
  color: var(--viola); background: var(--white); border: 1.5px solid var(--viola);
  padding: 11px 26px; border-radius: 6px; cursor: pointer; transition: all 0.15s;
}
.gallery-showall-btn:hover { background: var(--viola); color: var(--white); }
.gallery-showall-btn:focus-visible { box-shadow: var(--focus-ring); outline: none; }

/* ═══════════════════════════════════════════════════════════════════════
   VIEWER LIGHTBOX — modal opened from a project card (Home gallery or
   Catalogo grid), or filled full-page in embed mode (?embed=<id>).
   ═══════════════════════════════════════════════════════════════════ */
body.lightbox-open { overflow: hidden; }

.lightbox-overlay {
  position: fixed; inset: 0; background: rgba(0,34,79,0.6);
  z-index: 400;
}
.lightbox-overlay[hidden] { display: none; }

.viewer-lightbox {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(var(--lightbox-w), 94vw); height: min(var(--lightbox-h), 900px);
  background: var(--white); border-radius: 10px; overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,0.35);
  z-index: 401; display: flex; flex-direction: column;
}
.viewer-lightbox[hidden] { display: none; }

.lightbox-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--gray-10); flex-shrink: 0;
}
.lightbox-header-info { display: flex; align-items: center; gap: 12px; min-width: 0; }
.lightbox-title { font-size: 14px; font-weight: 700; color: var(--ossidiana); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lightbox-reperto-select {
  font-family: 'Titillium Web', Geneva, Tahoma, sans-serif; font-size: 12px; font-weight: 600;
  padding: 5px 8px; border: 1.5px solid var(--gray-10); border-radius: 4px;
  background: var(--white); color: var(--off-black); cursor: pointer; max-width: 220px;
}
.lightbox-header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.lightbox-embed-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'Titillium Web', Geneva, Tahoma, sans-serif; font-size: 12px; font-weight: 700;
  color: var(--gray-70); background: var(--white); border: 1.5px solid var(--gray-10);
  padding: 6px 12px; border-radius: 4px; cursor: pointer; transition: all 0.15s;
}
.lightbox-embed-btn:hover { border-color: var(--viola); color: var(--viola); }
.lightbox-embed-btn:focus-visible { box-shadow: var(--focus-ring); outline: none; }
.lightbox-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 4px; border: none;
  background: transparent; color: var(--gray-40); cursor: pointer;
}
.lightbox-close:hover { color: var(--viola); }
.lightbox-close:focus-visible { box-shadow: var(--focus-ring); outline: none; }

.lightbox-body { flex: 1; display: flex; overflow: hidden; min-height: 0; }

/* ═══════════════════════════════════════════════════════════════════════
   EMBED CODE MODAL
   ═══════════════════════════════════════════════════════════════════ */
.embed-overlay {
  position: fixed; inset: 0; background: rgba(0,34,79,0.55); z-index: 500;
}
.embed-overlay[hidden] { display: none; }
.embed-modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(460px, 92vw); background: var(--white); border-radius: 8px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.35); z-index: 501; overflow: hidden;
}
.embed-modal[hidden] { display: none; }
.embed-modal-body { padding: 18px 20px 20px; }
.embed-code-box {
  width: 100%; margin-top: 10px; padding: 10px; resize: vertical;
  font-family: 'SF Mono', Menlo, Consolas, monospace; font-size: 11.5px; line-height: 1.5;
  border: 1.5px solid var(--gray-10); border-radius: 5px; color: var(--off-black); background: var(--gray-05);
}
.embed-copy-btn {
  margin-top: 12px; width: 100%;
  font-family: 'Titillium Web', Geneva, Tahoma, sans-serif; font-size: 12.5px; font-weight: 700;
  color: var(--white); background: var(--viola); border: none; border-radius: 5px;
  padding: 9px 0; cursor: pointer; transition: background 0.15s;
}
.embed-copy-btn:hover { background: var(--viola-dark); }
.embed-copy-btn:focus-visible { box-shadow: var(--focus-ring); outline: none; }

/* ═══════════════════════════════════════════════════════════════════════
   EMBED MODE — ?embed=<id> boots straight into a chrome-less full-page
   viewer, suitable for an <iframe> on a third-party site.
   ═══════════════════════════════════════════════════════════════════ */
body.embed-mode .pre-header,
body.embed-mode .site-header,
body.embed-mode .header-nav-band,
body.embed-mode .header-nav-mobile,
body.embed-mode .prefooter,
body.embed-mode .site-footer,
body.embed-mode .app-view,
body.embed-mode .lightbox-overlay,
body.embed-mode .lightbox-header { display: none !important; }
body.embed-mode .viewer-lightbox {
  position: fixed; inset: 0; transform: none;
  width: 100%; height: 100%; max-width: none; max-height: none;
  border-radius: 0; box-shadow: none;
}

@media (max-width: 1023px) {
  .lightbox-reperto-select { max-width: 140px; }
  .lightbox-embed-btn span { display: none; }
}
