:root {
  color-scheme: dark;
  /* The same night wall as the project page, with tablets set into it. */
  --night: #0f2531;
  --night-deep: #0b1d27;
  --light: #efebe1;
  --light-muted: #b9c3bf;
  --gilt: #d9b674;
  --frame: #b18a50;
  --paper: #ece7da;
  --paper-deep: #dfd8c8;
  --ink: #1d2a2e;
  --muted: #4c5754;
  --gold: #7a6235;
  --art-aspect: 16 / 9;
  /* Gold tesserae on dark mortar, as the frames on the project page's wall are laid. */
  --tesserae: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24'><rect width='24' height='24' fill='%233a2d19'/><rect x='0.7' y='0.7' width='6.6' height='6.6' rx='.6' fill='%23b18a50'/><rect x='8.7' y='0.7' width='6.6' height='6.6' rx='.6' fill='%23c99d5c'/><rect x='16.7' y='0.7' width='6.6' height='6.6' rx='.6' fill='%23a5824a'/><rect x='0.7' y='8.7' width='6.6' height='6.6' rx='.6' fill='%23d8b571'/><rect x='8.7' y='8.7' width='6.6' height='6.6' rx='.6' fill='%23bf9455'/><rect x='16.7' y='8.7' width='6.6' height='6.6' rx='.6' fill='%23ad874d'/><rect x='0.7' y='16.7' width='6.6' height='6.6' rx='.6' fill='%23cfa766'/><rect x='8.7' y='16.7' width='6.6' height='6.6' rx='.6' fill='%23b79052'/><rect x='16.7' y='16.7' width='6.6' height='6.6' rx='.6' fill='%23c49a5a'/></svg>");
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --gutter: clamp(20px, 5vw, 72px);
  font: 400 16px / 1.55 var(--sans);
  color: var(--light);
  background: var(--night);
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(120% 70% at 50% 0%, #163646 0%, var(--night) 55%, var(--night-deep) 100%), var(--night); min-height: 100vh; }
button, input, select { font: inherit; }
button, a, select, input { -webkit-tap-highlight-color: transparent; }
button, select { color: inherit; }
button, a { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled, select:disabled { cursor: default; opacity: .42; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--gilt); outline-offset: 4px; }
button, a, select { transition: color .18s, background .18s, opacity .18s; }
[hidden] { display: none !important; }

.masthead, main { width: min(100% - 2 * var(--gutter), 1240px); margin-inline: auto; }

/* Masthead, as on the project page. */
.masthead { height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.wordmark { display: inline-flex; align-items: center; gap: 10px; font: 600 24px / 1 var(--serif); letter-spacing: -0.02em; text-decoration: none; }
.mark { width: 21px; height: 21px; }
.nav { display: flex; align-items: center; gap: clamp(16px, 2.4vw, 32px); font: 500 14px / 1 var(--sans); }
.nav a { color: var(--light-muted); text-decoration: none; }
.nav a:hover { color: var(--light); }
.nav .nav-studio { color: var(--light); border: 1px solid rgb(239 235 225 / 0.7); border-radius: 2px; padding: 10px 14px; }
.nav .nav-studio[aria-current="page"] { background: var(--light); color: var(--ink); }

.introduction { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 24px 48px; align-items: end; padding: clamp(28px, 4vw, 56px) 0 clamp(24px, 3vw, 40px); }
h1 { margin: 0; font: 400 clamp(44px, 5.6vw, 84px) / 0.98 var(--serif); letter-spacing: -0.03em; }
.intro-copy { margin: 0; color: var(--light-muted); font: 400 17px / 1.6 var(--serif); text-wrap: pretty; max-width: 46ch; }

/* The artwork, set in a gold frame like the emblems on the project page's wall. */
.artwork { border: 10px solid var(--frame); border-image: var(--tesserae) 8 round; box-shadow: 0 18px 50px -24px rgb(0 0 0 / .7); }
.canvas-shell { width: 100%; aspect-ratio: var(--art-aspect); position: relative; margin-inline: auto; overflow: hidden; background: #1c3643; }
canvas { display: block; width: 100%; height: 100%; touch-action: pan-y; }
.gesture-note { position: absolute; left: 18px; bottom: 16px; color: var(--light); font: 400 13px / 1.4 var(--sans); text-shadow: 0 1px 2px rgb(8 18 24 / .7); pointer-events: none; transition: opacity .35s; }
.canvas-shell:hover .gesture-note { opacity: 0; }
.loading { position: absolute; inset: 0; display: flex; gap: 18px; flex-direction: column; align-items: center; justify-content: center; color: #dcd9c5; background: #1c3643; font-size: 14px; padding: 24px; text-align: center; }
.loading-mark { width: 30px; height: 30px; opacity: .7; animation: breathe 2s ease-in-out infinite; }
.loading .text-button { color: #dcd9c5; }
@keyframes breathe { 50% { opacity: .25; transform: rotate(4deg); } }

.caption { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; padding: 18px 0 26px; gap: 8px 24px; }
.caption-title { margin: 0; }
.work-number { color: var(--light-muted); font-size: 13px; font-variant-numeric: tabular-nums; margin-right: 6px; }
.art-title { font: italic 400 19px / 1.4 var(--serif); margin-right: 10px; }
.material-note, .stone-count { font-size: 14px; color: var(--light-muted); font-variant-numeric: tabular-nums; }

.film-controls { display: flex; align-items: center; gap: 24px; padding: 0 0 26px; }
.film-toggle { display: flex; align-items: center; gap: 9px; min-width: 96px; }
#film-icon { font-size: 10px; min-width: 11px; }
#film-time { flex: 1; }
#film-clock { min-width: 86px; text-align: right; color: var(--light-muted); }

/* Tablets: the controls are set on slabs, as the words are on the project page. */
.tablet { color: var(--ink); background: var(--paper) padding-box; padding: 24px 28px; border: 9px solid var(--frame); border-image: var(--tesserae) 8 round; box-shadow: inset 6px 7px 10px -7px rgb(20 24 22 / .55); }
.tools { display: grid; grid-template-columns: minmax(200px, 1.3fr) 1fr 1fr minmax(150px, .85fr) auto; align-items: center; gap: clamp(20px, 3vw, 44px); margin-bottom: 36px; }
.source-tools { display: flex; align-items: flex-start; flex-direction: column; gap: 12px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; border: 1px solid var(--ink); padding: 0 18px; min-height: 46px; font: 600 15px / 1 var(--sans); white-space: nowrap; border-radius: 2px; }
.button svg { height: 16px; width: 16px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: square; }
.button-dark { background: var(--ink); color: var(--paper); }
.button-dark:hover:not(:disabled) { background: #33464a; }
.button-outline { background: transparent; }
.button-outline:hover:not(:disabled) { background: var(--paper-deep); }
.text-button { padding: 0; background: none; border: 0; font: 500 14px / 1.5 var(--sans); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.tablet .text-button { color: var(--muted); }
.tablet .text-button:hover:not(:disabled) { color: var(--ink); }
.film-toggle.text-button:hover { color: var(--gilt); }
.range-control { min-width: 100px; }
.range-control label { display: flex; justify-content: space-between; font-size: 15px; gap: 8px; margin-bottom: 14px; }
output { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
input[type="range"] { display: block; appearance: none; width: 100%; height: 3px; margin: 0; background: #b8b4a4; accent-color: var(--ink); cursor: pointer; border-radius: 0; }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 14px; height: 14px; border: 2px solid var(--paper); border-radius: 50%; box-shadow: 0 0 0 1px var(--ink); background: var(--ink); }
input[type="range"]::-moz-range-thumb { width: 10px; height: 10px; border: 2px solid var(--paper); border-radius: 50%; box-shadow: 0 0 0 1px var(--ink); background: var(--ink); }
.film-controls input[type="range"] { background: #4f6a73; accent-color: var(--light); }
.film-controls input[type="range"]::-webkit-slider-thumb { border-color: var(--night); box-shadow: 0 0 0 1px var(--light); background: var(--light); }
.flow-control { display: flex; flex-direction: column; gap: 10px; }
.flow-control #sound { margin-top: 4px; }
.switch { display: flex; gap: 10px; align-items: center; border: 0; padding: 0; background: transparent; font-size: 15px; white-space: nowrap; }
.switch-track { display: block; width: 30px; height: 16px; border-radius: 8px; background: #a6a99e; padding: 3px; transition: background .2s; }
.switch-track span { display: block; width: 10px; height: 10px; border-radius: 50%; background: var(--paper); transform: translateX(0); transition: transform .2s; }
.switch[aria-checked="true"] .switch-track { background: #2f5a5f; }
.switch[aria-checked="true"] .switch-track span { transform: translateX(14px); }
.control-note { color: var(--muted); font-size: 13px; }
.image-settings { display: flex; align-items: center; gap: 28px; }
.settings-intro { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.settings-label { margin: 0; font: 600 20px / 1.3 var(--serif); }
#settings-note, .local-note { font-size: 14px; line-height: 1.5; color: var(--muted); }
.select-control { display: flex; align-items: center; gap: 10px; }
.select-control label { font-size: 14px; color: var(--muted); }
.select-control select { border: 1px solid rgb(29 42 46 / .35); background: transparent; color: var(--ink); padding: 9px 26px 9px 10px; font-size: 14px; min-width: 130px; border-radius: 2px; }
.local-note { margin: 0; }
.feedback { font-size: 15px; min-height: 0; margin: 0; color: #b9d3bd; text-shadow: 0 1px 2px rgb(8 18 24 / .5); }
.feedback:not(:empty) { padding: 22px 0 0; }
.feedback.error { color: #f0b3a8; }

.footer { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 12px 32px; margin-top: clamp(56px, 7vw, 96px); padding: 24px 0 40px; border-top: 1px solid rgb(239 235 225 / .16); font-size: 14px; color: var(--light-muted); }
.footer p { margin: 0; }
.footer-mark { display: flex; align-items: center; gap: 8px; color: var(--light); font-weight: 500; }
.footer-mark svg { width: 15px; height: 15px; }

@media (max-width: 1100px) {
  .tools { grid-template-columns: 1.3fr 1fr 1fr; gap: 28px 38px; }
  .source-tools { grid-row: span 2; align-self: center; }
  #save-button { justify-self: end; }
  .local-note { display: none; }
}
@media (max-width: 760px) {
  :root { --gutter: 18px; }
  .masthead { height: 60px; }
  .nav a:not(.nav-studio, .nav-source) { display: none; }
  .wordmark { font-size: 22px; }
  .introduction { grid-template-columns: minmax(0, 1fr); }
  h1 { font-size: 46px; }
  .intro-copy { font-size: 16px; }
  .artwork { border-width: 7px; }
  .gesture-note { left: 12px; bottom: 10px; font-size: 12px; }
  .tablet { padding: 20px 18px; border-width: 7px; }
  .tools { grid-template-columns: 1fr 1fr; gap: 24px; }
  .source-tools { flex-direction: row; justify-content: space-between; align-items: center; grid-column: 1 / -1; grid-row: auto; gap: 14px; }
  .button { font-size: 14px; padding: 0 14px; }
  #save-button { min-width: 120px; }
  .image-settings { flex-wrap: wrap; column-gap: 18px; row-gap: 16px; }
  .settings-intro { flex-basis: 100%; }
  .select-control { gap: 8px; flex: 1; }
  .select-control select { flex: 1; min-width: 90px; width: 100%; padding-right: 14px; }
  .select-control label { white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
