/* The site's palette (src/styles/_tokens.scss): brown, rust, cream, peach. */
:root {
   --brown: #381803;
   --rust: #a45928;
   --cream: #f1e6db;
   --off-white: #f9f7f4;
   --peach: #fbc799;
   --copper-light: #e3aa79;
   --coral: #db8458;
   --line: rgba(164, 89, 40, 0.35);
   color-scheme: light;
}

* {
   box-sizing: border-box;
}

body {
   margin: 0;
   background: var(--cream);
   color: var(--brown);
   font:
      16px/1.45 system-ui,
      -apple-system,
      "Segoe UI",
      sans-serif;
}

header {
   display: flex;
   flex-wrap: wrap;
   align-items: baseline;
   gap: 0.4rem 1.6rem;
   padding: 2rem clamp(1rem, 4vw, 3rem);
   background: var(--brown);
   color: var(--cream);
}

h1 {
   margin: 0;
   font: 400 1.8rem/1 Georgia, serif;
   letter-spacing: 0.35em;
   text-transform: uppercase;
   color: var(--copper-light);
}

.eyebrow {
   margin: 0;
   flex: 1;
   font-size: 0.8rem;
   letter-spacing: 0.18em;
   text-transform: uppercase;
}

#who {
   margin: 0;
}

main {
   max-width: 72rem;
   margin: 0 auto;
   padding: 1.6rem clamp(1rem, 4vw, 3rem) 4rem;
}

/* Sticks to the top of the screen so feedback shows wherever the button was. */
#message {
   position: sticky;
   top: 0.8rem;
   z-index: 1;
   width: fit-content;
   max-width: 100%;
   margin: 0 0 1rem;
   padding: 0.6rem 1rem;
   border-radius: 0.5rem;
   background: var(--brown);
   color: var(--cream);
}

#message:empty {
   display: none;
}

#sign-in {
   max-width: 26rem;
   margin: 2rem auto 0;
}

#sign-in form {
   max-width: none;
}

.card {
   margin: 0 0 1.4rem;
   padding: 1.4rem;
   background: var(--off-white);
   border: 1px solid var(--line);
}

form {
   display: grid;
   gap: 0.9rem;
   max-width: 26rem;
}

.add {
   max-width: none;
   grid-template-columns: 1fr auto auto;
   align-items: end;
}

.add h2 {
   grid-column: 1 / -1;
}

h2 {
   margin: 0;
   font-size: 0.85rem;
   letter-spacing: 0.18em;
   text-transform: uppercase;
   color: var(--rust);
}

label {
   display: grid;
   gap: 0.3rem;
   font-size: 0.85rem;
}

input,
select {
   min-height: 2.75rem;
   padding: 0.5rem 0.7rem;
   border: 1px solid var(--line);
   border-radius: 0.5rem;
   background: #fff;
   color: inherit;
   font: inherit;
}

button {
   min-height: 2.75rem;
   padding: 0.5rem 1rem;
   border: 0;
   border-radius: 0.5rem;
   background: var(--rust);
   color: #fff;
   font: inherit;
   cursor: pointer;
}

button:hover {
   filter: brightness(1.1);
}

button:disabled {
   opacity: 0.6;
   cursor: progress;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
   outline: 2px solid var(--rust);
   outline-offset: 2px;
}

.link {
   min-height: 0;
   padding: 0;
   background: none;
   color: var(--peach);
   text-decoration: underline;
}

.link:hover {
   filter: none;
   color: var(--cream);
}

.note {
   margin: 0;
   font-size: 0.85rem;
   opacity: 0.8;
}

summary {
   cursor: pointer;
   font-size: 0.85rem;
   letter-spacing: 0.1em;
   text-transform: uppercase;
}

details form {
   margin-top: 1rem;
}

.link-box p {
   margin: 0 0 0.8rem;
}

.link-row {
   display: flex;
   gap: 0.6rem;
}

.link-row input {
   flex: 1;
   min-width: 0;
}

table {
   width: 100%;
   border-collapse: collapse;
   background: var(--off-white);
}

caption {
   padding: 0 0 0.6rem;
   text-align: left;
   font-size: 0.85rem;
   letter-spacing: 0.18em;
   text-transform: uppercase;
   color: var(--rust);
}

th,
td {
   padding: 0.7rem 0.8rem;
   border-bottom: 1px solid var(--line);
   text-align: left;
   vertical-align: middle;
   font-size: 0.9rem;
   font-variant-numeric: tabular-nums;
}

.email {
   min-width: 16rem;
   font-weight: 500;
   overflow-wrap: anywhere;
}

th {
   white-space: nowrap;
   font-weight: 500;
   font-size: 0.75rem;
   letter-spacing: 0.12em;
   text-transform: uppercase;
}

.actions {
   display: flex;
   flex-wrap: wrap;
   gap: 0.4rem;
   justify-content: flex-end;
}

.actions button {
   background: transparent;
   color: var(--rust);
   border: 1px solid var(--line);
   font-size: 0.85rem;
   white-space: nowrap;
}

.actions button:hover {
   filter: none;
   background: var(--cream);
}

.actions .danger {
   border-color: var(--coral);
}

.actions .danger:hover {
   background: var(--coral);
   color: var(--brown);
}

.visually-hidden {
   position: absolute;
   width: 1px;
   height: 1px;
   overflow: hidden;
   clip: rect(0 0 0 0);
}

@media (max-width: 720px) {
   .add {
      grid-template-columns: 1fr;
   }

   thead {
      display: none;
   }

   tr {
      display: grid;
      padding: 0.6rem 0;
      border-bottom: 1px solid var(--line);
   }

   td {
      border: 0;
      padding: 0.2rem 0.8rem;
   }

   td[data-label]::before {
      content: attr(data-label);
      display: inline-block;
      min-width: 7.5rem;
      font-size: 0.75rem;
      letter-spacing: 0.12em;
      text-transform: uppercase;
      color: var(--rust);
   }

   .actions {
      justify-content: flex-start;
      padding-top: 0.6rem;
   }
}
