/*
 * Cream canvas, hard black borders, offset shadows with no blur, buttons that
 * press down when you click them. Two palettes, light and dark, picked by
 * whatever the reader's system is set to.
 */

:root {
  /* Cream whatever the reader's system is set to. The palette is the design,
     so following a dark system setting would throw it away. */
  color-scheme: light;

  --bg: #eeefe9;
  --surface: #ffffff;
  --sunk: #f6f7f2;
  --ink: #151515;
  --quiet: #5f6057;
  --line: #151515;
  --hair: #dcddd4;
  --shadow: rgba(21, 21, 21, 0.12);

  --orange: #f54e00;
  --blue: #1d4aff;
  --yellow: #f7a501;
  --teal: #00cec9;
  --on-accent: #ffffff;

  --radius: 10px;
  --border: 1.5px solid var(--line);
}

* {
  box-sizing: border-box;
}

body {
  background: var(--bg);
  color: var(--ink);
  margin: 0 auto;
  max-width: 64rem;
  padding: 1.5rem 1.25rem 6rem;
  font:
    16px/1.6 'Inter',
    system-ui,
    sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* --- Header --- */

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  border-bottom: 1.5px solid var(--hair);
  padding: 0.5rem 0 1.25rem;
}

h1 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: -0.03em;
}

/* The dot after the wordmark, the one piece of decoration on the page. */
h1::after {
  content: '';
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  margin-left: 0.3rem;
  border-radius: 50%;
  background: var(--orange);
  vertical-align: 0.35rem;
}

#account {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

#who {
  font-weight: 600;
  font-size: 0.9rem;
}

/* Google renders its button in an iframe, so the corners and the shadow it
   sits on are the only parts of it we own. */
#signin {
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 3px 0 var(--line);
}

/* --- Headings and prose --- */

section {
  margin-top: 3.5rem;
}

h2 {
  margin: 0 0 0.4rem;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* The first section reads as the headline of the page. */
main > section:first-of-type {
  margin-top: 2.5rem;
}

main > section:first-of-type h2 {
  font-size: clamp(2rem, 5vw, 2.75rem);
  line-height: 1.1;
  font-weight: 900;
  letter-spacing: -0.04em;
  max-width: 18ch;
}

h3 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.lede {
  color: var(--quiet);
  margin: 0.5rem 0 0;
  max-width: 62ch;
  font-size: 1rem;
}

main > section:first-of-type .lede {
  font-size: 1.1rem;
}

.quiet {
  color: var(--quiet);
  margin: 0.25rem 0;
  font-size: 0.9rem;
}

/* Both buttons under this write for real and neither can be undone. */
.warn {
  background: color-mix(in srgb, var(--orange) 12%, var(--surface));
  border: 1.5px solid var(--orange);
  border-radius: var(--radius);
  padding: 0.85rem 1.1rem;
  color: var(--ink);
  max-width: none;
}

code {
  background: var(--sunk);
  border: 1px solid var(--hair);
  border-radius: 4px;
  padding: 0.05rem 0.3rem;
  font-size: 0.85em;
}

/* --- The status line --- */

#message {
  margin: 1.25rem 0 0;
  background: color-mix(in srgb, var(--yellow) 22%, var(--surface));
  border: var(--border);
  border-left: 5px solid var(--yellow);
  border-radius: var(--radius);
  padding: 0.85rem 1.1rem;
  font-weight: 500;
}

/* --- Cards --- */

.cards {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  margin-top: 1.75rem;
}

.card {
  position: relative;
  background: var(--surface);
  border: var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.25rem 1.25rem;
  box-shadow: 4px 4px 0 var(--shadow);
}

/* One colour per board, in the order the API sends them back. */
.cards .card::before {
  content: '';
  position: absolute;
  inset: -1.5px -1.5px auto;
  height: 6px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--orange);
}

.cards .card:nth-child(2)::before {
  background: var(--blue);
}

.cards .card:nth-child(3)::before {
  background: var(--teal);
}

.leader {
  margin: 0.9rem 0 0.25rem;
  font-weight: 700;
  font-size: 1rem;
}

/* --- Standings --- */

.standings {
  list-style: none;
  counter-reset: place;
  margin: 1.1rem 0 0;
  padding: 0;
  border-top: 1px solid var(--hair);
}

.standings li {
  counter-increment: place;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--hair);
}

.standings li::before {
  content: counter(place);
  flex: none;
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--sunk);
  border: 1px solid var(--hair);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--quiet);
}

/* Whoever is top of a board is the one designing the drop, so say it louder. */
.standings li:first-child::before {
  background: var(--yellow);
  border-color: var(--line);
  color: var(--ink);
}

.standings .line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex: 1;
  min-width: 0;
}

.name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.95rem;
}

.score {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

/* --- The slot the game mounts into --- */

.placeholder {
  background: var(--sunk);
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 3.5rem 1.25rem;
  text-align: center;
  margin-top: 1.75rem;
}

.placeholder p:first-child {
  margin: 0;
  font-weight: 700;
  font-size: 1.05rem;
}

/* --- The merch ledger --- */

.drop {
  margin-top: 1.25rem;
}

.images {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 20rem));
  margin: 1.25rem 0 0;
}

figure {
  margin: 0;
}

figure img,
.empty {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1.5px solid var(--hair);
  border-radius: 8px;
  object-fit: cover;
  background: var(--sunk);
  color: var(--quiet);
  font-size: 0.85rem;
}

figcaption {
  margin-top: 0.4rem;
}

/* --- Forms --- */

label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--quiet);
}

input,
select {
  font: inherit;
  font-size: 0.95rem;
  padding: 0.5rem 0.7rem;
  border: 1.5px solid var(--hair);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}

input:focus-visible,
select:focus-visible,
button:focus-visible,
a.button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.image-form {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.25rem;
  max-width: 30rem;
}

/* Buttons press down into their own shadow, which is the whole trick. */
button,
a.button {
  font: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  justify-self: start;
  padding: 0.5rem 1rem;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 3px 0 var(--line);
  transition:
    transform 60ms,
    box-shadow 60ms;
}

button:active,
a.button:active {
  transform: translateY(3px);
  box-shadow: 0 0 0 var(--line);
}

/* The two buttons that write something get the loud colour. */
.tool button {
  background: var(--orange);
  color: var(--on-accent);
  border-color: var(--line);
}

#signout {
  font-size: 0.85rem;
  padding: 0.35rem 0.75rem;
}

/* --- Test tools --- */

.tool {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 1rem;
  background: var(--surface);
  border: var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-top: 1.25rem;
  box-shadow: 4px 4px 0 var(--shadow);
}

#tools-output {
  background: var(--sunk);
  border: 1.5px solid var(--hair);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-top: 1.25rem;
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.5;
}

a.button {
  display: inline-block;
  text-decoration: none;
}
