/* The cookie banner: a warm white card in the bottom left corner of a white page, with a cookie in its top corner;
   folded, only the cookie is left, in a round button in the same corner. */
:root {
  --page: #ffffff;          /* the page */
  --surface: #fffdf9;       /* the card and the round button */
  --ink: #2a1d14;           /* chocolate */
  --muted: #8b7b6e;
  --line: #ece4da;
  --on: #c8742f;            /* a switch turned on */
  --off: #e6ddd2;
  --shadow: drop-shadow(0 2px 3px rgba(60, 36, 18, 0.08)) drop-shadow(0 14px 26px rgba(60, 36, 18, 0.16));
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Gabarito Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* the corner the banner lives in: the card sits in it, and the folded cookie lands in it */
.consent {
  --gap: 24px;
  position: fixed;
  left: var(--gap);
  bottom: var(--gap);
  z-index: 10;
}

/* ---------------------------------------------------------------- the card */
.card {
  position: relative;
  width: min(440px, calc(100vw - var(--gap) * 2));
  padding: 20px;
  filter: var(--shadow);
}

/* the card's paper: cut down to a circle around the cookie when the card folds */
.card__surface {
  position: absolute;
  inset: 0;
  border-radius: 22px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px rgba(42, 29, 20, 0.06);
}

.card__head {
  position: relative;
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 16px;
  align-items: start;
}

.card__slot {
  position: relative;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
}

.card__title {
  margin: 4px 0 6px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.card__text {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
  color: var(--muted);
}

/* ---------------------------------------------------------------- the cookie */
.cookie {
  display: block;
  width: 56px;
  height: 56px;
  overflow: visible;
}

.cookie__dough {
  fill: #e2a256;
}

.cookie__bake {
  fill: #ebb56f;
}

.cookie__rim {
  fill: none;
  stroke: #c98638;
  stroke-width: 2;
}

.cookie__chunks {
  fill: #4f2d1a;
}

.cookie__cracks {
  fill: none;
  stroke: #b8742f;
  stroke-width: 1.6;
  stroke-linecap: round;
}

.cookie__crumb {
  fill: #d99a4e;
}

/* ---------------------------------------------------------------- the kinds of cookies */
.card__more {
  position: relative;
}

.kinds {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.kind {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.kind__name {
  display: block;
  font-size: 15px;
  font-weight: 650;
}

.kind__line {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
}

/* a switch: a real checkbox over the track */
.switch {
  position: relative;
  display: block;
  width: 46px;
  height: 28px;
}

.switch input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.switch input:disabled {
  cursor: not-allowed;
}

.switch__track {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background: var(--off);
}

.switch__knob {
  position: absolute;
  left: 3px;
  top: 3px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 11px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(42, 29, 20, 0.25);
}

.switch__knob svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.switch input:focus-visible ~ .switch__track {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.switch--locked .switch__track {
  opacity: 0.55;
}

/* ---------------------------------------------------------------- the buttons */
.card__actions {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.cbtn {
  display: inline-flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  font: 650 15px 'Gabarito Variable', system-ui, sans-serif;
  box-shadow: inset 0 0 0 1.5px var(--line);
  cursor: pointer;
  transition: box-shadow 0.25s, background-color 0.25s, transform 0.2s;
  -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
  .cbtn:hover {
    box-shadow: inset 0 0 0 1.5px #d6c8b8;
  }
}

.cbtn:active {
  transform: scale(0.97);
}

.cbtn--main {
  background: var(--ink);
  color: #fff7ec;
  box-shadow: none;
}

@media (hover: hover) {
  .cbtn--main:hover {
    background: #3d2b1e;
    box-shadow: none;
  }
}

/* without a frame; alone on its row (on a phone) it takes the whole row, like the others */
.cbtn--plain {
  box-shadow: none;
}

@media (hover: hover) {
  .cbtn--plain:hover {
    background: rgba(42, 29, 20, 0.05);
    box-shadow: none;
  }
}

.cbtn:focus-visible,
.corner:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

/* the focus moves to the round button and back when the card folds and opens: its ring shows only to who uses
   the keys */
html[data-using='pointer'] .cbtn:focus-visible,
html[data-using='pointer'] .corner:focus-visible {
  outline: none;
}

.cbtn__clip {
  display: block;
  overflow: hidden;
}

.cbtn__label {
  display: block;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- the round button in the corner */
.corner {
  position: absolute;
  left: 0;
  bottom: 0;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px rgba(42, 29, 20, 0.06);
  filter: var(--shadow);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.corner[hidden] {
  display: none;
}

@media (max-width: 520px) {
  .consent {
    --gap: 12px;
  }

  .card {
    padding: 18px;
  }

  .card__head {
    gap: 12px;
  }
}
