/* Fillable worksheet tools — see worksheet-tools.js for why these exist.
   Sits on the page's dark IFS palette. The print block deliberately breaks from it. */

/* ---------------------------------------------------------------------------
   LAYOUT. The section grid was 2 columns with the default align-items:stretch,
   so a short card was forced to match a tall neighbour and left a large dead
   panel — obvious as soon as any card grew.
   Single column fixes that at the root, and it is the right measure regardless:
   these are instructions you read while typing into the worksheet below, not
   items you compare side by side. It also leaves the right-hand side free for
   the Companion sidebar rather than competing with it for width.
   align-items:start stays as a guard for any grid that returns here later.
   --------------------------------------------------------------------------- */
.exercises-grid {
  grid-template-columns: 1fr;
  align-items: start;
  max-width: 860px;
  gap: 22px;
}

/* Keep the tool on the same measure as the cards above it. */
.worksheet-tool {
  max-width: 860px;
}

/* ---------------------------------------------------------------------------
   SHEET NAV. Was four icon cards with 32px padding and a sentence each, costing
   most of a viewport before any content. Now the report's own section-nav pattern
   (results-display/report-view.js): a sticky pill row, one coloured dot per sheet,
   active state driven by scroll position.
   Top bar rather than the report's desktop left TOC — four items don't earn a
   column, and the right-hand side is wanted for the Companion.
   --------------------------------------------------------------------------- */
.sheet-nav {
  position: sticky;
  top: 70px;                    /* clears the site header (70px; 60px under 768) */
  z-index: 30;
  background: rgba(12, 15, 20, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.sheet-nav-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  padding: 11px 16px;
}

.sheet-nav a {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.55);
  text-decoration: none;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: color 0.12s ease, background 0.12s ease;
}

.sheet-nav a:hover {
  color: rgba(255, 255, 255, 0.82);
}

.sheet-nav a.active {
  color: #eef2f7;
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.14);
}

.sheet-nav .nav-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sec, rgba(255, 255, 255, 0.5));
  display: inline-block;
  margin-right: 8px;
  flex: 0 0 auto;
}

/* Short labels below 768: the full set needs ~390px of pills on a 361px screen, so the
   last one sat off-screen and the row read as broken rather than scrollable. */
.lbl-short { display: none; }

@media (max-width: 768px) {
  .lbl-full { display: none; }
  .lbl-short { display: inline; }

  .sheet-nav { top: 60px; }           /* site header is 60px under 768 */
  .sheet-nav a { font-size: 12.5px; padding: 6px 10px; }
  .sheet-nav .nav-dot { margin-right: 6px; }

  /* Four equal columns rather than content-width pills in a row. Content-sized, "Self"
     was half the width of "Protectors" and the set sat bunched to the left with dead
     space after it; as a fixed set of four peers they should read as one control.
     A grid also removes the horizontal scroll entirely — nothing is off-screen, so
     there is no cut-off edge to mistake for breakage. */
  .sheet-nav-inner {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
    padding: 9px 12px;
    overflow-x: visible;
  }

  .sheet-nav a {
    justify-content: center;
    padding: 7px 4px;
    width: 100%;
  }
}

/* Below ~360px four equal columns leave ~70px each, and "Protectors" plus its dot needs
   more than that. The dot is the first thing to go: the label carries the meaning, the
   colour only reinforces it. */
@media (max-width: 380px) {
  .sheet-nav .nav-dot { display: none; }
  .sheet-nav a { font-size: 12px; }
}

/* Anchor targets must clear BOTH sticky bars, or a jump lands underneath them.
   Desktop: 70px header + 59px nav. Mobile: 60px header + ~52px nav. */
#self-energy,
#parts-mapping,
#protector-work,
#exile-healing {
  scroll-margin-top: 140px;
}

@media (max-width: 768px) {
  #self-energy,
  #parts-mapping,
  #protector-work,
  #exile-healing {
    scroll-margin-top: 122px;
  }
}

/* ---------------------------------------------------------------------------
   SECTION HEADERS. Each section opened with ~300px before a word of content:
   70px of section padding, a 72px icon centred on its own line, the title, then a
   50px margin. Four sections, so roughly 1,200px of runway on a page people are
   meant to work in.
   Now a compact row — icon beside the title, intro beneath — left-aligned on the
   same 860px measure as the cards, instead of centred text over left-aligned
   content. Grid areas do this without touching the existing markup.
   --------------------------------------------------------------------------- */
.worksheet-section {
  padding: 42px 0;
}

.worksheet-section .section-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 14px;
  row-gap: 10px;
  text-align: left;
  max-width: 860px;
  margin-bottom: 26px;
}

.worksheet-section .section-header .section-icon {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  font-size: 1.1rem;
  margin-bottom: 0;
}

.worksheet-section .section-header h2 {
  margin: 0;
}

