/* motastan.com: TUSoft palette, JetBrains Mono for identity and data, IBM Plex Sans for reading. */
@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/JetBrainsMonoNerdFont-Regular.woff2") format("woff2"),
    url("/assets/fonts/JetBrainsMonoNerdFont-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/assets/fonts/IBMPlexSans-Regular.woff2") format("woff2"),
    url("/assets/fonts/IBMPlexSans-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/assets/fonts/IBMPlexSans-SemiBold.woff2") format("woff2"),
    url("/assets/fonts/IBMPlexSans-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}

:root {
  --text: #192135;
  --muted: #555d71;
  --heading: #385eb4;
  --label: #a93d31;
  --surface: #ffffff;
  --page: #f5f7fa;
  --border: #dfe3ea;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #e6e9ef;
    --muted: #a7aebd;
    --heading: #8aa8ec;
    --label: #ef8b7f;
    --surface: #161b26;
    --page: #0d1118;
    --border: #2a3242;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  padding: 2rem 1rem;
  background: var(--page);
  color: var(--text);
  font: 400 1rem/1.6 var(--sans);
}

/* Two columns on wide screens: the card, and the self-assembling console. */
.layout {
  width: min(100%, 46rem);
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  align-items: stretch;
}

.stage { display: none; position: relative; min-height: 34rem; }
.stage .poster,
.stage .board {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.stage .poster { object-fit: contain; opacity: 0.85; transition: opacity 0.8s ease; }
.stage .board {
  opacity: 0;
  transition: opacity 0.8s ease;
  /* Close-ups fill the column; soft edges blend them into the page. */
  mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent), linear-gradient(to bottom, transparent, #000 8%, #000 92%, transparent);
  mask-composite: intersect;
}
.stage.ready .board { opacity: 1; }
/* After a finished game run the CV button glows in the brand colours for a moment. */
.button.glow { animation: cv-glow 1.5s ease-in-out 4; }
@keyframes cv-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(113, 161, 255, 0); }
  33% { box-shadow: 0 0 1.2rem 0.2rem rgba(248, 120, 104, 0.55); }
  66% { box-shadow: 0 0 1.2rem 0.2rem rgba(98, 189, 92, 0.55); }
}
.stage.playable .board { cursor: pointer; }
.stage.playing .board { cursor: default; }

/* The game runs here, out of sight; its picture is drawn on the console screen. */
.game-frame {
  position: fixed;
  top: 0;
  left: -10000px;
  width: 512px;
  height: 288px;
  border: 0;
  opacity: 0;
  pointer-events: none;
}
.stage.ready .poster,
.stage.loading .poster { opacity: 0; }

/* While the 3D model loads: the TUSoft mark inside a spinning RGB ring. */
.stage .loader {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
}
.stage.loading .loader { opacity: 1; }
.stage.ready .loader { opacity: 0; }
.loader .ring,
.loader .mark { grid-area: 1 / 1; }
.loader .mark { width: 4rem; height: auto; filter: drop-shadow(0 0.3rem 1rem rgba(56, 94, 180, 0.35)); }
.loader .ring {
  width: 7.5rem;
  height: 7.5rem;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #ff0000, #00ff00, #0000ff, #ff0000);
  mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
  animation: spin 1.1s linear infinite;
}
@keyframes spin { to { transform: rotate(1turn); } }

@media (min-width: 60rem) {
  .layout { width: min(100%, 78rem); grid-template-columns: minmax(0, 40rem) minmax(0, 1fr); }
  .stage { display: block; }
}

.card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: clamp(1.5rem, 5vw, 3rem);
}

.identity { display: flex; align-items: center; gap: 1.5rem; }

.photo {
  width: 7rem;
  height: 7rem;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
}

h1 {
  margin: 0;
  font: 400 clamp(1.5rem, 4vw, 2rem)/1.2 var(--mono);
  letter-spacing: -0.01em;
}

