/*
  Medium-Rare Games
  The page reads top to bottom as a slice of steak: charred edge, crust,
  rare centre, bone. Bands meet in ordered dither, the technique used in
  the Algolemeth artwork. Colours are the logo's exact palette.
*/

:root {
  --char: #000000;
  --crust: #ff9932;
  --rare: #f12707;
  --bone: #f6d2ad;
  --flame: #00ccff;
  --white: #ffffff;

  --pixel: "DotGothic16", "MS Gothic", monospace;
  --body: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic", sans-serif;

  --gutter: clamp(16px, 4vw, 56px);
  --band-edge: 96px;
  --rule: 4px;
}

/* DotGothic16's Latin is fixed-width, which leaves holes around l and i in running English.
   Japanese pages keep it because a heavier Latin would stand out from the fine Japanese strokes. */
html[lang="en"] { --pixel: "Jersey 20", "DotGothic16", "MS Gothic", monospace; }

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--char);
  color: var(--char);
  font: 500 17px/1.85 var(--body);
  word-break: auto-phrase;
  overflow-wrap: break-word;
}

img { display: block; max-width: 100%; height: auto; }

a { color: inherit; text-underline-offset: 4px; text-decoration-thickness: 2px; }
a:hover { text-decoration-thickness: 4px; }
:focus-visible { outline: var(--rule) solid var(--focus, var(--char)); outline-offset: 3px; }

h1, h2, h3 { margin: 0; font-family: var(--pixel); font-weight: 400; line-height: 1.3; }
h2 { font-size: clamp(30px, 5vw, 52px); }
h3 { font-size: clamp(21px, 2.6vw, 26px); }
p { margin: 0; }
ul, ol { list-style: none; margin: 0; padding: 0; }
dl, dd { margin: 0; }
ruby rt { font-size: .42em; }

.skip {
  position: absolute;
  z-index: 10;
  left: 8px;
  top: -80px;
  padding: 8px 16px;
  background: var(--white);
  color: var(--char);
}
.skip:focus { top: 8px; }

/* Kept for search engines and screen readers where the artwork already shows the name. */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.wrap { width: min(100%, 1240px); margin-inline: auto; padding-inline: var(--gutter); }
.measure { max-width: 40em; }
.stack > * + * { margin-top: 1em; }
.sections > * + * { margin-top: 56px; }

/* ---- Bands ---- */

.band { position: relative; padding-block: 24px; }
.band--char { --focus: var(--flame); background: var(--char); color: var(--white); }
.band--crust { background: var(--crust); }
.band--rare { background: var(--rare); }
.band--bone { background: var(--bone); }

.edge {
  height: var(--band-edge);
  background-repeat: repeat-x;
  background-size: 24px var(--band-edge);
}
/* The background colour matches the band below, so fractional device pixels leave no seam. */
.edge--char-crust { background-color: var(--crust); background-image: url(../img/edge/char-crust.svg); }
.edge--char-rare { background-color: var(--rare); background-image: url(../img/edge/char-rare.svg); }
.edge--crust-bone { background-color: var(--bone); background-image: url(../img/edge/crust-bone.svg); }
.edge--rare-crust { background-color: var(--crust); background-image: url(../img/edge/rare-crust.svg); }
.edge--rare-char { background-color: var(--char); background-image: url(../img/edge/rare-char.svg); }
.edge--bone-char { background-color: var(--char); background-image: url(../img/edge/bone-char.svg); }

/* ---- Header ---- */

/* The emblem sits wholly on the black band, where its own black merges with the background. */
.site-head { --focus: var(--flame); background: var(--char); color: var(--white); }
.site-head .wrap { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding-block: 16px; }
/* Whole multiples of the 71x75 master keep every logo pixel the same size. */
.emblem, .foot-emblem { flex: none; width: 142px; }
.emblem a { display: block; }
.emblem img, .foot-emblem img { width: 100%; }

.nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 28px; font: 400 20px/1.4 var(--pixel); }
.nav a { display: block; padding-block: 4px; text-decoration: none; border-bottom: var(--rule) solid transparent; }
.nav a:hover, .nav a[aria-current="page"] { border-color: var(--flame); }

/* The strip uses the logo's 5x7 border tile, so it is drawn at a whole multiple of 7.
   The black below it separates the strip's pattern from the dither that follows. */
.meander { height: 28px; margin-bottom: 4px; background: url(../img/meander.svg) repeat-x center top / auto 28px; }

/* ---- Page title on inner pages ---- */

.page-title { padding-block: 40px 0; }
.page-title h1 { font-size: clamp(38px, 7vw, 84px); line-height: 1.15; }
.page-lead { margin-top: 16px; font: 400 clamp(19px, 2.4vw, 26px)/1.6 var(--pixel); }

/* ---- Sections ---- */

