/* Secret Santa Generator — Tool Styles */
/* Inherits brand tokens from /assets/css/site.css */

/* ── Tool Layout ──────────────────────────────────────────────────────────── */

.tool-main {
  width: 100%;
  max-width: var(--tool-max);
  margin: 0 auto;
  padding: 2rem 1rem 2.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.tool-header { text-align: center; }

.tool-header h1 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.tool-header p {
  margin-top: 0.3rem;
  color: var(--stone);
  font-size: 0.95rem;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ── Field Groups ─────────────────────────────────────────────────────────── */

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
}

.hint {
  font-weight: 400;
  color: var(--stone);
  font-size: 0.82rem;
}

/* ── Textarea ─────────────────────────────────────────────────────────────── */

textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  resize: vertical;
  min-height: 140px;
  transition: border-color 0.15s;
}

textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(55, 48, 163, 0.12);
  background: var(--surface);
}

textarea.drag-over {
  border-color: var(--accent);
  background: #EDEDFF;
}

/* ── File Upload ──────────────────────────────────────────────────────────── */

.upload-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
}

.btn-upload {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  background: var(--warm-bg);
  color: var(--warm-text);
  border: 1px solid var(--warm-border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  min-height: 44px;
}

.btn-upload:hover { background: #FDE68A; border-color: var(--warm); }
.btn-upload:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  clip: rect(0,0,0,0);
}

.upload-hint {
  font-size: 0.82rem;
  color: #2d6a3f;
  font-weight: 600;
}

/* ── Toggle ───────────────────────────────────────────────────────────────── */

.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  min-height: 44px;
  color: var(--ink);
}

.toggle-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */

.btn-primary {
  width: 100%;
  padding: 0.9rem 1.5rem;
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  min-height: 52px;
  touch-action: manipulation;
  letter-spacing: 0.01em;
  box-shadow: 0 2px 6px rgba(55, 48, 163, 0.3);
}

.btn-primary:hover        { background: var(--accent-hover); box-shadow: 0 3px 10px rgba(55, 48, 163, 0.35); }
.btn-primary:active       { transform: scale(0.98); }
.btn-primary:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  min-height: 44px;
  touch-action: manipulation;
}

.btn-secondary:hover        { background: var(--bg); border-color: #c8c0b0; }
.btn-secondary:active       { background: #EDEDFF; }
.btn-secondary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ── Cross-link Card ──────────────────────────────────────────────────────── */

.crosslink-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--warm-bg);
  border: 1px solid var(--warm-border);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  font-size: 0.9rem;
  color: var(--ink);
}

.crosslink-icon {
  color: var(--warm);
  flex-shrink: 0;
}

.crosslink-card strong {
  display: block;
  font-weight: 700;
  margin-bottom: 0.1rem;
}

.crosslink-card a {
  color: var(--warm);
  font-weight: 600;
  text-decoration: none;
}

.crosslink-card a:hover { text-decoration: underline; }

/* ── Toast ────────────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--surface);
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 1000;
  white-space: nowrap;
  animation: toast-in 0.2s ease-out;
  pointer-events: none;
}

.toast--hide { animation: toast-out 0.25s ease-in forwards; }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateX(-50%) translateY(0); }
  to   { opacity: 0; transform: translateX(-50%) translateY(8px); }
}

/* ── Secret Santa ─────────────────────────────────────────────────────────── */

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.input-section { display: flex; flex-direction: column; gap: 1.25rem; }

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
}

.count {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--stone);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.btn-text {
  background: none;
  border: none;
  padding: 0.45rem 0.25rem;
  min-height: 44px;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.btn-text:hover { color: var(--accent-hover); }
.btn-text:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* Text, date and select inputs share the textarea look */
input[type="text"], input[type="date"], select {
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--bg);
  transition: border-color 0.15s;
}
input[type="text"]:focus, input[type="date"]:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(55, 48, 163, 0.12);
  background: var(--surface);
}
::placeholder { color: var(--stone); opacity: 1; }
input, textarea { caret-color: var(--accent); }

.details-row {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 0.75rem;
}

