/*
  Cost of 3D Prints — all of the visual design.

  Colors live in :root. Change those and the whole site follows.
  Inter is loaded from Google Fonts in each HTML page. The fallback
  stack below is a normal system sans-serif, used offline or on file://
  if that request does not finish.
*/

:root {
  --bg: #ffffff;
  --card: #f3f7fe;
  --ink: #0f172a;
  --muted: #334155;
  --line: #d3e2f7;
  --blue: #1e63d6;
  --blue-dark: #174ead;
  --result-bg: #e8f1fc;
  --result-ink: #0f172a;
  --result-muted: #334155;
  --error: #9f1239;
  --error-bg: #fef2f2;
  --link: #1e63d6;
  --focus: #1e63d6;
  --shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  color-scheme: light;
}

/* Room for the mobile total bar. Pages without that bar are unchanged. */
body:has(.sticky-total) {
  padding-bottom: calc(4.75rem + env(safe-area-inset-bottom));
}

img {
  max-width: 100%;
  height: auto;
}

h1, h2, legend {
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

h1 {
  margin: 0 0 0.6rem;
  font-size: clamp(2.1rem, 4.4vw, 3.35rem);
}

h2 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.45rem, 2.4vw, 1.85rem);
}

h3 {
  font-size: 1.18rem;
  line-height: 1.3;
  font-weight: 600;
  margin: 0 0 0.4rem;
}

p {
  margin: 0 0 0.9rem;
}

a {
  color: var(--link);
  text-underline-offset: 0.16em;
}

a:hover {
  color: var(--blue-dark);
}

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

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

.skip {
  position: absolute;
  left: 0.75rem;
  top: 0.75rem;
  transform: translateY(-160%);
  background: #fff;
  color: var(--ink);
  padding: 0.5rem 0.75rem;
  z-index: 20;
  border-radius: 6px;
}

