/* The same light colours everywhere, even in dark mode. Each one keeps the same meaning:
   ink = coming, grey = not coming, rust = no answer, roll calls and the stamp, blue = buttons.
   Colour is never the only sign: there's always text too. */

:root {
  color-scheme: light;
  --page: #f1e6d3;
  --paper: #fffdf8;
  --ink: #2c2c2a;
  --grey: #5f5e5a;
  --rust: #993c1d;
  --blue: #185fa5;
  --line: #d9c7a8;
  --radius: 0.875rem;
}

* {
  box-sizing: border-box;
}

/* Otherwise "display: flex" on buttons would show hidden ones. */
[hidden] {
  display: none !important;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 1.0625rem/1.5 system-ui, sans-serif;
  overflow-wrap: anywhere;
}

/* The stamp is wider than the screen for a moment as it lands. */
main {
  overflow-x: clip;
}

h1,
h2,
h3,
p,
ul {
  margin: 0;
}

h1,
h2,
h3 {
  line-height: 1.2;
}

h1 {
  font-size: 1.75rem;
  letter-spacing: -0.02em;
}

h2,
.coming h3 {
  font-size: 1.25rem;
}

ul {
  padding: 0;
  list-style: none;
}

a {
  color: var(--blue);
}

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.icon {
  flex: none;
  width: 1.25em;
  height: 1.25em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Header */

header,
main {
  width: 100%;
  padding-inline: max(1rem, env(safe-area-inset-left)) max(1rem, env(safe-area-inset-right));
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: max(0.5rem, env(safe-area-inset-top)) 0.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

/* A small FR | EN switch. Each side can be tapped over 44px, more than it looks. */

.languages {
  display: flex;
  flex: none;
  padding: 2px;
  border: 1.5px solid var(--grey);
  border-radius: 1rem;
}

.languages a {
  position: relative;
  width: 2.75rem;
  border-radius: 1rem;
  color: var(--grey);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.5rem;
  text-align: center;
  text-decoration: none;
}

.languages a::after {
  content: '';
  position: absolute;
  inset: -0.625rem 0;
}

.languages a[aria-current] {
  background: var(--ink);
  color: var(--paper);
}

/* Pages: one column */

.page header,
.page main {
  max-width: 32rem;
  margin-inline: auto;
}

.page main {
  padding-block: 0.5rem max(2rem, env(safe-area-inset-bottom));
}

.page main > * + *,
.card > * + * {
  margin-block-start: 0.875rem;
}

.card {
  padding: 1.125rem;
  border-radius: var(--radius);
  background: var(--paper);
}

.quiet,
.date {
  color: var(--grey);
}

.date::first-letter {
  text-transform: uppercase;
}

.code {
  font: 700 2.25rem/1.25 ui-monospace, monospace;
  letter-spacing: 0.2em;
  user-select: all;
}

.error {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: var(--rust);
  color: var(--paper);
}

.error a {
  color: inherit;
}

/* Forms and buttons */

label {
  display: block;
  font-weight: 600;
}

label + input {
  margin-block-start: 0.25rem;
}

input,
button,
.button {
  width: 100%;
  min-height: 3rem;
  padding: 0.5rem 1rem;
  border: 2px solid var(--grey);
  border-radius: var(--radius);
  background: var(--paper);
  color: inherit;
  font: inherit;
}

::placeholder {
  color: var(--grey);
  opacity: 1;
}

button,
.button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-color: var(--blue);
  background: transparent;
  color: var(--blue);
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.main {
  background: var(--blue);
  color: var(--paper);
}

summary,
.page p > a:only-child:not(.button) {
  padding-block: 0.625rem;
}

.page p > a:only-child:not(.button) {
  display: inline-block;
}

summary {
  cursor: pointer;
}

details > * + * {
  margin-block-start: 0.5rem;
}

/* The two answers: blue for yes, grey for no */

.answers {
  display: grid;
}

.answers button {
  flex-direction: column;
  gap: 0.125rem;
  border: 0;
  color: var(--paper);
  font-weight: 400;
}

.answers strong {
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.answers .yes {
  background: var(--blue);
}

.answers .no {
  background: var(--grey);
}

.answers :focus-visible {
  outline-color: var(--paper);
  outline-offset: -0.625rem;
}

.answers .current {
  margin-block-start: 0.5rem;
  padding: 0 0.75rem;
  border: 1.5px solid;
  border-radius: 1rem;
  font-size: 0.875rem;
}

.current::before {
  content: '✓ ';
  content: '✓ ' / '';
}

/* The question fills the screen */

.question main {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 0;
}

.question .intro {
  display: grid;
  gap: 0.375rem;
  padding: 0.5rem 1rem 0.75rem;
}

.question .links {
  display: flex;
  flex-wrap: wrap;
  column-gap: 1.25rem;
}

.question .links a {
  padding-block: 0.625rem;
}

.question .answers {
  flex: 1;
  grid-template-rows: 1fr 1fr;
}

.question .answers button {
  min-height: 9rem;
  border-radius: 0;
}

.question .no {
  padding-block-end: max(0.5rem, env(safe-area-inset-bottom));
}

.question strong {
  font-size: clamp(3.5rem, 18vw, 6rem);
}

/* Side by side on wide or short screens */
@media (min-width: 40rem), (max-height: 30rem) {
  .question .answers {
    grid-template-rows: none;
    grid-template-columns: 1fr 1fr;
  }
}

/* Smaller on a day's page */

.page .answers {
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: 0.75rem;
}

.page .answers button {
  min-height: 5.5rem;
}

.page .answers strong {
  font-size: 1.625rem;
}

.page .answers span {
  font-size: 0.875rem;
}

/* A day's page */

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.tabs a {
  padding-block: 0.625rem;
  border-block-end: 2px solid var(--line);
  color: var(--grey);
  text-align: center;
  text-decoration: none;
}

.tabs [aria-current] {
  border-color: var(--ink);
  color: var(--ink);
  font-weight: 700;
}

.me {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.me > * + * {
  margin: 0;
}

.stamp {
  padding: 0.25rem 0.75rem;
  border: 3px solid;
  border-radius: 0.5rem;
  color: var(--rust);
  font-size: 1.125rem;
  font-weight: 800;
  transform: rotate(-8deg);
}

@media (prefers-reduced-motion: no-preference) {
  .stamp {
    animation: stamp 0.3s ease-in both;
  }
}

@keyframes stamp {
  from {
    opacity: 0;
    transform: rotate(-8deg) scale(2);
  }
}

.roll-call {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0.875rem;
  border: 2px solid;
  border-radius: var(--radius);
  color: var(--rust);
  font-weight: 600;
}

.coming ul {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  gap: 0.25rem 1rem;
  margin-block-start: 0.625rem;
}

.coming li {
  display: flex;
  gap: 0.5rem;
}

.coming li::before {
  content: '✓';
  content: '✓' / '';
  font-weight: 700;
}

.not-coming,
.no-answer,
.not-coming h3,
.no-answer h3 {
  display: flex;
  align-items: baseline;
  gap: 0.375rem;
  font-size: 1rem;
}

/* Next to the first line when the names wrap */
.not-coming .icon,
.no-answer .icon {
  align-self: flex-start;
  margin-block-start: 0.125em;
}

.not-coming h3,
.no-answer h3 {
  flex: none;
  font-weight: 600;
}

.not-coming {
  color: var(--grey);
}

.no-answer {
  color: var(--rust);
}

.not-coming li,
.no-answer li {
  display: inline;
}

.not-coming li:not(:last-child)::after,
.no-answer li:not(:last-child)::after {
  content: ', ';
}

/* Admin */

.people li + li {
  border-block-start: 1px solid var(--line);
}

.people a {
  display: inline-block;
  min-width: 2.75rem;
  padding-block: 0.625rem;
}

input:not([type='hidden']) + button {
  margin-block-start: 0.875rem;
}

form[action$='/delete'] button {
  border-color: var(--rust);
  color: var(--rust);
}

/* High-contrast mode replaces our colours, so use borders instead. */
@media (forced-colors: active) {
  .answers button,
  .languages a[aria-current] {
    border: 2px solid;
  }

  .answers button[aria-pressed='true'] {
    border-width: 6px;
  }
}