/* Exclusions */
.exclusions {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.exclusions summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 0;
  min-height: 44px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  user-select: none;
}
.exclusions summary::-webkit-details-marker { display: none; }
.exclusions summary::after {
  content: '+';
  margin-left: auto;
  font-weight: 400;
  font-size: 1.05rem;
  color: var(--stone);
}
.exclusions[open] summary::after { content: '−'; }
.exclusions summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: var(--radius); }

.excl-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--warm-text);
  background: var(--warm-bg);
  border: 1px solid var(--warm-border);
  border-radius: 999px;
  padding: 0.05rem 0.55rem;
}

.excl-body {
  padding: 0 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.excl-help { font-size: 0.85rem; color: var(--stone); line-height: 1.55; text-wrap: pretty; }
.excl-add {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  align-items: center;
  gap: 0.5rem;
}
.excl-and { font-size: 0.85rem; color: var(--stone); font-weight: 600; }
.excl-empty { font-size: 0.85rem; color: var(--stone); }

.excl-list { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.excl-list li {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.2rem 0.2rem 0.2rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}
.excl-list li.is-stale { color: var(--stone); border-style: dashed; }
.excl-list .stale-note { font-weight: 400; font-size: 0.78rem; margin-left: 0.3rem; }
.excl-remove {
  display: inline-grid;
  place-items: center;
  width: 32px; height: 32px;
  border: none;
  border-radius: 999px;
  background: none;
  color: var(--stone);
  cursor: pointer;
}
.excl-remove:hover { background: #EDEDFF; color: var(--ink); }
.excl-remove:focus-visible { outline: 3px solid var(--accent); outline-offset: 0; }

.form-error {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--highlight);
  background: #FFF1F2;
  border: 1px solid #FECDD3;
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  line-height: 1.5;
}

/* Results */
.results-section { display: flex; flex-direction: column; gap: 1rem; }
.results-top { display: flex; flex-direction: column; gap: 0.2rem; }
.results-heading {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--stone);
}
.results-meta { font-size: 0.95rem; font-weight: 700; color: var(--ink); }
.results-help { font-size: 0.9rem; color: var(--stone); line-height: 1.6; text-wrap: pretty; }

.draw-list {
  list-style: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}
.draw-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.6rem 0.5rem 0.9rem;
  min-height: 60px;
}
.draw-row + .draw-row { border-top: 1px solid var(--border); }

