@font-face {
  font-family: "Inter";
  src: url("assets/fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Pixelify Sans";
  src: url("assets/fonts/pixelify-sans-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Pixelify Sans";
  src: url("assets/fonts/pixelify-sans-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Silkscreen";
  src: url("assets/fonts/silkscreen-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

/* ------------------------------------------------------------ tokens */

:root {
  --night-0: #090a1a;
  --night-1: #12153a;
  --night-2: #1d2150;
  --hill: #0e1029;

  --bg: var(--hill);
  --surface: #151938;
  --surface-2: #1b1f45;
  --text: #ece6d6;
  --muted: #a3a2bf;
  --gold: #e3b55b;
  --gold-soft: rgba(227, 181, 91, 0.14);
  --teal: #7fd6c2;
  --frame: #2b3064;
  --frame-strong: #3d4385;

  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-pixel: "Pixelify Sans", "Inter", system-ui, sans-serif;
  --font-label: "Silkscreen", ui-monospace, monospace;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --px: 2px;

  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f3eddd;
    --surface: #fbf7ec;
    --surface-2: #f7f1e2;
    --text: #1c1a2c;
    --muted: #5c596d;
    --gold: #8a5f12;
    --gold-soft: rgba(138, 95, 18, 0.1);
    --frame: #d9cfb5;
    --frame-strong: #c2b48f;
    color-scheme: light;
  }
}

/* ------------------------------------------------------------ base */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.6 var(--font-body);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  image-rendering: pixelated;
}

h1,
h2,
h3,
p {
  margin: 0;
}

a {
  color: inherit;
}

a,
button {
  touch-action: manipulation;
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 20;
  padding: 8px 12px;
  background: var(--gold);
  color: #141229;
  font-weight: 600;
}
.skip:focus {
  top: 12px;
}

.muted {
  color: var(--muted);
}

/* A notched pixel frame: shadows offset on one axis leave the corners empty. */
.pixel-frame,
.btn,
.sheet,
.feat,
.quest-feature,
.contact-card,
.slot,
.inventory li {
  box-shadow:
    0 calc(var(--px) * -1) 0 0 var(--frame),
    0 var(--px) 0 0 var(--frame),
    calc(var(--px) * -1) 0 0 0 var(--frame),
    var(--px) 0 0 0 var(--frame);
}

.eyebrow {
  font: 400 0.75rem/1.4 var(--font-label);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold);
}

/* ------------------------------------------------------------ nav */

.nav {
  position: fixed;
  inset: 0 0 auto;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: calc(12px + env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px)) 12px max(20px, env(safe-area-inset-left, 0px));
  background: rgba(9, 10, 26, 0.62);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: #ece6d6;
}

.nav-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font: 700 1.05rem/1 var(--font-pixel);
  letter-spacing: 0.01em;
  user-select: none;
  -webkit-user-select: none;
}
.nav-mark img {
  width: 18px;
  height: auto;
}

.nav nav {
  display: flex;
  gap: 4px;
}
.nav nav a {
  padding: 6px 10px;
  font-size: 0.875rem;
  color: #b9b8d2;
  text-decoration: none;
  transition: color 150ms ease;
}

@media (max-width: 640px) {
  .nav nav a:not([href="#contact"]):not(.world-switch) {
    display: none;
  }
}
.nav nav a.world-switch {
  margin-left: 14px;
  padding: 0;
  color: #b9b8d2;
}
@media (max-width: 640px) {
  .nav-mark { white-space: nowrap; }
  .nav nav a.world-switch { margin-left: 10px; }
  .nav .ws-label { display: none; }
}
/* The hero already has the email and LinkedIn buttons, so Contact can go first. */
@media (max-width: 420px) {
  .nav nav a[href="#contact"] { display: none; }
}

/* ------------------------------------------------------------ hero */

.hero {
  --scene-h: clamp(240px, 30vw, 460px);
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  overflow: hidden;
  color: #ece6d6;
  background: linear-gradient(180deg, var(--night-0) 0%, var(--night-1) 55%, var(--night-2) 100%);
}

