/* GiftPuffin tool pages (loaded only on /gift-finder/, /secret-santa/, posting dates, anniversaries,
   birthstones). Builds on site.css tokens and components. No inline styles anywhere (CSP). */

/* ---------- Shared ---------- */
.tool .page-head { margin-bottom: var(--space-5); }
.tool-section, .tool-prose, .tool-browse, .tool-sources { max-width: 52rem; margin: 0 0 var(--space-7); }
.tool-section > h2, .tool-prose > h2, .tool-browse > h2, .tool-sources > h2 { font-size: var(--step-2); }
.tool-prose > p, .tool-prose > ul, .tool-prose > ol { max-width: var(--measure); }
.tool-prose h2 + p { margin-top: 0; }
.tool-prose h2:not(:first-child) { margin-top: var(--space-6); }
.tool-prose ul, .tool-bullets { padding-left: 1.2em; }
.tool-prose li, .tool-bullets li { margin-bottom: var(--space-2); }
.tool-prose li::marker, .tool-bullets li::marker { color: var(--beak); }
.tool-steps { padding-left: 1.4em; }
.tool-steps li::marker { font-family: var(--serif); font-weight: 700; color: var(--beak-deep); }
.tool-small { font-size: var(--step--1); color: var(--ink-soft); }
.tool-note { max-width: 48rem; padding: var(--space-4); background: var(--sea-mist); color: var(--sea-deep); border-radius: var(--radius); }
.tool-disclaimer { margin-bottom: var(--space-7); }
.tool-error { color: #9c2a0b; font-weight: 700; margin: 0 0 var(--space-3); }
.tool-error:empty { display: none; }
.tool-label { display: block; font-weight: 700; margin-bottom: var(--space-1); }
.tool-label .tool-small { font-weight: 500; }
.not-yet { font-weight: 700; color: var(--ink-soft); }
.row-note { display: block; font-size: var(--step--1); color: var(--ink-soft); font-weight: 400; margin-top: var(--space-1); }
p.row-note { margin: 0 0 var(--space-3); }

.tool input[type="text"], .tool input[type="number"], .tool input[type="date"], .tool select, .tool textarea {
  font: inherit;
  color: var(--ink);
  width: 100%;
  max-width: 32rem;
  min-height: 48px;
  padding: 0.55rem 0.8rem;
  background: #fff;
  border: 2px solid var(--ink-soft);
  border-radius: var(--radius);
}
.tool textarea { min-height: 7rem; line-height: 1.5; resize: vertical; }
.tool input:focus-visible, .tool select:focus-visible, .tool textarea:focus-visible { outline: 3px solid var(--sea); outline-offset: 2px; border-color: var(--ink); }
.tool button { touch-action: manipulation; }
.tool .btn-primary { cursor: pointer; }

.tool-fieldset { border: 0; border-top: 2px solid var(--ink); margin: 0 0 var(--space-5); padding: var(--space-4) 0 0; min-width: 0; }
.tool-fieldset > legend { font-family: var(--serif); font-size: var(--step-1); font-weight: 650; padding: 0 var(--space-2) 0 0; font-variation-settings: "SOFT" 80, "opsz" 36; }
.tool-fieldset p { margin-bottom: var(--space-3); }

.finder-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin: var(--space-5) 0 var(--space-6); }

.tool-cols { display: grid; gap: var(--space-5) var(--space-6); grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.tool-col h3 { font-family: var(--sans); font-size: var(--step--1); font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--sea); padding-bottom: var(--space-2); border-bottom: 2px solid var(--ink); margin-bottom: 0; }
.tool-col .link-list a { font-size: 1rem; }
.tool-col .link-list span { display: none; }

