/*
  Still wrapped scale. Hold to this.

  One face: IBM Plex Sans. Cool gray field, white sheet, black ink.
  No gradients, glass, shadows, pills, or side rails.
  Sizes: 14, 16, 18, 22, 28, 40, 56.
  Space: 4, 8, 16, 24, 32, 48, 64, 96.
  Radius: 2px controls, 4px the sheet and photos.
  Borders are 1px. No shadow.
*/

:root {
  --bg: #f2f3f1;
  --paper: #ffffff;
  --paper-deep: #e6e8e4;
  --ink: #121417;
  --muted: #3a4250;
  --line: #d5d8d4;
  --alert: #8c1d1d;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 48px;
  --space-7: 64px;
  --space-8: 96px;
  --text-sm: 14px;
  --text-body: 16px;
  --text-md: 18px;
  --text-lg: 22px;
  --text-xl: 28px;
  --text-2xl: 40px;
  --text-3xl: 56px;
  --radius-control: 2px;
  --radius-sheet: 4px;
  --hit: 44px;
  --measure: 38rem;
  --sans: "IBM Plex Sans", "Segoe UI", sans-serif;
  color-scheme: light;
}

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

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--text-body);
  line-height: 1.45;
}

::selection {
  background: var(--ink);
  color: var(--paper);
}

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

a {
  color: inherit;
}

.skip {
  position: absolute;
  left: var(--space-3);
  top: -100px;
  background: var(--paper);
  color: var(--ink);
  padding: var(--space-2) var(--space-3);
  z-index: 2;
}

.skip:focus {
  top: var(--space-3);
}

.frame {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  width: min(100%, 72rem);
  margin: 0 auto;
  padding: var(--space-4) var(--space-3) calc(var(--space-7) + env(safe-area-inset-bottom));
}

.wordmark {
  font-weight: 600;
  font-size: var(--text-xl);
  line-height: 1.15;
  color: var(--ink);
  text-decoration: none;
}

.wordmark:hover {
  text-decoration: underline;
  text-underline-offset: var(--space-1);
}

.margin-note {
  margin: 0;
  min-width: 0;
  max-width: 20ch;
  font-weight: 600;
  font-size: var(--text-lg);
  line-height: 1.15;
  color: var(--ink);
  text-wrap: balance;
}

.display {
  font-size: var(--text-xl);
}

#app {
  min-width: 0;
}

.pad {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--ink);
  border-radius: var(--radius-sheet);
  padding: var(--space-4) var(--space-3) var(--space-5);
}

h1,
h2,
.item-title {
  font-weight: 600;
  line-height: 1.15;
  text-wrap: balance;
}

h1 {
  margin: 0 0 var(--space-3);
  font-size: var(--text-xl);
}

h2,
.section-title {
  margin: var(--space-5) 0 var(--space-2);
  font-size: var(--text-lg);
}

h2:first-child,
.pad > h1 + h2 {
  margin-top: var(--space-4);
}

p {
  margin: 0;
}

.lede,
.hint,
.quiet {
  color: var(--muted);
}

.lede {
  max-width: var(--measure);
  font-size: var(--text-md);
  margin-bottom: var(--space-4);
}

.hint,
.quiet {
  font-size: var(--text-sm);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

label,
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

input,
textarea {
  width: 100%;
  margin: 0;
  padding: var(--space-2) var(--space-3);
  min-height: var(--hit);
  border: 1px solid var(--ink);
  border-radius: var(--radius-control);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: var(--text-body);
}

textarea {
  min-height: var(--space-8);
  padding-top: var(--space-3);
  resize: vertical;
}

[hidden] {
  display: none !important;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--hit);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--ink);
  border-radius: var(--radius-control);
  background: var(--ink);
  color: var(--paper);
  font: inherit;
  font-size: var(--text-body);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.button:hover {
  background: #2a2f36;
  border-color: #2a2f36;
}

button.secondary,
.button.secondary {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--ink);
}

button.secondary:hover,
.button.secondary:hover {
  background: var(--paper-deep);
}

button:disabled {
  background: var(--line);
  border-color: var(--line);
  color: var(--ink);
  cursor: wait;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

hr,
.rule {
  border: 0;
  border-top: 1px solid var(--line);
  margin: var(--space-5) 0;
}

.error {
  color: var(--alert);
  font-size: var(--text-body);
}

.items,
.results,
.mine {
  list-style: none;
  margin: 0;
  padding: 0;
}

.item {
  padding: var(--space-3) 0;
  border-top: 1px solid var(--line);
}

.product {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-3);
  align-items: start;
}

.product:has(.thumb-wrap) {
  grid-template-columns: var(--space-8) minmax(0, 1fr);
}

.thumb-wrap {
  width: var(--space-8);
  height: var(--space-8);
}

.thumb {
  display: block;
  width: var(--space-8);
  height: var(--space-8);
  object-fit: cover;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sheet);
}

.item-title {
  margin: 0;
  font-size: var(--text-lg);
  overflow-wrap: anywhere;
}

.item-title.is-bought {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.price {
  margin-top: var(--space-2);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.product-copy p + p,
.item .quiet {
  margin-top: var(--space-2);
}

.item .stack,
.preview {
  margin-top: var(--space-3);
}

.results a,
.mine a {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-height: var(--hit);
  padding: var(--space-2) 0;
  border-top: 1px solid var(--line);
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: var(--space-1);
}

.result-name,
.mine a {
  font-size: var(--text-md);
  font-weight: 600;
}

.result-code {
  font-size: var(--text-sm);
  color: var(--muted);
}

.summary {
  margin-top: var(--space-3);
  font-size: var(--text-md);
}

.link-url {
  font-size: var(--text-sm);
}

@media (max-width: 1099px) {
  .margin-note {
    display: none;
  }

  body[data-page="home"] .margin-note {
    display: block;
  }
}

@media (min-width: 900px) {
  .pad {
    padding: var(--space-5) var(--space-5) var(--space-6);
  }

  h1,
  .display {
    font-size: var(--text-2xl);
  }

  .actions {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

@media (min-width: 1100px) {
  .frame {
    grid-template-columns: minmax(0, 36rem) minmax(16rem, 1fr);
    grid-template-areas:
      "head note"
      "app note";
    column-gap: var(--space-6);
    row-gap: var(--space-5);
    padding: var(--space-6);
    align-items: start;
  }

  .top {
    grid-area: head;
  }

  .margin-note {
    display: block;
    grid-area: note;
    position: sticky;
    top: var(--space-6);
    max-width: 14ch;
    font-size: var(--text-3xl);
  }

  #app {
    grid-area: app;
  }

  .display {
    font-size: var(--text-3xl);
  }
}
