/* macemu — written for this site rather than inherited from the DOS one.
 *
 * The visual idea is Platinum: the Mac OS 8 appearance, which is what most
 * people picture when they picture an old Mac. Warm grey ground, off-white
 * "paper" panels with a hairline border and a highlight along the top edge,
 * one blue for selection and links, and square-ish corners. Nothing here uses
 * a gradient where a 1-pixel highlight would do, because that is how the real
 * thing was drawn.
 *
 * Type is the system stack rather than a webfont: nothing to download, and a
 * Mac visitor gets San Francisco, which is the closest living relative of the
 * fonts this site is about.
 */

:root {
  --bg: #d8d4cc;          /* the desktop grey, warmed */
  --bg-card: #f5f3ee;     /* paper */
  --bg-elev: #e7e3da;     /* title bars, table headers */
  --bg-sunk: #ddd9d0;

  --fg: #1a1916;
  --fg-dim: #5c584f;
  --muted: #6e695f;

  --accent: #2a4d9e;      /* the System 7 selection blue */
  --accent-hover: #17347a;
  --accent-soft: #e4e9f6;

  --border: #a9a396;      /* the hairline */
  --border-soft: #c6c0b3;
  --highlight: #ffffff;   /* the top-edge shine that makes Platinum Platinum */
  --shadow: rgba(40, 36, 28, 0.16);

  --good: #1d6b38;
  --good-bg: #e6f0e7;
  --bad: #9a2222;
  --bad-bg: #f7e8e6;
  --warn: #7a5c0c;
  --warn-bg: #fbf3dd;

  --radius: 5px;
  --measure: 68ch;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* The one rule that outranks a class setting display. The `hidden` attribute
 * loses to `.overlay { display:flex }` in the cascade, which once left a Play
 * overlay sitting on top of a perfectly good running Macintosh. */
[hidden] { display: none !important; }

a { color: var(--accent); text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-hover); }

h1, h2, h3 { line-height: 1.25; letter-spacing: -0.012em; font-weight: 650; }
h2 { font-size: 1.42rem; margin: 0 0 0.7rem; }
h3 { font-size: 1.1rem; margin: 1.6rem 0 0.5rem; }
p { margin: 0 0 1rem; }
p:last-child, ul:last-child, ol:last-child, table:last-child { margin-bottom: 0; }

code, kbd, pre { font-family: var(--mono); }
code { font-size: 0.9em; background: var(--bg-sunk); padding: 0.1em 0.34em; border-radius: 3px; }
pre {
  background: var(--bg-sunk); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 0.85rem 1rem; overflow-x: auto; font-size: 0.86rem;
}
pre code { background: none; padding: 0; }

kbd {
  font-size: 0.82em; padding: 0.14em 0.42em; background: var(--bg-elev);
  border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 3px;
  color: var(--fg); white-space: nowrap;
}

.muted { color: var(--muted); }
.small { font-size: 0.87rem; }
.center { text-align: center; }

/* ── header ─────────────────────────────────────────────────────────────── */
header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  box-shadow: inset 0 1px 0 var(--highlight), 0 1px 2px var(--shadow);
  padding: 1.7rem 1rem 1.1rem;
  text-align: center;
}

.brand { display: inline-flex; align-items: center; gap: 0.55rem; }
.brand h1 { font-size: 1.85rem; margin: 0; letter-spacing: -0.02em; font-weight: 700; }

/* The Happy Mac, as a mark rather than an image. */
.logo {
  display: inline-grid; place-items: center;
  width: 1.75rem; height: 1.75rem;
  background: var(--fg); color: var(--bg-card);
  border-radius: 4px; font-size: 1rem; line-height: 1;
}

.tagline { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.97rem; }