/* Intro drops to its own row under both, keeping the reading measure. */
.worksheet-section .section-header .section-intro {
  grid-column: 1 / -1;
  margin: 0;
  max-width: 74ch;
}

/* The decorative rule under the centred title assumed centring. */
.worksheet-section .section-header h2::after {
  margin-left: 0;
  margin-right: auto;
}

@media (max-width: 600px) {
  .worksheet-section { padding: 32px 0; }
  .worksheet-section .section-header { margin-bottom: 20px; }
}

/* ---------------------------------------------------------------------------
   Mobile reading measure. The card carried 32px of side padding, the steps box
   another 28px inside that, and each numbered step a 40px gutter — on a 361px
   screen that left ~250px for the text, so "Notice a recent strong reaction"
   wrapped after three words and the nested bullets were narrower still.

   Scoped with .ifs-worksheets-page because ifs-styles.css sets these at (0,2,1)
   and a media query adds no specificity — an unscoped rule here silently loses.
   --------------------------------------------------------------------------- */
@media (max-width: 700px) {
  /* Four nested boxes each took their own inset — container 15 + card 32 + steps box 28
     + a 40px step gutter — so 75px of a 361px screen was gone before the first letter.
     Shaving each one is not enough; the inner box loses its horizontal padding entirely
     and becomes a full-bleed band inside the card. Same grouping, none of the double
     inset. Left inset: 75px -> 54px. */
  .ifs-worksheets-page .container { padding: 0 12px; }

  /* The card adds 20px of its own on top of the body's — double padding for one edge. */
  .ifs-worksheets-page .exercise-card {
    padding-left: 0;
    padding-right: 0;
  }

  /* And the <ol> adds another 15px inside the (now flush) steps box. */
  .ifs-worksheets-page .exercise-steps ol,
  .ifs-worksheets-page .journal-prompts ul {
    padding-left: 0;
  }

  .ifs-worksheets-page .exercise-card-header { padding: 16px 14px; }
  .ifs-worksheets-page .exercise-card-body { padding: 18px 14px; }

  .ifs-worksheets-page .exercise-steps,
  .ifs-worksheets-page .journal-prompts,
  .ifs-worksheets-page .tip-box {
    padding: 15px 0;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }

  .ifs-worksheets-page .exercise-steps li {
    padding-left: 28px;         /* was 40 */
    line-height: 1.6;
    margin-bottom: 12px;
  }

  /* The badge sets the floor for that gutter. */
  .ifs-worksheets-page .exercise-steps li::before {
    width: 22px;
    height: 22px;
    line-height: 22px;
  }

  .ifs-worksheets-page .exercise-steps li ul {
    margin-left: 0;
    padding-left: 18px;         /* nested bullets compounded the inset */
  }

  .ifs-worksheets-page .exercise-description,
  .ifs-worksheets-page .exercise-steps li,
  .ifs-worksheets-page .journal-prompts li {
    font-size: 0.94rem;
  }

  /* The time pill was pushed onto its own right-aligned row, reading as detached
     from the title it belongs to. */
  .ifs-worksheets-page .exercise-card-meta { margin-left: 0; }
}

/* ---------------------------------------------------------------------------
   Exercise card header: the title and the time pill were stacked, so a two-word
   duration cost a whole row. One row, wrapping only when it genuinely must.
   --------------------------------------------------------------------------- */
.exercise-card-header {
  display: flex;
  align-items: center;
  gap: 12px 16px;
  flex-wrap: wrap;
  padding: 20px 24px;
}

.exercise-card-header h3 {
  margin-bottom: 0 !important;
  flex: 1 1 auto;
  min-width: 0;
}

.exercise-card-meta {
  flex: 0 0 auto;
  margin-left: auto;
}

/* The tool is a full-width block BELOW the instruction grid, not a passenger
   inside one card: a fillable worksheet in a half-width column is unusable, and
   it was what made the columns lopsided in the first place. */
.worksheet-tool {
  margin: 30px 0 0;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(30, 41, 59, 0.7);
  backdrop-filter: blur(10px);
}

.ws-head h4 {
  margin: 0 0 6px;
  font-size: 1.12rem;
  color: #fff;
}

.ws-head p {
  margin: 0 0 20px;
  font-size: 0.9rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.58);
  max-width: 62ch;
}

.ws-item {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 16px;
  background: rgba(0, 0, 0, 0.2);
}

.ws-item[data-single="true"] {
  border: 0;
  padding: 0;
  background: none;
}

.ws-item-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.ws-item-num {
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
}

.ws-sel {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.ws-sel label {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.55);
}

/* Two columns of fields on wide screens keeps a six-field interview from
   becoming a very long ladder; textareas that need room span both. */
.ws-fields {
  display: grid;
  gap: 14px;
}

@media (min-width: 860px) {
  .ws-fields {
    grid-template-columns: 1fr 1fr;
  }
  .ws-field:has(textarea) {
    grid-column: 1 / -1;
  }
}

