/* Round 3. The system is studied from Duolingo's real product: white ground, grey outlines,
   rounded bold type, buttons with a solid 4px edge that press down. Pangea's own copper is the lead colour. */

@font-face {
  font-family: 'Jost';
  src: url('../fonts/jost-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #1d1b18;
  --wolf: #6e6a63;
  --hare: #a8a299;
  --swan: #e7e2d9;
  --polar: #f5f2ec;
  --snow: #fcfbf8;

  --lead: #b8744c;
  --lead-edge: #96593a;
  --lead-soft: #f6ebe3;
  --blue: #1d1b18;
  --blue-edge: #000000;
  --blue-soft: #f5f2ec;
  --blue-line: #cfc8bc;
  --red: #b23a2e;
  --red-edge: #8c2f2f;
  --red-soft: #f8e4e0;
  --done: #1c6e4a;
  --done-edge: #14523a;
  --done-soft: #e4f0ea;
  --bee: #b8744c;
  --bee-edge: #96593a;
  --fox: #b8744c;
  --purple: #1d1b18;
  --purple-edge: #000000;

  --font: 'Jost', 'Avenir Next', 'Century Gothic', sans-serif;
  --text: 17px;
  --small: 15px;
  --edge: 0px;
  --r-btn: 999px;
  --r-card: 18px;
  --nav: 248px;
  --center: 640px;
  --rail: 368px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --spring: cubic-bezier(0.34, 1.3, 0.64, 1);
  --fast: 120ms;
  --mid: 280ms;
  --slow: 600ms;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--snow);
  color: var(--ink);
  font: 400 var(--text) / 1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p {
  margin: 0;
  font-weight: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

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

.sr,
.skip:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip:focus {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 50;
  padding: 10px 16px;
  border-radius: var(--r-btn);
  background: var(--ink);
  color: var(--snow);
}

/* ---------- the side nav (a bottom tab bar on phones) ---------- */

.top {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: var(--nav);
  padding: 22px 16px 16px;
  border-right: 1px solid var(--swan);
  background: var(--snow);
}

.logo {
  padding: 2px 16px 18px;
}

.logo img {
  width: auto;
  height: 46px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 8px 14px;
  border: 0;
  border-radius: 14px;
  color: var(--wolf);
  font-size: 16px;
  font-weight: 500;
  transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease);
}

.nav a:hover {
  background: var(--polar);
}

.nav a[aria-current='page'] {
  background: var(--polar);
  color: var(--ink);
  font-weight: 600;
}

.nav a[aria-current='page'] svg {
  color: var(--lead);
}

.nav svg,
.who svg {
  flex: none;
  width: 24px;
  height: 24px;
}

.who {
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.who label {
  display: grid;
  gap: 6px;
}

.who .hint {
  padding: 0 4px;
  color: var(--hare);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.who select,
.field select {
  appearance: none;
  background: var(--snow) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9'%3E%3Cpath d='M1.5 1.5l5.5 5.5 5.5-5.5' fill='none' stroke='%23afafaf' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 14px center;
  cursor: pointer;
}

.who select {
  width: 100%;
  min-height: 46px;
  padding: 0 38px 0 14px;
  border: 1px solid var(--swan);
  border-radius: 14px;
  font-weight: 500;
}

/* ---------- type ---------- */

.caps {
  color: var(--hare);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.h1 {
  font-size: 34px;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.h2 {
  font-size: 20px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.sub {
  color: var(--wolf);
}

.link {
  padding: 0;
  border: 0;
  background: none;
  border-bottom: 1px solid var(--blue-line);
  color: var(--ink);
  font-size: var(--small);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}

.link:hover {
  border-bottom-color: var(--lead);
  color: var(--lead-edge);
}

.alert {
  position: fixed;
  left: 50%;
  top: 16px;
  z-index: 60;
  margin: 0;
  padding: 12px 18px;
  border-radius: var(--r-btn);
  background: var(--red);
  box-shadow: 0 var(--edge) 0 var(--red-edge);
  color: var(--snow);
  font-weight: 800;
  transform: translateX(-50%);
}

/* ---------- buttons: a solid edge underneath, pressed flat on tap ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--r-btn);
  background: var(--face, var(--ink));
  color: var(--snow);
  font-size: var(--small);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--mid) var(--ease), transform var(--fast) var(--ease);
}

.btn:hover {
  background: var(--face-hover, var(--lead-edge));
}

.btn:active {
  transform: scale(0.96);
}

.btn.done {
  --face: var(--ink);
  --face-hover: var(--done);
}

.btn.blue {
  --face: var(--blue);
  --rim: var(--blue-edge);
}

.btn.red {
  --face: var(--red);
  --rim: var(--red-edge);
}

.btn.plain {
  --face: transparent;
  --face-hover: var(--polar);
  border: 1px solid var(--blue-line);
  color: var(--ink);
}

.btn.plain.on {
  --face: var(--ink);
  --face-hover: var(--ink);
  border-color: var(--ink);
  color: var(--snow);
}

.btn[disabled] {
  --face: var(--swan);
  --rim: var(--swan);
  color: var(--hare);
  cursor: default;
}

/* ---------- cards and fields ---------- */

.card {
  padding: 22px 22px 20px;
  border: 1px solid var(--swan);
  border-radius: var(--r-card);
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field > span {
  color: var(--wolf);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--swan);
  border-radius: 14px;
  background-color: var(--polar);
  font-weight: 400;
}

.field select {
  padding-right: 40px;
  background-color: var(--polar);
}

.field input::placeholder {
  color: var(--hare);
  font-weight: 500;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--blue-line);
  background-color: var(--snow);
}

.field.gap > span {
  color: var(--red);
}

/* ---------- avatars: a letter on a colour ---------- */

.pin {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: var(--size, 48px);
  height: var(--size, 48px);
  border-radius: 50%;
  background: var(--pin, var(--blue));
  color: var(--snow);
  font-size: calc(var(--size, 48px) * 0.4);
  font-weight: 500;
  line-height: 1;
}

/* ---------- page frame ---------- */

main {
  display: flex;
  justify-content: center;
  gap: 48px;
  margin-left: var(--nav);
  padding: 24px 24px 80px;
}

main:focus {
  outline: none;
}

.center {
  flex: 0 1 var(--center);
  min-width: 0;
}

.center.wide {
  flex-basis: 760px;
}

.side {
  position: sticky;
  top: 24px;
  flex: 0 0 var(--rail);
  display: grid;
  gap: 24px;
  align-self: flex-start;
  min-width: 0;
}

@keyframes arrive {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

@keyframes pop {
  0% {
    transform: scale(0.6);
  }
  60% {
    transform: scale(1.12);
  }
  100% {
    transform: scale(1);
  }
}

[data-fresh] .arrive {
  animation: arrive 360ms var(--ease) both;
  animation-delay: calc(var(--i, 0) * 35ms);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    transition-duration: 1ms !important;
  }
}

/* Mid widths: icons only in the nav, the rail drops under the page. */
@media (max-width: 1180px) {
  :root {
    --nav: 88px;
  }

  .logo {
    padding: 2px 0 14px;
    overflow: hidden;
    width: 52px;
  }

  .logo img {
    height: 44px;
    max-width: none;
  }

  .nav a {
    justify-content: center;
    padding: 8px;
  }

  .nav a span,
  .who .hint {
    display: none;
  }

  .who select {
    padding: 0 8px;
    background-image: none;
    font-size: 13px;
    text-overflow: ellipsis;
  }

  main {
    flex-direction: column;
    align-items: center;
    gap: 28px;
  }

  .center,
  .center.wide,
  .side {
    flex: none;
    width: min(100%, 640px);
  }

  .side {
    position: static;
  }
}

/* Phones: stats on top, tabs under the thumb. */
@media (max-width: 700px) {
  .top {
    inset: auto 0 0 0;
    flex-direction: row;
    align-items: center;
    width: auto;
    padding: 8px 8px max(8px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--swan);
    border-right: 0;
  }

  .logo {
    display: none;
  }

  .nav {
    display: flex;
    flex: 1;
    justify-content: space-around;
    gap: 2px;
  }

  .nav a {
    padding: 6px;
  }

  .who {
    position: fixed;
    top: 10px;
    right: 12px;
    z-index: 21;
    margin: 0;
  }

  .who .link {
    display: none;
  }

  .who select {
    width: auto;
    max-width: 132px;
    min-height: 40px;
    padding: 0 10px;
    font-size: 14px;
  }

  main {
    margin-left: 0;
    padding: 12px 14px 104px;
  }
}