/* ---------- Gift Finder ---------- */
.finder, .santa-form, .reveal-box {
  position: relative;
  max-width: 46rem;
  margin: 0 0 var(--space-7);
  padding: var(--space-5) var(--space-4);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: var(--wobble-2);
}
@media (min-width: 40em) { .finder, .santa-form, .reveal-box { padding: var(--space-6); } }
.finder-bar { height: 8px; margin: 0 0 var(--space-4); background: var(--cream); border: 1.5px solid var(--ink); border-radius: 999px; overflow: hidden; }
.finder-bar-fill { display: block; height: 100%; width: 4%; background: var(--beak); transition: width 0.25s ease; }
.finder-bar-fill.w1 { width: 17%; } .finder-bar-fill.w2 { width: 33%; } .finder-bar-fill.w3 { width: 50%; }
.finder-bar-fill.w4 { width: 67%; } .finder-bar-fill.w5 { width: 83%; } .finder-bar-fill.w6 { width: 100%; }
.finder-step { border: 0; margin: 0; padding: 0; min-width: 0; }
.finder-legend { display: block; padding: 0; margin: 0 0 var(--space-2); font-family: var(--serif); font-size: var(--step-2); font-weight: 650; line-height: 1.15; font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 72; }
.finder-legend:focus { outline: none; }
.finder-legend:focus-visible { outline: 3px solid var(--sea); }
.finder-count { display: block; margin-bottom: var(--space-2); font-family: var(--sans); font-size: var(--step--1); font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--sea); }
.finder-hint { color: var(--ink-soft); margin-bottom: var(--space-4); }
.finder .opt span { background: #fff; }
.finder-nav { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin-top: var(--space-5); padding-top: var(--space-4); border-top: 1px dashed #c9b99d; }
.finder-nav [data-act="next"], .finder-nav [data-act="go"] { margin-left: auto; }
.finder-results { max-width: 52rem; margin: 0 0 var(--space-7); }
.finder-results > h2 { font-size: var(--step-3); padding-bottom: var(--space-3); border-bottom: 2px solid var(--ink); }
.finder-results > h2:focus { outline: none; }
.finder-summary { font-size: var(--step-1); }
.finder-page { padding: var(--space-4); background: var(--sea-mist); border-radius: var(--radius); font-weight: 600; }
.tool-why { padding: var(--space-2) var(--space-3); border-left: 3px solid var(--beak); background: rgba(244, 192, 78, 0.16); font-size: 0.98rem; }

/* ---------- Secret Santa ---------- */
.santa-form .opts { margin-bottom: var(--space-3); }
.santa-form .opt span { background: #fff; }
.santa-custom input { max-width: 10rem; }
.santa-pair { display: grid; gap: 0 var(--space-4); grid-template-columns: 1fr; align-items: end; }
@media (min-width: 40em) { .santa-pair { grid-template-columns: 1fr 1fr auto; } }
.santa-pairs { list-style: none; margin: 0; padding: 0; }
.santa-pairs li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-1) 0; border-bottom: 1px solid var(--line); font-weight: 600; }
.santa-results { max-width: 46rem; margin: 0 0 var(--space-7); }
.santa-results > h2:focus { outline: none; }
.santa-links { list-style: none; margin: 0; padding: 0; }
.santa-links li { padding: var(--space-3) 0; border-bottom: 1px solid var(--line); }
.santa-row { display: flex; gap: var(--space-2); }
.santa-row input { flex: 1 1 auto; min-width: 0; font-size: 0.9rem; color: var(--ink-soft); }
.santa-row button { flex: 0 0 auto; }

.reveal-hi { font-size: var(--step-1); }
.reveal-name { font-family: var(--serif); font-size: var(--step-3); font-weight: 650; line-height: 1.1; margin: 0 0 var(--space-4); font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144; }
.reveal-name:focus { outline: none; }
.reveal-facts { padding-left: 1.2em; margin: 0; }
.reveal-facts li::marker { color: var(--beak); }
.reveal-ideas { max-width: 52rem; margin: 0 0 var(--space-7); }

/* ---------- Posting dates ---------- */
.cd-box { max-width: 52rem; margin: 0 0 var(--space-5); }
.cd-box h2 { font-size: var(--step-2); }
.cd-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); }
@media (max-width: 39.99em) { .cd-list li { padding: var(--space-3); } .cd-big { font-size: var(--step-1); } .cd-what { font-size: 0.9rem; } }
.cd-list li { padding: var(--space-4); background: var(--paper); border: 2px solid var(--ink); border-radius: var(--wobble); }
.cd-big { display: block; font-family: var(--serif); font-size: var(--step-2); font-weight: 650; line-height: 1.1; color: var(--ink); font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 72; margin-bottom: var(--space-1); }
.cd-what { display: block; color: var(--ink-soft); font-size: 0.98rem; }
.cd.is-soon { color: var(--beak-deep); font-weight: 750; }
.cd-list li.is-past, tr.is-past { opacity: 0.6; }
.tool-section h3 { margin-top: var(--space-6); }

