:root {
  --black: #000000;
  --gold: #F2B212;
  --gold-soft: #C9A25A;
  --ivory: #F3EAD6;
  --muted: #A89E89;
  --gold-line: rgba(242, 178, 18, 0.6);
  --gold-faint: rgba(242, 178, 18, 0.22);
  --gold-glow: rgba(242, 178, 18, 0.11);
  --gold-select: rgba(242, 178, 18, 0.28);
  --panel-hi: #1D1913;
  --panel-lo: #060504;

  --sans: "Bricolage Grotesque", system-ui, sans-serif;
  --serif: "Bodoni Moda", Georgia, serif;

  --cw: clamp(9.5rem, 17.5vw, 16rem); /* card width */
  --intro: 1.45s;                    /* when the hand starts dealing */
  --settle: cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; }

html {
  color-scheme: dark;
  scrollbar-color: #5A430F var(--black);
}

::selection {
  background: var(--gold-select);
  color: inherit;
}

.hand { user-select: none; -webkit-user-select: none; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--black);
  color: var(--ivory);
  font-family: var(--sans);
  font-size: 1.125rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

.sprite { position: absolute; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 45% 55% at 70% 45%, var(--gold-glow), transparent 70%);
  animation: arrive 1s var(--settle) var(--intro) both;
}

/* The crest: shown alone on load as gold foil, then it grows and fades
   into a watermark behind the whole page. The resting state is the base
   style, so the page is correct even if animations never run. */
.crest {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(44vmin, 26rem);
  aspect-ratio: 1;
  z-index: 0;
  pointer-events: none;
  opacity: 0.07;
  transform: scale(2.5);
  animation: crest 2.3s var(--settle) both;
}

.crest::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, #9A6606 0%, #F2B212 38%, #FFF1BF 50%, #F2B212 62%, #9A6606 100%);
  background-size: 320% 100%;
  background-position: 0% 0;
  -webkit-mask: url(logo-gold.webp) center / contain no-repeat;
  mask: url(logo-gold.webp) center / contain no-repeat;
  animation: sheen 1.3s ease-in-out 0.35s both;
}

@keyframes crest {
  0%   { opacity: 0; transform: scale(0.9); filter: blur(14px); }
  24%  { opacity: 1; transform: scale(1);   filter: blur(0); }
  58%  { opacity: 1; transform: scale(1.03); }
  100% { opacity: 0.07; transform: scale(2.5); }
}

@keyframes sheen {
  from { background-position: 100% 0; }
  to   { background-position: 0% 0; }
}

main {
  flex: 1;
  overflow-x: clip; /* panels deal in from off-screen */
}
.table, .projects, .foot { position: relative; z-index: 1; }
.table { overflow-y: clip; }

.intro, .foot {
  animation: arrive 0.8s var(--settle) calc(var(--intro) + 0.2s) both;
}

@keyframes arrive {
  from { opacity: 0; }
}

/* Layout */
.table {
  flex: 1;
  width: 100%;
  max-width: 76rem;
  margin: 0 auto;
  padding: clamp(2.5rem, 7vw, 6rem) clamp(1rem, 5vw, 4rem) 2rem;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(2rem, 5vw, 5rem);
}

/* Type */
h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(3rem, 6.2vw, 5.75rem);
  font-variation-settings: "opsz" 18;
  line-height: 0.98;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.lede {
  margin: 1.5rem 0 0;
  max-width: 28ch;
  font-size: clamp(1.25rem, 2.2vw, 1.5rem);
  line-height: 1.35;
}


.entries {
  list-style: none;
  margin: clamp(2.5rem, 6vw, 4rem) 0 0;
  padding: 0;
}

.entry {
  display: grid;
  gap: 0.2rem;
  max-width: 34rem;
  text-decoration: none;
}
.entry-title {
  font-family: var(--serif);
  font-weight: 700;
  font-variation-settings: "opsz" 18;
  font-size: 1.75rem;
  line-height: 1.1;
  transition: color 0.15s;
}
.entry-sub { color: var(--muted); }
.entry:hover .entry-title { color: var(--gold); }