.sky {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.star {
  position: absolute;
  width: 2px;
  height: 2px;
  background: #e8e4ff;
  opacity: var(--o, 0.6);
}
.star.twinkle {
  animation: twinkle var(--d, 6s) ease-in-out var(--delay, 0s) infinite;
}
@keyframes twinkle {
  50% {
    opacity: 0.15;
  }
}

.moon {
  position: absolute;
  top: clamp(84px, 14vh, 140px);
  right: clamp(24px, 9vw, 160px);
  width: clamp(56px, 7vw, 88px);
  height: auto;
  filter: drop-shadow(0 0 24px rgba(239, 230, 207, 0.25));
}

.hero-inner {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 40px;
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: calc(104px + env(safe-area-inset-top, 0px)) 20px calc(var(--scene-h) * 0.6);
}

@media (min-width: 960px) {
  .hero-inner {
    grid-template-columns: 1fr 360px;
    align-items: center;
    padding-top: calc(80px + 6vh);
    padding-bottom: calc(var(--scene-h) * 0.8);
  }
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  margin-bottom: 28px;
  background: rgba(227, 181, 91, 0.1);
  box-shadow:
    0 -1px 0 0 rgba(227, 181, 91, 0.35),
    0 1px 0 0 rgba(227, 181, 91, 0.35),
    -1px 0 0 0 rgba(227, 181, 91, 0.35),
    1px 0 0 0 rgba(227, 181, 91, 0.35);
  font-size: 0.8125rem;
  font-weight: 500;
  color: #f4d48e;
}
.status-gem {
  width: 8px;
  height: 8px;
  flex: none;
  background: #e3b55b;
  transform: rotate(45deg);
  animation: gem 2.4s ease-in-out infinite;
}
@keyframes gem {
  50% {
    opacity: 0.45;
  }
}

.hero .eyebrow {
  color: #e3b55b;
  margin-bottom: 12px;
}

h1 {
  font: 700 clamp(3rem, 9vw, 6rem)/0.95 var(--font-pixel);
  letter-spacing: -0.01em;
  color: #f6f0e1;
  text-shadow: 0 2px 0 #141229;
}

.lede {
  max-width: 38rem;
  margin-top: 20px;
  font-size: clamp(1.0625rem, 1.6vw, 1.1875rem);
  line-height: 1.6;
  color: #c9c6dc;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 32px;
}

.btn {
  --frame: #4a5096;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 20px;
  background: rgba(29, 33, 80, 0.7);
  color: #ece6d6;
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 140ms var(--ease-out), background-color 150ms ease;
}
.btn:active {
  transform: scale(0.97);
}
.btn-primary {
  --frame: #8a6420;
  background: #e3b55b;
  color: #1a1426;
}

.sheet {
  --frame: rgba(120, 128, 200, 0.35);
  padding: 20px 22px;
  background: rgba(16, 18, 44, 0.6);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.portrait {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
}
.portrait img {
  width: 88px;
  height: 88px;
  object-fit: cover;
  image-rendering: auto;
  box-shadow:
    0 -2px 0 0 #8a6420,
    0 2px 0 0 #8a6420,
    -2px 0 0 0 #8a6420,
    2px 0 0 0 #8a6420;
}
.portrait .sheet-title {
  margin-bottom: 0;
}
.portrait-name {
  margin-top: 6px;
  font: 700 1.25rem/1.1 var(--font-pixel);
}
.portrait-sub {
  margin-top: 4px;
  font-size: 0.8125rem;
  color: #8f8eae;
}
.sheet-title {
  margin-bottom: 14px;
  font: 400 0.75rem/1 var(--font-label);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7fd6c2;
}
.sheet dl {
  display: grid;
  gap: 10px;
  margin: 0;
}
.sheet dl div {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
}
.sheet dl div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}
.sheet dt {
  font-size: 0.8125rem;
  color: #8f8eae;
}
.sheet dd {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
}
.sheet .muted {
  color: #8f8eae;
  font-weight: 400;
}

.scene {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: var(--scene-h);
  object-fit: cover;
  object-position: center bottom;
}

/* ------------------------------------------------------------ sections */

.section {
  padding: clamp(56px, 8vw, 96px) 20px;
}

/* A small pixel ornament between chapters. */
.section + .section::before {
  content: "";
  display: block;
  width: 6px;
  height: 6px;
  margin: 0 auto clamp(56px, 8vw, 96px);
  background: var(--gold);
  box-shadow:
    -18px 0 0 var(--frame-strong),
    18px 0 0 var(--frame-strong);
}

.wrap {
  width: min(1040px, 100%);
  margin: 0 auto;
}

h2 {
  margin: 10px 0 32px;
  font: 700 clamp(1.75rem, 3.6vw, 2.5rem)/1.1 var(--font-pixel);
  letter-spacing: -0.005em;
  text-wrap: balance;
}

h3 {
  font-size: 1.0625rem;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.quest-feature {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  align-items: start;
  padding: 24px;
  background: var(--surface);
  max-width: 52rem;
}
.quest-feature p {
  font-size: 1.0625rem;
  line-height: 1.7;
}
.feature-icon {
  width: 36px;
  height: auto;
  margin-top: 4px;
}

.feats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}
.feat {
  padding: 20px;
  background: var(--surface);
}
.feat p:last-child {
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.5;
}
.feat-num {
  margin-bottom: 6px;
  font: 700 2rem/1.1 var(--font-pixel);
  color: var(--gold);
}

/* quest log */

.quests {
  position: relative;
  margin: 0;
  padding: 0 0 0 28px;
  list-style: none;
}
.quests::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: repeating-linear-gradient(to bottom, var(--frame-strong) 0 4px, transparent 4px 8px);
}

