@import url("https://fonts.googleapis.com/css2?family=Cinzel:wght@400;500;600;700&family=Inter:wght@300;400;500;600;700&display=swap");

:root {
  --ink: #080611;
  --ink-soft: #110d24;
  --violet-950: #120a2a;
  --violet-800: #39206e;
  --violet-500: #9b70ef;
  --violet-300: #c7a9ff;
  --gold-700: #9d702c;
  --gold-500: #dbb968;
  --gold-300: #f7e7b3;
  --mist: #f6f1ff;
  --muted: #c8bedc;
  --panel: rgba(17, 12, 38, 0.62);
  --panel-strong: rgba(20, 13, 45, 0.88);
  --line: rgba(229, 208, 149, 0.26);
  --shadow: 0 24px 72px rgba(0, 0, 0, 0.48);
  --font-display: "Cinzel", Georgia, serif;
  --font-body: "Inter", "Segoe UI", sans-serif;
  --content-width: 1160px;
  --pointer-x: 50%;
  --pointer-y: 50%;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--ink); scroll-behavior: smooth; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--mist);
  background: var(--ink);
  font-family: var(--font-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; }
a { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.background-cosmic,
.background-glow,
#neuralField {
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
}
.background-cosmic {
  background: #080611 url("../assets/background-cosmic.png") center / cover no-repeat;
  opacity: 0.56;
}
.background-cosmic::after {
  position: absolute;
  inset: 0;
  content: "";
  background: radial-gradient(circle at var(--pointer-x) var(--pointer-y), rgba(118, 80, 195, 0.16), transparent 32%), linear-gradient(180deg, rgba(8, 6, 17, 0.12), rgba(8, 6, 17, 0.76));
}
.background-glow {
  z-index: -2;
  background: url("../assets/background-glow.png") center / cover no-repeat;
  opacity: 0.38;
  mix-blend-mode: screen;
}
#neuralField { z-index: -1; width: 100%; height: 100%; }