.skip:focus {
  transform: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.inner {
  width: min(1120px, calc(100% - 2rem));
  margin-inline: auto;
}

.site-header {
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.site-header .inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding: 0.85rem 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand img {
  display: block;
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.brand:hover span,
.brand:focus-visible span {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav a {
  color: var(--link);
  font-weight: 600;
}

.nav a[aria-current="page"] {
  text-decoration-thickness: 2px;
}

.home {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.6rem 0 3rem;
}

.kicker {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blue);
}

.lede {
  max-width: 40rem;
  margin: 0 0 0.7rem;
  font-size: 1.125rem;
  line-height: 1.55;
}

.trust {
  margin: 0 0 0.8rem;
  color: var(--muted);
}

.jump {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.8rem;
  margin: 0 0 1.4rem;
}

.layout {
  display: grid;
  gap: 1.25rem;
  align-items: start;
}

.form-card,
.page-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 4px solid var(--blue);
  border-radius: 16px;
  padding: 1.15rem 1.15rem 1.35rem;
}

.form-lead {
  margin-top: -0.2rem;
}

fieldset {
  border: 0;
  margin: 1.15rem 0 0;
  padding: 1.05rem 0 0;
  border-top: 1px solid var(--line);
  min-inline-size: 0;
}

.fold {
  margin: 0.85rem 0 0;
  border-top: 1px solid var(--line);
  padding-top: 0.35rem;
}

.fold > summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 44px;
  padding: 0.35rem 0;
  cursor: pointer;
  list-style: none;
  font-weight: 600;
}

.fold > summary::-webkit-details-marker {
  display: none;
}

.fold > summary::before {
  content: "";
  flex: 0 0 auto;
  width: 0.5rem;
  height: 0.5rem;
  margin-left: 0.15rem;
  border-right: 2px solid var(--blue);
  border-bottom: 2px solid var(--blue);
  transform: rotate(-45deg);
}

.fold[open] > summary::before {
  transform: rotate(45deg);
  margin-top: -0.15rem;
}

.fold-label {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
  min-width: 0;
}

.fold-title {
  font-size: 1.28rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.fold-value {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 500;
}

.fold-body {
  padding: 0 0 0.35rem 1.35rem;
}

.js .guide {
  display: none;
}

legend {
  padding: 0;
  font-size: 1.28rem;
}

.optional {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-left: 0.35rem;
}

.field {
  margin-top: 0.85rem;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

input,
select {
  width: 100%;
  max-width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.7rem;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid #c5d4ee;
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
}

input::placeholder {
  color: #475569;
  opacity: 1;
}

input[aria-invalid="true"] {
  border-color: var(--error);
  background: var(--error-bg);
}

.hint {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.45;
}

.field-error {
  color: var(--error);
  font-size: 0.92rem;
  font-weight: 600;
  margin: 0.55rem 0 0;
}

.field-error:empty {
  display: none;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1rem;
}

.actions,
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.2rem;
}

.button {
  min-height: 44px;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  border: 1px solid #c5d4ee;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.button.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #ffffff;
}

.button.primary:hover {
  background: var(--blue-dark);
  border-color: var(--blue-dark);
}

.button.ghost:hover,
.result-actions .button:hover {
  background: #e8f1fc;
}

.actions .button {
  flex: 1 1 12rem;
}

.results {
  background: var(--result-bg);
  color: var(--result-ink);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.15rem 1.15rem 1.2rem;
  box-shadow: var(--shadow);
}

.results h2 {
  color: var(--result-ink);
}

.receipt-brand {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blue);
}

.results table {
  width: 100%;
  border-collapse: collapse;
}

.results th {
  width: 68%;
  text-align: left;
  font-weight: 500;
  font-size: 1.1rem;
  vertical-align: top;
  padding: 0.7rem 0.75rem 0.7rem 0;
}

.results td {
  text-align: right;
  vertical-align: top;
  padding: 0.7rem 0;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-size: 1.1rem;
  font-weight: 700;
}

.line-name {
  font-weight: 600;
  font-size: 1.1rem;
}

.subline {
  display: block;
  margin-top: 0.2rem;
  color: var(--result-muted);
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.4;
  max-width: 26rem;
  white-space: pre-line;
}

.total-row th,
.total-row td {
  border-top: 1px solid #c5d4ee;
  padding-top: 0.9rem;
  font-weight: 700;
}

.total-row .line-name {
  font-size: 1.2rem;
  font-weight: 700;
}

.total-row td {
  font-size: 1.65rem;
}

.sell-row .line-name {
  font-size: 1.2rem;
  font-weight: 700;
}

.sell-row td {
  color: var(--blue);
  font-size: clamp(1.7rem, 4.6vw, 2rem);
  font-weight: 700;
}

.results .button {
  color: var(--blue);
  border-color: var(--blue);
  background: #ffffff;
}

.results .button:hover {
  background: #dbe8fa;
}

.results a {
  color: var(--link);
}

.results a:visited {
  color: var(--link);
}

.results :focus-visible {
  outline-color: var(--blue);
}

.copy-status {
  min-height: 1.25em;
  margin: 0.55rem 0 0;
  font-size: 0.9rem;
}

.copy-fallback {
  margin: 0.6rem 0 0;
  padding: 0.7rem;
  max-height: 14rem;
  overflow: auto;
  white-space: pre-wrap;
  font-size: 0.8rem;
  color: var(--result-ink);
  background: transparent;
  border: 1px solid #c5d4ee;
  border-radius: 8px;
}

.results-more {
  margin: 0.8rem 0 0;
  font-size: 0.92rem;
}

.sticky-total {
  position: fixed;
  z-index: 5;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  flex-wrap: wrap;
  padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
  background: var(--result-bg);
  color: var(--result-ink);
  text-decoration: none;
  border-top: 3px solid var(--blue);
}

.sticky-total strong {
  font-variant-numeric: tabular-nums;
  font-size: 1.05rem;
}

#sticky-sell-amount {
  color: var(--blue);
}

.guide {
  max-width: 42rem;
  margin-top: 3.2rem;
}

.guide h2 {
  margin-top: 2.4rem;
}

.guide section:first-child h2 {
  margin-top: 0;
}

.guide p,
.guide li {
  font-size: 1.05rem;
  line-height: 1.65;
}

.guide ul,
.guide ol,
.section-dialog-body ul,
.section-dialog-body ol {
  list-style-position: outside;
  margin: 0 0 1rem;
  padding: 0.2rem 0.25rem 0.2rem 1.5rem;
}

.guide li + li,
.section-dialog-body li + li {
  margin-top: 0.45rem;
}

.formula-list,
.check-list {
  list-style-position: outside;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 1.15rem 0.85rem 1.75rem;
  margin: 0 0 1rem;
}

