:root {
  --ink: #191916;
  --paper: #f4efe3;
  --paper-bright: #fffaf0;
  --yellow: #f3d84d;
  --orange: #e76f3c;
  --rule: rgba(25, 25, 22, 0.22);
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  min-width: 320px;
  height: 100%;
  margin: 0;
  overflow-x: hidden;
  overflow-y: auto;
  background: #17130f;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, a { font: inherit; }
button { color: inherit; }

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

.portfolio-shell {
  position: relative;
  width: 100%;
  min-height: 100dvh;
}

.scene-frame {
  position: relative;
  width: 100%;
  height: calc(100vw * 0.75);
  min-height: 100dvh;
  overflow: hidden;
  background: #17130f;
  isolation: isolate;
}

.scene-frame::after {
  position: absolute;
  z-index: 7;
  inset: 0;
  background: linear-gradient(180deg, rgba(9, 7, 5, 0.32), transparent 19%, transparent 73%, rgba(9, 7, 5, 0.36)), radial-gradient(circle at center, transparent 55%, rgba(6, 5, 4, 0.22));
  content: "";
  pointer-events: none;
}

.scene-camera {
  position: absolute;
  z-index: 1;
  top: 0;
  left: 0;
  width: 100vw;
  aspect-ratio: 4 / 3;
  overflow: visible;
  transform: scale(1);
  transform-origin: var(--origin-x, 50%) var(--origin-y, 50%);
  transition: transform 650ms cubic-bezier(0.16, 1, 0.3, 1), filter 400ms ease;
  animation: scene-enter 900ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.scene-camera > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
}

.scene-image--wave {
  position: absolute;
  z-index: 2;
  inset: 0;
  clip-path: polygon(24% 10%, 69% 10%, 69% 76%, 24% 76%);
  opacity: 0;
  pointer-events: none;
}

.scene-image--wave-2 { z-index: 3; }
.scene-image--phone-buzz {
  position: absolute;
  z-index: 4;
  inset: 0;
  clip-path: polygon(11.2% 77%, 19.7% 77%, 20.2% 85.7%, 11.3% 85.8%);
  opacity: 0;
  pointer-events: none;
  transform-origin: 15.7% 81.5%;
}

.scene-frame.is-waving .scene-image--wave-1 { animation: character-wave-one 1.7s ease-in-out both; }
.scene-frame.is-waving .scene-image--wave-2 { animation: character-wave-two 1.7s ease-in-out both; }
.scene-frame.is-phone-buzzing .scene-image--phone-buzz { opacity: 0.88; animation: phone-buzz 820ms ease-in-out infinite; }

.scene-frame.is-focusing .scene-camera { transform: scale(1.42); }
.scene-frame.is-handing-off .scene-camera { filter: saturate(0.72) brightness(0.62); transform: scale(1.27); }

.hotspot {
  position: absolute;
  z-index: 5;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}

.hotspot::before {
  position: absolute;
  inset: 0;
  border: 2px solid rgba(255, 250, 240, 0.96);
  border-radius: inherit;
  background: rgba(243, 216, 77, 0.1);
  box-shadow: 0 0 0 1px rgba(25, 25, 22, 0.55), 0 0 22px rgba(243, 216, 77, 0.66);
  content: "";
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 180ms ease, transform 180ms ease;
}

.hotspot::after {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 2px 2px 0 var(--ink);
  content: "+";
  font-size: 15px;
  font-weight: 900;
  opacity: 0.95;
  transition: transform 180ms ease;
}

.hotspot:hover::before, .hotspot:focus-visible::before, .hotspot.is-pulsing::before { opacity: 1; transform: scale(1); }
.hotspot:hover::after, .hotspot:focus-visible::after { transform: rotate(90deg) scale(1.08); }
.hotspot:focus-visible { outline: 3px solid white; outline-offset: 3px; }
.hotspot--external::after { content: "↗"; }
.hotspot--external:hover::after, .hotspot--external:focus-visible::after { transform: translate(1px, -1px) scale(1.08); }

.hotspot-label {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 7px 11px;
  background: var(--paper-bright);
  box-shadow: 2px 2px 0 var(--ink);
  font-size: 10px;
  font-weight: 850;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 6px);
  transition: opacity 180ms ease, transform 180ms ease;
  white-space: nowrap;
}

