:root {
  --bg-0: #03060c;
  --bg-1: #0f2147;
  --text: #eef4ff;
  --muted: #bfd0f2;
  --accent: #77a8ff;
  --accent-2: #5ad8ff;
  --glass: rgba(25, 38, 65, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 50% 0%, #24559a 0%, var(--bg-1) 36%, var(--bg-0) 100%);
}

#app {
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  padding: 0;
  position: relative;
  overflow: hidden;
}

@supports (padding: max(0px)) {
  #app {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

.top-bar {
  position: absolute;
  inset: 1rem 1.2rem auto 1.2rem;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.name-block {
  display: block;
}

.top-bar h1 {
  margin: 0;
  font-size: clamp(1.7rem, 3.2vw, 2.35rem);
  letter-spacing: 0.01em;
  font-weight: 800;
  text-shadow: 0 0 24px rgba(99, 154, 255, 0.26);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.45rem;
}

.name-role-inline {
  color: #c6d7fb;
  font-size: clamp(0.86rem, 1.25vw, 1.03rem);
  font-weight: 600;
  letter-spacing: 0.01em;
  text-shadow: none;
}

.top-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.top-links a {
  text-decoration: none;
  color: var(--text);
  opacity: 0.9;
  font-size: 0.93rem;
  font-weight: 600;
  transition: color 0.2s ease, transform 0.2s ease, text-shadow 0.2s ease;
}

.top-links a:hover,
.top-links a:focus-visible {
  color: #cde5ff;
  transform: translateY(-1px);
  text-shadow: 0 0 14px rgba(120, 181, 255, 0.45);
}

main {
  height: 100%;
  min-height: 100%;
  overflow: hidden;
}

.scene-wrap {
  position: relative;
  height: 100%;
  min-height: 100%;
  border-radius: 0;
  overflow: hidden;
  background: radial-gradient(circle at 50% 0%, #1f4f93 0%, #0a1630 54%, #03070f 100%);
  touch-action: manipulation;
}

.scene-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 15%, rgba(133, 196, 255, 0.35), transparent 50%),
    radial-gradient(circle at 0% 0%, rgba(108, 175, 255, 0.25), transparent 44%),
    radial-gradient(circle at 100% 0%, rgba(110, 218, 255, 0.22), transparent 38%);
  z-index: 1;
}

.scene-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 -120px 180px rgba(3, 7, 14, 0.62), inset 0 0 90px rgba(3, 8, 18, 0.3);
  z-index: 1;
}

#scene {
  width: 100%;
  height: 100%;
  display: block;
  position: relative;
  z-index: 0;
}

.scene-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(3, 5, 10, 0.75);
  color: var(--muted);
  text-align: center;
  z-index: 15;
}

.scene-overlay[hidden] {
  display: none !important;
}

.scene-status {
  position: absolute;
  top: 4.7rem;
  right: 1rem;
  color: var(--muted);
  font-size: 0.8rem;
  background: rgba(14, 23, 41, 0.52);
  backdrop-filter: blur(8px);
  border-radius: 999px;
  padding: 0.32rem 0.55rem;
  z-index: 12;
}

.orientation-hint {
  display: none; /* shown only on mobile portrait */
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(3, 6, 12, 0.96);
  color: var(--text);
  font-size: 1.1rem;
  text-align: center;
  padding: 2rem;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.hover-label {
  position: absolute;
  transform: translate(-50%, -120%);
  background: rgba(4, 8, 16, 0.88);
  color: #eff6ff;
  border: 1px solid rgba(122, 166, 255, 0.5);
  border-radius: 8px;
  font-size: 0.74rem;
  padding: 0.3rem 0.5rem;
  white-space: nowrap;
  pointer-events: none;
  z-index: 14;
}

.hover-label[hidden] {
  display: none !important;
}

.engagement-instructions {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  max-width: 22rem;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
  background: rgba(14, 23, 41, 0.5);
  border: 1px solid rgba(122, 166, 255, 0.18);
  border-radius: 10px;
  backdrop-filter: blur(8px);
  z-index: 12;
  overflow: hidden;
}

.engagement-instructions-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: color 0.2s ease, background 0.2s ease;
}

.engagement-instructions-trigger:hover,
.engagement-instructions-trigger:focus-visible {
  background: rgba(122, 166, 255, 0.12);
  color: #cde5ff;
  outline: none;
}

.engagement-instructions-chevron {
  font-size: 0.6rem;
  opacity: 0.9;
  transition: transform 0.2s ease;
}