.quest {
  position: relative;
  padding-bottom: 40px;
}
.quest:last-child {
  padding-bottom: 0;
}
.quest::before {
  content: "";
  position: absolute;
  left: -28px;
  top: 10px;
  width: 12px;
  height: 12px;
  background: var(--bg);
  box-shadow: inset 0 0 0 2px var(--frame-strong);
}
.quest-current::before {
  background: var(--gold);
  box-shadow: inset 0 0 0 2px var(--gold), 0 0 0 4px var(--gold-soft);
}

.quest-head {
  display: grid;
  gap: 2px;
  margin-bottom: 12px;
}
.quest-head h3 {
  font: 700 1.375rem/1.2 var(--font-pixel);
}
.quest-role {
  font-weight: 550;
}
.quest-meta {
  font-size: 0.875rem;
  color: var(--muted);
}

.quest ul {
  display: grid;
  gap: 8px;
  max-width: 46rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.quest ul li {
  position: relative;
  padding-left: 18px;
  color: var(--text);
  opacity: 0.88;
}
.quest ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.68em;
  width: 6px;
  height: 6px;
  background: var(--gold);
}

/* abilities */

.abilities,
.schools {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 16px 28px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ability,
.school {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: start;
  padding: 8px 0;
}
.ability p,
.school p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.5;
}
.school .quest-meta {
  font-size: 0.875rem;
}

.slot {
  --frame: #2b3064;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  background: #1b1f45;
}
.slot img {
  width: 28px;
  height: auto;
}

