/* maxen.fun — shared styles for every page */

:root {
  --bg: #111113;
  --fg: #F4F4F5;
  --text: #D4D4D8;
  --muted: #A1A1AA;
  --faint: #8A8A93;
  --slot: #16161A;
  --slot-edge: #202025;
  --chip-edge: #2E2E35;
  --chip-hover: #1C1C20;
  --me-bg: #BDBDC4;   /* sent bubbles + "copied": light, but not glaring white */
  --me-fg: #111113;
  --sent-bg: #0B6CF2;  /* your replies on /about: message blue, white text stays readable */
  --sent-fg: #FFFFFF;
  --ok: #34C759;       /* "copied" on /contact */
  --display: 'Schibsted Grotesk', 'Helvetica Neue', Arial, sans-serif;
  --body: 'Bricolage Grotesque', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
/* everything is sized in rem, so the whole site scales with the screen:
   on computers it's 90% of the original size (laptops 1280px wide), growing on big monitors */
html { font-size: clamp(14.4px, 1.125vw, 21.6px); }   /* 90% of the old size, like zooming the browser out to 90% */
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
a { color: var(--fg); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }
/* touchscreens: no white focus rings left behind after a tap (keyboards on computers keep them) */
@media (hover: none) and (pointer: coarse) {
  a:focus, a:focus-visible, button:focus, button:focus-visible, .contact-link:focus-visible { outline: none !important; }
}

/* page frame: header on top, content, footer pinned to the bottom */
.page {
  min-height: 100%;
  padding-inline: clamp(1rem, 8vw, 7.5rem);
  padding-block: 3.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.5rem;
}

header { margin-bottom: 1.25rem; }
/* the whole title block is one link home */
.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  margin: -0.5rem -1rem;
  padding: 0.5rem 1rem;
  border-radius: 0.75rem;
  text-align: center;
  text-decoration: none;
  color: inherit;
}
.site {
  margin: 0;
  font-family: var(--display);
  font-size: 1.75rem;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg);
  text-decoration: none;
}
.tagline { margin: 0; font-size: 0.9375rem; color: var(--muted); }

footer {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  /* sized to undo the 90% zoom, so the footer stays its original size on computers */
  gap: 0.2778rem 1.6667rem;
  font-size: 0.9722rem;
}
footer a { color: var(--muted); text-decoration: none; padding: 0.8333rem 0; transition: color .18s ease-in-out; }
footer a:hover, footer a:focus-visible { color: var(--fg); }
footer a[aria-current="page"] { color: var(--fg); }

/* ---------- home: game grid ---------- */
.games {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 3rem 1.5rem;
  width: 100%;
  max-width: 55rem;
}
.game, .slot {
  flex: 0 1 calc((100% - 3rem) / 3);
  min-width: min(100%, 16.25rem);
}
.game { display: flex; flex-direction: column; gap: 0.75rem; }
/* only the thumbnail is a link */
a.tile {
  display: block;
  -webkit-tap-highlight-color: transparent;   /* no grey box flash on phones */
  outline: 2px solid transparent;
  outline-offset: 0;
  transition: transform 180ms ease-in-out;
}
/* hover (computers only): the picture lifts a hair, with the same 180ms ease as the footer links */
@media (hover: hover) and (min-width: 641px) {
  a.tile:hover { transform: translateY(-3px); }
  .game a.tile:active { transform: translateY(-1px) scale(0.97); }
}
/* keyboard: a white ring so you can see which game is selected */
a.tile:focus-visible { outline-color: var(--fg); outline-offset: 0; }
/* tap / click feedback: a quick press-in */
a.tile:active { transform: scale(0.97); }

