/* Tellurin free tools — forms, results and reference pages, on top of /style.css. */

:root {
  --warn: #8a5a0b;   /* 5.6:1 on paper */
  --bad: #9c3328;    /* 6.3:1 on paper */
  --field-bg: rgba(255, 255, 255, 0.66);
  --field-brd: rgba(29, 42, 69, 0.16);
}

/* ---------- page head ---------- */
.tool-hero { position: relative; padding: 116px 0 24px; isolation: isolate; }
.crumbs { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; font-size: 13px; color: var(--ink-mute); }
.crumbs a { color: var(--ink-soft); border-bottom: 1px solid var(--hairline); }
.crumbs a:hover { color: var(--ink); border-color: var(--gold-line); }
.tool-title { font-size: clamp(2.5rem, 7vw, 4.8rem); margin-top: 18px; }
.tool-lead { max-width: 38rem; margin: 22px auto 0; color: var(--ink-soft); font-size: 17px; line-height: 1.7; }
.privacy {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-top: 24px;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-soft);
  text-align: left;
}
.privacy svg { flex: none; color: var(--ok); }

/* ---------- the tool card ---------- */
.tool-section { position: relative; padding: 24px 0 64px; }
.tool-card { border-radius: 28px; padding: 22px 18px; }
.tool-grid { display: grid; gap: 28px; }
.tool-form { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.tool-form fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.f-label, .tool-form legend {
  display: block;
  padding: 0;
  margin-bottom: 9px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-deep);
}
.f-hint { margin-top: 8px; font-size: 13px; line-height: 1.55; color: var(--ink-mute); }
.f-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.f-row-3 { grid-template-columns: 1fr 1fr 96px; }

.tool-form input[type="number"],
.tool-form input[type="text"],
.tool-form select {
  width: 100%;
  min-height: 50px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid var(--field-brd);
  background: var(--field-bg);
  box-shadow: inset 0 1px 2px rgba(29, 42, 69, 0.06);
  font: inherit;
  font-size: 17px; /* ≥16px: no zoom on iPhone */
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--ink);
  transition: border-color 0.2s, background 0.2s;
}
.tool-form select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 44px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--gold-deep) 50%),
    linear-gradient(135deg, var(--gold-deep) 50%, transparent 50%);
  background-position: calc(100% - 22px) 52%, calc(100% - 16px) 52%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  background-color: var(--field-bg);
}
.tool-form input:hover, .tool-form select:hover { border-color: rgba(29, 42, 69, 0.3); }
.tool-form input:focus-visible, .tool-form select:focus-visible { outline: 2px solid var(--gold-deep); outline-offset: 1px; border-radius: 14px; background-color: #fff; }
.tool-form input[aria-invalid="true"] { border-color: var(--bad); }
.tool-form .big-input input { font-family: var(--serif); font-size: 26px; font-weight: 500; min-height: 58px; }

/* segmented choice (radio buttons as pills) */
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg label { position: relative; flex: 1 1 auto; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.seg span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.45);
  box-shadow: 0 6px 16px -12px rgba(29, 42, 69, 0.4);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink-soft);
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.seg span:hover { background: rgba(255, 255, 255, 0.78); color: var(--ink); }
.seg input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--cream); }
.seg input:focus-visible + span { outline: 2px solid var(--gold-deep); outline-offset: 2px; }
.seg input:disabled + span { opacity: 0.4; cursor: not-allowed; }

/* ---------- results ---------- */
.results { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.result-main { border-radius: 22px; padding: 22px 22px 20px; }
.result-label { font-size: 12px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--cream); opacity: 0.8; }
.result-big { margin-top: 8px; font-family: var(--serif); font-size: clamp(2.8rem, 9vw, 3.8rem); font-weight: 500; line-height: 1; letter-spacing: -0.01em; }
.result-big small { font-size: 0.42em; font-weight: 500; margin-left: 4px; opacity: 0.85; }
.result-sub { margin-top: 10px; font-size: 15px; opacity: 0.88; }
.result-list { border-radius: 22px; padding: 6px 20px; }
.result-list dl { margin: 0; }
.result-list .row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; padding: 14px 0; border-bottom: 1px solid var(--hairline); align-items: baseline; }
.result-list .row:last-child { border-bottom: 0; }
.result-list dt { font-size: 14px; color: var(--ink-soft); }
.result-list dd { margin: 0; text-align: right; font-weight: 600; font-size: 15px; color: var(--ink); font-variant-numeric: lining-nums tabular-nums; }
.result-list dd small { display: block; font-weight: 500; font-size: 13px; color: var(--ink-mute); }

