/* Metrica Sensing LiDAR portal: portfolio and 3D viewer */
:root {
  --bg: #0f1214;
  --panel: #171b1e;
  --panel-2: #1e2327;
  --line: #2b3237;
  --ink: #ecebe6;
  --muted: #9aa6a0;
  --accent: #ff7a1a;
  --accent-ink: #16181a;
  --forest: #1f3a2c;
  --font: 'Commissioner', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --step-small: clamp(0.8125rem, 0.8rem + 0.1vw, 0.875rem);
  --step-body: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  --step-head: clamp(2.25rem, 1.4rem + 3.6vw, 4.5rem);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: var(--step-body); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
img { max-width: 100%; display: block; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- top bar ---------- */
.bar { display: flex; align-items: center; gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel); min-height: 56px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
.brand img { width: 30px; height: 30px; }
.brand small { font-weight: 500; color: var(--muted); }
.bar-spacer { flex: 1; }
.lang { display: flex; gap: 2px; }
.lang button { font: inherit; font-size: var(--step-small); color: var(--muted); background: transparent; border: 0; padding: 6px 8px; border-radius: 4px; cursor: pointer; }
.lang button[aria-pressed="true"] { color: var(--ink); background: var(--panel-2); }
.btn { display: inline-flex; align-items: center; gap: 8px; font: inherit; font-size: var(--step-small); font-weight: 500; text-decoration: none; padding: 9px 14px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel-2); color: var(--ink); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #46525a; }
.btn-accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-accent:hover { background: #ff8c39; border-color: #ff8c39; }
.btn svg, .card-cta svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- portfolio ---------- */
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 16px; }
.hero { padding: clamp(40px, 7vw, 96px) 0 clamp(28px, 4vw, 48px); display: grid; gap: 20px; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: end; }
.hero h1 { font-size: var(--step-head); line-height: 0.98; letter-spacing: -0.035em; margin: 0; }
.hero h1 span { color: var(--accent); }
.hero p { margin: 0; color: var(--muted); max-width: 46ch; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 16px; padding-bottom: 64px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; text-decoration: none; transition: border-color .2s, transform .3s cubic-bezier(.22,1,.36,1); }
.card:hover { border-color: #46525a; transform: translateY(-2px); }
.card-thumb { aspect-ratio: 16 / 10; background: #0b0d0e; position: relative; overflow: hidden; }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.card-thumb .kind { position: absolute; left: 12px; top: 12px; font-size: 12px; font-weight: 500; padding: 4px 8px; border-radius: 4px; background: rgba(15, 18, 20, .8); }
.card-body { padding: 16px; display: grid; gap: 6px; flex: 1; }
.card-body h2 { font-size: 1.25rem; margin: 0; letter-spacing: -0.01em; line-height: 1.2; }
.card-body .where { color: var(--muted); font-size: var(--step-small); margin: 0; }
.card-body .desc { margin: 4px 0 0; font-size: var(--step-small); color: #c6cdc9; }
.stats { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 10px 0 0; padding: 12px 0 0; border-top: 1px solid var(--line); font-size: var(--step-small); }
.stats div { display: flex; gap: 6px; }
.stats dt { color: var(--muted); }
.stats dd { margin: 0; font-weight: 500; font-variant-numeric: tabular-nums; }
.card-cta { margin-top: 12px; color: var(--accent); font-weight: 500; font-size: var(--step-small); display: inline-flex; gap: 6px; align-items: center; }
.empty { border: 1px dashed var(--line); border-radius: 10px; padding: clamp(32px, 6vw, 72px) 24px; text-align: center; display: grid; gap: 12px; justify-items: center; margin-bottom: 64px; }
.empty h2 { margin: 0; font-size: 1.5rem; }
.empty p { margin: 0; color: var(--muted); max-width: 52ch; }
.foot { border-top: 1px solid var(--line); padding: 20px 0 32px; color: var(--muted); font-size: var(--step-small); display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; }
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; }
  .brand small { display: none; }
}

/* ---------- viewer ---------- */
body.viewer { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.v-title { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.v-title strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-title span { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-main { flex: 1; display: flex; min-height: 0; position: relative; }
.v-stage { flex: 1; position: relative; min-width: 0; }
.v-stage .potree_container { position: absolute; inset: 0; }
#potree_render_area { background: radial-gradient(ellipse at 50% 40%, #1c2226 0%, #0c0e10 75%) !important; }
.v-tools { position: absolute; left: 12px; top: 12px; z-index: 20; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; max-width: calc(100% - 24px); }
.v-tools label { display: inline-flex; align-items: center; gap: 8px; background: rgba(23, 27, 30, .92); border: 1px solid var(--line); border-radius: 6px; padding: 4px 4px 4px 12px; font-size: var(--step-small); color: var(--muted); }
.v-tools select { font: inherit; font-size: var(--step-small); color: var(--ink); background: var(--panel-2); border: 0; border-radius: 4px; padding: 5px 8px; }
.v-tools input[type=range] { width: 90px; accent-color: var(--accent); }
.v-tools .btn { background: rgba(23, 27, 30, .92); }
.v-tools .btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.v-info { width: 320px; flex: none; background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; padding: 18px; font-size: var(--step-small); }
.v-info[hidden] { display: none; }
.v-info h2 { font-size: 1.125rem; margin: 0 0 4px; }
.v-info h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 0 8px; font-weight: 500; }
.v-info p { margin: 0; color: #c6cdc9; }
.v-info dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; }
.v-info dt { color: var(--muted); }
.v-info dd { margin: 0; text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.legend { height: 10px; border-radius: 3px; margin-top: 8px; }
.legend-ends { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.v-status { position: absolute; inset: 0; display: grid; place-items: center; z-index: 30; pointer-events: none; }
.v-status div { background: rgba(23, 27, 30, .95); border: 1px solid var(--line); border-radius: 8px; padding: 18px 22px; text-align: center; max-width: 360px; pointer-events: auto; }
.v-status[hidden] { display: none; }
.v-status p { margin: 6px 0 0; color: var(--muted); font-size: var(--step-small); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); margin: 0 auto 10px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
/* Potree's own sidebar (measuring tools) sits under the render area; the render area slides right to reveal it */
#potree_render_area { transition: left .25s ease; }
#potree_quick_buttons { display: none !important; }
.v-stage.tools-open .v-tools { left: 312px; max-width: calc(100% - 324px); }
@media (max-width: 560px) { .v-stage.tools-open .v-tools { left: 12px; top: auto; bottom: 12px; } }
@media (max-width: 860px) {
  .v-info { position: absolute; right: 0; top: 0; bottom: 0; z-index: 26; width: min(320px, 90vw); box-shadow: -12px 0 32px rgba(0,0,0,.5); }
  .v-tools .opt-wide { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .card { transition: none; }
  .spinner { animation-duration: 3s; }
}