.engagement-instructions.is-expanded .engagement-instructions-chevron {
  transform: rotate(180deg);
}

.engagement-instructions-content {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.25s ease, opacity 0.2s ease, padding 0.2s ease;
  padding: 0 0.85rem;
}

.engagement-instructions-content .engagement-instructions-list {
  padding: 0 0 0.6rem;
  margin: 0.4rem 0 0;
  border-top: 1px solid rgba(122, 166, 255, 0.15);
}

.engagement-instructions:hover .engagement-instructions-content,
.engagement-instructions.is-expanded .engagement-instructions-content {
  max-height: 12rem;
  opacity: 1;
  padding: 0 0.85rem;
}

.engagement-instructions-list {
  margin: 0;
  padding-left: 1.1rem;
}

.engagement-instructions-list li {
  margin-bottom: 0.25rem;
}

.engagement-instructions-list li:last-child {
  margin-bottom: 0;
}

.engagement-instructions-list strong {
  color: #c6d7fb;
  font-weight: 600;
}

.quick-nav {
  position: absolute;
  left: 1rem;
  top: 4.7rem;
  display: flex;
  gap: 0.36rem;
  flex-wrap: wrap;
  z-index: 12;
}

.quick-nav button {
  border: 0;
  background: rgba(14, 23, 41, 0.42);
  color: #d8e5ff;
  border-radius: 999px;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.32rem 0.52rem;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.quick-nav button:hover,
.quick-nav button:focus-visible,
.quick-nav button[aria-pressed="true"] {
  background: rgba(70, 120, 208, 0.72);
  color: #f1f7ff;
  transform: translateY(-1px);
}

.detail-panel {
  position: absolute;
  top: 9rem;
  right: 1.15rem;
  width: min(32rem, 46vw);
  max-height: calc(100vh - 7.5rem);
  max-height: calc(100dvh - 7.5rem);
  overflow: auto;
  z-index: 22;
  border-radius: 16px;
  background: linear-gradient(155deg, rgba(18, 31, 55, 0.72), rgba(8, 14, 27, 0.66));
  border: 1px solid rgba(176, 206, 255, 0.24);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(196, 223, 255, 0.26);
  backdrop-filter: blur(16px) saturate(135%);
  -webkit-backdrop-filter: blur(16px) saturate(135%);
  padding: 1rem;
  transform: translateX(0);
  opacity: 1;
  transition: transform 0.28s ease, opacity 0.28s ease;
}

.detail-panel.is-hidden {
  transform: translateX(106%);
  opacity: 0;
  pointer-events: none;
}

.panel-close {
  border: 0;
  background: rgba(18, 30, 54, 0.75);
  color: #eef4ff;
  border-radius: 999px;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.28rem 0.58rem;
  cursor: pointer;
}

.panel-close.panel-back-arrow {
  font-size: 1.1rem;
  padding: 0.3rem 0.5rem;
  line-height: 1;
}

#panel-title {
  margin: 0.4rem 0 0.2rem;
  font-size: 1.25rem;
}

#panel-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

#panel-content {
  margin-top: 0.55rem;
  font-size: 0.88rem;
  line-height: 1.5;
}

#panel-content ul {
  margin: 0.4rem 0 0.7rem;
  padding-left: 1.08rem;
}

#panel-content li {
  margin-bottom: 0.32rem;
}