.stripe { display: flex; width: 12rem; height: 4px; margin: 0.6rem 0; }
.stripe span { flex: 1; }
.stripe span:nth-child(1) { background: #ff0000; }
.stripe span:nth-child(2) { background: #00ff00; }
.stripe span:nth-child(3) { background: #0000ff; }

.title { margin: 0; color: var(--heading); font: 400 1.05rem/1.4 var(--mono); }

.profile { margin: 1.75rem 0; }

.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.button {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  border: 1px solid var(--heading);
  border-radius: 0.5rem;
  color: var(--heading);
  font: 600 1rem/1.2 var(--sans);
  text-decoration: none;
}
.button.primary { background: var(--heading); color: var(--surface); }
.button:hover { filter: brightness(1.1); }
.button:focus-visible, a:focus-visible { outline: 3px solid var(--label); outline-offset: 2px; }

.meta { margin: 0.6rem 0 0; color: var(--muted); font: 400 0.85rem/1.4 var(--mono); }

.note { margin: 1rem 0 0; color: var(--muted); font-size: 0.95rem; }
.note a { color: var(--heading); }

/* Contacts: two label/value pairs per row, aligned in columns. */
.contacts {
  display: grid;
  grid-template-columns: max-content minmax(0, max-content) max-content minmax(0, 1fr);
  gap: 0.5rem 0.6rem;
  margin: 2rem 0 0;
  padding: 1.25rem 0 0;
  border-top: 1px solid var(--border);
  list-style: none;
  font: 400 0.9rem/1.5 var(--mono);
}
.contacts li { display: contents; }
.contacts li:nth-child(even) .label { margin-left: 1.4rem; }
.contacts .label { color: var(--label); }
.contacts a { color: var(--heading); overflow-wrap: anywhere; }

footer { color: var(--muted); font: 400 0.8rem/1.4 var(--mono); }

/* Music toggle: bottom-right corner, three bars that dance while playing. */
.music {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font: 400 0.8rem/1 var(--mono);
  cursor: pointer;
}
.music:hover { color: var(--text); border-color: var(--heading); }
.music:focus-visible { outline: 3px solid var(--label); outline-offset: 2px; }
.music[aria-pressed="true"] { color: var(--heading); border-color: var(--heading); }
.music .bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 0.8rem; }
.music .bars i { width: 3px; height: 30%; background: currentColor; border-radius: 1px; }
.music .bars i:nth-child(1) { background: #ff3b3b; }
.music .bars i:nth-child(2) { background: #2bd94a; }
.music .bars i:nth-child(3) { background: #4a6bff; }
.music[aria-pressed="true"] .bars i { animation: bar 0.9s ease-in-out infinite alternate; }
.music[aria-pressed="true"] .bars i:nth-child(2) { animation-delay: -0.3s; }
.music[aria-pressed="true"] .bars i:nth-child(3) { animation-delay: -0.6s; }
@keyframes bar { from { height: 25%; } to { height: 100%; } }
.music.waiting .bars i { animation: none; height: 60%; }
@media (prefers-reduced-motion: reduce) {
  .music[aria-pressed="true"] .bars i { animation: none; height: 70%; }
}

@media (max-width: 34rem) {
  .contacts { grid-template-columns: max-content minmax(0, 1fr); }
  .contacts li:nth-child(even) .label { margin-left: 0; }
  .identity { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .photo { width: 5.5rem; height: 5.5rem; }
}

/* Social profiles: a row of small outlined links under the contacts. */
.social { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 1.25rem 0 0; }
.social a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--heading);
  font: 400 0.8rem/1 var(--mono);
  text-decoration: none;
}
.social a:hover { border-color: var(--heading); }
/* The mono font sits high in its line box; lift the icon to the capital letters' centre. */
.social svg { display: block; flex: none; width: 1rem; height: 1rem; transform: translateY(-0.11em); }
footer a { color: inherit; }