.guide .formula-list,
.guide .check-list,
.section-dialog-body .formula-list,
.section-dialog-body .check-list {
  padding: 0.75rem 1.15rem 0.85rem 1.75rem;
}

.formula-list li,
.check-list li {
  padding: 0.7rem 0;
  margin-top: 0;
  border-bottom: 1px solid var(--line);
}

.formula-list li:last-child,
.check-list li:last-child {
  border-bottom: 0;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
}

.price-table {
  width: 100%;
  min-width: 36rem;
  border-collapse: collapse;
}

.price-table caption {
  caption-side: bottom;
  text-align: left;
  padding: 0.7rem 0.2rem 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.price-table th,
.price-table td {
  text-align: left;
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.price-table td:nth-child(2),
.price-table th:nth-child(2) {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.slide-hint {
  display: none;
}

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

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 1rem;
  padding: 1.4rem 0 2rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.site-footer .inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.5rem;
  justify-content: space-between;
  align-items: start;
}

.site-footer a {
  color: var(--link);
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.page {
  width: min(42rem, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.6rem 0 3rem;
}

.page p,
.page li {
  font-size: 1.05rem;
  line-height: 1.65;
}

.page h2 {
  margin-top: 1.8rem;
  font-size: 1.45rem;
}

.updated {
  color: var(--muted);
  font-size: 0.92rem;
}

@media (min-width: 861px) {
  body:has(.sticky-total) {
    padding-bottom: 0;
  }

  .layout {
    grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  }

  .results {
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow: auto;
  }

  .sticky-total {
    display: none;
  }
}

@media (max-width: 860px) {
  .results {
    scroll-margin-bottom: 5.5rem;
  }

  .guide h2,
  .faq-item {
    scroll-margin-bottom: 5rem;
  }
}

@media (max-width: 640px) {
  .slide-hint {
    display: block;
  }
}

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

.section-dialog {
  padding: 0;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  max-width: calc(100vw - 2rem);
}

.section-dialog[open] {
  display: flex;
  flex-direction: column;
  width: min(44rem, calc(100vw - 2rem));
  max-height: min(85vh, 48rem);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.section-dialog::backdrop {
  background: rgba(15, 23, 42, 0.48);
}

.section-dialog-top {
  display: flex;
  justify-content: flex-end;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.dialog-close {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--blue);
  font: inherit;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.dialog-close:hover {
  background: var(--card);
}

.section-dialog-body {
  overflow: auto;
  padding: 1.5rem;
}

.section-dialog-body h2 {
  margin: 0 0 0.75rem;
  color: var(--ink);
  font-size: clamp(1.45rem, 2.4vw, 1.85rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.section-dialog-body h3 {
  margin: 1.5rem 0 0.4rem;
  color: var(--ink);
  font-size: 1.18rem;
  font-weight: 600;
  line-height: 1.3;
}

.section-dialog-body p,
.section-dialog-body li {
  color: var(--ink);
  font-size: 1.05rem;
  line-height: 1.65;
}

.section-dialog-body .hint,
.section-dialog-body caption,
.section-dialog-body .fold-value {
  color: var(--muted);
}

.section-dialog-body a {
  color: var(--link);
}

@media (max-width: 700px) {
  .section-dialog[open] {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
  }

  .section-dialog-body {
    flex: 1;
    padding: 1rem;
  }

  .fold-body {
    padding-left: 0.35rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    transition: none !important;
    animation: none !important;
  }
}

@media (prefers-contrast: more) {
  :root {
    --line: #0f172a;
    --muted: #0f172a;
  }

  input,
  select,
  .button {
    border-color: #0f172a;
  }
}

@media (forced-colors: active) {
  .results,
  .form-card,
  .button,
  .sticky-total {
    border: 1px solid CanvasText;
  }
}

@media print {
  body,
  .site-header {
    background: white;
  }

  body:has(.sticky-total) {
    padding-bottom: 0;
  }

  .skip,
  .jump,
  .actions,
  .result-actions,
  .sticky-total,
  .guide,
  .site-footer,
  .nav {
    display: none !important;
  }

  .layout {
    display: block;
  }

  .form-card,
  .results {
    box-shadow: none;
    border: 1px solid #000;
  }

  .results,
  .results * {
    background: white !important;
    color: black !important;
  }
}
