:root {
  --bg: #f5f3ef;
  --bg-2: #f1eee8;
  --panel: rgba(240, 236, 228, 0.72);
  --panel-solid: #ede9e1;
  --border: rgba(135, 85, 45, 0.20);
  --border-strong: rgba(135, 55, 0, 0.45);
  --text: #19120c;
  --muted: #755f4b;
  --accent: #c91f3b;
  --accent-2: #955600;
  --glow: rgba(201, 31, 59, 0.22);
  --cube-size: min(82vw, 70vh, 560px);
  --half: calc(var(--cube-size) / 2);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  background: radial-gradient(1200px 800px at 70% -10%, var(--bg-2), var(--bg) 60%);
  color: var(--text);
  font-family: "Space Grotesk", system-ui, -apple-system, sans-serif;
  overflow: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: "JetBrains Mono", ui-monospace, monospace; }

/* ---------- Background ---------- */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(135, 85, 45, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(135, 85, 45, 0.07) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 50% 45%, #000 30%, transparent 78%);
  pointer-events: none;
  z-index: 0;
}

.bg-glow {
  position: fixed;
  width: 60vmax;
  height: 60vmax;
  left: 50%;
  top: 48%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, var(--glow), transparent 62%);
  filter: blur(40px);
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
}

/* ---------- Top region (bar + booking band) ---------- */
/* The fixed bars span the full viewport above the cube stage; make their
   empty areas click-transparent so they don't swallow clicks on the cube. */
.topregion {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 30;
  pointer-events: none;
}

.navbtn,
.book-btn { pointer-events: auto; }

/* ---------- Top bar ---------- */
.topbar {
  position: static;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  background: linear-gradient(180deg, rgba(245, 243, 239, 0.85), transparent);
}

/* ---------- Booking band ---------- */
.book-band {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  padding: 2px 20px 14px;
}

.book-band__headline {
  margin: 0;
  max-width: 640px;
  font-family: "Space Grotesk", system-ui, -apple-system, sans-serif;
  font-size: clamp(13px, 2.6vw, 15px);
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0.01em;
  color: var(--text);
}

.book-band__headline strong { font-weight: 700; }
.book-band__sub { color: var(--text); }

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.topbar__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.navbtn {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  transition: color 0.18s, border-color 0.18s, background 0.18s;
}

.navbtn:hover { color: var(--text); border-color: var(--border); }

.navbtn.is-active {
  color: var(--accent);
  border-color: var(--border-strong);
  background: rgba(201, 31, 59, 0.08);
}

/* ---------- Booking CTA ---------- */
.book-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 14px var(--glow);
  transition: transform 0.18s, box-shadow 0.18s, background 0.18s;
}

.book-btn:hover {
  transform: translateY(-1px);
  background: #b21932;
  box-shadow: 0 6px 20px var(--glow);
}

.book-btn .dot--live { background: #fff; box-shadow: 0 0 8px rgba(255, 255, 255, 0.7); }

/* Google inserts its real button as a sibling AFTER #gcal-target (class
   .qxCTlb). Hide both; the injected button's click handler still fires on a
   programmatic .click() and appends its overlay to document.body. */
#gcal-target,
#gcal-target + button,
.qxCTlb { display: none !important; }

/* ---------- Dots ---------- */
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  display: inline-block;
}

.dot--live {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ---------- Stage / cube ---------- */
.stage {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 10;
  touch-action: none;
  cursor: grab;
}

.stage.is-dragging { cursor: grabbing; }

.stage.is-dragging,
.stage.is-dragging * {
  -webkit-user-select: none;
  user-select: none;
}

.scene {
  width: var(--cube-size);
  height: var(--cube-size);
  perspective: 1400px;
}

.cube {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transform: rotateX(-18deg) rotateY(24deg);
  will-change: transform;
  /* At exactly +/-90deg the edge-on cube div wins Chromium hit-testing and
     swallows clicks meant for the front face. Faces opt back in via
     .face.is-front { pointer-events: auto }. */
  pointer-events: none;
}

.cube.is-snapping { transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1); }

/* Resting mode (set by main.js once snapped on a face): render the front
   face flat so clicks/hover hit-test natively; --rest-scale matches the
   perspective projection so the swap is pixel-identical. */
.cube.is-resting {
  transform: none !important;
  transform-style: flat;
}
.cube.is-resting .face { display: none; }
.cube.is-resting .face.is-front {
  display: flex;
  transform: scale(var(--rest-scale, 1.25)) !important;
}

.face {
  position: absolute;
  inset: 0;
  display: flex;
  pointer-events: none;
  border: 1px solid var(--border-strong);
  background: var(--panel-solid);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.03),
    0 10px 30px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.face.is-front { pointer-events: auto; }