.foot {
  padding: 1.5rem clamp(1rem, 5vw, 4rem) 2rem;
  max-width: 76rem;
  width: 100%;
  margin: 0 auto;
  font-size: 0.9375rem;
  color: var(--muted);
}
.foot p { margin: 0; }

/* Links */
a { color: inherit; }

.text-link {
  font-weight: 600;
  color: var(--gold);
  text-decoration: none;
  transition: color 0.15s;
}
.text-link:hover { color: var(--ivory); }

.btn {
  display: inline-block;
  padding: 0.7rem 1.2rem;
  border: 1px solid var(--gold);
  border-radius: 3px;
  color: var(--gold);
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}
.btn:hover {
  background: var(--gold);
  color: var(--black);
}

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

.links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
  margin-top: 2.5rem;
}

.foot .text-link { font-weight: 400; }

/* The hand: the ace and seven of spades */
.hand {
  position: relative;
  width: calc(var(--cw) * 1.82);
  height: calc(var(--cw) * 1.55);
}

.slot {
  --a: 0deg;
  --x: 0%;
  position: absolute;
  left: calc(50% + var(--cw) * 0.025);
  top: 5%;
  width: var(--cw);
  aspect-ratio: 5 / 7;
  margin-left: calc(var(--cw) / -2);
  transform-origin: 50% 140%;
  transform: translateX(var(--x)) rotate(var(--a));
  animation: gather 1.1s var(--settle) calc(var(--intro) + var(--i) * 0.05s) both;
}

.seven { --a: -8deg; --x: -14%; z-index: 1; }
.ace   { --a: 7deg;  --x: 14%;  z-index: 2; }

@keyframes gather {
  0%   { transform: translateX(0%) translateY(90vh) rotate(0deg); }
  45%  { transform: translateX(0%) translateY(12%) rotate(0deg); }
  100% { transform: translateX(var(--x)) translateY(0%) rotate(var(--a)); }
}

.lift {
  width: 100%;
  height: 100%;
  perspective: 1400px;
  transition: translate 0.25s ease-out;
}

.card {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  animation: flip 0.7s cubic-bezier(.3, .7, .3, 1) calc(var(--intro) + 0.8s + var(--i) * 0.18s) both;
}

@keyframes flip {
  from { transform: rotateY(180deg); }
  to   { transform: rotateY(0deg); }
}

.face {
  position: absolute;
  inset: 0;
  border-radius: 5.6% / 4%;
  background: var(--panel-lo);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow:
    0 0 0 1px var(--gold-faint),
    0 2px 4px rgba(0, 0, 0, 0.6),
    0 22px 44px -14px rgba(0, 0, 0, 0.9);
  overflow: hidden;
}
.face svg { display: block; width: 100%; height: 100%; }
.face.back { transform: rotateY(180deg); }

.rank {
  font-family: var(--serif);
  font-weight: 800;
  font-variation-settings: "opsz" 8;
  font-size: 38px;
  text-anchor: middle;
  fill: url(#gold);
}

@media (hover: hover) and (pointer: fine) {
  .slot:hover .lift { translate: 0 -7%; }
}

/* Small screens: hand first, then text */
@media (max-width: 800px) {
  :root { --cw: min(40vw, 11rem); }
  .table {
    grid-template-columns: 1fr;
    padding-top: 2rem;
    justify-items: start;
  }
  .hand { order: -1; justify-self: center; margin-bottom: 0.5rem; }
}

.seen { --intro: 0s; }
.seen .crest,
.seen .crest::before { animation: none; }

@media (prefers-reduced-motion: reduce) {
  .slot, .card, .crest, .crest::before { animation: none; }
  body::before { animation-delay: 0s; }
  .intro, .foot { animation-delay: 0s; }
}

/* Projects contributed to: panels framed like cards, dealt in on scroll */
.projects {
  width: 100%;
  max-width: 76rem;
  margin: 0 auto;
  padding: clamp(3rem, 8vw, 6rem) clamp(1rem, 5vw, 4rem) clamp(3rem, 7vw, 5rem);
  scroll-margin-top: 1rem;
}

.projects-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 700;
  font-variation-settings: "opsz" 18;
  font-size: clamp(2.5rem, 5.5vw, 4.5rem);
  line-height: 0.98;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
.projects-head .lede { max-width: 42ch; }

/* Profile card: Roblox and Discord, split down the middle */
.profiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  max-width: 44rem;
  margin-top: 2rem;
  border: 1px solid var(--gold-line);
  outline: 1px solid var(--gold-faint);
  outline-offset: -7px;
  border-radius: 12px;
  background: radial-gradient(ellipse 120% 100% at 50% 40%, var(--panel-hi), var(--panel-lo));
}

