/* =========================================================
   Blank Worksheet Generator — tool-specific styles.
   Layered on /tools/_shared/tool.css. The baked-in print
   credit uses the shared .print-credit component.
   ========================================================= */

/* ---------- Controls ---------- */
.ws-controls {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  margin-bottom: var(--space-6);
}

.ws-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  align-items: end;
}
@media (min-width: 640px) {
  .ws-row { grid-template-columns: auto 1fr; align-items: end; }
}

.ws-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.ws-field label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-muted);
}
.ws-toggle-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-transform: none;
  letter-spacing: 0.18em;
}
.ws-toggle-inline input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.ws-field input[type="text"],
.ws-field input[type="number"] {
  width: 100%;
  padding: 10px 14px;
  font: inherit;
  font-size: 15px;
  background: var(--surface-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  transition: var(--transition-colors);
}
.ws-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.ws-field input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.ws-field-narrow input[type="number"] { max-width: 180px; }

/* ---------- Line-spacing segment ---------- */
.ws-segment-group {
  border: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.ws-segment-group legend {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  padding: 0;
  margin-bottom: var(--space-2);
}
.ws-segment {
  display: inline-flex;
  padding: 4px;
  background: var(--surface-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  align-self: flex-start;
}
.ws-seg-opt {
  position: relative;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: calc(var(--radius) - 4px);
  transition: var(--transition-colors);
  text-align: center;
}
.ws-seg-opt input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
}
.ws-seg-opt:hover { color: var(--text); }
.ws-seg-opt:has(input:checked) {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

/* ---------- Toggles row ---------- */
.ws-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4) var(--space-5);
}
.ws-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}
.ws-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ---------- Actions ---------- */
.ws-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}
@media (min-width: 540px) {
  .ws-actions { grid-template-columns: 2fr 1fr; }
}
.ws-actions .btn {
  font-size: 16px;
  min-height: 52px;
}

/* ---------- Preview ---------- */
.ws-preview-wrap {
  border-top: 1px solid var(--border);
  padding-top: var(--space-5);
}
.ws-preview-wrap .section-eyebrow {
  margin-bottom: var(--space-4);
}

/* The .ws-page looks like a printed Letter sheet on screen;
   the print stylesheet strips screen-only chrome and lets the
   real page take over. */
.ws-page {
  background: #FFFFFF;
  color: #18181B;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 48px 56px;
  max-width: 100%;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.4;
}

/* ---------- Page header (title on top, then name / date) ---------- */
.ws-page-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  border-bottom: 1.5px solid #18181B;
  padding-bottom: 10px;
  margin-bottom: 18px;
}
/* When the header has nothing in it, collapse the rule. */
.ws-page-header.is-empty {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 8px;
}
.ws-page-title {
  font-size: 20px;
  font-weight: 700;
  color: #18181B;
  letter-spacing: -0.005em;
  text-align: left;
}
/* Name + date share one row below the title; name is the larger field.
   nowrap + flex-basis 0 keeps them side by side and lets the ruled blanks
   shrink instead of wrapping onto separate lines in a narrow preview. */
.ws-page-meta {
  display: flex;
  flex-wrap: nowrap;
  align-items: baseline;
  gap: 6px var(--space-5);
}
/* If the title is off and both name + date are off, the meta row is empty —
   drop it so the collapsed header doesn't keep a phantom gap. */
.ws-page-meta:not(:has(> :not([hidden]))) {
  display: none;
}
.ws-page-name {
  font-size: 15px;
  color: #18181B;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex: 3 1 0;
  min-width: 0;
}
.ws-page-date {
  font-size: 13px;
  color: #3F3F46;
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex: 1 1 0;
  min-width: 0;
}
.ws-blank {
  display: inline-block;
  flex: 1 1 auto;
  border-bottom: 1px solid #18181B;
  height: 1em;
  min-width: 40px;
}
.ws-blank-date { min-width: 40px; }

/* These flex elements set their own `display`, which would otherwise win
   over the UA `[hidden] { display: none }` rule — so the JS toggles had no
   effect. Re-assert none when hidden. */
.ws-page-title[hidden],
.ws-page-name[hidden],
.ws-page-date[hidden] {
  display: none;
}

/* ---------- The ruled lines ---------- */
.ws-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: wsline;
}
.ws-list li {
  counter-increment: wsline;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  border-bottom: 1px solid #18181B;
  min-height: 36px;
}
/* Numbered variant */
.ws-page.is-numbered .ws-list li::before {
  content: counter(wsline) ".";
  display: inline-block;
  width: 2.2em;
  text-align: right;
  font-size: 14px;
  font-weight: 600;
  color: #18181B;
  align-self: flex-end;
  padding-bottom: 4px;
  font-variant-numeric: tabular-nums;
}

/* On-screen sense of the chosen spacing. */
.ws-page[data-spacing="2"] .ws-list li { min-height: 56px; }
.ws-page[data-spacing="3"] .ws-list li { min-height: 76px; }

/* ---------- Print ----------
   Hide everything except the worksheet sheet. */
@media print {
  @page {
    size: 8.5in 11in;
    margin: 1in;
  }
  html, body {
    background: #FFFFFF !important;
    color: #000000 !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .tool-header,
  .tool-footer,
  .ws-controls,
  .article,
  .attenda-cta,
  .skip-link,
  .widget-header,
  .ws-preview-wrap .section-eyebrow {
    display: none !important;
  }
  main { display: block !important; }
  .widget-wrap,
  .widget-card,
  .ws-preview-wrap {
    margin: 0 !important;
    padding: 0 !important;
    background: #FFFFFF !important;
    border: none !important;
    box-shadow: none !important;
    max-width: none !important;
    width: 100% !important;
  }
  .ws-page {
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #FFFFFF !important;
    color: #000000 !important;
    font-size: 12pt;
    width: 100% !important;
    max-width: none !important;
  }
  .ws-page-header { border-bottom-color: #000 !important; }
  .ws-page-title,
  .ws-page-name,
  .ws-page-date,
  .ws-list li::before {
    color: #000 !important;
  }
  .ws-blank,
  .ws-list li {
    border-bottom-color: #000 !important;
  }
  .ws-list li {
    page-break-inside: avoid;
  }
  /* Print line heights — match the on-page spacing options. */
  .ws-page[data-spacing="1"] .ws-list li { min-height: 0.5in; }
  .ws-page[data-spacing="2"] .ws-list li { min-height: 0.75in; }
  .ws-page[data-spacing="3"] .ws-list li { min-height: 1.0in; }
}
