/* Gift pages: the /christmas-gift-ideas/ hub and every /christmas-gifts-for-*/ page.
   Loaded with the page field  preload: '<link rel="stylesheet" href="/css/gifts.css">'.
   Every class starts with .gi- so it never collides with a page's own prefix.
   The idea list is plain HTML and reads fine with JS off; /js/tools/gift-ideas.js adds the
   filter bar, stars, the shortlist panel, the floating pill and the print sheet. */

/* ---------- the tool card ---------- */
.tool.gi-tool { padding-top: clamp(30px, 4vw, 46px); }
.gi-tool::before { content: ""; position: absolute; inset: 0 0 auto; height: 10px; border-radius: 18px 18px 0 0;
  background: repeating-linear-gradient(-45deg, #d93a2f 0 9px, #fbf6ec 9px 18px); }
.gi-tool::after { content: ""; position: absolute; top: -26px; right: clamp(16px, 4vw, 40px); width: 78px; height: 56px; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 58'%3E%3Cpath d='M36 26l-11 28 9-4 6 7 3-30zM44 26l11 28-9-4-6 7-3-30z' fill='%23b52a21' stroke='%231d2b28' stroke-width='2.5' stroke-linejoin='round'/%3E%3Cpath d='M40 24C31 5 6 2 10 18c3 10 22 10 30 6z' fill='%23d93a2f' stroke='%231d2b28' stroke-width='2.5'/%3E%3Cpath d='M40 24C49 5 74 2 70 18c-3 10-22 10-30 6z' fill='%23d93a2f' stroke='%231d2b28' stroke-width='2.5'/%3E%3Cpath d='M18 14c4-4 12-3 16 4M62 14c-4-4-12-3-16 4' fill='none' stroke='%23fbf6ec' stroke-opacity='.55' stroke-width='2.5' stroke-linecap='round'/%3E%3Ccircle cx='40' cy='24' r='6.5' fill='%23e2433b' stroke='%231d2b28' stroke-width='2.5'/%3E%3C/svg%3E") center / contain no-repeat; }
.gi-tool :focus-visible { outline-color: var(--cranberry-deep); }
.gi-head { max-width: 62ch; margin-bottom: 18px; }
.gi-head h2 { margin: 0 0 8px; }
.gi-head p { margin: 0; color: var(--ink-soft); }

/* ---------- filter bar (built by the script) ---------- */
.gi-bar { display: grid; gap: 14px; padding: 16px 0 18px; margin-bottom: 18px; border-top: 2px dashed #eadcc3; border-bottom: 2px dashed #eadcc3; }
.gi-filter { display: grid; grid-template-columns: 136px minmax(0, 1fr); gap: 10px; align-items: start; }
.gi-flabel { font: 800 13px/1.2 var(--body); letter-spacing: 0.1em; text-transform: uppercase; color: var(--cranberry-deep); padding-top: 14px; }
.gi-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.gi-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 14px; border: 2px solid #d8cdb8; border-radius: 999px;
  background: #fff; color: var(--ink); font: 800 15px/1.1 var(--body); cursor: pointer; transition: background 160ms var(--ease), border-color 160ms var(--ease); }
.gi-chip b { font-weight: 800; font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.gi-chip[aria-pressed=true] { background: var(--ink); border-color: var(--ink); color: var(--snow); }
.gi-chip[aria-pressed=true] b { color: #d3dfda; }
.gi-chip.is-zero { opacity: 0.5; border-style: dashed; }
@media (hover: hover) and (pointer: fine) { .gi-chip:hover { border-color: var(--ink); } }
.gi-status { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.gi-count { margin: 0; font: 600 clamp(20px, 2.2vw, 24px)/1.2 var(--display); color: var(--ink); }
.gi-count small { font: 700 15px var(--body); color: var(--ink-soft); }
.gi-clear { min-height: 44px; padding: 0 6px; border: 0; background: none; color: var(--cranberry-deep); font: 800 15px var(--body); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* ---------- someone shared a shortlist ---------- */
.gi-shared-note { display: grid; gap: 10px; margin: 0 0 18px; padding: 14px 16px; border-radius: 14px; background: #e7f2ea; border: 2px dashed var(--pine); }
.gi-shared-note p { margin: 0; color: var(--ink); }
.gi-shared-note p:focus { outline: none; }
.gi-shared-note div { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- ideas + shortlist layout ---------- */
.gi-body { display: grid; gap: 26px; }
@media (min-width: 1100px) { .gi-body { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; } }

/* ---------- the ideas: gift tags ---------- */
.gi-ideas { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 16px; }
.gi-idea { position: relative; display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 16px 16px 14px; background: #fff;
  border: 2px solid #eadfca; border-radius: 6px 18px 18px 18px; scroll-margin: 90px 0; transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease); }
.gi-idea::before { content: ""; position: absolute; left: 14px; top: 16px; width: 11px; height: 11px; border-radius: 50%; background: var(--snow); box-shadow: inset 0 0 0 2px #d6c49f; }
.gi-idea:focus { outline: 3px solid var(--cranberry-deep); outline-offset: 3px; }
.gi-band { align-self: flex-start; margin: 0 48px 2px 20px; padding: 2px 10px; border-radius: 4px 999px 999px 4px; border: 1.5px solid #e0bf6c;
  background: #fff3d0; color: #5d4612; font: 800 13px/1.5 var(--body); font-variant-numeric: tabular-nums; white-space: nowrap; }
.gi-idea[data-band=u25] .gi-band { background: #e7f2ea; border-color: #a9d0b6; color: #1f5c40; }
.gi-idea[data-band="75up"] .gi-band { background: #fde8e6; border-color: #efb3ad; color: #a3241c; }
.gi-tool .gi-idea h3 { margin: 2px 0 0; font: 600 19px/1.25 var(--display); color: var(--ink); }
.gi-tool .gi-idea p { margin: 0; font-size: 15.5px; line-height: 1.5; color: var(--ink-soft); }
.gi-tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: auto 0 0; padding: 8px 0 0; }
.gi-tags li { margin: 0; padding: 1px 9px; border-radius: 999px; background: var(--snow); border: 1.5px solid #eadfca; font: 700 12.5px/1.6 var(--body); color: var(--ink-soft); }
.gi-badge { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; margin: 0 0 2px; padding: 2px 10px 2px 8px; border-radius: 999px;
  background: var(--pine); color: #fff !important; font: 800 12.5px/1.6 var(--body) !important; }
.gi-badge svg { width: 14px; height: 14px; fill: var(--gold); }
.gi-idea.is-shared { border-style: dashed; border-color: var(--pine); }
.gi-idea.is-starred { border-color: #e0b84a; box-shadow: 0 0 0 3px #f4c24d40; }
.gi-idea.gi-flash { box-shadow: 0 0 0 5px #f4c24d80; }

/* star button (added by the script) */
.gi-star { position: absolute; top: 4px; right: 4px; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; display: grid; place-items: center; }
.gi-star svg { width: 27px; height: 27px; fill: transparent; stroke: #b39a63; stroke-width: 1.7; stroke-linejoin: round; transition: fill 160ms var(--ease), stroke 160ms var(--ease); }
.gi-star[aria-pressed=true] svg { fill: var(--gold); stroke: #a87c12; }
@media (hover: hover) and (pointer: fine) { .gi-star:hover { background: var(--snow); } .gi-star:hover svg { stroke: #a87c12; } }
.js-motion .gi-star.gi-pop svg { animation: gi-pop 260ms var(--ease); }
@keyframes gi-pop { 45% { transform: scale(1.35) rotate(-10deg); } }
.gi-none { margin: 8px 0 0; padding: 18px; border-radius: 14px; background: var(--snow); text-align: center; color: var(--ink-soft); font-weight: 700; }
.gi-none button { min-height: 44px; border: 0; background: none; color: var(--cranberry-deep); font: 800 16px var(--body); text-decoration: underline; cursor: pointer; }

/* ---------- shortlist panel ---------- */
.gi-panel { position: relative; padding: 20px 18px 16px; border-radius: 16px; background: #fffdf7; border: 2px dashed #dcc79b; }
@media (min-width: 1100px) { .gi-panel { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; } }
.gi-panel-h { display: flex; align-items: center; gap: 8px; margin: 0 0 6px !important; font: 600 22px/1.2 var(--display) !important; }
.gi-panel-h:focus { outline: none; }
.gi-panel-h svg { width: 24px; height: 24px; flex: none; fill: var(--gold); stroke: #a87c12; stroke-width: 1.5; }
.gi-panel-n { display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 8px; border-radius: 999px; background: var(--ink); color: var(--snow); font: 800 14px var(--body); font-variant-numeric: tabular-nums; }
.gi-panel-empty { margin: 0 0 8px; font-size: 15px; color: var(--ink-soft); }
.gi-sl { list-style: none; margin: 4px 0 0; padding: 0; }
.gi-sl li { display: grid; grid-template-columns: minmax(0, 1fr) 44px; align-items: center; gap: 2px 6px; padding: 6px 0; border-bottom: 1.5px dashed #eadcc3; }
.gi-sl a { display: block; font-weight: 800; font-size: 15.5px; line-height: 1.3; color: var(--ink) !important; text-decoration: none; overflow-wrap: anywhere; padding: 4px 0; }
.gi-sl a:hover { text-decoration: underline; }
.gi-sl span { display: block; font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.gi-sl-x { width: 44px; height: 44px; border: 0; border-radius: 50%; background: none; color: var(--ink-soft); font: 400 26px/1 var(--body); cursor: pointer; }
.gi-sl-x:hover { background: var(--snow-2); color: var(--cranberry-deep); }
.js-motion .gi-sl li.gi-new { animation: gi-in 240ms var(--ease) both; }
@keyframes gi-in { from { opacity: 0; transform: translateY(-6px); } }
.gi-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.gi-actions .btn { min-height: 46px; padding: 0 18px; font-size: 15.5px; width: 100%; }
.gi-act { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 999px; border: 2px solid #d8cdb8;
  background: #fff; color: var(--ink); font: 800 15px var(--body); cursor: pointer; }
.gi-act svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) and (pointer: fine) { .gi-act:hover { border-color: var(--ink); } }
.gi-act[disabled], .gi-actions .btn[disabled] { opacity: 0.45; cursor: default; }
.gi-act[aria-pressed=true] { background: var(--ink); border-color: var(--ink); color: var(--snow); }
.gi-actions .gi-act { flex: 1 1 auto; }
.gi-msg { min-height: 24px; margin: 10px 0 0; font-weight: 700; font-size: 15px; color: #1e5b2b; }
.gi-msg:empty { min-height: 0; margin: 0; }
.gi-linkwrap { display: grid; gap: 4px; margin-top: 8px; font-weight: 800; font-size: 14px; }
.gi-linkwrap input { width: 100%; min-height: 44px; font: 14px/1.3 ui-monospace, Menlo, monospace; border: 2px solid #d8cdb8; border-radius: 10px; padding: 8px 10px; color: var(--ink); background: #fff; }
.gi-note { margin: 12px 0 0; font-size: 13.5px; line-height: 1.45; color: var(--ink-soft); }

/* floating "My shortlist" pill on phones and tablets */
.gi-pill { position: fixed; left: 50%; bottom: 14px; z-index: 60; display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 18px 0 14px; border-radius: 999px;
  background: var(--night); color: var(--snow) !important; font: 800 15px var(--body); text-decoration: none; box-shadow: var(--shadow-float), 0 0 0 2px #f4c24d66;
  transform: translate(-50%, 160%); visibility: hidden; transition: transform 240ms var(--ease), visibility 0s linear 240ms; white-space: nowrap; }
.gi-pill.on { transform: translate(-50%, 0); visibility: visible; transition: transform 240ms var(--ease), visibility 0s; }
.gi-pill svg { width: 20px; height: 20px; fill: var(--gold); }
.gi-pill b { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 999px; background: var(--gold); color: var(--ink); font-size: 13px; }
.paused .gi-pill { transition: none; }
@media (min-width: 1100px) { .gi-pill { display: none; } }

/* ---------- page helpers (answer sections) ---------- */
/* a gift tag holding a short checklist */
.gi-checklist { position: relative; width: min(100%, 470px); justify-self: center; margin: 0; color: var(--ink); padding: 30px 26px 22px 30px; background: #fffdf7; border-radius: 10px 26px 26px 26px; box-shadow: var(--shadow-float); transform: rotate(-1.2deg); }
.gi-checklist::before { content: ""; position: absolute; left: 18px; top: 18px; width: 14px; height: 14px; border-radius: 50%; background: var(--paper); box-shadow: inset 0 0 0 2.5px #c9b083; }
.gi-checklist::after { content: ""; position: absolute; left: 22px; top: -34px; width: 3px; height: 54px; background: repeating-linear-gradient(180deg, #d93a2f 0 6px, #fbf6ec 6px 12px); border-radius: 2px; transform: rotate(-18deg); }
.gi-checklist h3 { margin: 0 0 12px 22px !important; font-size: 22px !important; }
.gi-checklist ol { list-style: none; margin: 0; padding: 0; counter-reset: gi; }
.gi-checklist li { position: relative; margin: 0; padding: 10px 0 10px 40px; border-bottom: 1.5px dashed #eadcc3; color: var(--ink); font-weight: 700; font-size: 16px; line-height: 1.4; counter-increment: gi; }
.gi-checklist li:last-child { border-bottom: 0; }
.gi-checklist li::before { content: counter(gi); position: absolute; left: 0; top: 9px; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--pine); color: #fff; font: 600 15px/1 var(--display); }
.gi-checklist small { display: block; font-weight: 400; font-size: 14px; color: var(--ink-soft); }

/* numbered steps, for the /ask/ and /gift/ how-it-works rows */
.gi-steps { list-style: none; margin: 26px 0 0; padding: 0 !important; display: grid; gap: 14px; counter-reset: gis; }
.gi-steps li { position: relative; margin: 0; padding: 14px 16px 14px 62px; border-radius: 14px; background: #ffffff0f; border: 1px solid #ffffff24; counter-increment: gis; }
.gi-steps li::before { content: counter(gis); position: absolute; left: 14px; top: 14px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--gold); color: var(--ink); font: 600 18px/1 var(--display); }
.gi-steps b { display: block; color: var(--snow); font-size: 17px; }
.gi-steps span { display: block; color: #d3dfda; font-size: 15.5px; }
.sec:not(.night) .gi-steps li { background: #fff; border: 2px solid #eadfca; }
.sec:not(.night) .gi-steps b { color: var(--ink); }
.sec:not(.night) .gi-steps span { color: var(--ink-soft); }

/* a paper receipt for survey numbers (hub) */
.gi-receipt { position: relative; margin: 0; padding: 24px 22px 30px; background: #fff; color: var(--ink); box-shadow: var(--shadow-float); transform: rotate(1deg);
  -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / 18px 51% repeat-x, linear-gradient(#000 0 0) top / 100% calc(100% - 8px) no-repeat;
  mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / 18px 51% repeat-x, linear-gradient(#000 0 0) top / 100% calc(100% - 8px) no-repeat; }
.gi-receipt h3 { margin: 0 0 4px !important; text-align: center; font-size: 20px !important; letter-spacing: 0.04em; text-transform: uppercase; }
.gi-receipt > p { margin: 0 0 12px; text-align: center; font-size: 13px; color: var(--ink-soft); }
.gi-receipt dl { margin: 0; }
.gi-receipt div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: baseline; padding: 10px 0; border-top: 1.5px dashed #d6c8a8; }
.gi-receipt dt { font-weight: 700; font-size: 15px; line-height: 1.35; }
.gi-receipt dt small { display: block; font-weight: 400; font-size: 13px; color: var(--ink-soft); }
.gi-receipt dd { margin: 0; font: 700 18px/1.2 ui-monospace, Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; color: var(--pine); }

/* hub: "Who are you shopping for?" picture grid (cards come from funGrid(pages, "gifts")) */
.gi-who .fun-grid { margin-top: 26px; }
.gi-who:not(.night) .fun-grid a { color: var(--ink); background: #fff; border: 2px solid #eadfca; }
.gi-who:not(.night) .fun-grid span { color: var(--ink-soft); }
@media (hover: hover) and (pointer: fine) { .gi-who:not(.night) .fun-grid a:hover { background: #fff; box-shadow: var(--shadow-float); } }

/* ---------- print: only the sheet, and only after "Print the list" ---------- */
.gi-sheet { display: none; }
@media print {
  @page { size: auto; margin: 12mm; }
  html.gi-printing, html.gi-printing body { background: #fff !important; }
  html.gi-printing body > :not(main), html.gi-printing main > :not(.gi-sheet.on) { display: none !important; }
  html.gi-printing .gi-sheet.on { display: block !important; color: #1d2b28; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .gi-sheet-frame { border: 4mm solid #d93a2f; border-image: repeating-linear-gradient(-45deg, #d93a2f 0 3mm, #fff 3mm 6mm) 12; padding: 8mm 10mm 6mm; }
  .gi-sheet-k { margin: 0; font: 800 9pt/1 var(--body); letter-spacing: 0.14em; text-transform: uppercase; color: #b52a21; }
  .gi-sheet-t { margin: 2mm 0 1mm; font: italic 600 24pt/1.1 var(--display); }
  .gi-sheet-s { margin: 0 0 4mm; font: 700 10pt var(--body); color: #4b5a56; }
  .gi-sheet ol { list-style: none; margin: 0; padding: 0; }
  .gi-sheet li { display: grid; grid-template-columns: 7mm minmax(0, 1fr) auto; column-gap: 3mm; align-items: start; padding: 2.4mm 0; border-bottom: 0.4mm dashed #c9b48a; break-inside: avoid; }
  .gi-sheet li i { width: 4.5mm; height: 4.5mm; margin-top: 0.8mm; border: 0.5mm solid #1d2b28; border-radius: 1mm; }
  .gi-sheet li b { display: block; font: 700 11.5pt/1.25 var(--body); }
  .gi-sheet li small { display: block; font: 400 9pt/1.3 var(--body); color: #4b5a56; }
  .gi-sheet li em { font: 800 9.5pt var(--body); font-style: normal; color: #1f6b4a; white-space: nowrap; }
  .gi-sheet-f { display: flex; justify-content: space-between; gap: 6mm; margin: 4mm 0 0; font: 700 8.5pt var(--body); color: #4b5a56; }
}

@media (max-width: 640px) {
  .tool.gi-tool { padding-left: 14px; padding-right: 14px; }
  .gi-filter { grid-template-columns: 1fr; gap: 6px; }
  .gi-flabel { padding-top: 0; }
  .gi-chips { gap: 6px; }
  .gi-chip { gap: 4px; padding: 4px 11px; font-size: 14px; }
  .gi-chip b { font-size: 12px; }
  .gi-tool::after { width: 62px; height: 44px; top: -20px; }
  .gi-ideas { gap: 12px; }
  .gi-idea { padding: 14px 14px 12px; }
}
@media (max-width: 360px) {
  .gi-idea { padding: 12px 12px 10px; }
  .gi-checklist { padding: 28px 18px 18px 22px; }
  .gi-checklist li { padding-left: 36px; font-size: 15px; }
}
