/* ============================================================
   Manah Sibernetika
   Wordmark font: "Adelphe Trouble" (Germinal Regular) —
   Typothèque Bye Bye Binary, CUTE licence:
   https://typotheque.genderfluid.space/fr/fontes/adelphe-trouble
   Body text: the browser's default serif.
   Mobile-first: single scrolling column; the two-halves layout
   (only the right half scrolls) applies from 821px up.
   ============================================================ */

@font-face {
  font-family: "Adelphe Trouble";
  src: url("fonts/Adelphe-Trouble-GerminalRegular.woff2") format("woff2"),
       url("fonts/Adelphe-Trouble-GerminalRegular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #ffffff;
  --fg: #000000;
  --line: var(--fg);
  --faint: rgba(0, 0, 0, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --fg: #ffffff;
    --faint: rgba(255, 255, 255, 0.09);
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  background: var(--bg);
  color: var(--fg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: serif;
  font-size: 17px;
  line-height: 1.55;
}

a { color: inherit; }

/* ---------- layout: single column (mobile default) ---------- */

.left {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1.5rem 2rem;
  /* svh, not dvh: iOS Safari resizes dvh as the address bar collapses,
     which reflows the page mid-scroll and makes scrolling feel broken */
  min-height: 92svh;
}

.right-inner {
  padding: 2.5rem 1.25rem 3rem;
  width: 100%;
  max-width: 44rem;
  margin: 0 auto;
}

/* ---------- two halves from tablet/desktop up ---------- */

@media (min-width: 821px) {
  .page {
    display: grid;
    grid-template-columns: 11fr 9fr;
    height: 100dvh;
    overflow: hidden;
  }

  .left {
    min-height: 0;
    padding: 2rem;
  }

  .right {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
  }

  /* main.js pins .right-inner's top margin so short content starts
     centered but expansion only grows downwards */
  .right-inner {
    margin: 0;
    padding: 3rem clamp(1.5rem, 5vw, 4rem);
    align-self: center;
  }
}

/* ---------- left half ---------- */

.logo {
  width: min(92%, 460px);
  height: auto;
}

@media (min-width: 821px) {
  .logo { width: min(84%, 63svh * 0.764, 640px); }
}

@media (prefers-color-scheme: dark) {
  .logo { filter: brightness(0.88); }
}

.wordmark {
  font-family: "Adelphe Trouble", Georgia, serif;
  font-weight: 400;
  font-size: clamp(2.1rem, 4.3vw, 3.6rem);
  margin-top: 1.4rem;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  white-space: nowrap;
}

.wordmark span { display: inline-block; }

.wordmark.animating span.glyph {
  position: absolute;
  left: 0;
  top: 0;
  will-change: transform;
}

.ouro-heart {
  position: absolute;
  left: 0;
  top: 0;
  font-size: 2rem;
  line-height: 1;
  pointer-events: none;
  z-index: 3;
}

/* ---------- right half ---------- */

.artifacts-header {
  font-weight: 700;
  font-size: 1.55rem;
  margin-bottom: 1.6rem;
}

/* classic table: full grid lines */
.projects {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
}

.projects th, .projects td {
  border: 1px solid var(--line);
  padding: 0.55rem 0.8rem;
}

.projects thead th {
  font-weight: 700;
}

.projects .col-no   { text-align: right; width: 3.8rem; }
.projects .col-name { text-align: left; }
.projects .col-year { text-align: center; width: 5.5rem; }

.projects tbody tr.project-row { cursor: pointer; }

/* hover-capable devices only — iOS makes :hover stick after a tap */
@media (hover: hover) {
  .projects tbody tr.project-row:hover { background: var(--faint); }
}

/* row stays grey while its description is open */
.projects tbody tr.project-row.active { background: var(--faint); }

.projects .col-name a {
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.projects .col-name a:hover { opacity: 0.65; }

.projects tr.detail-row { display: none; }
.projects tr.detail-row.open { display: table-row; }

.projects tr.detail-row td {
  padding: 0.9rem 0.8rem 1.1rem;
  font-size: 0.95rem;
}

.projects .detail-desc { margin-bottom: 0.75rem; }

.soon {
  margin-top: 2rem;
  font-size: 1rem;
}

.contact {
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: 1rem;
}

.contact p + p { margin-top: 0.5rem; }

.contact a {
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.contact a:hover { opacity: 0.65; }

/* ---------- boxed buttons / modals ---------- */

.box-btn {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--fg);
  padding: 0.4rem 1.1rem;
  cursor: pointer;
}

.box-btn:hover { background: var(--fg); color: var(--bg); }

.modal-wrap {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  z-index: 20;
}

.modal-box {
  background: var(--bg);
  border: 1px solid var(--fg);
  padding: 1.6rem 2rem;
  text-align: center;
}

.modal-title { font-weight: 700; letter-spacing: 0.06em; }
.modal-sub { margin-top: 0.5rem; }
.modal-btns { margin-top: 1.2rem; display: flex; gap: 0.8rem; justify-content: center; }

[hidden] { display: none !important; }

/* ---------- snake game: windowed modal over the site ---------- */

.snake-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom));
  touch-action: none;
}

.snake-modal {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--fg);
  display: flex;
  flex-direction: column;
  width: 100%;
  height: min(85svh, 640px);
}

@media (min-width: 821px) {
  .snake-modal {
    width: min(860px, 92vw);
    height: min(78svh, 640px);
  }
}

.snake-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--line);
}

.snake-score { font-weight: 700; }

.snake-close { padding: 0.25rem 0.7rem; }

.snake-layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

@media (min-width: 821px) {
  .snake-layout { flex-direction: row; }
}

.snake-canvas-wrap {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#snakeCanvas {
  border: 1px solid var(--line);
  max-width: 100%;
  max-height: 100%;
}

.dpad {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem;
}

.dpad-mid { display: flex; gap: 3.2rem; }

.dpad-btn {
  font-family: inherit;
  font-size: 1.1rem;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--fg);
  width: 3rem;
  height: 3rem;
  cursor: pointer;
  touch-action: manipulation;
}

.dpad-btn:hover { background: var(--fg); color: var(--bg); }

/* game-over covers only the snake modal, not the whole screen */
.game-over-wrap { position: absolute; }
