:root {
  --ink: #f2f0e9;
  --paper: #0d0f0e;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  overflow: hidden;
}
button, a { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; }

.portal {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: minmax(250px, 40%) 1fr;
  overflow: hidden;
  background:
    radial-gradient(circle at 75% -20%, rgba(118, 169, 87, .17), transparent 38%),
    radial-gradient(circle at 4% 20%, rgba(170, 72, 42, .12), transparent 32%),
    var(--paper);
}

.profile {
  min-height: 0;
  padding: 22px 7vw;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(25px, 4vw, 58px);
  text-align: left;
}
.animatedLogo {
  flex: 0 0 auto;
  width: clamp(104px, 12vw, 152px);
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  background: #050505;
  box-shadow: 0 15px 52px rgba(0, 0, 0, .42);
  position: relative;
}
.animatedLogo::after { content: ""; position: absolute; inset: 0; border: 1px solid rgba(91,54,34,.2); border-radius: inherit; pointer-events: none; }
.animatedLogo video { width: 100%; height: 100%; object-fit: cover; object-position: 50% 50%; display: block; }
.profileCopy { max-width: 660px; }
.eyebrow { margin: 0 0 10px; text-transform: uppercase; font-size: 9px; font-weight: 700; letter-spacing: .25em; color: #9a9f97; }
.profile h1 { margin: 0; font-size: clamp(45px, 6.2vw, 82px); line-height: .92; letter-spacing: -.06em; font-weight: 650; }
.intro { margin: 15px 0 0; font-size: clamp(13px, 1.5vw, 17px); line-height: 1.5; color: #b7bbb3; }

.worlds {
  min-height: 0;
  width: 100%;
  display: flex;
  gap: 2px;
  background: #171a18;
  overflow: hidden;
}
.world {
  min-width: 0;
  flex: 1 1 50%;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  color: #f5f6f0;
  background-size: cover;
  background-repeat: no-repeat;
  transition: flex-basis .6s cubic-bezier(.22,.8,.28,1), opacity .35s ease;
}
.world::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(180deg, rgba(4,8,6,.05) 0%, rgba(4,10,8,.18) 45%, rgba(3,9,6,.88) 100%);
  transition: background .45s ease;
}
.world::after { content: ""; position: absolute; z-index: 4; inset: 0; border: 1px solid rgba(255,255,255,.11); pointer-events: none; }
.chameleon { background-color: #16311f; background-image: url("assets/chameleon-texture.webp"); background-position: 50% 48%; }
.tech { background-color: #102330; background-image: url("assets/atelier-tech.webp"); background-position: 11% 50%; }
.tech::before { background: linear-gradient(180deg, rgba(3,10,16,.02) 0%, rgba(3,10,16,.19) 44%, rgba(3,9,14,.91) 100%); }

.worldOpen {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  padding: clamp(22px, 3vw, 44px);
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}
.worldOpen:focus-visible { outline: 3px solid #fff; outline-offset: -7px; }
.worldOpen:disabled { cursor: default; opacity: 1; }
.worldIndex {
  position: absolute;
  top: clamp(20px, 2.5vw, 34px);
  right: clamp(20px, 2.5vw, 34px);
  width: 39px;
  height: 39px;
  border: 1px solid rgba(255,255,255,.36);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 9px;
  letter-spacing: .08em;
}
.worldHeading { position: absolute; left: clamp(22px, 3vw, 44px); right: clamp(22px, 3vw, 44px); bottom: clamp(22px, 3vw, 40px); display: block; }
.worldType { display: block; margin-bottom: 10px; font-size: 9px; text-transform: uppercase; letter-spacing: .2em; opacity: .72; }
.worldHeading strong { display: block; max-width: 590px; font-size: clamp(34px, 4.5vw, 64px); line-height: .9; letter-spacing: -.055em; font-weight: 600; text-shadow: 0 2px 25px rgba(0,0,0,.18); }
.openHint { display: inline-flex; align-items: center; gap: 9px; margin-top: 18px; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .17em; opacity: .8; }
.openHint span { width: 22px; height: 22px; border: 1px solid rgba(255,255,255,.4); border-radius: 50%; display: grid; place-items: center; font-size: 14px; line-height: 1; }

.worldExpanded {
  position: absolute;
  z-index: 3;
  left: clamp(22px, 3vw, 44px);
  bottom: clamp(25px, 3vw, 42px);
  width: min(500px, calc(100% - 90px));
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: opacity .3s ease .08s, transform .4s ease .08s;
}
.worldExpanded p { margin: 0 0 18px; max-width: 430px; font-size: 14px; line-height: 1.55; color: rgba(255,255,255,.82); }
.worldLinks { display: flex; flex-wrap: wrap; gap: 8px; }
.worldExpanded .networkCard { min-width: 205px; display: grid; grid-template-columns: 24px 1fr 18px; align-items: center; gap: 10px; padding: 11px 13px; border: 1px solid rgba(255,255,255,.32); border-radius: 14px; background: rgba(5,10,8,.2); backdrop-filter: blur(9px); transition: background .2s ease, border-color .2s ease; }
.worldExpanded .networkCard:hover { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.5); }
.networkCard > span { min-width: 0; }
.networkCard strong { display: block; font-size: 10px; line-height: 1.2; }
.networkCard small { display: block; margin-top: 3px; color: rgba(255,255,255,.6); font-size: 8px; font-weight: 400; letter-spacing: .03em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.networkCard .arrow { width: 15px; }
.youtubeCard > svg:first-child { stroke-width: 1.5; }

.closeWorld {
  position: absolute;
  z-index: 5;
  top: 20px;
  left: 20px;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(255,255,255,.4);
  border-radius: 50%;
  background: rgba(0,0,0,.17);
  color: #fff;
  backdrop-filter: blur(8px);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: scale(.88);
  transition: opacity .25s ease, transform .25s ease;
}
.closeWorld span { display: block; font-size: 27px; line-height: 36px; font-weight: 200; }

.world.isActive { flex-basis: 100%; }
.world.isInactive { flex-basis: 0; opacity: 0; pointer-events: none; }
.world.isActive::before { background: linear-gradient(90deg, rgba(3,9,6,.78) 0%, rgba(3,9,6,.31) 48%, rgba(3,9,6,.09) 100%); }
.world.tech.isActive::before { background: linear-gradient(90deg, rgba(3,9,14,.83) 0%, rgba(3,9,14,.32) 50%, rgba(3,9,14,.09) 100%); }
.world.isActive .worldOpen { pointer-events: none; }
.world.isActive .worldHeading { top: clamp(30px, 4vw, 54px); bottom: auto; max-width: 720px; }
.world.isActive .worldHeading strong { font-size: clamp(40px, 6vw, 78px); }
.world.isActive .worldType { margin-bottom: 12px; }
.world.isActive .openHint { display: none; }
.world.isActive .worldIndex { opacity: 0; }
.world.isActive .worldExpanded { opacity: 1; transform: translateY(0); pointer-events: auto; }
.world.isActive .closeWorld { opacity: 1; pointer-events: auto; transform: scale(1); }

@media (max-width: 640px) {
  .portal { grid-template-rows: minmax(235px, 42%) 1fr; }
  .profile { padding: 16px 17px 19px; gap: 17px; }
  .animatedLogo { width: 83px; }
  .profileCopy { min-width: 0; }
  .eyebrow { margin-bottom: 7px; font-size: 7px; letter-spacing: .2em; }
  .profile h1 { font-size: clamp(36px, 10.6vw, 49px); }
  .intro { margin-top: 9px; font-size: 11px; line-height: 1.42; max-width: 250px; }
  .worldOpen { padding: 18px 14px; }
  .worldIndex { top: 15px; right: 13px; width: 30px; height: 30px; font-size: 7px; }
  .worldHeading { left: 14px; right: 10px; bottom: 20px; }
  .worldType { margin-bottom: 8px; font-size: 6.5px; letter-spacing: .13em; }
  .worldHeading strong { font-size: clamp(25px, 7.2vw, 34px); line-height: .92; }
  .openHint { margin-top: 12px; font-size: 7px; gap: 6px; letter-spacing: .11em; }
  .openHint span { width: 18px; height: 18px; font-size: 12px; }
  .chameleon { background-position: 52% 48%; }
  .tech { background-position: 10% 50%; }

  .world.isActive .worldHeading { top: 23px; left: 74px; right: 18px; }
  .world.isActive .worldHeading strong { font-size: clamp(34px, 10vw, 48px); }
  .world.isActive .worldType { font-size: 7px; }
  .worldExpanded { left: 18px; bottom: 22px; width: calc(100% - 36px); }
  .worldExpanded p { max-width: 320px; margin-bottom: 15px; font-size: 12px; line-height: 1.45; }
  .worldLinks { gap: 7px; }
  .worldExpanded .networkCard { min-width: 0; flex: 1 1 140px; padding: 9px 10px; gap: 7px; grid-template-columns: 20px 1fr 14px; }
  .worldExpanded .networkCard svg { width: 17px; height: 17px; }
  .networkCard strong { font-size: 9px; }
  .networkCard small { font-size: 7px; }
  .closeWorld { top: 18px; left: 17px; width: 38px; height: 38px; }
  .closeWorld span { line-height: 32px; }
  .world.isActive::before,
  .world.tech.isActive::before { background: linear-gradient(180deg, rgba(3,9,8,.32) 0%, rgba(3,9,8,.3) 45%, rgba(3,9,8,.9) 100%); }
}

@media (max-height: 650px) {
  .portal { grid-template-rows: 38% 1fr; }
  .animatedLogo { width: 72px; }
  .intro { margin-top: 7px; }
}

@media (prefers-reduced-motion: reduce) {
  .world, .worldExpanded, .closeWorld { transition: none; }
}