.panel-overview-grid {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.panel-overview-card {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid rgba(176, 206, 255, 0.22);
  border-radius: 10px;
  background: rgba(18, 27, 50, 0.4);
  padding: 0.5rem 0.6rem;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.panel-overview-card:hover,
.panel-overview-card:focus-within {
  background: rgba(30, 48, 85, 0.6);
  border-color: rgba(176, 206, 255, 0.4);
}

.panel-overview-card-inner {
  flex: 1;
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
  padding: 0.1rem 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.panel-card-github {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  opacity: 0.85;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.panel-card-github:hover {
  color: var(--text);
  opacity: 1;
}

.panel-card-github img {
  display: block;
  filter: brightness(0) invert(1);
}

.panel-card-vercel {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  opacity: 0.85;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.panel-card-vercel:hover {
  color: var(--text);
  opacity: 1;
}

.panel-card-vercel img {
  display: block;
  filter: brightness(0) invert(1);
}

.panel-overview-title {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
}

.panel-overview-subtitle {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 0.15rem;
}

.panel-overview-daterange {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.panel-detail-content {
  margin-top: 0.25rem;
}

.panel-detail-tech {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.panel-detail-tech-label {
  font-size: 0.8em;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.85;
  margin-right: 0.15rem;
}

.panel-detail-tech-pill {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  font-size: 0.82em;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  white-space: nowrap;
}

.panel-detail-content ul {
  margin: 0.4rem 0 0.7rem;
  padding-left: 1.08rem;
}

.panel-detail-content li {
  margin-bottom: 0.32rem;
}

.panel-detail-content .panel-detail-note {
  font-size: 0.9em;
  opacity: 0.9;
  font-weight: normal;
}

.panel-detail-github {
  margin: 0 0 0.6rem;
}

.panel-detail-github-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.panel-detail-github-link:hover,
.panel-detail-github-link:focus-visible {
  color: var(--accent-2);
  opacity: 1;
}

.panel-detail-github-link img,
.panel-detail-vercel-link img {
  display: block;
  filter: brightness(0) invert(1);
  opacity: 0.95;
}

/* Space between the two links only when both present (e.g. Fantasy Basketball) */
.panel-detail-vercel-link + .panel-detail-github-link {
  margin-left: 0.75rem;
}

.panel-detail-vercel-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.panel-detail-vercel-link:hover,
.panel-detail-vercel-link:focus-visible {
  color: var(--accent-2);
  opacity: 1;
}

.panel-skills {
  margin-top: 0.35rem;
}

.panel-skills-group {
  margin-bottom: 0.85rem;
}

.panel-skills-group:last-child {
  margin-bottom: 0;
}

.panel-skills-group-title {
  margin: 0 0 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.panel-skills-logos {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.6rem;
  align-items: center;
}

.panel-skill-item {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  min-width: 2.5rem;
}

.panel-skill-logo {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex-shrink: 0;
}

.panel-skill-label {
  font-size: 0.62rem;
  color: var(--muted);
  max-width: 4rem;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.46rem;
  margin: 0.6rem 0 0.8rem;
}

.metric-tile {
  background: rgba(18, 27, 50, 0.54);
  border-radius: 10px;
  padding: 0.48rem;
}

.metric-tile strong {
  display: block;
  font-size: 0.98rem;
}

.metric-tile span {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.74rem;
}

.badge {
  display: inline-flex;
  border-radius: 999px;
  background: rgba(21, 35, 66, 0.72);
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  margin-right: 0.34rem;
  margin-bottom: 0.34rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sr-only-focusable {
  position: absolute;
  left: -9999px;
}

.sr-only-focusable:focus {
  left: 1rem;
  top: 1rem;
  z-index: 50;
  background: #dce9ff;
  color: #041029;
  border-radius: 8px;
  text-decoration: none;
  padding: 0.42rem 0.6rem;
  font-weight: 700;
}

/* Portrait on mobile: block the site, require landscape */
@media (max-width: 900px) and (orientation: portrait) {
  .orientation-hint {
    display: flex;
  }
}

/* Mobile landscape: small screen in landscape orientation */
@media (max-height: 500px) {
  html, body {
    overflow: hidden;
  }

  #app, main, .scene-wrap {
    overflow: hidden;
  }

  .top-bar {
    inset: 0.5rem 0.8rem auto 0.8rem;
    gap: 0.4rem;
  }

  .top-bar h1 {
    font-size: 1.1rem;
  }

  .name-role-inline {
    font-size: 0.7rem;
  }

  .top-links a {
    font-size: 0.75rem;
  }

  .quick-nav {
    top: 2.8rem;
    left: 0.8rem;
  }

  .quick-nav button {
    font-size: 0.62rem;
    padding: 0.22rem 0.42rem;
  }

  .scene-status {
    top: 2.8rem;
    font-size: 0.68rem;
    padding: 0.22rem 0.45rem;
  }

  .detail-panel {
    top: 0.5rem;
    right: 0.5rem;
    width: min(28rem, 42vw);
    max-height: calc(100vh - 1rem);
    max-height: calc(100dvh - 1rem);
    padding: 0.6rem;
    font-size: 0.82rem;
    border-radius: 12px;
  }

  #panel-title {
    font-size: 1rem;
    margin: 0.2rem 0 0.1rem;
  }

  #panel-subtitle {
    font-size: 0.72rem;
  }

  #panel-content {
    margin-top: 0.35rem;
    font-size: 0.78rem;
  }

  .panel-overview-title {
    font-size: 0.82rem;
  }

  .panel-overview-subtitle {
    font-size: 0.7rem;
  }

  .panel-overview-card {
    padding: 0.35rem 0.45rem;
  }

  .engagement-instructions {
    display: none;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }
}
