/* Landing page: the yard by daylight. Gravel ground, steel signs, the three skip colours,
   and a weigh ticket that adds up the day. The tester page (tester/) builds on this file. */
/* Baba speaks Turkish: ğ and ş live in the extended Latin files, so both subsets are loaded. */
@font-face {
  font-family: 'Barlow Condensed';
  font-weight: 600;
  font-display: swap;
  src: url('./fonts/barlow-condensed-latin-ext-600-normal.woff2') format('woff2');
  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;
}

@font-face {
  font-family: 'Barlow Condensed';
  font-weight: 600;
  font-display: swap;
  src: url('./fonts/barlow-condensed-latin-600-normal.woff2') format('woff2');
  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: 'Barlow Condensed';
  font-weight: 800;
  font-display: swap;
  src: url('./fonts/barlow-condensed-latin-ext-800-normal.woff2') format('woff2');
  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;
}

@font-face {
  font-family: 'Barlow Condensed';
  font-weight: 800;
  font-display: swap;
  src: url('./fonts/barlow-condensed-latin-800-normal.woff2') format('woff2');
  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;
}

:root {
  /* Ground and ink */
  --gravel: #ece3d2;
  --gravel-deep: #dccfb6;
  --ink: #1c1f24;
  --ink-soft: #4d4a44;
  /* Signs, as in the game */
  --steel: #1c1f24;
  --steel-mid: #262a31;
  --steel-light: #4a4f58;
  --paper: #ffffff;
  --paper-dim: #c9cdd3;
  --orange: #ff5c05;
  /* The skips and the weighbridge */
  --copper: #d9641e;
  --alu: #2a6fb8;
  --link: #1d5591;
  --iron: #7a2b22;
  --scale-yellow: #f4c531;

  --font: 'Barlow Condensed', 'Arial Narrow', system-ui, sans-serif;
  /* Type scale: three text sizes, the headings scale with the window. */
  --t-small: 17px;
  --t-body: 21px;
  --t-large: 25px;
  --chamfer: polygon(0 0, 100% 0, 100% calc(100% - 12px), calc(100% - 14px) 100%, 0 100%);
  --gutter: clamp(16px, 4vw, 48px);
  --page: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--gravel);
  color: var(--ink);
  font: 600 var(--t-body) / 1.4 var(--font);
  letter-spacing: 0.01em;
}

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

h1,
h2,
h3 {
  margin: 0;
  font-weight: 800;
  text-transform: uppercase;
  line-height: 0.95;
  text-wrap: balance;
}

p {
  margin: 0;
}

a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--alu);
  outline-offset: 3px;
}

/* Hero: the yard itself, the title on a steel sign that hangs over its lower edge. */
.hero {
  padding-bottom: 8px;
}

.hero-img {
  width: 100%;
  /* Low minimum: on a phone held sideways the button below must still fit on the first screen. */
  height: clamp(150px, 48vh, 560px);
  object-fit: cover;
  object-position: 68% 55%;
}

.sign {
  position: relative;
  width: min(700px, 100% - 2 * var(--gutter));
  margin: -72px 0 0 max(var(--gutter), (100% - var(--page)) / 2);
  padding: clamp(22px, 3.4vw, 36px) clamp(20px, 3.4vw, 38px) clamp(26px, 3.6vw, 40px);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 26px), calc(100% - 30px) 100%, 0 100%);
  background: var(--steel);
  color: var(--paper);
}

h1 {
  font-size: clamp(54px, 7.4vw, 92px);
  letter-spacing: -0.005em;
}

.lead {
  max-width: 26em;
  margin: 14px 0 24px;
  color: var(--paper-dim);
  font-size: clamp(var(--t-body), 2.2vw, var(--t-large));
  line-height: 1.3;
}

.play {
  display: inline-block;
  padding: 15px 30px 17px 24px;
  clip-path: var(--chamfer);
  background: var(--orange);
  color: var(--steel);
  font-weight: 800;
  font-size: var(--t-large);
  line-height: 1;
  text-decoration: none;
  text-transform: uppercase;
  transition: background 0.15s, transform 0.15s;
}

.play:hover {
  background: var(--paper);
  transform: translateY(-2px);
}

.play:active {
  transform: translateY(1px);
}

/* The chamfer is a clip-path and would cut an outer ring away, so these two get theirs inside. */
.play:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: -8px;
}

.ticket-play:focus-visible {
  outline: 2px solid var(--paper);
  outline-offset: -6px;
}

.note {
  max-width: 27em;
  margin-top: 16px;
  color: var(--paper-dim);
  font-size: var(--t-small);
}