.inventory-title {
  margin: 48px 0 16px;
  font: 400 0.75rem/1.4 var(--font-label);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold);
}
.inventory {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.inventory li {
  padding: 4px 12px;
  background: var(--surface);
  font-size: 0.875rem;
  font-weight: 500;
}

/* contact */

.contact-card {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: clamp(32px, 6vw, 56px) 24px;
  text-align: center;
  background: var(--surface);
  overflow: hidden;
}
.contact-card::before {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 60%;
  background: radial-gradient(ellipse at 50% 100%, var(--gold-soft), transparent 70%);
  pointer-events: none;
}
.contact-icon {
  width: 40px;
  height: auto;
  margin-bottom: 8px;
}
.contact-card h2 {
  margin: 0;
}
.contact-card p:not(.eyebrow) {
  max-width: 32rem;
  color: var(--muted);
}
.contact-card .actions {
  justify-content: center;
  margin-top: 16px;
}

/* In light mode the buttons below the hero sit on parchment, not night. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) main .btn:not(.btn-primary) {
    --frame: var(--frame-strong);
    background: var(--surface-2);
    color: var(--text);
  }
  :root:not([data-theme="dark"]) .slot {
    --frame: #2b3064;
  }
}

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  width: min(1040px, 100% - 40px);
  margin: 0 auto;
  padding: 28px 0 calc(28px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--frame);
  font-size: 0.8125rem;
  color: var(--muted);
}

/* ------------------------------------------------------------ hover (pointer devices only) */

@media (hover: hover) and (pointer: fine) {
  .nav nav a:hover {
    color: #ffffff;
  }
  .btn:hover {
    background: rgba(41, 46, 104, 0.9);
  }
  .btn-primary:hover {
    background: #ecc172;
  }
  main .btn:not(.btn-primary):hover {
    background: var(--surface-2);
  }
  .footer a:hover {
    color: var(--text);
  }
}

/* ------------------------------------------------------------ entrance */

.js .reveal {
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 500ms var(--ease-out),
    transform 500ms var(--ease-out);
  transition-delay: var(--stagger, 0ms);
}
.js .reveal.is-in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .js .reveal {
    transform: none;
    transition: opacity 200ms ease;
  }
  .star.twinkle,
  .status-gem {
    animation: none;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .nav,
  .sheet {
    background: #10122c;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

@media (max-width: 959px) {
  .moon {
    top: calc(68px + env(safe-area-inset-top, 0px));
    right: 20px;
    width: 44px;
  }
  .hero-inner {
    padding-top: calc(128px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(var(--scene-h) * 0.82);
  }
  .scene {
    object-position: 60% bottom;
  }
}

@media (min-width: 960px) {
  .moon {
    right: auto;
    left: 55%;
    top: 96px;
  }
}

@media (max-width: 640px) {
  .quest-feature {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

/* ------------------------------------------------------------ guild marks */

.guilds {
  display: grid;
  grid-template-columns: repeat(2, max-content);
  gap: 6px 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.guilds li {
  display: flex;
  align-items: center;
  gap: 8px;
}
.guilds img {
  width: 16px;
  height: 12px;
  object-fit: contain;
}

.quest-head h3 {
  display: flex;
  align-items: center;
  gap: 12px;
}
.guild-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  background: #1b1f45;
  box-shadow:
    0 -2px 0 0 #2b3064,
    0 2px 0 0 #2b3064,
    -2px 0 0 0 #2b3064,
    2px 0 0 0 #2b3064;
}
.guild-mark img {
  width: auto;
  height: 16px;
}

/* ------------------------------------------------------------ house */

.house {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}
.house img {
  width: 16px;
  height: 14px;
  object-fit: contain;
}

.motto {
  font-style: italic;
}

/* ------------------------------------------------------------ realms */

.realm-toggle {
  --frame: #3a4080;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
  padding: 6px 12px;
  border: 0;
  background: rgba(255, 255, 255, 0.05);
  color: #ece6d6;
  font: 500 0.8125rem/1 var(--font-body);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  box-shadow:
    0 -1px 0 0 var(--frame),
    0 1px 0 0 var(--frame),
    -1px 0 0 0 var(--frame),
    1px 0 0 0 var(--frame);
  transition: transform 140ms var(--ease-out), background-color 150ms ease;
}
.realm-toggle img {
  width: 12px;
  height: 12px;
}
.realm-toggle:active {
  transform: scale(0.97);
}
@media (hover: hover) and (pointer: fine) {
  .realm-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
  }
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #0b1730 0%, #18304f 55%, #3a5c88 100%);
  opacity: 0;
  pointer-events: none;
}
.scene-storybook {
  opacity: 0;
}

[data-realm="storybook"] .hero::before,
[data-realm="storybook"] .scene-storybook {
  opacity: 1;
}
[data-realm="storybook"] .scene-night,
[data-realm="storybook"] .moon {
  opacity: 0;
}
[data-realm="storybook"] .star {
  opacity: calc(var(--o, 0.6) * 0.5);
}

.realm-ready .hero::before,
.realm-ready .scene,
.realm-ready .moon {
  transition: opacity 450ms ease;
}

.flake {
  position: absolute;
  top: -4px;
  width: 2px;
  height: 2px;
  background: #eef3fb;
  opacity: 0;
  display: none;
}
[data-realm="storybook"] .flake {
  display: block;
  opacity: var(--o);
  animation: fall var(--d, 14s) linear var(--delay, 0s) infinite;
}
@keyframes fall {
  to {
    transform: translate3d(var(--drift, 0), 105vh, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  [data-realm="storybook"] .flake {
    animation: none;
    transform: translateY(var(--y, 0));
  }
}
