/* Design With Color Cubes — shared styles.
   A modern revival of the toy: the four cube colors as bold bands, one rounded geometric face
   (Rubik) throughout, chunky buttons that press in like a toy, and real renders and scans of
   the cubes sitting across the edges between bands. */

@font-face {
  font-family: "Rubik";
  src: url("/fonts/rubik-latin.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Rubik";
  src: url("/fonts/rubik-latin-ext.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* The four cube colors, the same as site/js/cubecode.js */
  --red: #C0272D;
  --cream: #F4ECD8;
  --navy: #1E2A5A;
  --yellow: #E3B23C;

  --red-deep: #8E1A1F;
  --navy-deep: #141C40;
  --yellow-deep: #B8871C;
  --paper: #FBF7EE;
  --hero: #ECEAE4;
  --ink: #1E2A5A;
  --ink-soft: #4E5778;
  --line: #E4D9BF;

  --font: "Rubik", system-ui, "Segoe UI", Roboto, sans-serif;
  --measure: 60ch;
  --wide: 1180px;
  --gutter: clamp(16px, 5vw, 48px);
  --radius: 18px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.125rem/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { max-width: 100%; height: auto; }
p { margin: 0 0 1em; max-width: var(--measure); }
a { color: inherit; text-decoration-thickness: 0.09em; text-underline-offset: 0.2em; }
a:hover { color: var(--red); }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; border-radius: 6px; }
strong { font-weight: 600; }

h1, h2, h3 { font-family: var(--font); margin: 0; text-wrap: balance; }
h1 { font-weight: 800; font-size: clamp(2.9rem, 8.4vw, 6.6rem); line-height: 0.92; letter-spacing: -0.025em; }
h2 { font-weight: 750; font-size: clamp(2rem, 4.6vw, 3.4rem); line-height: 1; letter-spacing: -0.02em; margin-bottom: 0.45em; }
h3 { font-weight: 650; font-size: 1.25rem; line-height: 1.25; margin: 1.6em 0 0.45em; }
.lede { font-size: clamp(1.2rem, 2vw, 1.4rem); line-height: 1.45; }
.fineprint { font-size: 0.95rem; color: var(--ink-soft); }

/* ---------- Bands: each section is one cube color, edge to edge ---------- */

.band { position: relative; }
.band.navy { background: var(--navy); color: var(--cream); }
.band.red { background: var(--red); color: var(--cream); }
.band.yellow { background: var(--yellow); color: var(--navy); }
.band.cream { background: var(--cream); }
.band.grey { background: var(--hero); }
.band.navy a:hover, .band.red a:hover { color: var(--yellow); }
.band.yellow a:hover { color: var(--red); }
.band.navy .fineprint, .band.red .fineprint { color: rgb(244 236 216 / 0.8); }
.band.yellow .fineprint { color: rgb(30 42 90 / 0.8); }

.section {
  max-width: var(--wide);
  margin: 0 auto;
  padding: clamp(64px, 9vw, 112px) var(--gutter);
}
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
}
.split.top { align-items: start; }
@media (max-width: 860px) { .split { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Buttons: chunky, and they press in ---------- */

.actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 28px; }
.btn {
  --face: var(--navy);
  --text: var(--cream);
  --edge: var(--navy-deep);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 24px;
  border: 0;
  border-radius: 14px;
  background: var(--face);
  color: var(--text);
  font: 600 1.05rem/1 var(--font);
  text-decoration: none;
  box-shadow: 0 5px 0 var(--edge);
  transform: translateY(0);
  transition: transform 80ms ease, box-shadow 80ms ease;
  cursor: pointer;
}
.btn:hover { color: var(--text); transform: translateY(-1px); box-shadow: 0 6px 0 var(--edge); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--edge); }
.btn.yellow { --face: var(--yellow); --text: var(--navy); --edge: var(--yellow-deep); }
.btn.red { --face: var(--red); --text: var(--cream); --edge: var(--red-deep); }
.btn.cream { --face: var(--cream); --text: var(--navy); --edge: #CDBF9C; }
.btn.line { background: transparent; box-shadow: inset 0 0 0 2px currentColor; color: inherit; }
.btn.line:hover, .btn.line:active { transform: none; box-shadow: inset 0 0 0 3px currentColor; color: inherit; }
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } }

/* ---------- Top bar ---------- */

.bar {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 18px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 28px;
  flex-wrap: wrap;
  position: relative;
  z-index: 2;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; text-decoration: none; }
.brand svg { width: 30px; height: 30px; }
.nav { display: flex; flex-wrap: wrap; gap: 4px 24px; font-weight: 500; }
.nav a { text-decoration: none; padding: 6px 0; border-bottom: 2px solid transparent; }
.nav a:hover { border-bottom-color: currentColor; }
.nav a[aria-current="page"] { border-bottom-color: var(--red); }
.band.navy .nav a[aria-current="page"] { border-bottom-color: var(--yellow); }

/* ---------- Hero: cubes tossed into the four corners, the words in the middle ---------- */

/* A faint paper grain (tools/render_corners.py --paper) under rendered cubes with soft shadows. */
.hero { background: var(--hero) url(/img/paper.jpg); color: var(--ink); }
.hero .bar { border-bottom: 1px solid rgb(30 42 90 / 0.1); max-width: none; padding-inline: max(var(--gutter), calc((100% - var(--wide)) / 2 + var(--gutter))); }
.hero-stage {
  position: relative;
  overflow: hidden;
  min-height: clamp(560px, calc(100vh - 140px), 800px);
  min-height: clamp(560px, calc(100svh - 140px), 800px);
  display: grid;
  place-items: center;
  padding: clamp(150px, 16vw, 200px) var(--gutter);
}
.corner { position: absolute; width: clamp(140px, 30vw, 440px); height: auto; pointer-events: none; user-select: none; }
.corner.tl { top: 0; left: 0; }
.corner.tr { top: 0; right: 0; }
.corner.bl { bottom: 0; left: 0; }
.corner.br { bottom: 0; right: 0; }
.hero-text { position: relative; z-index: 1; text-align: center; max-width: 36rem; }
.hero h1 { font-size: clamp(2.8rem, 7vw, 5.6rem); line-height: 0.95; }
.hero .lede { margin: 24px auto 0; max-width: 32ch; color: var(--ink-soft); }
.hero .actions { justify-content: center; }
@media (max-width: 600px) {
  .hero-stage { min-height: 0; padding-block: 132px 140px; }
}

/* A row of cubes resting on the edge between two bands. Set --from and --to to the two colors. */
.edge {
  --from: var(--navy);
  --to: var(--paper);
  background: linear-gradient(var(--from) 50%, var(--to) 50%);
  overflow: hidden;
}
.heap { align-self: center; }
.faces-row { margin-top: clamp(40px, 6vw, 72px); }
.edge.from-hero { background: linear-gradient(transparent 50%, var(--to) 50%), var(--hero) url(/img/paper.jpg); }
.edge img { display: block; width: min(1600px, 112%); max-width: none; height: auto; margin: 0 auto; position: relative; left: 50%; transform: translateX(-50%); }

/* ---------- Photos and figures ---------- */

figure { margin: 0; }
figcaption { font-size: 0.95rem; color: var(--ink-soft); margin-top: 0.7em; }
.band.navy figcaption, .band.red figcaption { color: rgb(244 236 216 / 0.8); }
.photo { display: block; width: 100%; height: auto; border-radius: var(--radius); }
.art { display: block; width: 100%; height: auto; }

blockquote.letter { margin: 0; }
blockquote.letter p { font-size: clamp(1.15rem, 1.6vw, 1.3rem); line-height: 1.6; }
blockquote.letter footer { font-weight: 700; font-size: 1.2rem; color: var(--red); }

/* ---------- One cube, six faces ---------- */

.looks { margin: clamp(28px, 5vw, 48px) calc(var(--gutter) * -1) 0; }
.looks img { display: block; width: 100%; height: auto; }

