/* The owners' page. Colours and type follow the store (the theme's
   snippets/cc-styles.liquid): ink background, paper text, one bright accent.
   No fonts or images are fetched from anywhere, so the store's typefaces are
   named first and the device's own fonts stand in when they are missing. */

:root {
  --ink: #0b0c0e;
  --ink-2: #121417;
  --ink-3: #1b1e22;
  --paper: #f3f1ea;
  --muted: rgb(243 241 234 / 0.66);
  --rule: rgb(243 241 234 / 0.14);
  --grid: rgb(243 241 234 / 0.04);
  --accent: #d2ff3a;
  --accent-ink: #0b0c0e;
  --danger: #ff8a80;
  --display: 'Archivo', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'Space Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --radius: 16px;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--ink);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px;
  background-position: center top;
  color: var(--paper);
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.55;
}

[hidden] {
  display: none !important;
}

.wrap {
  width: min(100% - 2.5rem, 880px);
  margin-inline: auto;
}

.skip {
  position: absolute;
  inset-inline-start: 1rem;
  top: -4rem;
  padding: 0.6rem 1rem;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}

.skip:focus {
  top: 1rem;
  z-index: 10;
}

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

/* Top bar */
.top {
  border-block-end: 1px solid var(--rule);
  background: var(--ink);
}

.top__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.03em;
}

/* The store's mark: viewfinder corners around a lens */
.brand__mark {
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.6;
  stroke-linecap: square;
}

.brand__mark circle {
  fill: var(--accent);
  stroke: none;
}