.status { display: flex; gap: 12px; align-items: flex-start; border-radius: 18px; padding: 14px 16px; font-size: 14.5px; line-height: 1.55; color: var(--ink-soft); background: rgba(255, 255, 255, 0.5); border: 1px solid rgba(255, 255, 255, 0.7); }
.status strong { color: var(--ink); font-weight: 600; }
.status .dot { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; margin-top: 0; border-radius: 50%; color: #fff; font-size: 13px; font-weight: 700; line-height: 1; }
.status.ok .dot { background: var(--ok); }
.status.warn .dot { background: var(--warn); }
.status.bad .dot { background: var(--bad); }
.status.info .dot { background: var(--ink-mute); }
.notes { display: flex; flex-direction: column; gap: 8px; }

.tool-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.btn-tool { min-height: 44px; padding: 0 18px; border-radius: 999px; font-size: 13.5px; font-weight: 600; }
.copied { font-size: 13px; color: var(--ok); }

/* ---------- cover diagram ---------- */
.diagram-wrap { margin-top: 26px; border-radius: 22px; padding: 18px 14px 14px; }
.diagram-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; align-items: baseline; padding: 0 6px; }
.diagram-title { font-family: var(--serif); font-size: 22px; font-weight: 600; }
.diagram { margin-top: 12px; width: 100%; height: auto; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 12px; padding: 0 6px; font-size: 12.5px; color: var(--ink-mute); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { display: inline-block; width: 18px; height: 10px; border-radius: 2px; }
.lg-bleed { background: rgba(196, 92, 72, 0.22); border: 1px solid rgba(156, 51, 40, 0.5); }
.lg-trim { border: 1.5px solid #1d2a45; }
.legend i.lg-fold { width: 0; height: 12px; border-left: 1.5px dashed #1d2a45; border-radius: 0; margin: 0 8px; }
.lg-safe { border: 1.5px dashed #4d7345; }
.lg-bar { background: rgba(255, 255, 255, 0.95); border: 1px solid #5c6580; }

/* ---------- reference prose ---------- */
.prose-section { position: relative; padding: 48px 0; }
.prose h2 { font-family: var(--serif); font-size: clamp(2rem, 4.4vw, 2.9rem); font-weight: 500; line-height: 1.1; }
.prose h3 { margin-top: 30px; font-family: var(--serif); font-size: 24px; font-weight: 600; line-height: 1.25; }
.prose p { margin-top: 16px; color: var(--ink-soft); line-height: 1.75; }
.prose p strong, .prose li strong { color: var(--ink); font-weight: 600; }
.prose a:not(.btn) { color: var(--ink); border-bottom: 1px solid var(--gold-line); }
.prose a:not(.btn):hover { color: var(--gold-deep); }
.prose ol.mistakes { counter-reset: m; margin-top: 22px; display: flex; flex-direction: column; gap: 14px; }
.prose ol.mistakes li { counter-increment: m; position: relative; padding: 18px 20px 18px 62px; border-radius: 18px; color: var(--ink-soft); line-height: 1.65; }
.prose ol.mistakes li::before {
  content: counter(m);
  position: absolute;
  left: 18px;
  top: 16px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  color: var(--gold-deep);
  border: 1px solid var(--gold-line);
}
.formula {
  margin-top: 20px;
  padding: 18px 20px;
  border-radius: 18px;
  font-family: var(--serif);
  font-size: clamp(1.15rem, 2.6vw, 1.45rem);
  line-height: 1.45;
  color: var(--ink);
}
.formula span { color: var(--gold-deep); font-style: italic; }

.ref-table-wrap { margin-top: 22px; border-radius: 20px; padding: 4px; overflow-x: auto; }
.ref-table { width: 100%; border-collapse: collapse; font-size: 14.5px; line-height: 1.45; font-variant-numeric: lining-nums tabular-nums; }
.ref-table th, .ref-table td { padding: 12px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid rgba(29, 42, 69, 0.08); }
.ref-table thead th { font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold-deep); border-bottom-color: rgba(29, 42, 69, 0.16); }
.ref-table tbody tr:last-child td, .ref-table tbody tr:last-child th { border-bottom: 0; }
.ref-table tbody th { font-weight: 600; color: var(--ink); }
.ref-table td { color: var(--ink-soft); }

.sources { margin-top: 22px; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; color: var(--ink-mute); line-height: 1.55; }
.sources a { color: var(--ink-soft); border-bottom: 1px solid var(--hairline); word-break: break-word; }

/* ---------- discreet Tellurin note ---------- */
.t-note { display: flex; gap: 16px; align-items: center; margin-top: 8px; border-radius: 22px; padding: 18px 20px; }
.t-note svg { flex: none; }
.t-note p { margin: 0; font-size: 15px; line-height: 1.6; color: var(--ink-soft); }
.t-note a { color: var(--ink); font-weight: 600; border-bottom: 1px solid var(--gold-line); white-space: nowrap; }

/* ---------- other tools ---------- */
.tool-cards { display: grid; gap: 16px; margin-top: 28px; }
.tool-link { display: flex; flex-direction: column; gap: 8px; border-radius: 24px; padding: 24px; transition: transform 0.4s var(--ease-out); }
.tool-link:hover { transform: translateY(-4px); }
.tool-link .tl-kicker { font-size: 12px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold-deep); }
.tool-link .tl-title { font-family: var(--serif); font-size: 26px; font-weight: 500; line-height: 1.15; color: var(--ink); }
.tool-link .tl-copy { font-size: 15px; line-height: 1.6; color: var(--ink-soft); }
.tool-link .tl-go { margin-top: auto; padding-top: 10px; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.tool-link[aria-current="page"] { opacity: 0.55; pointer-events: none; }

/* ---------- trim size catalog ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 8px; }
.trim-group { margin-top: 40px; }
.trim-group-title { font-family: var(--serif); font-size: clamp(1.7rem, 3.4vw, 2.3rem); font-weight: 500; }
.trim-cat { margin-top: 22px; font-size: 12px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold-deep); }
.trim-table { width: 100%; margin-top: 10px; border-collapse: separate; border-spacing: 0; font-size: 14.5px; line-height: 1.45; font-variant-numeric: lining-nums tabular-nums; }
.trim-table th, .trim-table td { padding: 12px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid rgba(29, 42, 69, 0.08); }
.trim-table thead th { font-size: 11.5px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-mute); }
.trim-table tbody th { font-family: var(--serif); font-size: 19px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.trim-table td { color: var(--ink-soft); }
.trim-table .mm { display: block; font-family: var(--sans); font-size: 13px; font-weight: 500; color: var(--ink-mute); }
.avail { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.avail::before { content: ""; width: 8px; height: 8px; border-radius: 50%; }
.avail.standard { color: var(--ok); }
.avail.standard::before { background: var(--ok); }
.avail.custom { color: var(--warn); }
.avail.custom::before { background: transparent; border: 1.5px solid var(--warn); width: 6px; height: 6px; }
.avail.no { color: var(--ink-mute); }
.avail.no::before { background: var(--ink-mute); opacity: 0.4; }
.tbl-card { margin-top: 10px; border-radius: 22px; padding: 4px 8px; }
.mini-btn { display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--ink); background: rgba(255, 255, 255, 0.55); border: 1px solid rgba(255, 255, 255, 0.8); box-shadow: 0 4px 12px -8px rgba(29, 42, 69, 0.4); white-space: nowrap; }
.mini-btn:hover { background: #fff; }

@media (min-width: 860px) {
  .trim-table { table-layout: fixed; }
  .trim-table col.c-size { width: 17%; }
  .trim-table col.c-av { width: 12.5%; }
  .trim-table col.c-type { width: 12%; }
  .trim-table col.c-mar { width: 18%; }
  .trim-table col.c-btn { width: 92px; }
  .trim-table td:last-child { text-align: right; }
}
@media (max-width: 859px) {
  .trim-table colgroup { display: none; }
  /* each size becomes a small card */
  .trim-table thead { display: none; }
  .trim-table, .trim-table tbody, .trim-table tr, .trim-table th, .trim-table td { display: block; }
  .trim-table tr { padding: 14px 10px; border-bottom: 1px solid rgba(29, 42, 69, 0.08); }
  .trim-table tbody tr:last-child { border-bottom: 0; }
  .trim-table th, .trim-table td { padding: 0; border: 0; }
  .trim-table td { margin-top: 8px; }
  .trim-table td[data-k]::before { content: attr(data-k); display: block; font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-mute); margin-bottom: 2px; }
  .trim-table td.td-avail { display: inline-block; margin-right: 22px; }
  .trim-table th .mm { display: inline; margin-left: 8px; }
}

/* ---------- estimator ---------- */
.estimate-out .result-big { font-size: clamp(2.6rem, 8vw, 3.4rem); }

/* ---------- cover checker ---------- */
.drop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 150px;
  padding: 22px;
  border-radius: 20px;
  border: 1.5px dashed rgba(168, 133, 76, 0.7);
  background: rgba(255, 255, 255, 0.4);
  text-align: center;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.drop:hover, .drop.is-over { background: rgba(255, 255, 255, 0.75); border-color: var(--gold-deep); }
.drop:focus-within { outline: 2px solid var(--gold-deep); outline-offset: 3px; }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.drop-title { font-family: var(--serif); font-size: 22px; font-weight: 600; color: var(--ink); }
.drop-sub { font-size: 13.5px; color: var(--ink-mute); }
.drop-file { font-size: 14px; font-weight: 600; color: var(--ink); word-break: break-all; }
.preview-wrap { margin-top: 26px; border-radius: 22px; padding: 14px; }
.preview-stage { position: relative; margin-top: 12px; border-radius: 10px; overflow: hidden; background: repeating-conic-gradient(#ece6d8 0 25%, #f6f2e8 0 50%) 0 0 / 16px 16px; }
.preview-stage canvas { display: block; width: 100%; height: auto; }
.preview-stage canvas + canvas { position: absolute; inset: 0; height: 100%; }
.preview-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; padding: 0 6px; }
.check-list { display: flex; flex-direction: column; gap: 8px; }
.empty-state { border-radius: 22px; padding: 26px 22px; text-align: center; color: var(--ink-mute); font-size: 15px; line-height: 1.6; }
.empty-state strong { display: block; font-family: var(--serif); font-size: 24px; font-weight: 500; color: var(--ink); margin-bottom: 6px; }
.spinner { display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--hairline); border-top-color: var(--gold-deep); animation: spin 0.8s linear infinite; vertical-align: -3px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }


/* ---------- breakpoints ---------- */
@media (min-width: 640px) {
  .tool-hero { padding-top: 140px; }
  .tool-card { padding: 30px; border-radius: 32px; }
  .tool-cards { grid-template-columns: repeat(3, 1fr); }
  .diagram-wrap { padding: 22px 22px 18px; }
}
@media (min-width: 900px) {
  .tool-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 40px; align-items: start; }
  .tool-card { padding: 36px; }
  .results { position: sticky; top: 100px; }
}
@media (hover: none) {
  .tool-link:hover { transform: none; }
}
.f-hint a { color: var(--ink); border-bottom: 1px solid var(--gold-line); }
@media (max-width: 479px) {
  #cc-form .f-row:not(.f-row-3) { grid-template-columns: 1fr; }
}