.faces {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 18px 12px;
  margin-top: 28px;
}
@media (max-width: 480px) { .faces { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.faces li { font-size: 0.88rem; line-height: 1.3; font-weight: 500; }
.finish { display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 18px; border-radius: 999px; background: rgb(30 42 90 / 0.08); }
.finish button {
  min-height: 40px; padding: 0 16px; border: 0; border-radius: 999px; background: none;
  color: var(--navy); font: 500 0.95rem var(--font); cursor: pointer;
}
.finish button[aria-pressed="true"] { background: var(--navy); color: var(--cream); }
.faces img { display: block; width: 100%; height: auto; aspect-ratio: 1; margin-bottom: 8px; border-radius: 8px; box-shadow: 0 6px 14px rgb(20 28 64 / 0.18); }

.viewer {
  position: relative;
  aspect-ratio: 1;
  border-radius: 28px;
  background: radial-gradient(circle at 50% 40%, #fffaf0, var(--cream) 70%);
  overflow: hidden;
  touch-action: none;
}
.viewer canvas { display: block; width: 100%; height: 100%; }
.viewer .poster {
  position: absolute; inset: 0;
  display: grid; place-items: center; align-content: center; gap: 18px;
  padding: 24px; text-align: center; color: var(--navy);
}
.viewer .net { width: min(86%, 380px); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px; filter: drop-shadow(0 12px 16px rgb(20 28 64 / 0.22)); }
.viewer .net img { display: block; width: 100%; height: auto; border-radius: 4px; }
.viewer .switch {
  position: absolute; left: 14px; right: 14px; bottom: 14px; display: flex; flex-wrap: wrap; gap: 6px;
}
.viewer .switch button {
  min-height: 40px; padding: 0 14px; border-radius: 999px; border: 0;
  background: rgb(255 255 255 / 0.8); color: var(--navy); font: 500 0.95rem var(--font); cursor: pointer;
}
.viewer .switch button[aria-pressed="true"] { background: var(--navy); color: var(--cream); }
.viewer .status { position: absolute; inset: auto 0 18px; text-align: center; font-size: 0.95rem; color: var(--ink-soft); margin: 0 auto; }

/* ---------- Print ---------- */

.print-cube { margin-bottom: 28px; }
.print-cube .poster .status { position: static; }

.downloads { list-style: none; padding: 0; margin: 0.4em 0 1.4em; display: grid; gap: 10px; }
.downloads a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 16px;
  padding: 16px 18px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 0 0 2px var(--line);
  text-decoration: none;
}
.downloads a:hover { color: inherit; box-shadow: 0 0 0 3px var(--navy); }
.downloads b { font-weight: 650; font-size: 1.1rem; }
.downloads small { grid-column: 1; color: var(--ink-soft); font-size: 0.95rem; line-height: 1.4; }
.downloads em { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-style: normal; font-weight: 600; font-size: 0.9rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

.label {
  background: var(--navy);
  color: var(--cream);
  border-radius: 24px;
  padding: clamp(22px, 3.5vw, 36px);
}
.label h3 { margin: 0 0 12px; font-size: 1.4rem; }
.label dl { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); }
.label dt, .label dd { margin: 0; padding: 10px 0; border-top: 1px solid rgb(244 236 216 / 0.22); }
.label dt { font-weight: 600; padding-right: 22px; color: var(--yellow); }
.label dd { font-variant-numeric: tabular-nums; }

.strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-top: clamp(32px, 5vw, 56px); }
.strip img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 14px; }
@media (max-width: 620px) {
  .strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .strip img:nth-child(n + 4) { display: none; }
}

/* ---------- Gift: three steps in order ---------- */

ol.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 26px; }
ol.steps li { counter-increment: step; display: grid; grid-template-columns: 52px minmax(0, 1fr); column-gap: 18px; align-items: start; }
ol.steps li::before {
  content: counter(step);
  display: grid; place-items: center;
  width: 52px; height: 52px; border-radius: 12px;
  background: var(--navy); color: var(--yellow);
  font-weight: 800; font-size: 1.5rem;
  box-shadow: 0 4px 0 var(--navy-deep);
}
ol.steps strong { display: block; font-size: 1.2rem; margin-bottom: 2px; }
ol.steps p { margin: 0; }

/* ---------- Design tiles ---------- */