.profile {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  text-decoration: none;
  min-width: 0;
}
.profile + .profile { border-left: 1px solid var(--gold-faint); }

.profile-pic {
  width: 64px;
  height: 64px;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--gold-line);
  background: var(--black);
  object-fit: cover;
}
.discord-pic {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.discord-pic svg { width: 58%; fill: var(--gold); }
.discord-pic .discord-avatar {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.has-avatar .discord-pic svg { display: none; }

.profile-text {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}
.profile-name {
  font-weight: 600;
  font-size: 1.25rem;
  line-height: 1.25;
  color: var(--ivory);
  transition: color 0.15s;
}
.profile:hover .profile-name { color: var(--gold); }
.profile-sub {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.discord-status .dot {
  width: 9px;
  height: 9px;
  flex: none;
  border-radius: 50%;
  border: 1.5px solid var(--muted);
}
.discord-status[data-status="online"] .dot { background: var(--gold); border-color: var(--gold); }
.discord-status[data-status="idle"] .dot { background: var(--gold-soft); border-color: var(--gold-soft); }
.discord-status[data-status="dnd"] .dot { background: #B3202E; border-color: #B3202E; }
[hidden] { display: none !important; }

/* Game cards: art with a live badge, then title, role and numbers */
.game-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1.25rem, 3vw, 2rem);
  margin-top: clamp(2.5rem, 6vw, 4rem);
}

.game {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--gold-line);
  outline: 1px solid var(--gold-faint);
  outline-offset: -7px;
  border-radius: 12px;
  background: radial-gradient(ellipse 120% 100% at 50% 40%, var(--panel-hi), var(--panel-lo));
  padding: 10px;
}

.game-art {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  overflow: hidden;
  background: var(--panel-lo);
}
.game-art img,
.game-art svg {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pill {
  position: absolute;
  left: 0.75rem;
  bottom: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.78);
  border: 1px solid var(--gold-faint);
  color: var(--ivory);
  font-size: 0.875rem;
  font-weight: 600;
}
.pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid var(--muted);
}
.pill.is-live .dot { background: var(--gold); border-color: var(--gold); }
.pill.badge {
  left: auto;
  right: 0.75rem;
  bottom: auto;
  top: 0.75rem;
  background: var(--gold);
  border-color: var(--gold);
  color: var(--black);
}

.game-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 1rem 0.9rem 0.4rem;
}
.game h3 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 700;
  font-variation-settings: "opsz" 18;
  font-size: clamp(1.6rem, 2.4vw, 2.1rem);
  line-height: 1.1;
}
.game h3 a { text-decoration: none; transition: color 0.15s; }
.game h3 a:hover { color: var(--gold); }
.game-role {
  margin: 0.35rem 0 0;
  color: var(--ivory);
  font-weight: 600;
}
.game-stats {
  margin: 0.15rem 0 0;
  color: var(--muted);
}

.game-links {
  list-style: none;
  margin: auto 0 0;
  padding: 0.5rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.4rem;
}
.game-links .text-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

@media (max-width: 800px) {
  .game-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .profiles { grid-template-columns: 1fr; }
  .profile + .profile { border-left: 0; border-top: 1px solid var(--gold-faint); }
}

/* Scrolling deals each panel onto the table like a thrown card */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }

  @supports (animation-timeline: view()) {
    .deal-in {
      animation: deal-left linear both;
      animation-timeline: view();
      animation-range: entry 0% cover 38%;
    }
    .deal-in.from-right { animation-name: deal-right; }
  }
}

@keyframes deal-left {
  from { opacity: 0; transform: translate(-28vw, 12vh) rotate(-11deg); }
  to   { opacity: 1; transform: none; }
}
@keyframes deal-right {
  from { opacity: 0; transform: translate(28vw, 12vh) rotate(11deg); }
  to   { opacity: 1; transform: none; }
}