.who {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

/* A button in the header keeps to one line; the address beside it gives way. */
.top .btn {
  white-space: nowrap;
}

.who__email {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.875rem;
}

/* Type */
main {
  padding-block: clamp(2rem, 6vw, 4rem) 5rem;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.75em;
  margin: 0 0 1rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.eyebrow::before {
  content: '';
  width: 0.6em;
  height: 0.6em;
  background: var(--accent);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.25rem, 6vw, 3.75rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
  margin-block-end: 1.5rem;
}

h1 em {
  font-style: normal;
  color: var(--accent);
}

h2 {
  font-size: 1.375rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

/* A heading the keyboard was sent back to after something under it was removed */
h2:focus {
  outline: none;
}

h3 {
  font-family: var(--body);
  font-size: 1rem;
  font-weight: 700;
}

p {
  margin: 0;
  text-wrap: pretty;
}

.lede {
  max-width: 34em;
  margin-block-end: 2rem;
  font-size: 1.125rem;
  color: var(--muted);
}

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

.hint {
  font-size: 0.9375rem;
}

.smallprint {
  max-width: 44em;
  margin-block-start: 2rem;
  color: var(--muted);
  font-size: 0.875rem;
}

.mono {
  font-family: var(--mono);
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
}

/* Messages */
.status {
  position: sticky;
  top: 0.75rem;
  z-index: 5;
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--ink-3);
}

.status:empty {
  display: none;
}

.status[data-kind='error'] {
  border-color: var(--danger);
  color: var(--danger);
}

.error {
  color: var(--danger);
}

.error:empty {
  display: none;
}

/* Cards */
.card {
  display: grid;
  gap: 1.25rem;
  margin-block-start: 1.25rem;
  padding: clamp(1.25rem, 3vw, 2rem);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--ink-2);
  min-width: 0;
}

.signin {
  max-width: 32rem;
}

/* Forms */
.form {
  display: grid;
  gap: 0.6rem;
  min-width: 0;
}

.form--inline {
  gap: 0.9rem;
  padding-block-start: 1.25rem;
  border-block-start: 1px solid var(--rule);
}

label,
legend {
  font-weight: 600;
}

legend {
  padding: 0;
  margin-block-end: 0.5rem;
}

fieldset {
  display: grid;
  gap: 0.5rem;
  margin: 0.4rem 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

input[type='text'],
input[type='email'],
input[type='file'],
textarea {
  width: 100%;
  min-width: 0;
  padding: 0.75rem 0.9rem;
  border: 1.5px solid var(--rule);
  border-radius: 12px;
  background: var(--ink);
  color: var(--paper);
  font: inherit;
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

input::placeholder,
textarea::placeholder {
  color: rgb(243 241 234 / 0.4);
}

.input--code {
  max-width: 12rem;
  font-family: var(--mono);
  font-size: 1.25rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

input[type='file']::file-selector-button {
  margin-inline-end: 0.9rem;
  padding: 0.45rem 0.9rem;
  border: 1.5px solid var(--rule);
  border-radius: 9px;
  background: var(--ink-3);
  color: var(--paper);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

:is(a, button, input, textarea, summary):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.choice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border: 1.5px solid var(--rule);
  border-radius: 12px;
  font-weight: 400;
  cursor: pointer;
}

.choice:has(input:checked) {
  border-color: var(--accent);
}

.choice input {
  width: 1.15rem;
  height: 1.15rem;
  margin: 0.2rem 0 0;
  accent-color: var(--accent);
}

.choice strong,
.choice .hint {
  display: block;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.row--between {
  justify-content: space-between;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.6rem 1.35rem;
  border: 1.5px solid var(--accent);
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 700;
  line-height: 1.1;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: progress;
  transform: none;
}

.btn--ghost {
  border-color: var(--rule);
  background: transparent;
  color: var(--paper);
}

.btn--small {
  min-height: 2.75rem;
  padding: 0.4rem 0.9rem;
  font-size: 0.9375rem;
}

.btn--danger {
  border-color: var(--rule);
  background: transparent;
  color: var(--danger);
}

/* The button that confirms removing something */
.btn--warn {
  border-color: var(--danger);
  background: var(--danger);
  color: var(--ink);
}

.form > .btn {
  justify-self: start;
  margin-block-start: 0.4rem;
}

/* Plans */
.plan {
  display: grid;
  gap: 0.75rem;
}

.plan:empty {
  display: none;
}

.plans {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.plans:empty {
  display: none;
}

.plans__item {
  display: grid;
  align-content: start;
  gap: 0.35rem;
  padding: 1.1rem 1.25rem 1.25rem;
  border: 1.5px solid var(--rule);
  border-radius: 14px;
}

.plans__name {
  font-weight: 700;
  font-size: 1.125rem;
  text-transform: capitalize;
}

.plans__price {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.75rem;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.plans__item .btn {
  justify-self: start;
  margin-block-start: 0.6rem;
}

.notice {
  padding: 0.75rem 1rem;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--ink);
}

.notice--problem {
  border-color: var(--danger);
}

.card--quiet {
  background: transparent;
}

.card--quiet > .btn {
  justify-self: start;
}

/* Meters */
.meter {
  display: grid;
  gap: 0.5rem;
}

.meter label {
  font-weight: 400;
}

.figure {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.5rem, 7vw, 3.75rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

.figure small {
  font-family: var(--body);
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--muted);
}

progress {
  appearance: none;
  -webkit-appearance: none;
  display: block;
  width: 100%;
  height: 0.6rem;
  border: 0;
  border-radius: 999px;
  background: var(--ink-3);
  overflow: hidden;
}

progress::-webkit-progress-bar {
  background: var(--ink-3);
}

progress::-webkit-progress-value {
  background: var(--accent);
}

progress::-moz-progress-bar {
  background: var(--accent);
}

/* Fuller than full */
progress.is-over::-webkit-progress-value {
  background: var(--danger);
}

progress.is-over::-moz-progress-bar {
  background: var(--danger);
}

/* Lists of calculators and notes */
.list {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.list:empty {
  display: none;
}

.item {
  display: grid;
  gap: 0.75rem;
  padding-block: 1.1rem;
  border-block-start: 1px solid var(--rule);
  min-width: 0;
}

.item:first-child {
  border-block-start: 0;
  padding-block-start: 0;
}

.item__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

.item__title {
  min-width: 0;
  font-weight: 700;
  font-size: 1.0625rem;
  overflow-wrap: anywhere;
}

.item__meta {
  color: var(--muted);
  font-size: 0.9375rem;
}

.item__warn {
  color: var(--danger);
  font-size: 0.9375rem;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Questions per day */
.usage {
  display: grid;
  gap: 0.35rem;
  width: 100%;
  max-width: 26rem;
}

.days {
  display: block;
  width: 100%;
  height: 2.75rem;
}

.days__bar {
  fill: var(--accent);
}

.days__bar.days__empty {
  fill: var(--ink-3);
}

.days__column {
  fill: transparent;
}

.days g:hover .days__column {
  fill: var(--grid);
}

.days g:hover .days__bar {
  fill: var(--paper);
}

.usage__ends {
  display: flex;
  justify-content: space-between;
  padding-block-start: 0.35rem;
  border-block-start: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.busy::before {
  content: '';
  display: inline-block;
  width: 0.8em;
  height: 0.8em;
  margin-inline-end: 0.5em;
  border: 2px solid var(--rule);
  border-block-start-color: var(--accent);
  border-radius: 50%;
  vertical-align: -0.1em;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Adding notes */
.add {
  display: grid;
  gap: 1.5rem;
  padding-block-start: 1.25rem;
  border-block-start: 1px solid var(--rule);
}

@media (min-width: 760px) {
  .add {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 2rem;
  }
}

.add__form {
  align-content: start;
}

/* The edit window */
dialog {
  width: min(100% - 2rem, 44rem);
  padding: clamp(1.25rem, 3vw, 2rem);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--ink-2);
  color: var(--paper);
}

dialog::backdrop {
  background: rgb(0 0 0 / 0.7);
}

/* Renaming, and "are you sure?" */
.dialog--small {
  width: min(100% - 2rem, 28rem);
}

.dialog--small .form {
  gap: 0.9rem;
}

.dialog--small h2 {
  overflow-wrap: anywhere;
}

.dialog--small .row {
  margin-block-start: 0.4rem;
}

@media (prefers-reduced-motion: no-preference) {
  dialog[open] {
    animation: rise 0.18s ease-out;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn {
    transition: none;
  }

  .btn:hover {
    transform: none;
  }

  .busy::before {
    animation: none;
  }
}