.tiles { list-style: none; padding: 0; margin: clamp(28px, 4vw, 44px) 0 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: clamp(12px, 2.2vw, 26px); }
@media (max-width: 960px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 560px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tiles a { display: block; padding: 8px; border-radius: 14px; background: #fff; box-shadow: 0 0 0 2px var(--line); text-decoration: none; transition: transform 120ms ease; }
.tiles a:hover { color: inherit; transform: translateY(-3px); box-shadow: 0 0 0 3px var(--navy); }
.tiles svg { display: block; width: 100%; border-radius: 6px; }
.tiles.named { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 960px) { .tiles.named { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 480px) { .tiles.named { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tiles.named li { text-align: center; }
.tiles.named span { display: block; margin-top: 8px; font-size: 0.95rem; font-weight: 500; line-height: 1.3; }
@media (prefers-reduced-motion: reduce) { .tiles a { transition: none; } }

.group-head { font-size: clamp(1.6rem, 3vw, 2.2rem); margin: clamp(44px, 6vw, 72px) 0 0.3em; }

.size-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: clamp(28px, 5vw, 44px); }
.size-chips button {
  min-height: 44px; padding: 0 18px; border-radius: 999px; border: 0;
  box-shadow: inset 0 0 0 2px var(--navy);
  background: none; color: var(--navy); font: 600 1rem var(--font); cursor: pointer;
}
.size-chips button[aria-pressed="true"] { background: var(--navy); color: var(--cream); }

/* ---------- History ---------- */

.lid-scans { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(16px, 3vw, 32px); margin-top: clamp(32px, 5vw, 56px); }
@media (max-width: 620px) { .lid-scans { grid-template-columns: minmax(0, 1fr); } }
.footnote { font-size: 0.95rem; color: var(--ink-soft); border-top: 2px solid var(--line); padding-top: 14px; margin-top: 28px; }

.kit { list-style: none; padding: 0; margin: 24px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.kit a { display: block; height: 100%; padding: 18px; border-radius: 16px; background: rgb(255 255 255 / 0.1); box-shadow: inset 0 0 0 2px rgb(244 236 216 / 0.3); text-decoration: none; }
.kit a:hover { box-shadow: inset 0 0 0 2px var(--yellow); }
.band.grey .kit a { background: #FFFFFF; box-shadow: inset 0 0 0 2px rgb(30 42 90 / 0.1); }
.band.grey .kit a:hover { box-shadow: inset 0 0 0 2px var(--navy); }
.kit b { display: block; font-weight: 650; font-size: 1.1rem; margin-bottom: 4px; }
.kit small { display: block; font-size: 0.95rem; line-height: 1.4; opacity: 0.85; }

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

.foot { background: var(--navy-deep); color: var(--cream); }
.foot .section { padding-block: clamp(36px, 6vw, 64px); display: grid; gap: 18px; }
.foot a:hover { color: var(--yellow); }
.foot p { margin: 0; font-size: 1rem; }
.foot .links { display: flex; flex-wrap: wrap; gap: 6px 26px; font-weight: 600; }
.foot .small { font-size: 0.92rem; opacity: 0.8; }

/* ---------- Inner pages ---------- */

.page-top { padding-bottom: clamp(40px, 6vw, 72px); }
.page-top .section { padding-block: clamp(12px, 3vw, 32px) 0; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: clamp(20px, 4vw, 56px); align-items: center; }
.page-top h1 { font-size: clamp(2.6rem, 7vw, 5rem); color: var(--cream); }
.page-top .lede { margin-top: 18px; }
@media (max-width: 760px) { .page-top .section { grid-template-columns: minmax(0, 1fr); } .page-top .art { max-width: 420px; } }

@media (max-width: 700px) {
  body { font-size: 1.0625rem; }
  .bar { padding-block: 14px; }
  .nav { gap: 2px 18px; font-size: 0.98rem; }
  .label dt { padding-right: 14px; }
}

/* History and the picture kit share one navy band. */
#patterns .fineprint { margin-top: 20px; }
.page-top + main > .section:first-child { padding-top: clamp(28px, 4vw, 48px); }
