/* ictpo.me — the world selector (home page).
   A light paper canvas with ink linework; every bit of color lives inside the
   worlds, so each project's own palette is the loudest thing on the screen. */

@view-transition { navigation: auto; }

:root {
  --paper: #F4EFE4;
  --paper-2: #EAE2D1;
  --ink: #1C1A17;
  --ink-soft: #5B554C;
  --ink-faint: #8C8578;
  --clawd: #EB643A;          /* the site's one accent: Clawd's shell */
  --stroke: 2.5px;
  --display: 'Unbounded', 'Arial Black', sans-serif;
  --body: 'Instrument Sans', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --gutter: clamp(16px, 4vw, 48px);
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--paper); color: var(--ink); font-family: var(--body); font-size: 17px; line-height: 1.55; overflow-x: hidden; }
a { color: inherit; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px var(--gutter);
  background: rgba(244,239,228,0.9);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: var(--stroke) solid var(--ink);
}
.wordmark { display: inline-flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 800; font-size: 20px; letter-spacing: -0.02em; text-decoration: none; }
.wordmark svg { width: 34px; height: auto; }
.langs { display: flex; border: var(--stroke) solid var(--ink); border-radius: 999px; overflow: hidden; font-family: var(--mono); font-size: 13px; font-weight: 500; }
.langs a, .langs span { padding: 5px 12px; text-decoration: none; }
.langs [aria-current] { background: var(--ink); color: var(--paper); }
.langs span { color: var(--ink-faint); }

/* ---------- intro ---------- */
.hello { max-width: 1200px; margin: 0 auto; padding: clamp(56px, 10vh, 112px) var(--gutter) clamp(40px, 6vh, 64px); }
.hello .eyebrow { font-family: var(--mono); font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 18px; }
.hello h1 { font-family: var(--display); font-weight: 800; font-size: clamp(44px, 9vw, 112px); line-height: 0.95; letter-spacing: -0.04em; }
.hello h1 span + span { color: var(--clawd); }
.hello p { max-width: 560px; margin-top: 24px; font-size: 19px; color: var(--ink-soft); }

/* ---------- the worlds ---------- */
.worlds { display: flex; flex-direction: column; gap: clamp(72px, 11vh, 128px); padding: 32px var(--gutter) 120px; }
.world { width: min(84vw, 1200px); margin: 0 auto; }
@media (max-width: 720px) { .world { width: 100%; } }

.world-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }

/* The level badge: a diamond, like the world markers in a level select. */
.badge { position: relative; width: 46px; height: 46px; flex: none; display: grid; place-items: center; }
.badge::before { content: ''; position: absolute; inset: 7px; border: var(--stroke) solid var(--ink); background: var(--paper); transform: rotate(45deg); }
.badge b { position: relative; font-family: var(--display); font-weight: 800; font-size: 15px; }
.world:hover .badge::before, .world:focus-within .badge::before { background: var(--accent, var(--clawd)); }
.world:hover .badge b, .world:focus-within .badge b { color: #fff; }

.world-label { font-family: var(--mono); font-size: 13px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); }

/* The gateway card: a rounded window onto the world. */
.gate {
  display: block; position: relative;
  aspect-ratio: 21 / 9;
  border: var(--stroke) solid var(--ink);
  border-radius: 28px;
  overflow: hidden;
  background: var(--paper-2);
  box-shadow: 0 6px 0 var(--ink);
  transition: transform 0.25s cubic-bezier(.3,.7,.3,1), box-shadow 0.25s cubic-bezier(.3,.7,.3,1);
  text-decoration: none;
}
.gate:hover, .gate:focus-visible { transform: translateY(-4px); box-shadow: 0 10px 0 var(--ink); outline: none; }
.gate:active { transform: translateY(3px); box-shadow: 0 3px 0 var(--ink); }
.gate svg.slice { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.slice .layer { transition: transform 0.5s cubic-bezier(.2,.7,.3,1); }

/* "Entrar" tab on the card */
.gate .enter {
  position: absolute; right: 18px; bottom: 16px;
  font-family: var(--mono); font-size: 13px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase;
  background: var(--paper); color: var(--ink); border: var(--stroke) solid var(--ink); border-radius: 999px;
  padding: 7px 14px;
  transition: background .2s, color .2s;
}
.gate:hover .enter, .gate:focus-visible .enter { background: var(--ink); color: var(--paper); }

.world-text { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 40px; align-items: start; margin-top: 24px; }
.world-text h2 { font-family: var(--display); font-weight: 800; font-size: clamp(26px, 3.6vw, 40px); line-height: 1; letter-spacing: -0.03em; }
.world-text p { grid-column: 1; max-width: 620px; color: var(--ink-soft); }
.stack { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; max-width: 260px; list-style: none; }
.stack li { font-family: var(--mono); font-size: 12.5px; border: 1.5px solid var(--ink); border-radius: 999px; padding: 2px 10px; }
@media (max-width: 720px) {
  .gate { aspect-ratio: 5 / 4; border-radius: 22px; }
  .world-text { grid-template-columns: 1fr; }
  .stack { grid-column: 1; grid-row: auto; justify-content: flex-start; max-width: none; }
}

/* ---------- Clawd ---------- */
.clawd-bob { animation: bob 2.4s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes bob { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(0.97); } }
.clawd-eye { animation: blink 4.2s infinite; transform-box: fill-box; transform-origin: 50% 50%; }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(0.1); } }

/* Things in the worlds that move on their own, slowly */
.spin { animation: spin 80s linear infinite; transform-box: view-box; }
@keyframes spin { to { transform: rotate(360deg); } }
.drift { animation: drift 7s ease-in-out infinite alternate; }
@keyframes drift { to { transform: translateY(-10px); } }
.flicker { animation: flicker 2.6s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes flicker { 0%, 100% { transform: scale(1); opacity: .95 } 40% { transform: scale(1.08, 1.14); opacity: 1 } 70% { transform: scale(.94, .96); opacity: .85 } }
.sway { animation: sway 5s ease-in-out infinite; transform-box: view-box; }
@keyframes sway { 0%, 100% { transform: rotate(-2deg); } 50% { transform: rotate(2deg); } }

/* ---------- contact ---------- */
.contact { max-width: 1200px; margin: 0 auto; padding: 56px var(--gutter) 96px; border-top: var(--stroke) solid var(--ink); display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 24px; }
.contact .eyebrow { font-family: var(--mono); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.contact .mail { font-family: var(--display); font-weight: 800; font-size: clamp(24px, 4.6vw, 52px); letter-spacing: -0.03em; user-select: all; overflow-wrap: anywhere; margin-top: 8px; }
.contact small { font-family: var(--mono); font-size: 13px; color: var(--ink-faint); }

/* ---------- reveal once ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s ease, transform .7s cubic-bezier(.2,.7,.3,1); }
.reveal.seen { opacity: 1; transform: none; }

/* ---------- the zoom ---------- */
::view-transition-group(*) { animation-duration: 0.6s; animation-timing-function: cubic-bezier(0.7, 0, 0.2, 1); }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.35s; }

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  .clawd-bob, .clawd-eye, .spin, .drift, .flicker, .sway { animation: none; }
  .slice .layer, .gate { transition: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
}


/* ---------- the Clawd inside each world (posed by clawd-rig.js) ---------- */
.runner .eye { animation: blink 4.2s infinite; transform-box: fill-box; transform-origin: 50% 50%; }
@media (prefers-reduced-motion: reduce) { .runner .eye { animation: none !important; } }