.section-head { margin-bottom: 28px; }
.section-head:not(:first-child) { margin-top: 40px; }
.section-note { margin-top: 12px; font-size: 15px; }

.art { width: 100%; }

.game-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 32px 56px;
  margin-top: 32px;
  align-items: start;
}
.tagline { margin-top: 12px; font: 400 clamp(24px, 3vw, 36px)/1.55 var(--pixel); text-wrap: balance; }
.visually-hidden + .tagline { margin-top: 0; }
.tagline + p { margin-top: 8px; }
/* Black on this red has half the contrast of black on the orange, so copy here is heavier and larger. */
.band--rare .tagline ~ p { font-size: 1.06em; font-weight: 700; }

.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 20px; }
.facts dt { font-weight: 700; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 20px 32px; margin-top: 28px; }
.cta {
  display: inline-block;
  padding: 16px 24px;
  background: var(--char);
  color: var(--white);
  font: 400 20px/1.3 var(--pixel);
  text-decoration: none;
  box-shadow: 8px 8px 0 var(--white);
}
.cta:hover { box-shadow: 8px 8px 0 var(--flame); }
.band--char .cta { background: var(--white); color: var(--char); box-shadow: 8px 8px 0 var(--rare); }
.band--char .cta:hover { box-shadow: 8px 8px 0 var(--flame); }
.more { font: 400 18px/1.6 var(--pixel); }

/* ---- News ---- */

.news-list li {
  display: grid;
  grid-template-columns: 7.5em minmax(0, 1fr);
  gap: 4px 24px;
  padding-block: 16px;
  border-top: var(--rule) solid currentColor;
}
.news-list time { font: 400 18px/1.85 var(--pixel); }
.news-title { font-weight: 700; }
.news-list .news-link { display: inline-block; margin-top: 2px; font-size: 15px; }
.news-more { margin-top: 12px; }

/* ---- Studio ---- */

.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px 72px; }
.two-col h3 { margin-bottom: 12px; }
.past li { display: flex; justify-content: space-between; gap: 16px; padding-block: 6px; }
.links li { padding-block: 4px; }

/* ---- Algolemeth features ---- */

.feature {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 24px 48px;
  align-items: center;
}
.feature + .feature { margin-top: 56px; }
/* Swapping sides swaps the columns too, so every screenshot keeps the same size. */
.feature:nth-of-type(even) { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.feature:nth-of-type(even) .feature-text { order: 2; }
.feature--text { display: block; max-width: 40em; }
.feature h3 { margin-bottom: 12px; }

.shots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.shots a { display: block; }

.press li {
  display: grid;
  grid-template-columns: 7.5em minmax(0, 1fr);
  gap: 2px 20px;
  padding-block: 8px;
}
.press time { font-family: var(--pixel); }
.awards li { padding-block: 6px; }

/* ---- Video ---- */

.video { position: relative; display: block; aspect-ratio: 16 / 9; background: var(--char); color: var(--white); text-decoration: none; }
.video img { width: 100%; height: 100%; object-fit: cover; }
.video-frame { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; background: var(--char); }
.video-label {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 14px 24px;
  background: var(--char);
  border: var(--rule) solid var(--white);
  font: 400 clamp(18px, 2.4vw, 24px)/1.3 var(--pixel);
  white-space: nowrap;
}
.video:hover .video-label { border-color: var(--flame); }

/* ---- Footer ---- */

.site-foot { padding-block: 40px 48px; }
.foot-grid { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 24px 48px; }
.foot-links a { color: var(--flame); }
.foot-links li { padding-block: 2px; }
.foot-copy { margin-top: 8px; }

/* ---- 404 ---- */

.notfound { padding-block: 8px 24px; }
.notfound > * + * { margin-top: 16px; }

/* ---- Small screens ---- */

@media (max-width: 960px) {
  .two-col { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
  :root { --band-edge: 64px; }
  body { font-size: 16px; }
  .edge { background-size: 16px var(--band-edge); }
  .site-head .wrap { gap: 16px; padding-block: 12px; }
  .emblem, .foot-emblem { width: 71px; }
  .nav { gap: 2px 16px; font-size: 17px; }
  .meander { height: 21px; margin-bottom: 3px; background-size: auto 21px; }
  .game-grid, .two-col, .feature, .shots { grid-template-columns: minmax(0, 1fr); }
  .feature + .feature { margin-top: 40px; }
  .feature:nth-of-type(even) { grid-template-columns: minmax(0, 1fr); }
  .feature:nth-of-type(even) .feature-text { order: 0; }
  .news-list li, .press li { grid-template-columns: minmax(0, 1fr); }
}

/* Four items do not fit beside the logo on a phone, so they pair up instead of leaving one alone. */
@media (max-width: 480px) {
  .nav { display: grid; grid-template-columns: auto auto; justify-content: end; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

@media print {
  .edge, .nav { display: none; }
}
