:root {
  --bg: #f3efe6;
  --ink: #141414;
  --ink-soft: #4b4b44;
  --card-bg: #ffffff;
  --border: #ddd7c8;
  --accent: #ffd666;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(20, 20, 20, 0.04), 0 6px 16px rgba(20, 20, 20, 0.07);
  --shadow-hover: 0 10px 24px rgba(20, 20, 20, 0.12);
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: "Rubik", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 24px 20px 40px;
}

/* ---------- header ---------- */

.site-header {
  padding: 16px 0 36px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

.title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.logo {
  font-size: clamp(3rem, 12vw, 5.5rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.logo-dot {
  display: inline-block;
  width: 0.3em;
  height: 0.3em;
  margin-inline-start: 0.05em;
  border-radius: 0.095em;
  background: var(--accent);
  cursor: pointer;
  translate: 0 0;
  transition: translate 300ms cubic-bezier(0.34, 1.56, 0.64, 1),
    width 300ms ease, height 300ms ease, border-radius 300ms ease;
}

.logo-dot.dot-rect {
  width: 0.72em;
  height: 0.72em;
  border-radius: 0.22em;
  translate: 0 0;
}

/* the dot swallowing the screen on the way into the game */
.dot-grow {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  transition: left 550ms cubic-bezier(0.65, 0, 0.35, 1),
    top 550ms cubic-bezier(0.65, 0, 0.35, 1),
    width 550ms cubic-bezier(0.65, 0, 0.35, 1),
    height 550ms cubic-bezier(0.65, 0, 0.35, 1),
    border-radius 550ms cubic-bezier(0.65, 0, 0.35, 1),
    opacity 350ms ease;
}

.dot-grow.expand {
  left: 0 !important;
  top: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  border-radius: 0 !important;
}

.dot-grow.fade {
  opacity: 0;
}

.logo-dot.wiggle {
  animation: dot-jump 600ms ease-in-out;
}

@keyframes dot-jump {
  0%, 100% { transform: none; }
  30% { transform: translateY(-0.3em); }
  55% { transform: translateY(0); }
  75% { transform: translateY(-0.12em); }
  90% { transform: translateY(0); }
}

.tagline {
  display: inline-block;
  margin-top: 8px;
  margin-inline-start: -14px;
  font-family: inherit;
  font-size: clamp(1.125rem, 5vw, 1.35rem);
  color: var(--ink-soft);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 14px;
  border-radius: 999px;
}

.tagline:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.tagline.wiggle {
  animation: tagline-wiggle 600ms ease-in-out;
}

@keyframes tagline-wiggle {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-3deg); }
  40% { transform: rotate(3deg); }
  60% { transform: rotate(-2deg); }
  80% { transform: rotate(2deg); }
}

/* ---------- project grid ---------- */

main {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}

.projects {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 600px) {
  .projects {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .projects {
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
  }
}

.card {
  display: block;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform 250ms cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 250ms ease;
}

.card[dir="ltr"] {
  text-align: left;
}

.card:hover {
  transform: translateY(-4px) rotate(-0.6deg);
  box-shadow: var(--shadow-hover);
}

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

.card-thumb {
  aspect-ratio: 2 / 1;
  width: 100%;
  display: block;
  object-fit: cover;
}

.card-thumb-placeholder {
  aspect-ratio: 2 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.card-thumb-placeholder span {
  font-size: 3rem;
  font-weight: 900;
  transform: rotate(-6deg);
  color: rgba(20, 20, 20, 0.55);
  transition: transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.card:hover .card-thumb-placeholder span {
  transform: rotate(4deg) scale(1.1);
}

.card-body {
  padding: 16px 18px 20px;
}

.card-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.card-desc {
  margin-top: 4px;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

/* ---------- footer ---------- */

.site-footer {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding-top: 48px;
  text-align: center;
}

.socials {
  display: flex;
  gap: 0;
  align-items: center;
}

.socials a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--ink);
  transition: color 200ms ease, transform 200ms ease;
}

.socials a:hover {
  color: var(--accent);
  transform: translateY(-3px) rotate(-4deg);
}

.socials a:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.socials svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.footer-note {
  font-size: 0.85rem;
  color: var(--ink-soft);
  white-space: pre-line;
  line-height: 1.6;
}

/* ---------- ambient swirl ---------- */

.ambient-swirl {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
  opacity: 0.6;
}

.ambient-swirl path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 22 100;
  stroke-dashoffset: 22;
}

/* ---------- EATTHEDOT mini game ---------- */

.game {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.game[hidden],
.game-menu[hidden],
.game-play[hidden],
.game-over[hidden] {
  display: none;
}

body.game-open {
  overflow: hidden;
}

.game-menu,
.game-over {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 20px;
}

.game-title {
  direction: ltr;
  font-size: clamp(2.4rem, 10vw, 5rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  text-align: center;
}

.game-title .accent {
  color: var(--accent);
}

.game-final-score {
  font-size: 1.4rem;
  font-weight: 700;
}

.game-btn {
  font-family: inherit;
  font-weight: 700;
  font-size: 1.15rem;
  padding: 14px 36px;
  border: none;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  cursor: pointer;
  transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.game-btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 3px solid var(--ink);
  margin-top: -14px;
}

.game-btn:hover {
  transform: translateY(-2px) rotate(-1deg);
}

.game-btn:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

.game-play {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  min-height: 0;
}

.game-hud {
  font-weight: 700;
  text-align: center;
}

.game-board {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.game-board canvas {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.game-dpad {
  display: none;
}

@media (hover: none) and (pointer: coarse) {
  .game-dpad {
    display: grid;
    direction: ltr; /* keep left/right buttons on their physical sides in RTL */
    grid-template-areas:
      ". up ."
      "left down right";
    gap: 10px;
    justify-content: center;
    padding: 4px 0 12px;
  }

  .game-dpad button {
    width: 66px;
    height: 54px;
    font-size: 1.2rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--card-bg);
    color: var(--ink);
    touch-action: manipulation;
    box-shadow: var(--shadow);
  }

  .game-dpad button:active {
    background: var(--accent);
  }

  .dpad-up { grid-area: up; }
  .dpad-left { grid-area: left; }
  .dpad-down { grid-area: down; }
  .dpad-right { grid-area: right; }
}

/* ---------- motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