.face__inner {
  width: 100%;
  height: 100%;
  padding: clamp(16px, 4%, 30px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.face__inner::-webkit-scrollbar { width: 6px; }
.face__inner::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

.face__tag {
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--accent);
  text-transform: uppercase;
}

.face__title {
  font-size: clamp(20px, 5vw, 30px);
  margin: 2px 0 6px;
  font-weight: 600;
}

.face__body {
  color: var(--text);
  line-height: 1.55;
  font-size: clamp(13px, 2.6vw, 15px);
  margin: 0;
}

.face__body--muted { color: var(--muted); font-size: 12px; }

/* Cube face placement */
.face--home        { transform: translateZ(var(--half)); }
.face--services    { transform: rotateY(90deg) translateZ(var(--half)); }
.face--about       { transform: rotateX(-90deg) translateZ(var(--half)); }
.face--engagements { transform: rotateY(-90deg) translateZ(var(--half)); }
.face--approach    { transform: rotateX(90deg) translateZ(var(--half)); }
.face--contact     { transform: rotateY(180deg) translateZ(var(--half)); }

/* ---------- HOME face ---------- */
.hero__name {
  font-size: clamp(28px, 8vw, 48px);
  margin: 6px 0 0;
  line-height: 1.02;
  font-weight: 700;
  background: linear-gradient(120deg, var(--text), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero__role { color: var(--accent-2); font-size: 13px; margin: 4px 0 8px; }
.hero__lede { color: var(--text); line-height: 1.55; font-size: clamp(13px, 2.8vw, 15px); margin: 0; }
.hero__hint { color: var(--muted); font-size: 11px; margin-top: auto; }

.status-pill {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--accent);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 5px 12px;
}

/* ---------- Mini-screens (embedded device readouts) ---------- */
.screens {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.mini-screen {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
}

/* Scanline overlay shared by both screens */
.mini-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.06) 0px,
    rgba(0, 0, 0, 0.06) 1px,
    transparent 1px,
    transparent 3px
  );
  opacity: 0.5;
}

/* Oscilloscope */
.mini-screen--scope {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(237, 233, 225, 0.85));
}

.scope__canvas {
  display: block;
  width: 100%;
  height: 64px;
}

.scope__readouts {
  position: absolute;
  inset: auto 8px 6px 8px;
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--muted);
  z-index: 1;
}

.scope__readouts b { color: var(--accent); font-weight: 500; }

/* Terminal stream */
.mini-screen--term {
  background: #0c0e0d;
  border-color: rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
}

.term__bar {
  font-size: 9px;
  letter-spacing: 0.16em;
  color: rgba(120, 255, 170, 0.55);
  padding: 5px 8px 3px;
  border-bottom: 1px solid rgba(120, 255, 170, 0.14);
}

.term__stream {
  flex: 1;
  height: 64px;
  overflow: hidden;
  padding: 5px 8px 7px;
  font-size: 9px;
  line-height: 1.5;
  color: rgba(120, 255, 170, 0.85);
}

.term__line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.term__line--cmd { color: rgba(120, 255, 170, 0.95); }
.term__line--err { color: var(--accent); }
.term__line--dim { color: rgba(120, 255, 170, 0.45); }

/* ---------- Services ---------- */
.svc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.svc-list li {
  display: flex;
  gap: 12px;
  align-items: baseline;
  font-size: clamp(13px, 2.8vw, 15px);
  border-bottom: 1px dashed var(--border);
  padding-bottom: 8px;
}
.svc-list__k { color: var(--accent); font-size: 12px; }

/* ---------- About ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.chip {
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
}

/* ---------- Engagements ---------- */
.cards { display: flex; flex-direction: column; gap: 10px; }
.card {
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  border-radius: 8px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.55);
}
.card__k { color: var(--accent-2); font-size: 11px; letter-spacing: 0.1em; margin-bottom: 6px; }
.card__p, .card__o { margin: 2px 0; font-size: 13px; line-height: 1.45; }
.card__o { color: var(--muted); }
.card__o strong, .card__p strong { color: var(--text); font-weight: 600; }

.card--link {
  display: block;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.18s, transform 0.18s, background 0.18s;
  -webkit-user-select: text;
  user-select: text;
  -webkit-user-drag: none;
}
.card--link:hover {
  border-color: var(--border-strong);
  transform: translateX(4px);
  background: rgba(201, 31, 59, 0.06);
}
.card--link .card__cta-row {
  margin-top: 10px;
  padding: 9px 12px;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.7);
}
.card--link:hover .card__cta-row {
  border-color: var(--border-strong);
  background: rgba(201, 31, 59, 0.06);
}

/* ---------- Approach ---------- */
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.steps li { display: flex; gap: 10px; font-size: clamp(13px, 2.6vw, 14px); line-height: 1.45; }
.steps__n { color: var(--accent); }
.steps strong { font-weight: 600; }

/* ---------- Contact ---------- */
.links { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.link {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 14px;
  transition: border-color 0.18s, transform 0.18s, background 0.18s;
  -webkit-user-select: text;
  user-select: text;
  -webkit-user-drag: none;
}
.link:hover { border-color: var(--border-strong); transform: translateX(4px); background: rgba(201, 31, 59, 0.06); }
.link__icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: rgba(201, 31, 59, 0.12);
  color: var(--accent);
  font-size: 12px;
}

/* ---------- Under-cube nav ---------- */
.cube-nav {
  position: fixed;
  bottom: 52px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 25;
  pointer-events: none;
}

.cube-nav__arrow {
  pointer-events: auto;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  font-size: 22px;
  line-height: 1;
  color: var(--accent);
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.18s, transform 0.18s;
}

.cube-nav__arrow:hover { background: rgba(201, 31, 59, 0.10); transform: translateY(-1px); }
.cube-nav__arrow:active { transform: translateY(0); }

.cube-nav__label {
  min-width: 120px;
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--muted);
}

/* ---------- HUD ---------- */
.hud {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: linear-gradient(0deg, rgba(245, 243, 239, 0.9), transparent);
  z-index: 30;
  pointer-events: none;
}
.hud b { color: var(--accent); font-weight: 500; }
.hud__sep { opacity: 0.4; }
.hud__item { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  :root { --cube-size: min(88vw, 56vh, 460px); }
  .topbar { flex-direction: column; align-items: flex-start; gap: 8px; }
  .topbar__nav { width: 100%; }
  .book-btn { width: auto; justify-content: center; }
  .cube-nav { bottom: 64px; }
  .screens { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .cube.is-snapping { transition: transform 0.2s linear; }
  .dot--live { animation: none; }
}
