[hidden] {
  display: none !important;
}

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

html {
  background: #f7f5ff;
  scroll-padding-top: calc(8px + env(safe-area-inset-top));
  scroll-padding-bottom: calc(80px + env(safe-area-inset-bottom));
}

body {
  margin: 0;
  background: #f7f5ff;
  color: #1e1b4b;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
}

.skip {
  position: absolute;
  left: 18px;
  top: -48px;
  background: #fff;
  color: #1e1b4b;
  padding: 10px 12px;
  border-radius: 10px;
  z-index: 2;
}

.skip:focus {
  top: calc(8px + env(safe-area-inset-top));
}

.site-header,
main,
.site-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.wrap {
  width: min(1100px, 100%);
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
  padding-left: calc(18px + env(safe-area-inset-left));
  padding-right: calc(18px + env(safe-area-inset-right));
}

.site-header {
  background: #fff;
  border-bottom: 1px solid #e7e3f7;
  padding-top: env(safe-area-inset-top);
}

.header-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-height: 48px;
}

.brand {
  color: #1e1b4b;
  font-weight: 700;
  text-decoration: none;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
}

.menu-toggle,
.site-nav a,
.text-btn,
button,
input,
select,
.choice {
  min-height: 48px;
  font: inherit;
  font-size: 16px;
}

.menu-toggle {
  display: none;
  margin-left: auto;
  border: 1px solid #d5d0e8;
  background: #fff;
  color: #1e1b4b;
  border-radius: 10px;
  padding: 0 14px;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  color: #1e1b4b;
  text-decoration: none;
  border-radius: 10px;
}

.site-nav a[aria-current="page"] {
  color: #7c3aed;
  font-weight: 700;
}

.page {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 12px;
  padding-bottom: 8px;
}

.hero h1,
.prose h2,
.card h2,
.field label,
.notes p,
.help,
.figure-hint,
.field-error,
p {
  margin: 0;
}

.hero {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hero h1 {
  font-size: 1.75rem;
  line-height: 1.2;
  font-weight: 700;
}

.lead,
.help,
.figure-hint,
.site-footer,
.quiet {
  color: #54627a;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.text-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border-radius: 10px;
  background: #fff;
  color: #7c3aed;
  text-decoration: none;
  border: 1px solid #ddd4f7;
}

.sheet,
.stack,
.faq-list,
.source-list {
  display: flex;
  flex-direction: column;
}

.sheet,
#gravel-form {
  gap: 14px;
}

#gravel-form {
  display: flex;
  flex-direction: column;
}

.stack,
.faq-list {
  gap: 20px;
}

.source-list {
  gap: 16px;
}

.card {
  background: #fff;
  border: 1px solid #e7e3f7;
  border-radius: 14px;
  padding: 16px;
}

.card.prose,
.faq-list article {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.block,
.fields,
.choices,
.actions,
.notes {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fields,
.choices,
.actions {
  flex-direction: row;
  flex-wrap: wrap;
}

.choices .choice,
.choices button.preset {
  flex: 1 0 auto;
  width: auto;
  min-width: max-content;
  max-width: 100%;
  white-space: nowrap;
}

.field {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  gap: 8px;
}

.fields .field {
  flex: 1 1 120px;
}

.choice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid #d5d0e8;
  border-radius: 10px;
  background: #fff;
  color: #1e1b4b;
}

.choice span {
  white-space: nowrap;
}

.choice input {
  width: 1.15rem;
  height: 1.15rem;
  min-height: 0;
  accent-color: #7c3aed;
}

input,
select,
textarea {
  min-width: 0;
}

input,
select {
  width: 100%;
  height: 48px;
  padding: 0 12px;
  border: 1px solid #d5d0e8;
  border-radius: 10px;
  background: #fff;
  color: #1e1b4b;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 0 16px;
  cursor: pointer;
}

button.primary {
  background: #7c3aed;
  color: #fff;
}

button.secondary,
button.preset {
  background: #fff;
  color: #1e1b4b;
  border: 1px solid #d5d0e8;
}

.actions button {
  flex: 1 1 160px;
  scroll-margin-bottom: calc(16px + env(safe-area-inset-bottom));
}

.field-error {
  color: #9f1239;
}

.notice {
  background: #efe9ff;
  border: 1px solid #ddd4f7;
  border-radius: 14px;
  padding: 12px 14px;
  color: #1e1b4b;
}

.error-summary {
  background: #fff;
  border: 1px solid #fecdd3;
  border-radius: 14px;
  padding: 12px 14px;
  color: #9f1239;
}

.error-summary ul {
  margin: 8px 0 0;
  padding-left: 1.1rem;
}

.figures {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 0;
}

.figures div {
  background: #f7f5ff;
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.figures dt {
  color: #54627a;
}

.figures dd {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.notes {
  margin-top: 4px;
}

.prose ul {
  margin: 0;
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.formula {
  background: #f7f5ff;
  border-radius: 10px;
  padding: 12px;
  overflow-wrap: anywhere;
}

.prose,
.card p,
.help,
.notes p,
.lead {
  overflow-wrap: break-word;
}

.source a,
.email-link,
.prose a {
  overflow-wrap: anywhere;
}

a {
  color: #7c3aed;
}

.email-link {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  font-weight: 700;
}

.hint {
  color: #54627a;
  margin: 0;
}

.disclosure summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: 700;
}

.disclosure-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 4px;
}

.source-list {
  margin: 0;
  padding-left: 1.2rem;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}

.footer-nav a {
  min-height: 48px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  text-decoration: none;
  padding: 0 4px;
}
.site-footer p a {
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
  min-width: 44px;
  min-height: 44px;
}

.site-footer {
  border-top: 1px solid #e7e3f7;
  margin-top: 16px;
  padding-top: 12px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}

:focus-visible {
  outline: 3px solid #7c3aed;
  outline-offset: 2px;
}

@media (max-width: 800px) {
  .site-nav {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    margin-left: 0;
    gap: 8px;
    padding-bottom: 10px;
  }

  .js .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .js .site-nav {
    display: none;
  }

  .js .site-nav.is-open {
    display: flex;
  }

  .site-nav a {
    width: 100%;
  }

  .hero {
    text-align: center;
  }

  .hero .lead {
    margin-left: auto;
    margin-right: auto;
  }

  .hero-actions {
    justify-content: center;
  }

  .sheet,
  .card,
  .field,
  .fields,
  .block {
    text-align: left;
  }
}

@media (min-width: 801px) {
  .hero h1 {
    font-size: 2rem;
  }

  .figures {
    grid-template-columns: 1fr 1fr;
    gap: 12px 14px;
  }
}

/* Release polish: keep long values readable on narrow screens. */
.metric-value, dd { overflow-wrap: anywhere; }
.related-tools { margin-block: 2rem; }
details.card > summary { cursor: pointer; font-weight: 650; padding: .75rem 0; min-height: 44px; box-sizing: border-box; }
