/* Greeting cards (/cards/...). Builds on style.css. The preview stays in the first
   screen on a phone; the buttons come within a screen and a half. */

[hidden] { display: none !important; }

.card-lead { margin-bottom: 8px; }
.card-tool { padding-top: 12px; }

.card-stage { display: flex; justify-content: center; }
.card-canvas {
  height: min(46vh, 420px);
  width: auto;
  max-width: 100%;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgb(0 0 0 / 0.14);
  background: linear-gradient(#fff4ec, #ffe1e8);
}
.card-noscript { text-align: center; color: var(--muted); }

.card-form .field { margin-top: 10px; }
.card-form input[type="text"], .card-form textarea { min-height: 44px; padding: 10px 12px; font-size: 17px; }
.card-form textarea { resize: vertical; line-height: 1.5; }
.card-row { display: flex; gap: 10px; }
.card-row .card-name { flex: 2; }
.card-row .card-age { flex: 1; }
.card-row .card-from { flex: 1; }
.card-meaning { margin: 6px 0 0; }

/* Ready greetings: one scrolling row of chips. */
.card-phrases {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 0 4px;
  scrollbar-width: none;
}
.card-phrases::-webkit-scrollbar { display: none; }
.card-phrases button {
  flex: none;
  border: 1px solid var(--line, #d9d9de);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}
.card-phrases .card-next { background: var(--accent-soft, #e3f3ec); border-color: transparent; font-weight: 600; }

.card-form fieldset { border: 0; padding: 0; margin: 12px 0 0; min-width: 0; }
.card-form legend { font-size: 14px; color: var(--muted); margin-bottom: 4px; padding: 0; }

/* Template strip */
.card-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.card-strip label { flex: none; position: relative; text-align: center; cursor: pointer; width: 64px; }
.card-strip input { position: absolute; opacity: 0; }
.card-strip canvas {
  display: block;
  width: 54px;
  height: 96px;
  margin: 0 auto;
  border-radius: 8px;
  outline: 2px solid transparent;
  outline-offset: 2px;
  background: var(--bg);
}
.card-strip span { display: block; font-size: 11px; line-height: 1.3; margin-top: 4px; color: var(--muted); }
.card-strip input:checked + canvas { outline-color: var(--accent); }
.card-strip input:checked ~ span { color: var(--text); font-weight: 600; }
.card-strip input:focus-visible + canvas { outline-color: var(--accent); outline-style: dashed; }

/* Colours */
.card-swatches { display: flex; gap: 12px; }
.card-swatches label { position: relative; cursor: pointer; }
.card-swatches input { position: absolute; opacity: 0; }
.card-swatches span {
  display: block;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgb(0 0 0 / 0.15);
  outline: 2px solid transparent;
  outline-offset: 3px;
}
.card-swatches input:checked + span { outline-color: var(--accent); }
.card-swatches input:focus-visible + span { outline-style: dashed; outline-color: var(--accent); }

.card-choice .segmented span { font-size: 14px; padding: 7px 2px; }

/* Buttons */
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.card-actions .primary-button { flex: 1 1 140px; min-width: 0; justify-content: center; }
.card-actions .primary-button[data-act="save"]:not(:first-child) {
  background: var(--surface);
  color: var(--accent);
  border: 2px solid var(--accent);
}
.card-link {
  flex: 1 1 100%;
  display: block;
  text-align: center;
  padding: 11px 16px;
  border-radius: 12px;
  background: #25a244;
  color: #fff;
  font-weight: 600;
}
.card-link:hover { text-decoration: none; filter: brightness(1.06); }
.card-form .status:empty { display: none; }
.card-form .check { display: block; margin-top: 12px; }

/* Greetings list below the tool */
.card-lines li { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-lines button.copy { flex-shrink: 0; }

.name-chips { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.name-chips a { display: block; padding: 6px 14px; border-radius: 999px; background: var(--bg); color: var(--text); }
.name-chips a:hover { text-decoration: none; outline: 2px solid var(--accent); }

/* Wider screens: preview beside the form. */
@media (min-width: 760px) {
  .card-tool { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 24px; align-items: start; }
  .card-form { min-width: 0; }
  .card-stage { position: sticky; top: 16px; }
  .card-canvas { height: min(70vh, 620px); }
  .card-tool .privacy-note { grid-column: 1 / -1; }
}

/* Touch screens: 44 px targets for greeting chips, choices and colours (2026-10-22).
   The colour dots keep their size; an invisible ring takes the extra taps. */
@media (pointer: coarse) {
  .card-phrases button { min-height: 44px; }
  .name-chips a { display: flex; align-items: center; min-height: 44px; }
  .card-choice .segmented span { min-height: 44px; display: flex; align-items: center; justify-content: center; }
  .card-swatches label::after { content: ''; position: absolute; inset: -5px; }
}