.site-nav {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 0.35rem 1.15rem; margin-top: 0.95rem;
}
.site-nav a {
  text-decoration: none; color: var(--fg-dim); font-size: 0.94rem;
  padding: 0.18rem 0.1rem; border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ── layout ─────────────────────────────────────────────────────────────── */
main {
  max-width: 62rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.breadcrumb { font-size: 0.88rem; color: var(--muted); margin-bottom: 1rem; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }

/* A card is a Platinum window: hairline border, white shine on the top edge,
 * a soft drop shadow. */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 var(--highlight), 0 1px 3px var(--shadow);
  padding: 1.5rem 1.65rem;
  margin-bottom: 1.15rem;
}
.prose .card > p,
.prose .card > ul,
.prose .card > ol { max-width: var(--measure); }
.card ul, .card ol { padding-left: 1.3rem; }
.card li { margin-bottom: 0.35rem; }

/* ── verdict and badges ─────────────────────────────────────────────────── */
.verdict {
  display: inline-block; vertical-align: 0.18em;
  font-size: 0.72rem; font-weight: 650; letter-spacing: 0.02em;
  padding: 0.2rem 0.55rem; border-radius: 999px;
  border: 1px solid transparent; white-space: nowrap;
}
.verdict.good { background: var(--good-bg); color: var(--good); border-color: #b9d3bd; }
.verdict.partial { background: var(--warn-bg); color: var(--warn); border-color: #ddc98a; }
.verdict.bad { background: var(--bad-bg); color: var(--bad); border-color: #e0b6b1; }

.badge-new, .badge-free {
  font-size: 0.6rem; font-weight: 700; letter-spacing: 0.04em;
  padding: 0.12rem 0.34rem; border-radius: 3px; vertical-align: 0.14em;
}
.badge-new { background: var(--accent); color: #fff; }
.badge-free { background: var(--good-bg); color: var(--good); border: 1px solid #b9d3bd; }

/* ── callouts ───────────────────────────────────────────────────────────── */
.free-note, .warn-box {
  padding: 0.8rem 1rem; border-radius: var(--radius);
  border: 1px solid; border-left-width: 3px; font-size: 0.94rem;
  margin: 1.1rem 0 0;
}
.free-note { background: var(--good-bg); border-color: #b9d3bd; border-left-color: var(--good); }
.warn-box { background: var(--warn-bg); border-color: #ddc98a; border-left-color: var(--warn); }

.download-box { background: var(--bg-elev); }

/* ── tables ─────────────────────────────────────────────────────────────── */
.spec-table, .compat-table, .controls-table {
  width: 100%; border-collapse: collapse; font-size: 0.93rem; margin: 0.4rem 0 0;
}
.spec-table th, .spec-table td,
.compat-table th, .compat-table td,
.controls-table th, .controls-table td {
  text-align: left; padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--border-soft); vertical-align: top;
}
.spec-table th { width: 8.5rem; font-weight: 600; color: var(--muted); }
.compat-table thead th { background: var(--bg-elev); border-bottom-color: var(--border); font-weight: 650; }
.controls-table td:first-child { width: 11rem; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
/* Wide tables scroll inside themselves rather than pushing the page sideways. */
.card > table { display: block; overflow-x: auto; }

.controls-panel { margin-top: 1.3rem; }
.controls-panel h3 { margin-top: 0; }

/* ── the player ─────────────────────────────────────────────────────────── */
.embed-stage {
  position: relative; width: 100%; margin: 1.2rem auto 0;
  background: #0c0c0c; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px var(--shadow);
}
.embed-console-wrap { display: grid; place-items: center; height: 100%; }
/* A 1991 Macintosh smoothed by the browser looks like a photograph of a
 * Macintosh. Keep the pixels. */
.embed-console-wrap canvas { image-rendering: pixelated; max-width: 100%; display: block; }

.embed-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.7rem;
  background: radial-gradient(ellipse at 50% 42%, #3b3b3b, #131313);
  color: #f2f0ec; text-align: center; padding: 1rem;
}
.embed-play {
  font: 650 1.02rem/1 var(--font);
  padding: 0.72rem 1.4rem; background: var(--accent); color: #fff;
  border: 0; border-radius: var(--radius); cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.22);
}
.embed-play:hover { background: var(--accent-hover); }
.embed-play:disabled { opacity: 0.6; cursor: progress; }
.embed-hint { margin: 0; font-size: 0.82rem; color: #c3bfb8; max-width: 38ch; }

.dos-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,0.14); }
.dos-progress-fill { height: 100%; width: 0; background: var(--accent); transition: width 0.25s ease; }

.app-shot { margin: 1.2rem 0 0; }
.app-shot img {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--border); border-radius: var(--radius);
  image-rendering: pixelated; background: #0c0c0c;
}
.app-shot figcaption { font-size: 0.85rem; color: var(--muted); margin-top: 0.45rem; }

/* ── the file dropzone ──────────────────────────────────────────────────── */
.dropzone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  background: var(--bg-elev); padding: 2rem 1rem; text-align: center;
  transition: border-color 0.15s, background 0.15s;
  margin: 1.2rem 0 0;
}
.dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.is-busy { opacity: 0.55; pointer-events: none; }
.dz-title { font-size: 1.12rem; font-weight: 650; margin: 0 0 0.25rem; }
.dz-sub { font-family: var(--mono); color: var(--muted); font-size: 0.82rem; margin: 0 0 1rem; word-spacing: 0.3em; }
.dz-buttons { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.9rem; margin: 0 0 0.5rem; }
.dz-note { margin: 0.6rem 0 0; }
.dz-status { min-height: 1.5em; margin: 0.8rem 0 0; }
.dz-stage:not(:empty) { margin-top: 1rem; }

.cta-btn {
  font: 650 0.98rem/1 var(--font);
  padding: 0.62rem 1.2rem; background: var(--accent); color: #fff;
  border: 0; border-radius: var(--radius); cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.22);
}
.cta-btn:hover { background: var(--accent-hover); }

.linklike {
  background: none; border: 0; padding: 0; font: inherit;
  color: var(--accent); text-decoration: underline; cursor: pointer;
}
.linklike:hover { color: var(--accent-hover); }

/* ── the grid ───────────────────────────────────────────────────────────── */
.poster-grid {
  list-style: none; padding: 0; margin: 1.1rem 0 0;
  display: grid; gap: 0.9rem;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
}
.poster-card {
  display: flex; flex-direction: column; height: 100%;
  text-decoration: none; color: inherit;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: inset 0 1px 0 var(--highlight), 0 1px 2px var(--shadow);
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.poster-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 4px 10px var(--shadow);
}
.pc-shot {
  display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  background: #111; image-rendering: pixelated;
}
.pc-placeholder {
  display: grid; place-items: center;
  font-size: 2.2rem; font-weight: 300; color: #8d8d8d;
  background: repeating-linear-gradient(45deg, #1d1d1d 0 6px, #202020 6px 12px);
}
.pc-byo .pc-shot { display: grid; place-items: center; font-size: 2rem; color: var(--muted); background: var(--bg-sunk); }
.pc-body { padding: 0.6rem 0.7rem 0.7rem; display: flex; flex-direction: column; gap: 0.2rem; }
.pc-title { font-weight: 600; font-size: 0.93rem; line-height: 1.3; }
.pc-play { font-size: 0.79rem; color: var(--accent); }

/* ── filter ─────────────────────────────────────────────────────────────── */
.grid-filter { margin-top: 0.9rem; }
.gf-search {
  width: 100%; max-width: 22rem; font: inherit; font-size: 0.94rem;
  padding: 0.48rem 0.7rem; border: 1px solid var(--border);
  border-radius: var(--radius); background: #fff; color: var(--fg);
}
.gf-search:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.gf-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.7rem; }
.chip {
  font: inherit; font-size: 0.83rem; cursor: pointer;
  padding: 0.26rem 0.65rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg-elev); color: var(--fg-dim);
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip-n { opacity: 0.66; font-variant-numeric: tabular-nums; }
.gf-empty { margin-top: 0.8rem; font-size: 0.9rem; color: var(--muted); }

/* ── link cards and lists ───────────────────────────────────────────────── */
.card-grid {
  display: grid; gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  margin-top: 0.9rem;
}
.link-card {
  display: block; text-decoration: none; color: inherit;
  padding: 0.85rem 1rem; background: var(--bg-elev);
  border: 1px solid var(--border-soft); border-radius: var(--radius);
  transition: border-color 0.12s, background 0.12s;
}
.link-card:hover { border-color: var(--accent); background: var(--accent-soft); }
.link-card strong { display: block; margin-bottom: 0.2rem; color: var(--accent); }
.link-card span { font-size: 0.88rem; color: var(--muted); }

.link-list { list-style: none; padding: 0; margin: 0.6rem 0 0; }
.link-list li {
  padding: 0.5rem 0; border-bottom: 1px solid var(--border-soft);
  display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: baseline;
}
.link-list li:last-child { border-bottom: 0; }

/* ── FAQ ────────────────────────────────────────────────────────────────── */
details {
  border-bottom: 1px solid var(--border-soft);
  padding: 0.15rem 0;
}
details:last-of-type { border-bottom: 0; }
summary {
  cursor: pointer; font-weight: 600; padding: 0.62rem 0;
  list-style: none; position: relative; padding-left: 1.3rem;
}
summary::-webkit-details-marker { display: none; }
summary::before {
  content: "›"; position: absolute; left: 0.25rem; top: 0.58rem;
  color: var(--accent); font-size: 1.1rem; line-height: 1;
  transition: transform 0.15s ease; transform-origin: 40% 55%;
}
details[open] summary::before { transform: rotate(90deg); }
summary:hover { color: var(--accent); }
details p { margin: 0 0 0.9rem; padding-left: 1.3rem; max-width: var(--measure); color: var(--fg-dim); }

/* ── footer ─────────────────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: inset 0 1px 0 var(--highlight);
  padding: 1.7rem 1rem 2.2rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
}
footer p { max-width: 60ch; margin-inline: auto; }
.footer-nav {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 0.3rem 1rem; margin: 0.9rem 0;
}
.footer-nav a { color: var(--fg-dim); text-decoration: none; }
.footer-nav a:hover { color: var(--accent); text-decoration: underline; }

/* ── the play and embed routes ──────────────────────────────────────────── */
.playbar {
  display: flex; gap: 1rem; align-items: center;
  padding: 0.45rem 0.9rem; background: #1b1a18; color: #b9b5ad;
  font: 0.85rem/1.4 var(--font);
}
.playbar a { color: #9db8ec; text-decoration: none; }
.playbar a:hover { text-decoration: underline; }
.playstage { flex: 1; display: flex; align-items: center; justify-content: center; }

.embedbar {
  position: absolute; bottom: 0; right: 0;
  font: 11px/1.6 var(--font); background: rgba(0,0,0,0.6); padding: 0 6px;
}
.embedbar a { color: #9db8ec; text-decoration: none; }

/* ── responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  body { font-size: 16px; }
  main { padding: 1rem 0.8rem 2.5rem; }
  .card { padding: 1.15rem 1.1rem; border-radius: 0; margin-inline: -0.8rem; border-left: 0; border-right: 0; }
  h2 { font-size: 1.28rem; }
  .spec-table th { width: auto; }
  .controls-table td:first-child { width: auto; }
  .poster-grid { grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); gap: 0.7rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .poster-card:hover { transform: none; }
}

/* Printing a page about software you cannot print from is a small joke worth
 * honouring: drop the chrome, keep the article. */
@media print {
  header, footer, .site-nav, .grid-filter, .embed-stage, .dropzone { display: none; }
  body { background: #fff; font-size: 11pt; }
  .card { border: 0; box-shadow: none; padding: 0; margin-bottom: 1rem; }
  a { color: #000; text-decoration: underline; }
}

/* ── the standalone player and embed routes ─────────────────────────────────
 * These two pages are all machine and no article, so they set their own page
 * frame. They used to carry an inline <style> block written before the
 * stylesheet had rules for them, which meant two definitions of the same
 * layout that quietly disagreed — and the disagreement put the stage on top of
 * its own Play button, so the button could not be clicked at all. */
body.is-play {
  margin: 0; min-height: 100vh; background: #0c0c0c; color: #c9c5bd;
  display: flex; flex-direction: column;
}
body.is-play .playstage {
  flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
/* The mount is a plain block; the stage inside it carries the aspect ratio.
 * Bounding BOTH dimensions is what keeps a 4:3 screen inside a wide short
 * window instead of overflowing past the bottom of the page. */
body.is-play #mac-embed { width: 100%; max-width: min(100%, 90vh * 4 / 3); }
/* margin:0 here would undo the `margin-inline:auto` that centres the screen,
 * leaving a 640-wide Macintosh pinned to the left of a 1080-wide mount. */
body.is-play .embed-stage { margin-inline: auto; max-width: 100%; max-height: calc(100vh - 6rem); }

body.is-embed { margin: 0; height: 100%; background: #0c0c0c; overflow: hidden; }
body.is-embed #mac-embed, body.is-embed .embed-stage { width: 100%; height: 100%; max-width: none; }
body.is-embed .embed-stage { border: 0; border-radius: 0; margin: 0; }

/* Badges sat inline with the title and wrapped onto their own line when a name
   was long, which made one card in a row read as taller than its neighbours.
   Give the title its own line and let the badges sit together under it. */
.pc-title { display: block; }
.pc-title .badge-new, .pc-title .badge-free { vertical-align: 0.1em; margin-right: 0.2rem; }

/* The one line a bring-your-own-copy page must not bury: this is not hosted,
   here is what the page does instead. */
.byo-lede {
  margin: 1.2rem 0 0;
  padding: 0.8rem 1rem;
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
}