.draw-who {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}
.draw-name {
  font-size: 1rem;
  font-weight: 800;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.draw-status { font-size: 0.78rem; font-weight: 600; color: var(--stone); white-space: nowrap; }
.draw-row.is-seen .draw-status { color: #2d6a3f; }

.draw-reveal {
  font-size: 0.95rem;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.draw-reveal strong { color: var(--highlight); font-weight: 800; font-size: 1.15rem; }

.draw-actions { display: flex; gap: 0.4rem; flex-shrink: 0; }
.draw-actions .btn-secondary { padding: 0.5rem 0.8rem; }
.btn-tap {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-tap:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.draw-row.is-open {
  background: var(--surface);
  box-shadow: 0 2px 10px rgba(28, 28, 28, 0.08);
  position: relative;
}
.draw-row.is-open:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.draw-row.is-open:last-child { border-radius: 0 0 var(--radius) var(--radius); }

@keyframes reveal-in {
  from { opacity: 0; transform: translateY(4px); filter: blur(3px); }
  to   { opacity: 1; transform: none; filter: none; }
}
.draw-row.is-open .draw-reveal { animation: reveal-in 0.28s cubic-bezier(0.16, 1, 0.3, 1) both; }

.action-row { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.organizer-zone {
  border-top: 1px dashed var(--border);
  padding-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: flex-start;
}
.confirm-box, .all-draws {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-size: 0.9rem;
  line-height: 1.55;
}
.confirm-box {
  background: var(--warm-bg);
  border: 1px solid var(--warm-border);
  color: var(--warm-text);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
}
.btn-danger { color: var(--highlight); border-color: #FECDD3; }
.btn-danger:hover { background: #FFF1F2; border-color: var(--highlight); }

.all-list {
  padding-left: 1.4rem;
  font-variant-numeric: tabular-nums;
  columns: 2;
  column-gap: 2rem;
  font-weight: 600;
}
.all-list li { break-inside: avoid; padding: 0.15rem 0; }
.all-list .arrow { color: var(--stone); font-weight: 400; margin: 0 0.3rem; }
.all-warn { font-size: 0.82rem; color: var(--stone); }

/* Private link view */
.link-view { text-align: center; align-items: center; gap: 1rem; padding: 2rem 1.5rem; }
.link-group {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--warm);
}
.link-hello {
  font-size: clamp(1.4rem, 5vw, 1.9rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
#link-cover, .link-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 100%;
}
.link-note { color: var(--stone); font-size: 0.95rem; max-width: 34ch; line-height: 1.55; }
#btn-link-reveal { max-width: 320px; }
.link-label { font-size: 0.85rem; font-weight: 700; color: var(--stone); }
.link-recipient {
  font-size: clamp(2rem, 9vw, 3rem);
  font-weight: 800;
  color: var(--highlight);
  letter-spacing: -0.025em;
  line-height: 1.1;
  overflow-wrap: anywhere;
  margin-top: -0.6rem;
}
.link-result:not([hidden]) .link-recipient { animation: reveal-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) both; }
.link-meta { font-size: 0.95rem; font-weight: 600; color: var(--ink); }
.link-meta:empty { display: none; }
.link-bad { color: var(--stone); font-size: 0.95rem; max-width: 40ch; line-height: 1.55; }
.link-own { font-size: 0.85rem; padding-top: 0.5rem; border-top: 1px solid var(--border); width: 100%; }
.link-own a { color: var(--accent); font-weight: 600; text-underline-offset: 3px; }

[hidden] { display: none !important; }

/* Page content extras */
.faq-inner > ol {
  font-size: 0.9rem;
  color: var(--stone);
  line-height: 1.65;
  margin-bottom: 1.25rem;
  padding-left: 1.25rem;
}
.faq-inner > ol li + li { margin-top: 0.45rem; }
.faq-inner > ol strong, .faq-inner > p strong { color: var(--ink); }
.faq-inner code {
  font-size: 0.85em;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 0.3rem;
}

.crosslink-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--warm-bg);
  border-top: 1px solid var(--warm-border);
  padding: 0.75rem 1.5rem;
  font-size: 0.9rem;
  color: var(--stone);
  flex-wrap: wrap;
  text-align: center;
}
.crosslink-banner a { color: var(--warm); font-weight: 700; text-decoration: none; }
.crosslink-banner a:hover { text-decoration: underline; }

@media (max-width: 600px) {
  .details-row { grid-template-columns: 1fr 1fr; }
  .details-row .field-group:first-child { grid-column: 1 / -1; }
  .excl-add { grid-template-columns: 1fr 1fr; }
  .excl-and { display: none; }
  .excl-add .btn-secondary { grid-column: 1 / -1; justify-content: center; }
  .draw-row { flex-wrap: wrap; }
  .draw-row.is-open .draw-actions { width: 100%; }
  .all-list { columns: 1; }
}

/* Print: slips only */
.print-slips { display: none; }
@media print {
  body > *:not(.print-slips) { display: none !important; }
  body { background: #fff; display: block; }
  .print-slips {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 0;
  }
  .slip {
    border: 1px dashed #999;
    padding: 1.1rem 1rem;
    text-align: center;
    break-inside: avoid;
    font-family: var(--font);
    color: #1C1C1C;
  }
  .slip-group { font-size: 9pt; color: #555; margin-bottom: 0.2rem; }
  .slip-giver { font-size: 11pt; font-weight: 700; }
  .slip-label { font-size: 9pt; color: #555; margin-top: 0.4rem; }
  .slip-recipient { font-size: 20pt; font-weight: 800; margin-top: 0.1rem; }
  .slip-meta { font-size: 9pt; color: #555; margin-top: 0.4rem; }
}