.tile {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 34 / 23;
  border-radius: 1.25rem;
}
.thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.game-text { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.game-name { font-family: var(--display); font-size: 0.9375rem; font-weight: 600; color: var(--fg); }
.game-desc { font-size: 0.8125rem; color: var(--muted); }

.slot .tile { background: var(--slot); }
.slot .tile { border: 1px solid var(--slot-edge); }
/* "more soon" only shows on phones, where the empty slots are hidden */
.more-soon { display: none; margin: 0; font-size: 0.875rem; color: var(--faint); text-align: center; }

/* ---------- about + contact: text column ---------- */
main { width: 100%; max-width: 35rem; display: flex; flex-direction: column; gap: 2rem; }
.intro { display: flex; flex-direction: column; gap: 0.25rem; }
.intro h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.intro p { margin: 0; font-size: 0.875rem; color: var(--muted); }

.lede { display: flex; flex-direction: column; font-size: 1rem; line-height: 1.6; color: var(--text); }
.lede p { margin: 0; }

/* about: chat */
.chat { display: flex; flex-direction: column; gap: 1rem; min-width: 0; font-size: 1rem; line-height: 1.6; color: var(--text); }
.typing { align-self: flex-start; display: flex; align-items: baseline; gap: 1px; }
.dot { display: inline-block; animation: hop 0.6s linear infinite; }
.dot:nth-child(2) { animation-delay: .1s; }
.dot:nth-child(3) { animation-delay: .2s; }
@keyframes hop {
  0%, 50%, 100% { transform: translateY(0); }
  20% { transform: translateY(-0.375rem); }
}
.msg {
  align-self: flex-start;
  max-width: 85%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  animation: fadeUp .18s ease-out;
}
.msg + .msg, .msg + .typing { margin-top: -0.75rem; }
.msg p { margin: 0; overflow-wrap: anywhere; }

.sent { align-self: flex-end; max-width: 85%; display: flex; flex-direction: column; align-items: flex-end; gap: 0.25rem; }
.me {
  max-width: 100%;
  padding: 0.5rem 0.875rem;
  border-radius: 1.125rem 1.125rem 0.375rem 1.125rem;
  background: var(--sent-bg);
  border: 1px solid var(--sent-bg);
  color: var(--sent-fg);
  font-size: 0.9375rem;
  line-height: 1.5;
  animation: meIn .3s ease-in-out;
}
.receipt { font-size: 0.75rem; line-height: 1.3; color: var(--faint); padding-right: 0.375rem; animation: fadeIn .18s ease-out; }

.choices { display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem; animation: fadeUp .35s ease-in-out; }
.choice {
  min-height: 2.5rem;
  padding: 0.5rem 0.875rem;
  border-radius: 999px;
  border: 1px solid var(--chip-edge);
  background: transparent;
  color: var(--text);
  font: 400 0.9375rem var(--body);
  cursor: pointer;
  transition: background .18s ease-in-out, color .18s ease-in-out, border-color .18s ease-in-out;
}
.choice:hover, .choice:focus-visible { background: var(--chip-hover); color: var(--fg); border-color: #3A3A42; }

@keyframes meIn {
  from { background: transparent; color: var(--text); border-color: var(--chip-edge); border-radius: 1.25rem; }
  to { background: var(--sent-bg); color: var(--sent-fg); border-color: var(--sent-bg); border-radius: 1.125rem 1.125rem 0.375rem 1.125rem; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(0.25rem); } to { opacity: 1; transform: none; } }

/* contact: list */
.links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.25rem; }
.link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.875rem;
}
/* icon + text are one link; hovering either underlines the text */
.contact-link {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  min-width: 0;
  justify-self: start;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.contact-link:focus-visible { outline: 2px solid var(--fg); outline-offset: 4px; border-radius: 0.5rem; }
.icon { flex-shrink: 0; display: block; width: 1.75rem; height: 1.75rem; }
.icon img {
  display: block;
  width: 100%;
  height: 100%;
  /* the icon files are black; this turns them light grey, and white on hover */
  filter: invert(0.82);
  transition: filter .18s ease-in-out;
}
.handle {
  min-width: 0;
  font-size: 1rem;
  color: var(--text);
  overflow-wrap: anywhere;
  text-decoration: underline transparent;
  text-underline-offset: 0.22em;
  text-decoration-thickness: 1px;
  transition: text-decoration-color .18s ease-in-out, color .18s ease-in-out;
}
.contact-link:hover .handle, .contact-link:focus-visible .handle { color: var(--fg); text-decoration-color: currentColor; }
.contact-link:hover .icon img, .contact-link:focus-visible .icon img { filter: invert(1); }
.copy {
  min-height: 2rem;
  min-width: 4.5rem;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--chip-edge);
  background: transparent;
  color: var(--muted);
  font: 400 0.875rem var(--body);
  cursor: pointer;
  transition: background .18s ease-in-out, color .18s ease-in-out, border-color .18s ease-in-out;
}
.copy:hover, .copy:focus-visible { background: var(--chip-hover); color: var(--fg); border-color: #3A3A42; }
.copy.done, .copy.done:hover, .copy.done:focus-visible { background: transparent; color: var(--ok); border-color: var(--ok); }

/* phones: games become a list — square icon on the left, name + description beside it */
@media (max-width: 640px) {
  html { font-size: 16px; }   /* phones keep their original size */
  .page { padding: 2.5rem 1rem 1.5rem; gap: 2.25rem; }
  footer { font-size: 0.9375rem; column-gap: 2rem; }
  footer a { padding-block: 0.8125rem; }
  header { margin-bottom: 0; }
  .site { font-size: 2.125rem; }
  .tagline { font-size: 1rem; }

  .games { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 0.25rem; width: calc(100% + 1.25rem); margin-inline: -0.625rem; }
  .slot { display: none; }
  /* no white outline around the icon on phones, even on phones that report a mouse-style hover */
  a.tile, a.tile:hover, a.tile:focus, a.tile:focus-visible { outline: none; }
  .game {
    position: relative;               /* the whole row is tappable (see a.tile::after) */
    flex-direction: row;
    align-items: center;
    gap: 0.875rem;
    min-width: 0;
    padding: 0.625rem;
    border-radius: 1.375rem;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 80ms ease-out;
  }
  .game:active { background-color: var(--chip-hover); }
  a.tile { position: static; overflow: visible; flex-shrink: 0; width: 4.75rem; aspect-ratio: 1 / 1; }
  a.tile::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
  a.tile:active { transform: none; }
  /* square crop; a game can pick which part shows with style="--focus: x% y%" on its image */
  .thumb { position: static; border-radius: 1.125rem; object-position: var(--focus, 50% 50%); transition: transform 80ms ease-out; }
  .game:active .thumb { transform: scale(0.96); }
  .game-text { flex: 1; min-width: 0; align-items: flex-start; text-align: left; }
  .game-name { font-size: 1.0625rem; }
  .game-desc { font-size: 0.875rem; }

  /* last row: an empty icon + "more soon" */
  /* about + contact only (home has no <main>): extra breathing room at the sides */
  main { padding-inline: 1rem; }
  .wide-only { display: none; }   /* text that only shows on computers */

  .more-soon { display: flex; align-items: center; gap: 0.875rem; padding: 0.625rem; text-align: left; }
  .more-soon::before { content: ""; flex-shrink: 0; width: 4.75rem; height: 4.75rem; box-sizing: border-box; border-radius: 1.125rem; background: var(--slot); border: 1px solid var(--slot-edge); }
}

/* phones and touchscreens: tag games that need a mouse/keyboard */
@media (max-width: 640px), (hover: none) and (pointer: coarse) {
  .game.pc-only .game-name::after {
    content: "pc only";
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.125rem 0.4375rem;
    border-radius: 0.375rem;
    background: #26262C;
    color: var(--muted);
    font: 600 0.6875rem/1.4 var(--body);
    vertical-align: 0.15em;
  }
}

/* "needs a computer" sheet, slides up from the bottom on phones */
.pc-warning {
  width: 100%;
  max-width: 30rem;
  margin: auto auto 0;
  padding: 1.5rem 1.25rem 1.25rem;
  border: 0;
  border-radius: 1.5rem 1.5rem 0 0;
  background: #1C1C20;
  color: var(--fg);
  font-family: var(--body);
}
.pc-warning[open] { animation: sheetUp 160ms ease-out; }
.pc-warning::backdrop { background: rgba(0, 0, 0, 0.6); }
.pc-warning-title { margin: 0; font: 700 1.1875rem/1.25 var(--display); letter-spacing: -0.01em; }
.pc-warning-text { margin: 0.375rem 0 0; font-size: 0.9375rem; line-height: 1.45; color: var(--muted); }
.pc-warning-actions { display: flex; gap: 0.5rem; margin-top: 1.25rem; }
.pc-back, .pc-go {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  border-radius: 999px;
  font: 600 0.9375rem var(--body);
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pc-back { border: 1px solid var(--chip-edge); background: transparent; color: var(--text); }
.pc-go { border: 1px solid var(--me-bg); background: var(--me-bg); color: var(--me-fg); }
.pc-back:active, .pc-go:active { transform: scale(0.97); }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }

/* movement is small; under "reduce motion" swap slides for plain fades */
@media (prefers-reduced-motion: reduce) {
  .msg, .choices { animation-name: fadeIn; }
  .pc-warning[open] { animation: none; }
}

/* touchscreens: a tap can leave an element "hovered"; keep everything in its normal look instead */
@media (hover: none) and (pointer: coarse) {
  footer a:hover { color: var(--muted); }
  footer a[aria-current="page"]:hover { color: var(--fg); }
  .choice:hover { background: transparent; color: var(--text); border-color: var(--chip-edge); }
  .copy:not(.done):hover { background: transparent; color: var(--muted); border-color: var(--chip-edge); }
  .contact-link:hover .handle { color: var(--text); text-decoration-color: transparent; }
  .contact-link:hover .icon img { filter: invert(0.82); }
}