/* Head of a plain sub-page (tester/): no picture, the title straight on the gravel. */
.plain-head {
  max-width: calc(var(--page) + 2 * var(--gutter));
  margin: 0 auto;
  padding: clamp(36px, 6vw, 72px) var(--gutter) 0;
}

.plain-head .back {
  color: var(--ink-soft);
  font-size: var(--t-small);
}

.plain-head h1 {
  margin-top: 10px;
}

.plain-head .lead {
  max-width: 27em;
  margin-bottom: 12px;
  color: var(--ink);
}

.plain-head .note {
  margin: 0;
  color: var(--ink-soft);
}

main,
.facts {
  max-width: calc(var(--page) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

h2 {
  font-size: clamp(38px, 5vw, 60px);
}

/* The day: the shifts on the right, the weigh ticket travelling along on the left. */
.day {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  grid-template-areas:
    'head head'
    'ticket shifts';
  gap: 36px clamp(28px, 5vw, 72px);
  padding-top: clamp(56px, 8vw, 104px);
}

.day-head {
  grid-area: head;
  max-width: 34em;
}

.day-head p {
  max-width: 27em;
  margin-top: 14px;
  color: var(--ink-soft);
}

.ticket {
  grid-area: ticket;
  position: sticky;
  top: 24px;
  align-self: start;
  padding: 20px 20px 22px;
  background: var(--paper);
  box-shadow: 0 1px 0 var(--gravel-deep), 0 14px 30px rgb(60 45 20 / 14%);
  /* One family on the whole page: the slip is told by its torn edge, not by a printer's face. */
  font-size: var(--t-small);
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}

/* Perforated lower edge, like a slip torn off the scale's printer. */
.ticket::after {
  content: '';
  position: absolute;
  inset: auto 0 -8px;
  height: 8px;
  background:
    linear-gradient(135deg, var(--paper) 50%, transparent 50%) 0 0 / 12px 8px repeat-x,
    linear-gradient(225deg, var(--paper) 50%, transparent 50%) 0 0 / 12px 8px repeat-x;
}

.ticket-head {
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--ink);
  font-weight: 800;
  font-size: var(--t-large);
  text-transform: uppercase;
}

.ticket-rows {
  display: grid;
  gap: 7px;
  margin: 12px 0;
  padding: 0;
  list-style: none;
}

.ticket-rows li {
  display: grid;
  grid-template-columns: 3.4em minmax(0, 1fr) auto;
  gap: 8px;
  transition: opacity 0.3s;
}

.ticket-rows span:first-child {
  color: var(--ink-soft);
}

.ticket-rows b {
  font-weight: 800;
  text-align: right;
}

/* Not weighed yet: grey and light, but still dark enough to read. */
.ticket-rows li.open,
.ticket-rows li.open * {
  color: #6b665e;
  font-weight: 600;
}

.ticket-total {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 12px 8px;
  background: var(--scale-yellow);
}

.ticket-total span:first-child {
  margin-right: auto;
}

.ticket-sum {
  font-weight: 800;
  font-size: 40px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.ticket-bar {
  display: none;
}

.ticket-play {
  display: block;
  margin-top: 14px;
  padding: 11px 14px 12px;
  clip-path: var(--chamfer);
  background: var(--steel);
  color: var(--paper);
  font-weight: 800;
  font-size: var(--t-body);
  line-height: 1;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
}

.ticket-play:hover {
  background: var(--orange);
  color: var(--steel);
}

.shifts {
  grid-area: shifts;
  display: grid;
  gap: clamp(48px, 6vw, 76px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.shifts > li {
  max-width: 720px;
}

.when {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--ink-soft);
}

.when time {
  padding: 2px 11px 4px;
  background: var(--steel);
  color: var(--paper);
  font-weight: 800;
  line-height: 1.2;
}

h3 {
  margin-bottom: 10px;
  font-size: clamp(30px, 3.6vw, 42px);
}

.shifts > li > p:not(.when) {
  max-width: 27em;
  color: var(--ink-soft);
}

.metals {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.metals li {
  padding: 5px 20px 6px;
  color: var(--paper);
  font-weight: 800;
  font-size: var(--t-small);
  text-transform: uppercase;
  /* A skip seen from the side: wide at the rim, narrow at the bottom. */
  clip-path: polygon(0 0, 100% 0, calc(100% - 9px) 100%, 9px 100%);
}

.metals .copper {
  background: var(--copper);
  color: var(--ink);
}

.alu {
  background: var(--alu);
}

.iron {
  background: var(--iron);
}

/* Baba's line, as the game's own speech plate: his face on the orange end, the words on steel. */
blockquote {
  display: flex;
  align-items: stretch;
  width: fit-content;
  max-width: 100%;
  margin: 18px 0 0;
  background: var(--steel);
  color: var(--paper);
  line-height: 1.25;
}

blockquote img {
  flex: none;
  width: 58px;
  height: auto;
  align-self: stretch;
  object-fit: cover;
  border: 4px solid var(--orange);
}

blockquote p {
  align-self: center;
  padding: 9px 16px 11px 14px;
}

.shifts > li > img {
  margin-top: 20px;
  /* A steel frame and nothing else: the game is flat and hard-edged, soft shadows are not. */
  border-radius: 14px;
  box-shadow: 0 0 0 4px var(--steel);
}

/* Evening: the last picture across the whole width, the end of the day on a steel band below. */
.evening {
  margin-top: clamp(64px, 9vw, 120px);
  background: var(--steel);
  color: var(--paper);
}

.evening img {
  width: 100%;
  height: clamp(260px, 56vh, 560px);
  object-fit: cover;
  /* Narrow cuts keep the three figures on the right. */
  object-position: 72% 50%;
}

.evening-text {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 40px;
  align-items: center;
  max-width: calc(var(--page) + 2 * var(--gutter));
  margin: 0 auto;
  padding: clamp(28px, 4vw, 44px) var(--gutter) clamp(36px, 5vw, 56px);
}

.evening-text p {
  grid-column: 1;
  color: var(--paper-dim);
  font-size: var(--t-large);
  line-height: 1.3;
}

.evening-text .play {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.facts {
  padding-top: clamp(48px, 7vw, 88px);
}

.facts dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px clamp(24px, 4vw, 48px);
  margin: 26px 0 0;
}

.facts dt {
  padding-bottom: 6px;
  border-bottom: 3px solid var(--ink);
  font-weight: 800;
  font-size: var(--t-large);
  text-transform: uppercase;
}

/* Running text stays under about 80 characters a line; the condensed face fits many into an em. */
.facts dd {
  max-width: 27em;
  margin: 10px 0 0;
  color: var(--ink-soft);
}

.facts a {
  color: var(--link);
}

footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
  margin-top: clamp(56px, 8vw, 96px);
  padding: 24px max(var(--gutter), (100% - var(--page)) / 2) 30px;
  background: var(--steel);
  font-size: var(--t-small);
}

footer a {
  color: var(--paper-dim);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

footer a:hover {
  color: var(--paper);
}

footer a:focus-visible {
  outline-color: var(--paper);
}

/* Room for the whole title on one line once the sign is wide enough. */
@media (min-width: 760px) {
  h1 {
    white-space: nowrap;
  }
}

@media (max-width: 900px) {
  .day {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      'head'
      'ticket'
      'shifts';
    gap: 24px;
  }

  /* On a phone the ticket shrinks to one bar: the sum, six segments, the way into the game. */
  .ticket {
    top: 0;
    z-index: 2;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 12px;
    align-items: center;
    margin: 0 calc(-1 * var(--gutter));
    padding: 8px var(--gutter) 10px;
    background: var(--scale-yellow);
    box-shadow: 0 6px 16px rgb(60 45 20 / 18%);
    line-height: 1.4;
  }

  .ticket::after,
  .ticket-head,
  .ticket-rows {
    display: none;
  }

  .ticket-total {
    padding: 0;
    background: none;
  }

  .ticket-total span:first-child {
    margin-right: 0;
  }

  .ticket-sum {
    font-size: 30px;
  }

  .ticket-unit::after {
    content: ' von 1538';
  }

  .ticket-bar {
    display: grid;
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: 200fr 300fr 250fr 300fr 200fr 288fr;
    gap: 3px;
    height: 6px;
  }

  .ticket-bar i {
    background: var(--steel);
    transition: opacity 0.3s;
  }

  .ticket-bar i.open {
    opacity: 0.2;
  }

  .ticket-play {
    margin: 0;
    padding: 8px 16px 9px 12px;
    font-size: var(--t-body);
  }

  .facts dl {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 620px) {
  .hero-img {
    height: clamp(150px, 46vh, 420px);
    object-position: 66% 60%;
  }

  .sign {
    margin-top: -44px;
  }

  .play {
    display: block;
    text-align: center;
  }

  .evening img {
    height: 280px;
    object-position: 59% 50%;
  }

  .evening-text {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .evening-text .play {
    grid-column: 1;
    grid-row: auto;
    margin-top: 10px;
  }
}

/* A small phone held sideways (568 x 320): less picture, so the play button stays on the first screen. */
@media (max-height: 340px) and (orientation: landscape) {
  .hero-img {
    height: 34vh;
    min-height: 96px;
  }

  .sign {
    margin-top: -44px;
  }

  .lead {
    margin: 8px 0 14px;
  }
}

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

  * {
    transition: none !important;
  }
}
