/* Andres Design Portfolio: the whole site is a CAD workspace.
   Layout: title bar / ribbon / [specification tree | viewport or sheet | properties] / status bar.
   Four workspace themes switch every color through the tokens below. */

:root {
  --font-ui: 'IBM Plex Sans', 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Menlo, Consolas, monospace;
  --font-display: 'Barlow Condensed', 'Arial Narrow', 'IBM Plex Sans', sans-serif;
  --ease: cubic-bezier(.22, .9, .3, 1);
  --radius: 6px;
  --tree-w: 264px;
  --props-w: 340px;
}

/* ---------- Theme: CATIA (classic blue workbench, tree drawn over the viewport) ---------- */
:root, [data-theme="catia"] {
  --title-bg: linear-gradient(180deg, #123a73, #0b2a57);
  --title-fg: #ffffff;
  --title-muted: #a9c1e6;
  --ribbon-bg: linear-gradient(180deg, #f6f8fb, #e1e6ee);
  --ribbon-fg: #1c2a3f;
  --ribbon-muted: #5d6b80;
  --ribbon-border: #b7c2d2;
  --tab-active: #0b2a57;
  --tab-bar: #f29b16;
  --tool-hover: rgba(17, 66, 140, .1);
  --tool-on: rgba(242, 155, 22, .22);
  --panel-bg: transparent;
  --panel-solid: #f3f6fa;
  --panel-fg: #0d2347;
  --panel-muted: #3b5079;
  --panel-border: transparent;
  --panel-head: rgba(255, 255, 255, .0);
  --tree-line: #e8920f;
  --tree-icon: #0d4fa8;
  --select-bg: #f29b16;
  --select-fg: #1b1300;
  --accent: #f29b16;
  --accent-2: #0d4fa8;
  --accent-ink: #1b1300;
  --vp-bg: linear-gradient(180deg, #34558f 0%, #6f8fc4 42%, #c6d4ea 78%, #e9eef7 100%);
  --vp-fg: #ffffff;
  --vp-fg-2: #e7eefb;
  --vp-shadow: 0 2px 18px rgba(8, 24, 60, .35);
  --status-bg: linear-gradient(180deg, #e9edf3, #d6dce5);
  --status-fg: #23324a;
  --card-bg: #ffffff;
  --card-fg: #12233f;
  --card-muted: #56657d;
  --card-border: rgba(13, 35, 71, .12);
  --surface: #ffffff;
  --surface-2: #eef2f8;
  --input-bg: #ffffff;
  --input-border: #a9b6c8;
  --sheet-bg: #fbfcfe;
  --sheet-ink: #0d2347;
  --sheet-line: #1b3a6b;
  --hud-bg: rgba(255, 255, 255, .78);
  --hud-fg: #13284d;
  --drop: rgba(9, 28, 66, .45);
  --chip-bg: rgba(13, 79, 168, .1);
  --chip-fg: #0d3f86;
  color-scheme: light;
}

/* ---------- Theme: NX (light ribbon, blue accents, graduated grey viewport) ---------- */
[data-theme="nx"] {
  --title-bg: linear-gradient(180deg, #343a43, #272c33);
  --title-fg: #f2f4f7;
  --title-muted: #aab3c0;
  --ribbon-bg: linear-gradient(180deg, #fbfbfc, #eef0f3);
  --ribbon-fg: #1f2733;
  --ribbon-muted: #5f6b7b;
  --ribbon-border: #cfd5dd;
  --tab-active: #0f62c9;
  --tab-bar: #0f62c9;
  --tool-hover: rgba(15, 98, 201, .09);
  --tool-on: rgba(15, 98, 201, .16);
  --panel-bg: #ffffff;
  --panel-solid: #ffffff;
  --panel-fg: #1f2733;
  --panel-muted: #5f6b7b;
  --panel-border: #d3d9e1;
  --panel-head: linear-gradient(180deg, #f6f7f9, #eceff3);
  --tree-line: #b3bcc8;
  --tree-icon: #e07a1f;
  --select-bg: #d6e6fb;
  --select-fg: #0b3f85;
  --accent: #0f62c9;
  --accent-2: #e07a1f;
  --accent-ink: #ffffff;
  --vp-bg: linear-gradient(180deg, #eef1f4 0%, #c9d1da 48%, #98a5b4 100%);
  --vp-fg: #1b2532;
  --vp-fg-2: #3f4b5c;
  --vp-shadow: none;
  --status-bg: #e9ecf0;
  --status-fg: #2a3442;
  --card-bg: #ffffff;
  --card-fg: #1f2733;
  --card-muted: #5f6b7b;
  --card-border: #d3d9e1;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --input-bg: #ffffff;
  --input-border: #b9c2ce;
  --sheet-bg: #fdfdfb;
  --sheet-ink: #1b2532;
  --sheet-line: #2b3646;
  --hud-bg: rgba(255, 255, 255, .86);
  --hud-fg: #1f2733;
  --drop: rgba(28, 40, 58, .42);
  --chip-bg: #e7f0fc;
  --chip-fg: #0b4fa6;
  color-scheme: light;
}

/* ---------- Theme: SOLIDWORKS (white-to-steel viewport, FeatureManager, red accents) ---------- */
[data-theme="solidworks"] {
  --title-bg: linear-gradient(180deg, #ffffff, #eceef1);
  --title-fg: #2b2f36;
  --title-muted: #6d7480;
  --ribbon-bg: linear-gradient(180deg, #f9fafb, #e8ebef);
  --ribbon-fg: #23272e;
  --ribbon-muted: #6d7480;
  --ribbon-border: #c9ced6;
  --tab-active: #c8102e;
  --tab-bar: #c8102e;
  --tool-hover: rgba(200, 16, 46, .07);
  --tool-on: rgba(200, 16, 46, .13);
  --panel-bg: #f7f8fa;
  --panel-solid: #f7f8fa;
  --panel-fg: #23272e;
  --panel-muted: #6a717c;
  --panel-border: #d4d8de;
  --panel-head: linear-gradient(180deg, #fbfbfc, #eef0f3);
  --tree-line: #c4c9d1;
  --tree-icon: #2f6db5;
  --select-bg: #cfe3fb;
  --select-fg: #0e3a6e;
  --accent: #c8102e;
  --accent-2: #2f6db5;
  --accent-ink: #ffffff;
  --vp-bg: linear-gradient(180deg, #ffffff 0%, #eef2f7 38%, #c9d5e3 78%, #aebfd3 100%);
  --vp-fg: #1d232b;
  --vp-fg-2: #4a5462;
  --vp-shadow: none;
  --status-bg: #eceef1;
  --status-fg: #343a43;
  --card-bg: #ffffff;
  --card-fg: #23272e;
  --card-muted: #6a717c;
  --card-border: #d4d8de;
  --surface: #ffffff;
  --surface-2: #f2f4f6;
  --input-bg: #ffffff;
  --input-border: #bcc3cc;
  --sheet-bg: #ffffff;
  --sheet-ink: #1d232b;
  --sheet-line: #23272e;
  --hud-bg: rgba(255, 255, 255, .9);
  --hud-fg: #23272e;
  --drop: rgba(30, 44, 66, .38);
  --chip-bg: #fbe7ea;
  --chip-fg: #a00d25;
  color-scheme: light;
}

/* ---------- Theme: Dark Studio (render studio, deep charcoal, electric blue) ---------- */
[data-theme="studio"] {
  --title-bg: linear-gradient(180deg, #16191e, #111317);
  --title-fg: #e9edf2;
  --title-muted: #8893a1;
  --ribbon-bg: linear-gradient(180deg, #1c2026, #171a1f);
  --ribbon-fg: #dfe4ea;
  --ribbon-muted: #8a94a2;
  --ribbon-border: #2b3139;
  --tab-active: #ffffff;
  --tab-bar: #4da3ff;
  --tool-hover: rgba(77, 163, 255, .1);
  --tool-on: rgba(77, 163, 255, .2);
  --panel-bg: #1a1d22;
  --panel-solid: #1a1d22;
  --panel-fg: #dfe4ea;
  --panel-muted: #8a94a2;
  --panel-border: #2b3139;
  --panel-head: #1f2329;
  --tree-line: #3a424d;
  --tree-icon: #4da3ff;
  --select-bg: rgba(77, 163, 255, .18);
  --select-fg: #cfe5ff;
  --accent: #4da3ff;
  --accent-2: #ffb547;
  --accent-ink: #04121f;
  --vp-bg: radial-gradient(ellipse 85% 75% at 50% 38%, #3b434f 0%, #232830 52%, #121418 100%);
  --vp-fg: #f2f5f8;
  --vp-fg-2: #a9b4c2;
  --vp-shadow: 0 2px 22px rgba(0, 0, 0, .55);
  --status-bg: #121418;
  --status-fg: #9aa5b3;
  --card-bg: #1d2127;
  --card-fg: #e6eaef;
  --card-muted: #8f9aa8;
  --card-border: #2c323b;
  --surface: #1d2127;
  --surface-2: #23282f;
  --input-bg: #14171b;
  --input-border: #353c46;
  --sheet-bg: #15181c;
  --sheet-ink: #dbe2ea;
  --sheet-line: #7f8b9a;
  --hud-bg: rgba(24, 27, 32, .82);
  --hud-fg: #e3e8ee;
  --drop: rgba(0, 0, 0, .6);
  --chip-bg: rgba(77, 163, 255, .14);
  --chip-fg: #8cc4ff;
  color-scheme: dark;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.5 var(--font-ui); color: var(--panel-fg); background: #0b0d10; -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.app { position: fixed; inset: 0; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr) auto; background: var(--panel-solid); transition: background .4s var(--ease); }

/* ---------- title bar ---------- */
.titlebar { display: flex; align-items: center; gap: 14px; height: 44px; padding: 0 14px; background: var(--title-bg); color: var(--title-fg); position: relative; z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.brand-mark { width: 26px; height: 26px; flex: none; }
.brand-name { font: 600 15px/1 var(--font-display); letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; }
.brand-name b { font-weight: 700; }
.doc { font-size: 12.5px; color: var(--title-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.doc::before { content: '—'; margin-right: 10px; opacity: .6; }
.spacer { flex: 1; }
.themes { display: flex; align-items: center; gap: 4px; padding: 3px; border-radius: 999px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14); }
[data-theme="solidworks"] .themes { background: rgba(0, 0, 0, .04); border-color: rgba(0, 0, 0, .1); }
.themes-label { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--title-muted); padding: 0 6px 0 8px; }
.theme-btn { display: inline-flex; align-items: center; gap: 7px; border: 0; background: none; color: var(--title-fg); padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: .03em; transition: background .2s, color .2s; }
.theme-btn .sw { width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .5), 0 1px 2px rgba(0, 0, 0, .3); }
.theme-btn:hover { background: rgba(255, 255, 255, .12); }
[data-theme="solidworks"] .theme-btn:hover { background: rgba(0, 0, 0, .06); }
.theme-btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.sw-catia { background: linear-gradient(180deg, #34558f, #e9eef7); }
.sw-nx { background: linear-gradient(180deg, #eef1f4, #8592a0); }
.sw-solidworks { background: linear-gradient(180deg, #ffffff, #aebfd3); }
.sw-studio { background: radial-gradient(circle at 50% 35%, #4b5563, #0d0f12); }
.title-cta { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .25); text-decoration: none; font-size: 12.5px; font-weight: 600; }
[data-theme="solidworks"] .title-cta { border-color: rgba(0, 0, 0, .18); }
.title-cta:hover { background: rgba(255, 255, 255, .1); }

/* ---------- ribbon ---------- */
.ribbon { background: var(--ribbon-bg); color: var(--ribbon-fg); border-bottom: 1px solid var(--ribbon-border); position: relative; z-index: 4; }
.tabs { display: flex; gap: 2px; padding: 0 10px; border-bottom: 1px solid var(--ribbon-border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; text-decoration: none; border: 0; background: none; padding: 9px 14px 8px; font-size: 13px; font-weight: 500; color: var(--ribbon-muted); white-space: nowrap; transition: color .2s; }
.tab::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--tab-bar); transform: scaleX(0); transition: transform .3s var(--ease); }
.tab:hover { color: var(--ribbon-fg); }
.tab[aria-current="page"] { color: var(--tab-active); font-weight: 600; }
.tab[aria-current="page"]::after { transform: scaleX(1); }
.tools { display: flex; align-items: stretch; gap: 0; padding: 6px 8px; min-height: 77px; overflow-x: auto; scrollbar-width: thin; }
.tool-group { display: flex; flex-direction: column; padding: 0 8px; border-right: 1px solid var(--ribbon-border); }
.tool-group:last-child { border-right: 0; }
.tool-row { display: flex; gap: 2px; flex: 1; align-items: center; }
.tool-label { font-size: 10.5px; letter-spacing: .06em; color: var(--ribbon-muted); text-align: center; padding-top: 2px; white-space: nowrap; }
.tool { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 52px; padding: 4px 6px; border: 1px solid transparent; border-radius: 5px; background: none; color: var(--ribbon-fg); font-size: 11px; line-height: 1.1; white-space: nowrap; transition: background .15s, border-color .15s, opacity .2s; }
.tool svg.i { width: 22px; height: 22px; stroke-width: 1.5; }
.tool:hover:not(:disabled) { background: var(--tool-hover); border-color: var(--ribbon-border); }
.tool[aria-pressed="true"] { background: var(--tool-on); border-color: var(--accent); }
.tool:disabled { opacity: .38; cursor: default; }
.tool .ic-accent { stroke: var(--accent-2); }
.tool-range { display: flex; align-items: center; gap: 6px; font-size: 11px; padding: 0 4px; }
.tool-range input { width: 110px; accent-color: var(--accent); }
.ribbon-intro { display: flex; align-items: center; gap: 10px; padding: 0 12px; color: var(--ribbon-muted); font-size: 12.5px; }

/* ---------- workspace ---------- */
.workspace { position: relative; display: grid; grid-template-columns: var(--tree-w) 1fr var(--props-w); min-height: 0; background: var(--vp-bg); transition: background .5s var(--ease); }
.workspace.no-props { grid-template-columns: var(--tree-w) 1fr 0; }
.panel { position: relative; display: flex; flex-direction: column; min-height: 0; background: var(--panel-bg); color: var(--panel-fg); z-index: 2; transition: background .4s var(--ease), color .3s; }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 9px 12px; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--panel-muted); background: var(--panel-head); border-bottom: 1px solid var(--panel-border); }
.panel-head .x { margin-left: auto; display: none; border: 0; background: none; color: inherit; padding: 2px; }
.panel-body { flex: 1; overflow: auto; scrollbar-width: thin; min-height: 0; }
.tree-panel { border-right: 1px solid var(--panel-border); }
.props-panel { border-left: 1px solid var(--panel-border); overflow: hidden; }
.workspace.no-props .props-panel { visibility: hidden; }

/* CATIA draws its tree straight over the viewport gradient */
[data-theme="catia"] .tree-panel .panel-head { color: #ffffff; text-shadow: 0 1px 2px rgba(0, 0, 0, .35); border-bottom-color: rgba(255, 255, 255, .25); }
[data-theme="catia"] .tree { --panel-fg: #ffffff; --panel-muted: #e2ebfa; --tree-icon: #ffd38a; text-shadow: 0 1px 2px rgba(7, 22, 54, .55); }
[data-theme="catia"] .props-panel { background: rgba(244, 247, 252, .92); backdrop-filter: blur(10px); border-left: 1px solid rgba(255, 255, 255, .6); }
[data-theme="catia"] .props-panel .panel-head { color: var(--panel-muted); border-bottom-color: #d4dcea; }

/* ---------- specification tree ---------- */
.tree { list-style: none; margin: 0; padding: 8px 6px 18px 10px; font-size: 13px; }
.tree ul { list-style: none; margin: 0; padding: 0 0 0 18px; }
.tree li { position: relative; }
.tree ul > li::before { content: ''; position: absolute; left: -11px; top: 0; bottom: 0; border-left: 1px solid var(--tree-line); }
.tree ul > li:last-child::before { bottom: auto; height: 14px; }
.tree ul > li::after { content: ''; position: absolute; left: -11px; top: 14px; width: 9px; border-top: 1px solid var(--tree-line); }
.node { display: flex; align-items: center; gap: 7px; width: 100%; padding: 3px 6px; border: 0; border-radius: 4px; background: none; text-align: left; color: var(--panel-fg); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: background .15s; }
.node:hover { background: var(--tool-hover); }
.node[aria-current="true"] { background: var(--select-bg); color: var(--select-fg); text-shadow: none; }
.node .ni { color: var(--tree-icon); }
.node .nt { overflow: hidden; text-overflow: ellipsis; }
.node .count { margin-left: auto; font: 500 11px var(--font-mono); color: var(--panel-muted); }
.node[aria-current="true"] .count { color: inherit; }
.node.root { font-weight: 600; }
.part-row { display: flex; align-items: center; }
.part-row .node { flex: 1; min-width: 0; }
.eye { border: 0; background: none; color: var(--panel-muted); padding: 3px 5px; border-radius: 4px; display: inline-flex; }
.eye:hover { color: var(--panel-fg); background: var(--tool-hover); }
.eye[aria-pressed="false"] { opacity: .45; }
.tree-foot { padding: 12px 14px 16px; font-size: 12px; color: var(--panel-muted); border-top: 1px solid var(--panel-border); }
[data-theme="catia"] .tree-foot { color: #e2ebfa; border-top-color: rgba(255, 255, 255, .25); text-shadow: 0 1px 2px rgba(7, 22, 54, .5); }

/* ---------- stage: viewport + pages ---------- */
.stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; }
.viewport { position: absolute; inset: 0; }
.viewport canvas { display: block; width: 100%; height: 100%; outline: none; touch-action: none; }
.viewport.picking canvas { cursor: crosshair; }
.overlay { position: absolute; inset: 0; pointer-events: none; }
.overlay > * { pointer-events: auto; }
.anno-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.anno-layer > svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }

.loading { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--vp-fg); text-shadow: var(--vp-shadow); font-size: 13px; }
.loading .bar { width: 180px; height: 3px; border-radius: 3px; background: rgba(127, 127, 127, .3); overflow: hidden; }
.loading .bar i { display: block; height: 100%; width: 40%; background: var(--accent); border-radius: 3px; animation: slide 1.1s var(--ease) infinite; }
@keyframes slide { from { transform: translateX(-110%); } to { transform: translateX(260%); } }

/* heads-up toolbar floating in the viewport */
.hud { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 2px; padding: 4px; border-radius: 10px; background: var(--hud-bg); color: var(--hud-fg); box-shadow: 0 6px 22px rgba(0, 0, 0, .16), 0 0 0 1px rgba(127, 127, 127, .18); backdrop-filter: blur(10px); z-index: 3; }
.hud button { border: 0; background: none; color: inherit; padding: 6px; border-radius: 7px; display: inline-flex; }
.hud button:hover { background: var(--tool-hover); }
.hud button[aria-pressed="true"] { background: var(--tool-on); color: var(--accent); }
.hud .sep { width: 1px; margin: 4px 3px; background: rgba(127, 127, 127, .3); }

/* view cube + axis triad */
.viewcube { position: absolute; top: 14px; right: 18px; width: 92px; height: 92px; perspective: 400px; z-index: 3; }
.cube { position: absolute; left: 21px; top: 21px; width: 50px; height: 50px; transform-style: preserve-3d; }
.face { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 700 8.5px/1 var(--font-ui); letter-spacing: .06em; color: var(--hud-fg); background: var(--hud-bg); border: 1px solid rgba(127, 127, 127, .55); backface-visibility: hidden; cursor: pointer; user-select: none; transition: background .15s, color .15s; }
.face:hover { background: var(--accent); color: var(--accent-ink); }
.face.f-front { transform: translateZ(25px); }
.face.f-back { transform: rotateY(180deg) translateZ(25px); }
.face.f-right { transform: rotateY(90deg) translateZ(25px); }
.face.f-left { transform: rotateY(-90deg) translateZ(25px); }
.face.f-top { transform: rotateX(90deg) translateZ(25px); }
.face.f-bottom { transform: rotateX(-90deg) translateZ(25px); }
.cube-ring { position: absolute; inset: 10px; border-radius: 50%; border: 1.5px solid rgba(127, 127, 127, .35); }
.triad { position: absolute; left: 14px; bottom: 12px; width: 76px; height: 76px; z-index: 3; pointer-events: none; }
.triad text { font: 700 11px var(--font-mono); }

/* section slider in the viewport */
.section-ctl { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 999px; background: var(--hud-bg); color: var(--hud-fg); box-shadow: 0 6px 22px rgba(0, 0, 0, .18); font-size: 12px; z-index: 3; }
.section-ctl input { width: 220px; accent-color: var(--accent); }
.section-ctl select { border: 1px solid rgba(127, 127, 127, .4); background: transparent; border-radius: 6px; padding: 2px 4px; }

/* ---------- home hero over the viewport ---------- */
.hero { position: absolute; left: clamp(20px, 4vw, 56px); top: clamp(22px, 7vh, 72px); max-width: min(520px, 46%); color: var(--vp-fg); z-index: 2; pointer-events: none; }
.hero > * { pointer-events: auto; }
.hero .eyebrow { display: inline-flex; align-items: center; gap: 8px; font: 600 11.5px/1 var(--font-mono); letter-spacing: .16em; text-transform: uppercase; color: var(--vp-fg-2); text-shadow: var(--vp-shadow); }
.hero .eyebrow .dot { width: 8px; height: 8px; border-radius: 50%; background: #2bd47d; box-shadow: 0 0 0 4px rgba(43, 212, 125, .22); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(43, 212, 125, 0); } }
.hero h1 { margin: 14px 0 6px; font: 700 clamp(56px, 8.5vw, 116px)/.86 var(--font-display); letter-spacing: .01em; text-transform: uppercase; text-shadow: var(--vp-shadow); }
.hero h1 span { display: block; font-weight: 500; font-size: .36em; letter-spacing: .14em; margin-top: 12px; color: var(--vp-fg-2); }
.hero p { margin: 16px 0 0; max-width: 430px; font-size: 15px; line-height: 1.6; color: var(--vp-fg-2); text-shadow: var(--vp-shadow); }
.hero-ctas { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 8px; border: 1px solid transparent; font-weight: 600; font-size: 14px; text-decoration: none; transition: transform .2s var(--ease), box-shadow .2s, background .2s, color .2s; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 22px -8px var(--accent); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 26px -8px var(--accent); }
.btn-ghost { background: var(--hud-bg); color: var(--hud-fg); border-color: rgba(127, 127, 127, .3); backdrop-filter: blur(8px); }
.btn-ghost:hover { transform: translateY(-2px); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.featured-bar { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; gap: 6px; padding: 5px; border-radius: 999px; background: var(--hud-bg); box-shadow: 0 8px 26px rgba(0, 0, 0, .18); backdrop-filter: blur(10px); z-index: 3; max-width: calc(100% - 200px); overflow-x: auto; scrollbar-width: none; }
.featured-bar button { position: relative; border: 0; background: none; color: var(--hud-fg); padding: 7px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; }
.featured-bar button[aria-current="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.featured-bar button[aria-current="true"] .prog { position: absolute; left: 0; bottom: 0; height: 2px; background: currentColor; opacity: .55; animation: prog var(--dwell, 9s) linear forwards; }
@keyframes prog { from { width: 0; } to { width: 100%; } }
.open-project { position: absolute; right: 22px; bottom: 22px; z-index: 3; }

/* ---------- pages (gallery, about, contact) ---------- */
.page { position: absolute; inset: 0; overflow: auto; scrollbar-width: thin; padding: clamp(18px, 3vw, 36px); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 26px; color: var(--vp-fg); }
.page-head h2 { margin: 0; font: 700 clamp(34px, 4.5vw, 56px)/.95 var(--font-display); text-transform: uppercase; letter-spacing: .02em; text-shadow: var(--vp-shadow); }
.page-head p { margin: 8px 0 0; max-width: 560px; color: var(--vp-fg-2); text-shadow: var(--vp-shadow); }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filters a { padding: 6px 13px; border-radius: 999px; text-decoration: none; font-size: 13px; font-weight: 500; background: var(--hud-bg); color: var(--hud-fg); box-shadow: 0 2px 10px rgba(0, 0, 0, .08); }
.filters a[aria-current="true"] { background: var(--accent); color: var(--accent-ink); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: clamp(18px, 2.4vw, 30px); padding-bottom: 30px; }
.card { position: relative; display: flex; flex-direction: column; text-decoration: none; color: var(--card-fg); background: var(--card-bg); border-radius: 12px; border: 1px solid var(--card-border); box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 18px 40px -22px var(--drop); transform-style: preserve-3d; transition: transform .45s var(--ease), box-shadow .45s var(--ease); opacity: 0; animation: rise .7s var(--ease) forwards; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes rise { from { opacity: 0; transform: translateY(26px) scale(.98); } to { opacity: 1; transform: none; } }
.card:hover { box-shadow: 0 2px 4px rgba(0, 0, 0, .06), 0 34px 60px -24px var(--drop); }
.card .thumb { position: relative; aspect-ratio: 4 / 3; border-radius: 11px 11px 0 0; overflow: hidden; background: var(--vp-bg); }
.card .thumb img { position: absolute; inset: 6% 6% 14%; width: 88%; height: 80%; object-fit: contain; animation: bob 5.5s ease-in-out infinite; animation-delay: calc(var(--i, 0) * -900ms); filter: drop-shadow(0 18px 14px var(--drop)); transition: transform .5s var(--ease); }
.card:hover .thumb img { transform: scale(1.05) translateY(-4px); }
.card .thumb .floor { position: absolute; left: 22%; right: 22%; bottom: 9%; height: 14px; border-radius: 50%; background: radial-gradient(closest-side, var(--drop), transparent); filter: blur(3px); animation: floor 5.5s ease-in-out infinite; animation-delay: calc(var(--i, 0) * -900ms); }
@keyframes bob { 50% { translate: 0 -8px; } }
@keyframes floor { 50% { transform: scaleX(.86); opacity: .7; } }
.card .thumb .ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--vp-fg-2); }
.card .badge-row { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; justify-content: space-between; gap: 6px; }
.card .body { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px 16px; flex: 1; }
.card h3 { margin: 0; font: 600 19px/1.15 var(--font-display); letter-spacing: .02em; }
.card p { margin: 0; color: var(--card-muted); font-size: 13.5px; line-height: 1.5; }
.card .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font: 600 11px/1.4 var(--font-ui); letter-spacing: .02em; background: var(--chip-bg); color: var(--chip-fg); }
.chip.solid { background: var(--accent); color: var(--accent-ink); }
.chip.glass { background: var(--hud-bg); color: var(--hud-fg); backdrop-filter: blur(8px); }
.chip.warn { background: rgba(255, 181, 71, .22); color: #8a5a00; }
[data-theme="studio"] .chip.warn { color: #ffcf7a; }
.empty { text-align: center; padding: 60px 20px; color: var(--vp-fg); text-shadow: var(--vp-shadow); }

/* ---------- properties panel ---------- */
.props { padding: 16px 16px 26px; font-size: 13.5px; animation: fadein .45s var(--ease); }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.props h2 { margin: 6px 0 4px; font: 700 26px/1.05 var(--font-display); letter-spacing: .01em; }
.props .sub { color: var(--panel-muted); margin: 0 0 12px; }
.props h4 { margin: 20px 0 8px; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--panel-muted); }
.props .chips { display: flex; gap: 6px; flex-wrap: wrap; }
.specs { width: 100%; border-collapse: collapse; font-size: 13px; }
.specs th, .specs td { text-align: left; padding: 6px 0; border-bottom: 1px solid var(--panel-border); vertical-align: top; }
[data-theme="catia"] .specs th, [data-theme="catia"] .specs td { border-bottom-color: #d4dcea; }
.specs th { font-weight: 500; color: var(--panel-muted); width: 44%; padding-right: 10px; }
.specs td { font-family: var(--font-mono); font-size: 12.5px; }
.desc p { margin: 0 0 10px; line-height: 1.6; }
.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.thumbs button { position: relative; padding: 0; border: 1px solid var(--panel-border); border-radius: 6px; overflow: hidden; aspect-ratio: 1; background: var(--surface-2); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s var(--ease); }
.thumbs button:hover img { transform: scale(1.06); }
.thumbs .pdf { display: grid; place-items: center; height: 100%; font: 700 12px var(--font-mono); color: var(--accent); }
.legend { display: grid; gap: 6px; font-size: 12.5px; color: var(--panel-muted); }
.legend div { display: flex; align-items: center; gap: 8px; }
.kbd { font: 600 11px var(--font-mono); padding: 1px 6px; border-radius: 4px; border: 1px solid var(--panel-border); background: var(--surface-2); color: var(--panel-fg); }

/* ---------- GD&T annotations ---------- */
.anno { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); pointer-events: auto; transition: opacity .3s; white-space: nowrap; filter: drop-shadow(0 3px 8px rgba(0, 0, 0, .18)); }
.anno.hidden { opacity: 0; pointer-events: none; }
.fcf { display: inline-flex; border: 1.5px solid #1a1f27; background: #fffef6; color: #11151b; font: 600 13px/1 var(--font-mono); }
.fcf > span { display: inline-flex; align-items: center; justify-content: center; gap: 2px; min-width: 26px; height: 26px; padding: 0 7px; border-left: 1.5px solid #1a1f27; }
.fcf > span:first-child { border-left: 0; padding: 0 5px; }
.fcf svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.fcf .mod { display: inline-grid; place-items: center; width: 15px; height: 15px; border: 1.3px solid currentColor; border-radius: 50%; font-size: 9.5px; margin-left: 2px; }
.anno-note { display: block; margin-bottom: 3px; font: 600 12px var(--font-mono); color: #11151b; background: rgba(255, 254, 246, .9); padding: 2px 6px; border-radius: 3px; width: max-content; }
.datum { display: inline-flex; flex-direction: column; align-items: center; }
.datum b { display: grid; place-items: center; width: 26px; height: 26px; border: 1.5px solid #1a1f27; background: #fffef6; color: #11151b; font: 700 14px var(--font-mono); }
.note-tag { display: inline-block; padding: 5px 9px; border: 1.5px solid #1a1f27; background: #fffef6; color: #11151b; font: 600 12.5px var(--font-mono); border-radius: 2px; }
.anno-leader { stroke: #1a1f27; stroke-width: 1.4; fill: none; }
.anno-dot { fill: #1a1f27; }
[data-theme="studio"] .anno-leader { stroke: #e6eaef; }
[data-theme="studio"] .anno-dot { fill: #e6eaef; }
[data-theme="catia"] .anno-leader { stroke: #0b1f44; }

/* ---------- drawing sheet (About) ---------- */
.sheet { position: relative; max-width: 1100px; margin: 0 auto 30px; padding: 26px; background: var(--sheet-bg); color: var(--sheet-ink); box-shadow: 0 2px 4px rgba(0, 0, 0, .08), 0 40px 80px -30px var(--drop); border-radius: 3px; animation: rise .7s var(--ease) both; }
.sheet-frame { position: relative; border: 2px solid var(--sheet-line); padding: 34px 34px 0; }
.zones { position: absolute; display: flex; justify-content: space-around; font: 600 10px var(--font-mono); color: var(--sheet-line); }
.zones.top { left: 0; right: 0; top: -19px; } .zones.bottom { left: 0; right: 0; bottom: -19px; }
.zones.left { top: 0; bottom: 0; left: -17px; flex-direction: column; } .zones.right { top: 0; bottom: 0; right: -17px; flex-direction: column; }
.sheet-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 34px; }
.sheet h2 { margin: 0; font: 700 clamp(44px, 6vw, 76px)/.9 var(--font-display); text-transform: uppercase; letter-spacing: .01em; }
.sheet .role { font: 500 18px var(--font-display); letter-spacing: .16em; text-transform: uppercase; color: var(--accent); margin: 10px 0 22px; }
[data-theme="catia"] .sheet .role { color: #0d4fa8; }
.sheet .bio { font-size: 15.5px; line-height: 1.7; margin: 0 0 22px; max-width: 560px; }
.sheet .links { display: flex; gap: 8px; flex-wrap: wrap; }
.bom { width: 100%; border-collapse: collapse; font: 13px var(--font-mono); }
.bom caption { text-align: left; font: 600 11px var(--font-ui); letter-spacing: .14em; text-transform: uppercase; padding-bottom: 6px; color: var(--sheet-line); }
.bom th, .bom td { border: 1.4px solid var(--sheet-line); padding: 6px 9px; text-align: left; }
.bom th { font: 700 11px var(--font-ui); letter-spacing: .1em; text-transform: uppercase; background: rgba(127, 127, 127, .08); }
.bom td:first-child, .bom th:first-child { width: 58px; text-align: center; }
.titleblock { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; margin: 34px -34px 0 auto; width: min(100% + 34px, 640px); border-top: 2px solid var(--sheet-line); border-left: 2px solid var(--sheet-line); font: 12px var(--font-mono); }
.titleblock > div { padding: 6px 9px; border-right: 1.4px solid var(--sheet-line); border-bottom: 1.4px solid var(--sheet-line); }
.titleblock > div:nth-child(4n) { border-right: 0; }
.titleblock small { display: block; font: 600 9px var(--font-ui); letter-spacing: .12em; text-transform: uppercase; opacity: .7; }
.titleblock .big { grid-column: span 2; font: 700 20px var(--font-display); letter-spacing: .06em; text-transform: uppercase; }
.titleblock > div:last-child, .titleblock > div:nth-last-child(-n+4) { border-bottom: 0; }

/* ---------- dialog (Contact) ---------- */
.dialog { max-width: 620px; margin: 2vh auto 30px; background: var(--surface); color: var(--card-fg); border-radius: 10px; overflow: hidden; box-shadow: 0 2px 4px rgba(0, 0, 0, .08), 0 40px 80px -30px var(--drop), 0 0 0 1px var(--card-border); animation: rise .6s var(--ease) both; }
.dialog-title { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--title-bg); color: var(--title-fg); font-size: 13px; font-weight: 600; }
.dialog-title .dots { display: flex; gap: 6px; margin-left: auto; }
.dialog-title .dots i { width: 11px; height: 11px; border-radius: 50%; background: rgba(255, 255, 255, .35); }
[data-theme="solidworks"] .dialog-title .dots i { background: rgba(0, 0, 0, .15); }
.dialog-body { padding: 22px 22px 6px; }
.dialog-body h2 { margin: 0 0 4px; font: 700 30px/1 var(--font-display); text-transform: uppercase; letter-spacing: .02em; }
.dialog-body > p { margin: 0 0 18px; color: var(--card-muted); }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label { font-size: 12px; font-weight: 600; color: var(--card-muted); letter-spacing: .02em; }
.field input, .field textarea, .field select { width: 100%; padding: 9px 11px; border-radius: 6px; border: 1px solid var(--input-border); background: var(--input-bg); color: var(--card-fg); transition: border-color .15s, box-shadow .15s; }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--tool-on); }
.field textarea { min-height: 130px; resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dialog-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 14px 22px 18px; border-top: 1px solid var(--card-border); background: var(--surface-2); }
.dialog-foot .msg { margin-right: auto; font-size: 13px; color: var(--card-muted); }
.dialog-foot .msg.err { color: #c62828; }
.btn-plain { background: var(--surface); color: var(--card-fg); border-color: var(--input-border); }
.hp { position: absolute; left: -9999px; }
.direct { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

/* ---------- status bar ---------- */
.statusbar { display: flex; align-items: center; gap: 18px; height: 26px; padding: 0 12px; background: var(--status-bg); color: var(--status-fg); font: 11.5px var(--font-mono); border-top: 1px solid var(--ribbon-border); white-space: nowrap; overflow: hidden; }
.statusbar .ok::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #2bd47d; margin-right: 7px; vertical-align: 1px; }
.statusbar .grow { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.statusbar .dim { opacity: .7; }

/* ---------- lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(6, 9, 14, .86); backdrop-filter: blur(6px); animation: fadein .25s; padding: 24px; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 110px); border-radius: 6px; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); background: #fff; }
.lightbox figure { margin: 0; text-align: center; color: #e6eaef; }
.lightbox figcaption { margin-top: 12px; font-size: 14px; }
.lightbox .close { position: absolute; top: 14px; right: 16px; border: 0; background: rgba(255, 255, 255, .12); color: #fff; border-radius: 50%; width: 40px; height: 40px; display: grid; place-items: center; }

/* ---------- boot splash ---------- */
.splash { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: radial-gradient(ellipse at 50% 40%, #1d2735, #090c11 70%); color: #e8eef6; transition: opacity .6s var(--ease), visibility .6s; }
.splash.done { opacity: 0; visibility: hidden; }
.splash-inner { width: min(420px, 80vw); }
.splash .brand-mark { width: 54px; height: 54px; margin-bottom: 18px; }
.splash h1 { margin: 0; font: 700 40px/1 var(--font-display); letter-spacing: .14em; text-transform: uppercase; }
.splash p { margin: 8px 0 24px; font: 12px var(--font-mono); color: #8fa0b5; letter-spacing: .08em; }
.splash .track { height: 3px; background: rgba(255, 255, 255, .1); border-radius: 3px; overflow: hidden; }
.splash .track i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #4da3ff, #f29b16); animation: boot 1.1s var(--ease) forwards; }
@keyframes boot { to { width: 100%; } }
.splash .log { margin-top: 12px; height: 18px; font: 11.5px var(--font-mono); color: #7f90a6; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: 46px; transform: translateX(-50%); z-index: 60; padding: 10px 16px; border-radius: 8px; background: #11151b; color: #fff; font-size: 13.5px; box-shadow: 0 12px 30px rgba(0, 0, 0, .3); animation: fadein .25s var(--ease); }

/* ---------- mobile ---------- */
.only-mobile { display: none !important; }
@media (max-width: 1100px) {
  :root { --props-w: 300px; --tree-w: 230px; }
}
@media (max-width: 860px) {
  .only-mobile { display: inline-flex !important; }
  .hide-mobile { display: none !important; }
  .titlebar { height: 46px; gap: 8px; padding: 0 10px; }
  .doc { display: none; }
  .themes-label { display: none; }
  .theme-btn { padding: 5px 8px; }
  .theme-btn .nm { display: none; }
  .tools { min-height: 0; padding: 4px 6px; }
  .tool { min-width: 44px; font-size: 10px; }
  .tool .tl { display: none; }
  .tool-label { display: none; }
  .workspace, .workspace.no-props { grid-template-columns: 1fr; }
  .panel.drawer { position: absolute; top: 0; bottom: 0; width: min(88vw, 340px); z-index: 10; transition: transform .35s var(--ease); box-shadow: 0 20px 50px rgba(0, 0, 0, .35); background: var(--panel-solid); }
  [data-theme="catia"] .panel.drawer { background: linear-gradient(180deg, #24447e, #3d5f9a 60%, #5679b3); }
  [data-theme="catia"] .props-panel.drawer { background: #f4f7fc; }
  .tree-panel.drawer { left: 0; transform: translateX(-105%); }
  .props-panel.drawer { right: 0; transform: translateX(105%); visibility: visible !important; }
  .panel.drawer.open { transform: none; }
  .panel-head .x { display: inline-flex; }
  .hero { max-width: none; right: 20px; top: 20px; }
  .hero h1 { font-size: clamp(48px, 15vw, 76px); }
  .hero p { font-size: 14px; }
  .featured-bar { max-width: calc(100% - 24px); bottom: 14px; }
  .viewcube { transform: scale(.78); transform-origin: top right; top: 8px; right: 8px; }
  .triad { transform: scale(.85); transform-origin: bottom left; bottom: 66px; left: 8px; }
  .fcf { font-size: 11px; border-width: 1.2px; }
  .fcf > span { min-width: 20px; height: 21px; padding: 0 5px; border-left-width: 1.2px; }
  .fcf svg { width: 14px; height: 14px; }
  .fcf .mod { width: 13px; height: 13px; font-size: 8.5px; }
  .datum b { width: 21px; height: 21px; font-size: 12px; border-width: 1.2px; }
  .anno-note { font-size: 10.5px; }
  .note-tag { font-size: 11px; padding: 3px 7px; }
  .hud { top: auto; bottom: 64px; }
  .open-project { right: 12px; bottom: 64px; }
  .section-ctl { bottom: 112px; }
  .section-ctl input { width: 140px; }
  .sheet { padding: 14px; }
  .sheet-frame { padding: 22px 18px 0; }
  .sheet-grid { grid-template-columns: 1fr; gap: 24px; }
  .titleblock { margin: 24px -18px 0 -18px; width: auto; grid-template-columns: 1fr 1fr; }
  .titleblock .big { grid-column: span 2; }
  .titleblock > div:nth-child(4n) { border-right: 1.4px solid var(--sheet-line); }
  .titleblock > div:nth-child(2n) { border-right: 0; }
  .row2 { grid-template-columns: 1fr; gap: 0; }
  .statusbar .hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- small additions ---------- */
a.tool { text-decoration: none; }
.chip svg.i { width: 13px; height: 13px; stroke-width: 2; }
.btn svg.i { width: 17px; height: 17px; }
.section-ctl label { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.section-ctl svg.i { width: 16px; height: 16px; }
.dot-ok { width: 8px; height: 8px; border-radius: 50%; background: #2bd47d; box-shadow: 0 0 0 3px rgba(43, 212, 125, .25); flex: none; }
.tree-foot svg.i { width: 15px; height: 15px; }
.empty svg.i { width: 20px; height: 20px; vertical-align: -4px; }
.sheet .bom a { color: inherit; }
.sheet .bio p { margin: 0 0 12px; }
.ribbon-intro { white-space: nowrap; }
[data-theme="catia"] .tree-panel { background: linear-gradient(180deg, rgba(9, 30, 72, .1), rgba(9, 30, 72, .52)); backdrop-filter: blur(8px); border-right: 1px solid rgba(255, 255, 255, .16); }