.hotspot:hover .hotspot-label, .hotspot:focus-visible .hotspot-label { opacity: 1; transform: translate(-50%, 0); }

.hotspot--degree { left: 2.5%; top: 17.8%; width: 19%; height: 17%; }
.hotspot--globe { left: 3.8%; top: 36%; width: 7.5%; height: 10.8%; border-radius: 50%; }
.hotspot--phone { left: 11.3%; top: 76.8%; width: 9%; height: 9.8%; border-radius: 18px; transform: rotate(2deg); }
.hotspot--john-mayer { left: 37.2%; top: 55%; width: 14.8%; height: 17%; border-radius: 38% 42% 36% 34%; transform: rotate(-3deg); }
.hotspot--github { left: 63.5%; top: 14.2%; width: 7.1%; height: 10.5%; }
.hotspot--x { left: 70.8%; top: 14%; width: 7.1%; height: 10.5%; }
.hotspot--linkedin { left: 78.4%; top: 13.7%; width: 7%; height: 10.6%; }
.hotspot--mug { left: 0.5%; top: 57.2%; width: 13.2%; height: 26.2%; }
.hotspot--person { left: 39%; top: 13%; width: 28%; height: 42%; border-radius: 42% 42% 25% 25%; }
.hotspot--contact { left: 19.5%; top: 73.2%; width: 18.5%; height: 22.8%; transform: rotate(-1.5deg); }
.hotspot--resume { left: 73%; top: 75.3%; width: 26%; height: 20.5%; }
.notebook-message {
  position: absolute;
  inset: 17% 9% 17% 18%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #25231f;
  font-family: "Bradley Hand", "Segoe Print", "Comic Sans MS", cursive;
  font-size: clamp(10px, 1.55vw, 25px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.02;
  pointer-events: none;
  text-align: center;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
  transform: rotate(-1deg);
}
.hotspot--person,
.hotspot--person:hover,
.hotspot--person:focus,
.hotspot--person:focus-visible {
  border: 0 !important;
  outline: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.hotspot--person::before,
.hotspot--person::after {
  display: none !important;
  border: 0 !important;
  outline: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  content: none !important;
}

.phone-vibration {
  position: absolute;
  top: 28%;
  width: 9px;
  height: 44%;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}

.phone-screen-flash {
  position: absolute;
  z-index: 1;
  inset: 9% 11% 12%;
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.92), 0 0 26px rgba(255, 250, 240, 0.7);
  opacity: 0;
  pointer-events: none;
}

.phone-vibration--left { left: -13px; border-left: 2px solid var(--paper-bright); box-shadow: -4px 0 0 -2px var(--yellow); }
.phone-vibration--right { right: -13px; border-right: 2px solid var(--paper-bright); box-shadow: 4px 0 0 -2px var(--yellow); }
.scene-frame.is-phone-buzzing .phone-vibration { animation: vibration-lines 820ms ease-in-out infinite; }
.scene-frame.is-phone-buzzing .phone-screen-flash { animation: phone-screen-flash 820ms ease-in-out infinite; }

.speech-bubble {
  position: absolute;
  z-index: 7;
  top: 7%;
  left: 48%;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 2px solid var(--ink);
  border-radius: 18px 18px 18px 4px;
  padding: 9px 12px;
  background: var(--paper-bright);
  box-shadow: 4px 4px 0 var(--ink);
  font-family: Georgia, serif;
  font-size: 14px;
  font-style: italic;
  opacity: 0;
  transform: translateY(10px) rotate(-3deg) scale(0.9);
  transition: opacity 220ms ease, transform 450ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.scene-frame.is-greeting .speech-bubble { opacity: 1; transform: translateY(0) rotate(-3deg) scale(1); }
.scene-frame.is-greeting .wave { display: inline-block; transform-origin: 70% 70%; animation: wave 900ms ease-in-out 2; }

.handoff-paper {
  position: fixed;
  z-index: 20;
  right: 9%;
  bottom: 3%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  width: min(270px, 25vw);
  aspect-ratio: 0.77;
  border: 1.5px solid var(--ink);
  padding: 18px;
  background: linear-gradient(rgba(25, 25, 22, 0.08) 1px, transparent 1px), var(--paper-bright);
  background-size: 100% 16px;
  box-shadow: 6px 7px 0 rgba(25, 25, 22, 0.7);
  font-family: Georgia, serif;
  opacity: 0;
  pointer-events: none;
  transform: rotate(-8deg) scale(0.7);
}

.handoff-paper strong { font-size: clamp(18px, 2vw, 28px); }
.scene-frame.is-handing-off .handoff-paper { animation: handoff 700ms cubic-bezier(0.16, 1, 0.3, 1) both; }

.object-dock {
  position: fixed;
  z-index: 30;
  bottom: 20px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(25, 25, 22, 0.8);
  border-radius: 999px;
  padding: 5px;
  background: rgba(255, 250, 240, 0.88);
  box-shadow: 4px 5px 0 rgba(25, 25, 22, 0.8);
  backdrop-filter: blur(12px);
  transform: translateX(-50%);
  animation: dock-enter 650ms 350ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.dock-label { padding: 0 12px; color: rgba(25, 25, 22, 0.55); font-size: 9px; font-weight: 850; letter-spacing: 0.14em; text-transform: uppercase; }
.object-dock button { border: 0; border-radius: 999px; padding: 9px 13px; background: transparent; font-size: 10px; font-weight: 800; cursor: pointer; transition: background 180ms ease, transform 180ms ease; }
.object-dock button:hover, .object-dock button:focus-visible { background: var(--yellow); outline: 0; transform: translateY(-1px); }

.panel-backdrop { position: fixed; z-index: 90; inset: 0; background: rgba(14, 14, 12, 0.62); backdrop-filter: blur(8px); opacity: 0; transition: opacity 240ms ease; }
.panel-backdrop.is-visible { opacity: 1; }

.detail-panel {
  position: fixed;
  z-index: 100;
  inset: 50% auto auto 50%;
  width: min(680px, calc(100% - 32px));
  max-height: min(820px, calc(100dvh - 32px));
  margin: 0;
  overflow: auto;
  border: 2px solid var(--ink);
  border-radius: 4px;
  padding: clamp(28px, 5vw, 52px);
  background: var(--paper-bright);
  box-shadow: 11px 11px 0 var(--yellow), 0 30px 100px rgba(0, 0, 0, 0.34);
  opacity: 0;
  transform: translate(-50%, -45%) scale(0.94) rotate(1deg);
  transition: opacity 260ms ease, transform 420ms cubic-bezier(0.16, 1, 0.3, 1);
}

.detail-panel[open] { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0); }
.detail-panel::backdrop { background: transparent; }

.panel-close {
  position: absolute;
  top: 15px;
  right: 15px;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: transparent;
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease;
}

.panel-close:hover { background: var(--yellow); transform: rotate(7deg); }
.panel-kicker { margin: 0 0 16px; color: var(--orange); font-size: 10px; font-weight: 850; letter-spacing: 0.17em; text-transform: uppercase; }
.panel-content h2 { margin: 0 0 12px; max-width: 90%; font-family: Georgia, serif; font-size: clamp(40px, 7vw, 66px); font-weight: 500; letter-spacing: -0.06em; line-height: 0.98; }
.panel-content > p { margin: 0; color: rgba(25, 25, 22, 0.72); line-height: 1.65; }

.resume-preview { display: block; width: 100%; margin-top: 26px; border: 1px solid var(--ink); background: white; box-shadow: 5px 6px 0 rgba(25, 25, 22, 0.13); }
.diploma-link { display: block; margin-top: 26px; color: inherit; text-decoration: none; }
.diploma-preview { display: block; width: 100%; border: 1px solid var(--ink); background: #f7f4df; box-shadow: 5px 6px 0 rgba(25, 25, 22, 0.13); transition: box-shadow 180ms ease, transform 180ms ease; }
.diploma-link > span { display: flex; justify-content: space-between; margin-top: 8px; font-size: 10px; font-weight: 850; letter-spacing: 0.08em; text-transform: uppercase; }
.diploma-link:hover .diploma-preview { box-shadow: 8px 9px 0 var(--yellow); transform: translate(-2px, -2px); }
.diploma-link:focus-visible { outline: 3px solid var(--yellow); outline-offset: 5px; }
.panel-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.panel-cta { display: flex; align-items: center; justify-content: space-between; border: 1.5px solid var(--ink); padding: 13px 15px; background: var(--yellow); color: inherit; font-size: 12px; font-weight: 850; text-decoration: none; transition: transform 180ms ease, box-shadow 180ms ease; }
.panel-cta:hover { box-shadow: 4px 4px 0 var(--ink); transform: translate(-2px, -2px); }
.panel-cta--secondary { background: transparent; }

.fact-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 26px; }
.fact { border: 1px solid var(--ink); padding: 14px; background: var(--paper); }
.fact strong, .fact span { display: block; }
.fact strong { font-family: Georgia, serif; font-size: 24px; }
.fact span { margin-top: 2px; color: rgba(25, 25, 22, 0.65); font-size: 10px; font-weight: 750; text-transform: uppercase; }

.social-card { display: flex; align-items: center; gap: 18px; margin-top: 26px; border: 1px solid var(--ink); padding: 18px; background: var(--paper); }
.social-card-icon { display: grid; flex: 0 0 auto; width: 58px; height: 58px; place-items: center; border: 1px solid var(--ink); background: var(--yellow); font-size: 20px; font-weight: 900; }
.social-card p, .social-card strong { margin: 0; }
.social-card p { margin-top: 4px; color: rgba(25, 25, 22, 0.66); font-size: 13px; line-height: 1.45; }

.contact-form { display: grid; gap: 16px; margin-top: 26px; }
.contact-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.contact-field { display: grid; gap: 7px; }
.contact-field > span { font-size: 10px; font-weight: 850; letter-spacing: 0.12em; text-transform: uppercase; }
.contact-field input, .contact-field textarea {
  width: 100%;
  border: 1.5px solid var(--ink);
  border-radius: 0;
  padding: 13px 14px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  outline: 0;
  transition: background 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}
.contact-field textarea { min-height: 130px; resize: vertical; }
.contact-field input::placeholder, .contact-field textarea::placeholder { color: rgba(25, 25, 22, 0.42); }
.contact-field input:focus, .contact-field textarea:focus { background: var(--paper-bright); box-shadow: 3px 3px 0 var(--yellow); transform: translate(-1px, -1px); }
.contact-submit { width: 100%; cursor: pointer; }
.contact-note { margin: -6px 0 0; color: rgba(25, 25, 22, 0.56); font-size: 10px; line-height: 1.5; }

.project-video-shell {
  width: min(330px, 100%);
  margin: 26px auto 0;
  overflow: hidden;
  border: 1.5px solid var(--ink);
  border-radius: 24px;
  background: #050505;
  box-shadow: 6px 7px 0 rgba(25, 25, 22, 0.16);
}

.project-video {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  background: #050505;
}

.project-caption { margin: 13px 0 0; color: rgba(25, 25, 22, 0.55); font-size: 10px; line-height: 1.5; text-align: center; }
.panel-actions--single { grid-template-columns: 1fr; }

.travel-map {
  position: relative;
  margin-top: 26px;
  overflow: hidden;
  border: 1.5px solid var(--ink);
  background: #dce9e5;
  box-shadow: 6px 7px 0 rgba(25, 25, 22, 0.14);
}

.travel-map > object {
  display: block;
  width: 100%;
  aspect-ratio: 2048 / 1039;
  opacity: 0.92;
}

.map-legend {
  position: absolute;
  right: 10px;
  bottom: 10px;
  border: 1px solid var(--ink);
  padding: 6px 8px;
  background: rgba(255, 250, 240, 0.9);
  font-size: 9px;
  font-weight: 800;
}

.map-legend::before {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 5px;
  border: 1px solid var(--ink);
  background: var(--yellow);
  content: "";
}

.country-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.country-list li {
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 7px 10px;
  background: var(--paper);
  font-size: 10px;
  font-weight: 800;
}

@keyframes scene-enter { from { opacity: 0; transform: scale(1.025); } to { opacity: 1; transform: scale(1); } }
@keyframes dock-enter { from { opacity: 0; transform: translate(-50%, 18px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes wave { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(22deg); } 50% { transform: rotate(-10deg); } 75% { transform: rotate(18deg); } }
@keyframes character-wave-one { 0%, 7%, 100% { opacity: 0; } 15%, 32% { opacity: 1; } 42%, 54% { opacity: 0; } 64%, 78% { opacity: 1; } 88% { opacity: 0; } }
@keyframes character-wave-two { 0%, 32%, 100% { opacity: 0; } 42%, 54% { opacity: 1; } 64%, 78% { opacity: 0; } 88%, 93% { opacity: 1; } }
@keyframes phone-buzz {
  0%, 42%, 100% { transform: translate(0, 0) rotate(0); }
  6% { transform: translate(-0.12%, 0) rotate(-0.08deg); }
  12% { transform: translate(0.12%, -0.05%) rotate(0.08deg); }
  18% { transform: translate(-0.1%, 0.05%) rotate(-0.07deg); }
  24% { transform: translate(0.1%, 0) rotate(0.07deg); }
  30% { transform: translate(-0.07%, -0.04%) rotate(-0.05deg); }
  36% { transform: translate(0.06%, 0.03%) rotate(0.04deg); }
}
@keyframes vibration-lines { 0%, 42%, 100% { opacity: 0; transform: scaleY(0.7); } 8%, 34% { opacity: 0.95; transform: scaleY(1); } }
@keyframes phone-screen-flash { 0%, 5%, 42%, 100% { opacity: 0; } 9%, 34% { opacity: 0.98; } }
@keyframes handoff { 0% { opacity: 0; transform: translate(0, 0) rotate(-8deg) scale(0.7); } 100% { opacity: 1; transform: translate(-35vw, -25vh) rotate(1deg) scale(1.15); } }

@media (prefers-reduced-motion: reduce) {
  .scene-frame.is-phone-buzzing .scene-image--phone-buzz { animation: none; opacity: 0.2; }
  .scene-frame.is-phone-buzzing .phone-vibration { animation: none; opacity: 0.85; }
  .scene-frame.is-phone-buzzing .phone-screen-flash { animation: none; opacity: 0.98; }
}

@media (max-width: 720px) {
  html, body { height: auto; }
  .portfolio-shell { min-height: 100svh; }
  .scene-frame { height: 100vh; height: 100svh; min-height: calc(75vw + 74px); }
  .scene-frame::before {
    position: absolute;
    z-index: 0;
    inset: 75vw 0 0;
    background: linear-gradient(180deg, #714327 0, #3f281d 24%, #17130f 78%);
    content: "";
  }
  .hotspot-label, .dock-label { display: none; }
  .hotspot::after { top: 3px; right: 3px; width: 18px; height: 18px; font-size: 12px; }
  .object-dock { position: absolute; top: calc(75vw + 12px); bottom: auto; max-width: calc(100% - 24px); }
  .object-dock button { padding: 9px 10px; }
  .detail-panel { padding: 36px 23px 26px; }
  .panel-actions, .fact-grid, .contact-form-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