.portal-skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 20;
  transform: translateY(-160%);
  padding: 0.65rem 0.9rem;
  border-radius: 0.35rem;
  background: var(--gold-300);
  color: #1a1129;
  font-weight: 700;
  text-decoration: none;
  transition: transform 160ms ease;
}
.portal-skip-link:focus { transform: translateY(0); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.portal {
  position: relative;
  min-height: 100vh;
  padding: clamp(2.5rem, 7vw, 6rem) clamp(1rem, 4vw, 3rem) 2.25rem;
  isolation: isolate;
}
.portal-container {
  width: min(100%, var(--content-width));
  margin: 0 auto;
  animation: portal-enter 700ms both cubic-bezier(.2, .72, .25, 1);
}
.portal-hero {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(300px, 1.1fr);
  align-items: center;
  gap: clamp(1rem, 5vw, 5rem);
  min-height: min(630px, 68vh);
}

.portal-core {
  position: relative;
  width: min(100%, 440px);
  aspect-ratio: 1;
  margin: 0 auto;
  transform: perspective(900px) rotateX(var(--core-rotate-x, 0deg)) rotateY(var(--core-rotate-y, 0deg));
  transform-style: preserve-3d;
  transition: transform 160ms ease-out;
}
.portal-shadow,
.portal-energy,
.portal-halo,
.portal-light,
.portal-ring,
.portal-logo-wrapper { position: absolute; inset: 50%; transform: translate(-50%, -50%); border-radius: 50%; }
.portal-shadow {
  width: 60%;
  height: 14%;
  top: 90%;
  filter: blur(22px);
  background: rgba(0, 0, 0, 0.78);
  transform: translate(-50%, -50%) rotateX(70deg);
}
.portal-energy {
  width: 69%;
  aspect-ratio: 1;
  background: conic-gradient(from 14deg, transparent, rgba(209, 175, 255, 0.7), transparent 24%, rgba(226, 190, 105, 0.82), transparent 46%, rgba(146, 98, 238, 0.7), transparent 68%, rgba(226, 190, 105, 0.64), transparent);
  filter: blur(11px);
  opacity: 0.7;
  animation: core-spin 20s linear infinite;
}
.portal-halo {
  width: 72%;
  aspect-ratio: 1;
  background: radial-gradient(circle, rgba(246, 228, 178, 0.38), rgba(130, 80, 226, 0.21) 33%, transparent 68%);
  filter: blur(8px);
  animation: halo-pulse 4s ease-in-out infinite;
}
.portal-light {
  width: 38%;
  aspect-ratio: 1;
  background: radial-gradient(circle, #fffdf2 0%, var(--gold-300) 13%, rgba(215, 168, 67, 0.82) 25%, rgba(126, 68, 226, 0.6) 44%, transparent 70%);
  filter: blur(2px);
  box-shadow: 0 0 34px 18px rgba(218, 181, 95, 0.22), 0 0 90px 32px rgba(120, 75, 216, 0.25);
}
.portal-ring {
  width: 76%;
  aspect-ratio: 1;
  border: 1px solid rgba(228, 202, 128, 0.66);
  box-shadow: inset 0 0 20px rgba(145, 98, 236, 0.22), 0 0 20px rgba(219, 185, 104, 0.12);
}
.ring-1 { transform: translate(-50%, -50%) rotateX(66deg) rotateZ(-18deg); animation: ring-turn-a 15s linear infinite; }
.ring-2 { width: 92%; border-color: rgba(166, 123, 245, 0.45); transform: translate(-50%, -50%) rotateY(65deg) rotateZ(18deg); animation: ring-turn-b 19s linear infinite reverse; }
.ring-3 { width: 112%; border-color: rgba(223, 193, 115, 0.25); transform: translate(-50%, -50%) rotateX(24deg) rotateY(54deg); animation: ring-turn-c 27s linear infinite; }
.portal-logo-wrapper {
  z-index: 2;
  display: grid;
  width: 42%;
  aspect-ratio: 1;
  place-items: center;
  overflow: hidden;
  background: radial-gradient(circle, rgba(27, 15, 57, 0.92), rgba(9, 6, 20, 0.96));
  border: 1px solid rgba(247, 231, 179, 0.54);
  box-shadow: 0 0 32px rgba(231, 194, 96, 0.3), inset 0 0 24px rgba(148, 94, 240, 0.24);
}
.portal-logo { display: block; width: 78%; }
.portal-logo img { width: 100%; height: auto; filter: drop-shadow(0 0 12px rgba(241, 218, 151, 0.45)); }
.portal-spark, .portal-orb { position: absolute; z-index: 3; border-radius: 50%; pointer-events: none; }
.portal-spark { width: 5px; height: 5px; background: #fff3c7; box-shadow: 0 0 14px 4px rgba(255, 233, 163, 0.9); animation: twinkle 2.5s ease-in-out infinite; }
.spark-one { top: 19%; left: 25%; }
.spark-two { top: 31%; right: 13%; animation-delay: -0.8s; }
.spark-three { bottom: 22%; left: 17%; animation-delay: -1.6s; }
.portal-orb { width: 12px; height: 12px; background: var(--violet-300); box-shadow: 0 0 18px 7px rgba(166, 123, 245, 0.56); animation: float 4s ease-in-out infinite; }
.orb-one { top: 15%; right: 26%; }
.orb-two { right: 17%; bottom: 18%; width: 8px; height: 8px; background: var(--gold-300); box-shadow: 0 0 15px 6px rgba(245, 220, 141, 0.58); animation-delay: -1.4s; }

.portal-copy { max-width: 610px; text-align: left; }
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.9rem;
  margin: 0 0 1.1rem;
  padding: 0.25rem 0.75rem;
  border: 1px solid rgba(239, 214, 145, 0.5);
  border-radius: 100vmax;
  color: var(--gold-300);
  background: rgba(89, 54, 25, 0.2);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}
.portal-title {
  max-width: 11ch;
  margin: 0;
  color: #fffaf0;
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 5.1vw, 5rem);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: 0.015em;
  text-wrap: balance;
  text-shadow: 0 4px 32px rgba(0, 0, 0, 0.5);
}
.portal-subtitle {
  margin: 1.2rem 0 0;
  color: var(--gold-300);
  font-family: var(--font-display);
  font-size: clamp(0.88rem, 1.3vw, 1.08rem);
  letter-spacing: 0.105em;
  line-height: 1.7;
  text-transform: uppercase;
}
.portal-subtitle span { padding: 0 0.4rem; color: var(--violet-300); }
.portal-divider { width: min(130px, 38%); height: 1px; margin: 1.7rem 0; background: linear-gradient(90deg, var(--gold-500), transparent); }
.portal-intro { max-width: 58ch; margin: 0; color: #ded6ea; font-size: clamp(0.94rem, 1.5vw, 1.06rem); }
.portal-quote { max-width: 50ch; margin: 1.45rem 0 0; padding-left: 1rem; border-left: 2px solid rgba(220, 187, 103, 0.67); color: var(--gold-300); font-family: var(--font-display); font-size: clamp(0.88rem, 1.3vw, 1rem); font-style: italic; line-height: 1.75; }
.portal-author { margin: 1.25rem 0 0; color: var(--muted); font-size: 0.79rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; }

.portal-navigation {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(0.55rem, 1.3vw, 1rem);
  margin-top: clamp(1rem, 3vw, 2.4rem);
  padding: clamp(1.1rem, 3vw, 2rem);
  overflow: hidden;
  isolation: isolate;
}
.portal-orbit {
  position: absolute;
  z-index: -1;
  left: 50%;
  top: 50%;
  width: 68%;
  height: 130%;
  border: 1px solid rgba(165, 122, 238, 0.13);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%) rotate(-12deg);
}
.portal-orbit.level-2 { width: 88%; height: 170%; border-color: rgba(229, 202, 129, 0.1); transform: translate(-50%, -50%) rotate(13deg); }
.portal-node {
  position: relative;
  display: grid;
  min-height: 158px;
  place-items: center;
  align-content: center;
  gap: 0.38rem;
  overflow: hidden;
  padding: 1rem 0.65rem;
  border: 1px solid rgba(198, 171, 255, 0.18);
  border-radius: 1rem;
  background: linear-gradient(145deg, rgba(45, 28, 84, 0.56), rgba(14, 10, 31, 0.8));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 12px 26px rgba(0, 0, 0, 0.2);
  color: var(--mist);
  text-align: center;
  text-decoration: none;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}
.portal-node::before {
  position: absolute;
  inset: -75% 45% auto -100%;
  width: 40%;
  height: 240%;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(255, 243, 203, 0.18), transparent);
  opacity: 0;
  transform: rotate(24deg);
  transition: left 520ms ease, opacity 180ms ease;
}
.portal-node img { width: 3rem; height: 3rem; object-fit: contain; filter: drop-shadow(0 0 8px rgba(224, 185, 99, 0.25)); transition: transform 180ms ease, filter 180ms ease; }
.portal-node-title { color: #fffaf0; font-family: var(--font-display); font-size: clamp(0.85rem, 1.2vw, 1rem); letter-spacing: 0.045em; }
.portal-node-copy { color: var(--muted); font-size: 0.69rem; line-height: 1.35; }
.portal-node:hover, .portal-node.is-active { border-color: rgba(245, 219, 142, 0.62); background: linear-gradient(145deg, rgba(74, 45, 130, 0.8), rgba(23, 13, 52, 0.94)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 14px 32px rgba(0, 0, 0, 0.36), 0 0 28px rgba(181, 130, 255, 0.16); transform: translateY(-5px); }
.portal-node:hover::before, .portal-node.is-active::before { left: 160%; opacity: 1; }
.portal-node:hover img, .portal-node.is-active img { filter: drop-shadow(0 0 12px rgba(246, 222, 151, 0.66)); transform: scale(1.08); }

.portal-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.6rem 2rem;
  margin-top: clamp(2rem, 5vw, 4.5rem);
  padding: 1.25rem 0 0;
  border-top: 1px solid rgba(225, 204, 145, 0.2);
  color: var(--muted);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
}
.portal-footer p { margin: 0; }
.portal-footer a { color: var(--gold-300); text-decoration: none; text-underline-offset: 0.24em; }
.portal-footer a:hover { text-decoration: underline; }
.noscript-notice {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  left: 1rem;
  z-index: 5;
  max-width: 700px;
  margin: auto;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: var(--panel-strong);
  color: var(--mist);
  box-shadow: var(--shadow);
  font-size: 0.88rem;
}

.portal-node:focus-visible,
.portal-footer a:focus-visible,
.portal-logo:focus-visible,
.portal-skip-link:focus-visible {
  outline: 3px solid var(--gold-300);
  outline-offset: 4px;
}
.portal-node:focus-visible { transform: translateY(-5px); border-color: var(--gold-300); }

@keyframes portal-enter { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes core-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes halo-pulse { 50% { opacity: 0.72; transform: translate(-50%, -50%) scale(1.1); } }
@keyframes ring-turn-a { to { transform: translate(-50%, -50%) rotateX(66deg) rotateZ(342deg); } }
@keyframes ring-turn-b { to { transform: translate(-50%, -50%) rotateY(65deg) rotateZ(-342deg); } }
@keyframes ring-turn-c { to { transform: translate(-50%, -50%) rotateX(24deg) rotateY(54deg) rotateZ(360deg); } }
@keyframes twinkle { 50% { opacity: 0.28; transform: scale(0.55); } }
@keyframes float { 50% { transform: translateY(-10px) scale(1.25); } }

@media (max-width: 850px) {
  .portal { padding-top: 2.25rem; }
  .portal-hero { grid-template-columns: 1fr; gap: 0.45rem; min-height: auto; }
  .portal-core { width: min(76vw, 350px); }
  .portal-copy { max-width: 680px; margin: 0 auto; text-align: center; }
  .portal-title { max-width: none; }
  .portal-divider { margin-right: auto; margin-left: auto; background: linear-gradient(90deg, transparent, var(--gold-500), transparent); }
  .portal-quote { margin-right: auto; margin-left: auto; text-align: left; }
  .portal-navigation { grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 1.2rem 0; }
  .portal-node { min-height: 143px; }
}
@media (max-width: 610px) {
  .portal { padding: 1.35rem 0.85rem 1.4rem; }
  .portal-core { width: min(85vw, 320px); }
  .portal-title { font-size: clamp(2.15rem, 11vw, 3rem); }
  .portal-subtitle { font-size: 0.73rem; letter-spacing: 0.075em; }
  .portal-subtitle span { padding: 0 0.18rem; }
  .portal-intro { font-size: 0.9rem; }
  .portal-navigation { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.65rem; margin-top: 1.2rem; }
  .portal-node { min-height: 136px; padding: 0.75rem 0.4rem; border-radius: 0.75rem; }
  .portal-node-copy { font-size: 0.64rem; }
  .portal-footer { justify-content: center; margin-top: 2rem; text-align: center; }
}
@media (max-width: 360px) { .portal-navigation { grid-template-columns: 1fr; } .portal-node { min-height: 116px; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  .background-glow { opacity: 0.24; }
}
@media (forced-colors: active) {
  .portal-node, .badge, .portal-footer { border-color: CanvasText; }
  .portal-node { background: Canvas; color: CanvasText; }
}
@media print { .background-cosmic, .background-glow, #neuralField, .portal-core { display: none; } .portal { color: #111; background: #fff; } .portal-node { border: 1px solid #444; background: #fff; color: #111; } }