.ws-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.85rem;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.62);
}

.worksheet-tool input[type="text"],
.worksheet-tool input[type="email"],
.worksheet-tool textarea,
.worksheet-tool select {
  font: inherit;
  width: 100%;
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 9px;
  padding: 10px 12px;
}

.worksheet-tool select {
  width: auto;
  padding: 8px 10px;
}

.worksheet-tool textarea {
  resize: vertical;
  min-height: 60px;
  line-height: 1.55;
}

.worksheet-tool input::placeholder,
.worksheet-tool textarea::placeholder {
  color: rgba(255, 255, 255, 0.28);
}

.worksheet-tool input:focus,
.worksheet-tool textarea:focus,
.worksheet-tool select:focus {
  outline: none;
  border-color: rgba(124, 196, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(124, 196, 255, 0.16);
}

/* 8 C's checkboxes */
.ws-checks {
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
}

.ws-checks legend {
  padding: 0 6px;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.62);
}

.ws-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

.ws-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
}

.ws-check input {
  width: auto;
  accent-color: #7cc4ff;
}

.ws-remove {
  background: none;
  border: 0;
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.82rem;
  cursor: pointer;
  padding: 6px 8px;
  min-height: 44px;
}

.ws-remove:hover {
  color: #ff8a8a;
}

.ws-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 6px 0 22px;
}

.ws-btn {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border-radius: 999px;
  padding: 11px 22px;
  min-height: 44px;
  border: 1px solid rgba(124, 196, 255, 0.5);
  background: rgba(124, 196, 255, 0.18);
  color: #fff;
  transition: background 0.15s ease;
}

.ws-btn:hover:not(:disabled) {
  background: rgba(124, 196, 255, 0.3);
}

.ws-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ws-btn-ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.2);
}

.ws-email-box {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 20px;
}

.ws-email-box > label {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 9px;
}

.ws-email-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  max-width: 520px;
}

.ws-email-row input {
  flex: 1 1 220px;
}

.ws-email-row .ws-btn {
  flex: 0 0 auto;
}

.ws-optin {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 14px;
  min-height: 44px;
  font-size: 0.86rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.62);
  cursor: pointer;
}

.ws-optin input {
  width: auto;
  margin-top: 4px;
  accent-color: #7cc4ff;
}

.ws-privacy {
  margin: 10px 0 0;
  font-size: 0.78rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.4);
  max-width: 62ch;
}

.ws-note {
  margin: 10px 0 0;
  font-size: 0.86rem;
  min-height: 1em;
}

.ws-note.ok { color: #7ee0b0; }
.ws-note.err { color: #ff8a8a; }

.ws-status {
  margin: 18px 0 0;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.35);
}

@media (max-width: 600px) {
  .worksheet-tool { padding: 18px; }
  .ws-sel { margin-left: 0; width: 100%; }
}

/* ---------------------------------------------------------------------------
   PRINT — this is the "download". Someone who came for a printable worksheet
   gets THEIR filled copy without leaving for a blank PDF. Scoped to the single
   tool whose Print button was pressed (.ws-printing), since the page has four.
   --------------------------------------------------------------------------- */
@media print {
  body.ws-printing-active * {
    visibility: hidden !important;
  }

  body.ws-printing-active .ws-printing,
  body.ws-printing-active .ws-printing * {
    visibility: visible !important;
  }

  body.ws-printing-active .ws-printing {
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: #fff !important;
    backdrop-filter: none;
  }

  /* Controls are noise on paper. */
  .ws-actions,
  .ws-email-box,
  .ws-status,
  .ws-remove,
  .ws-head p {
    display: none !important;
  }

  .ws-head h4 {
    font-size: 17pt;
    color: #000 !important;
    margin-bottom: 12pt;
  }

  .ws-printing input,
  .ws-printing textarea,
  .ws-printing select,
  .ws-printing .ws-item,
  .ws-printing .ws-field label,
  .ws-printing .ws-item-num,
  .ws-printing .ws-sel label,
  .ws-printing .ws-checks,
  .ws-printing .ws-checks legend,
  .ws-printing .ws-check {
    color: #000 !important;
    background: #fff !important;
    box-shadow: none !important;
  }

  .ws-printing .ws-item {
    border: 1px solid #999 !important;
    border-radius: 6px;
    padding: 10pt;
    margin-bottom: 10pt;
    break-inside: avoid;      /* an item split across pages reads as two items */
    page-break-inside: avoid;
  }

  .ws-printing input,
  .ws-printing textarea,
  .ws-printing select {
    border: 0 !important;
    border-bottom: 1px solid #ccc !important;
    border-radius: 0;
    padding: 2pt 0;
  }

  .ws-printing .ws-field label {
    font-size: 8pt;
    color: #555 !important;
  }

  .ws-printing .ws-checks {
    border: 1px solid #ccc !important;
  }
}