/* ---------- Tables (stack into cards on small screens) ---------- */
.tool-table { width: 100%; border-collapse: collapse; margin: 0 0 var(--space-4); font-size: 0.98rem; }
.tool-table th, .tool-table td { text-align: left; vertical-align: top; padding: var(--space-3) var(--space-3) var(--space-3) 0; border-bottom: 1px solid var(--line); }
.tool-table thead th { font-size: var(--step--1); font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); border-bottom: 2px solid var(--ink); }
.tool-table tbody th { font-weight: 700; }
.tool-table .cd { display: block; font-size: var(--step--1); color: var(--ink-soft); }
.tool-table td > .cd:only-child { font-size: 0.98rem; color: var(--ink); }
.tool-table tr.is-null th { color: var(--ink-soft); }
@media (max-width: 47.99em) {
  .tool-table:not(.tool-table-years) thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .tool-table:not(.tool-table-years), .tool-table:not(.tool-table-years) tbody, .tool-table:not(.tool-table-years) tr,
  .tool-table:not(.tool-table-years) th, .tool-table:not(.tool-table-years) td { display: block; width: 100%; }
  .tool-table:not(.tool-table-years) tr { padding: var(--space-3) 0; border-bottom: 1px solid var(--line); }
  .tool-table:not(.tool-table-years) th, .tool-table:not(.tool-table-years) td { border: 0; padding: var(--space-1) 0; }
  .tool-table:not(.tool-table-years) tbody th { font-size: 1.05rem; }
  .tool-table:not(.tool-table-years) td[data-label]::before { content: attr(data-label) ": "; font-weight: 700; color: var(--ink-soft); font-size: var(--step--1); }
  .tool-table:not(.tool-table-years) td .cd { display: inline; margin-left: var(--space-2); }
}
.tool-table-years th, .tool-table-years td { padding-block: var(--space-2); }
.tool-table-years tbody th a { display: inline-flex; align-items: center; min-height: 32px; }

/* ---------- Anniversaries + birthstones ---------- */
.jump { max-width: 52rem; margin: 0 0 var(--space-6); }
.jump-form { margin-bottom: var(--space-3); }
.jump-row { display: flex; gap: var(--space-2); max-width: 30rem; }
.jump-row select { flex: 1 1 auto; min-width: 0; }
.jump-links ul { list-style: none; display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0; padding: 0; }
.jump-links a { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0 var(--space-3); border: 1.5px solid var(--line); border-radius: 999px; background: var(--cream); color: var(--ink); text-decoration: none; font-weight: 700; font-size: 0.95rem; }
.jump-links a:hover { border-color: var(--ink); }
.year-list { display: grid; gap: var(--space-4); }
.year-card { padding: var(--space-4) 0 var(--space-3); border-top: 2px solid var(--ink); scroll-margin-top: var(--space-4); }
.year-card:target { background: linear-gradient(180deg, rgba(244, 192, 78, 0.18), transparent 70%); }
.year-card h3 { font-size: var(--step-2); }
.year-card h3:focus { outline: none; }
.facts { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); margin: 0 0 var(--space-3); }
.facts div { min-width: 8rem; }
.facts dt { font-size: var(--step--1); font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--sea); }
.facts dd { margin: 0; font-weight: 650; font-size: 1.05rem; }
.year-none { padding: var(--space-3) var(--space-4); background: var(--paper); border-radius: var(--radius); }
.angles-h { font-weight: 800; margin: 0 0 var(--space-1); }
.tool-ideas { list-style: none; margin: 0; padding: 0; }
.tool-ideas .idea-card { border-bottom: 1px solid var(--line); padding-bottom: var(--space-5); }
.tool-ideas .idea-name { font-size: var(--step-1); }

.tool-sources .link-list a { font-weight: 600; font-size: 0.98rem; }

@media print {
  .finder, .santa-form, .jump, .finder-actions { display: none !important; }
}
