/*
 * Secret Santa – Material You look: soft colours, round shapes, calm motion.
 * Still big and easy to read. Sizes are in rem so the browser's text-size setting works.
 * No external fonts or scripts (the security policy only allows files from this site).
 */

:root {
  color-scheme: light;
  --primary: #9b2c34;
  --on-primary: #ffffff;
  --primary-container: #ffdad9;
  --on-primary-container: #410006;
  --secondary-container: #f6dedb;
  --on-secondary-container: #2c1514;
  --surface: #fff8f7;
  --surface-1: #fceeed;
  --surface-2: #f8e6e4;
  --on-surface: #201a1a;
  --on-surface-variant: #4f4142;
  --outline: #857372;
  --error-container: #ffdad6;
  --on-error-container: #410002;
  --ok-container: #d6f0dc;
  --on-ok-container: #0b2e18;
  --link: #0b4a9e;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --shadow-1: 0 1px 2px rgba(32, 26, 26, 0.18), 0 2px 6px rgba(32, 26, 26, 0.1);
  --shadow-2: 0 4px 10px rgba(155, 44, 52, 0.28), 0 10px 28px rgba(155, 44, 52, 0.22);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--surface);
  color: var(--on-surface);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.375rem;
  line-height: 1.5;
}

main {
  max-width: 40rem;
  margin: 0 auto;
  padding: 1rem 1.25rem 3rem;
}

h1 {
  font-size: 2.1rem;
  font-weight: 600;
  line-height: 1.2;
  margin: 0.5rem 0 1.25rem;
}

h1:focus { outline: none; }

h2 {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.25;
  margin: 2.25rem 0 0.5rem;
}

p { margin: 0 0 1rem; }

label {
  display: block;
  font-weight: 600;
  margin: 1rem 0 0.5rem;
}

/* ------------------------------------------------------------ Movement */

@keyframes enter {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

@keyframes pop {
  0% { opacity: 0; transform: scale(0.88) translateY(12px); }
  60% { opacity: 1; transform: scale(1.03); }
  100% { transform: none; }
}

@keyframes glow {
  0%, 100% { box-shadow: var(--shadow-2); }
  50% { box-shadow: 0 6px 14px rgba(155, 44, 52, 0.38), 0 14px 36px rgba(155, 44, 52, 0.3); }
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

main > section:not([hidden]) { animation: enter 0.4s var(--ease) both; }

.suggestions li,
.list li { animation: enter 0.35s var(--ease) both; }
.suggestions li:nth-child(2), .list li:nth-child(2) { animation-delay: 0.04s; }
.suggestions li:nth-child(3), .list li:nth-child(3) { animation-delay: 0.08s; }
.suggestions li:nth-child(4), .list li:nth-child(4) { animation-delay: 0.12s; }
.suggestions li:nth-child(5), .list li:nth-child(5) { animation-delay: 0.16s; }
.suggestions li:nth-child(n+6), .list li:nth-child(n+6) { animation-delay: 0.2s; }

.msg:not([hidden]) { animation: enter 0.3s var(--ease) both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* -------------------------------------------------------------- Fields */

input[type="text"],
input[type="url"],
input[type="password"],
textarea,
select {
  display: block;
  width: 100%;
  min-height: 3.5rem;
  padding: 0.75rem 1rem;
  font: inherit;
  color: var(--on-surface);
  background: #ffffff;
  border: 2px solid var(--outline);
  border-radius: 1rem;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary);
}

textarea {
  min-height: 9rem;
  line-height: 1.5;
  resize: vertical;
}


:focus-visible {
  outline: 4px solid #1a5fb4;
  outline-offset: 3px;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible { outline: none; }

/* Language button, top right */
.top-bar {
  display: flex;
  justify-content: flex-end;
}

.lang-toggle {
  position: relative;
  min-height: 3rem;
  padding: 0.4rem 1.25rem;
  font: inherit;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--on-secondary-container);
  background: var(--secondary-container);
  border: 0;
  border-radius: 2rem;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.15s var(--ease);
}

/* ------------------------------------------------------------- Buttons */

.btn {
  position: relative;
  display: block;
  width: 100%;
  min-height: 3.75rem;
  margin-top: 1rem;
  padding: 0.75rem 1.5rem;
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  color: var(--on-primary);
  background: var(--primary);
  border: 0;
  border-radius: 2rem;
  box-shadow: var(--shadow-1);
  cursor: pointer;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s var(--ease), box-shadow 0.2s var(--ease);
}

/* The "state layer": a soft tint on hover and press */
.btn::after,
.lang-toggle::after {
  content: "";
  position: absolute;
  inset: 0;
  background: currentColor;
  opacity: 0;
  transition: opacity 0.2s var(--ease);
  pointer-events: none;
}

.btn:hover::after,
.lang-toggle:hover::after { opacity: 0.08; }

.btn:active::after,
.lang-toggle:active::after { opacity: 0.16; }

.btn:active,
.lang-toggle:active { transform: scale(0.97); }

.btn.tonal {
  color: var(--on-secondary-container);
  background: var(--secondary-container);
  box-shadow: none;
}

.btn.text {
  color: var(--primary);
  background: transparent;
  box-shadow: none;
}

.btn.small {
  min-height: 3rem;
  margin-top: 0.75rem;
  font-size: 1.2rem;
}

/* ---------------------------------------------- Lists of names, rules */

.suggestions {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
}

.suggestions li { margin-top: 0.5rem; }

.suggestions .btn {
  margin-top: 0;
  padding-left: 1.5rem;
  text-align: left;
}

/* Name buttons with a second line of small text */
.btn .sub {
  display: block;
  font-size: 1.05rem;
  font-weight: 500;
  opacity: 0.85;
}

/* The person you give to, in the wishlist list */
.btn.mine-pick {
  color: var(--on-primary-container);
  background: var(--primary-container);
  border: 3px solid var(--primary);
  text-align: left;
  font-weight: 700;
}

/* ---------------------------------------- The person you give a gift to */

.hero {
  margin: 0.5rem 0 1.5rem;
  padding: 2rem 1.5rem 2.25rem;
  text-align: center;
  color: var(--on-primary);
  background: var(--primary);
  border-radius: 2rem;
  box-shadow: var(--shadow-2);
  animation: pop 0.6s var(--ease) 0.1s both, glow 3.2s ease-in-out 0.8s 2;
}

.hero-label {
  margin: 0 0 0.5rem;
  font-size: 1.3rem;
  font-weight: 500;
  opacity: 0.92;
}

.hero-name {
  margin: 0;
  font-size: 3rem;
  font-weight: 700;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

/* "Is this you?" card */
.big-name {
  margin: 0.25rem 0 1.5rem;
  padding: 1.5rem;
  text-align: center;
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--on-primary-container);
  background: var(--primary-container);
  border-radius: 1.75rem;
  overflow-wrap: anywhere;
  animation: pop 0.45s var(--ease) both;
}

.chip {
  display: inline-block;
  margin: 0 0 1rem;
  padding: 0.35rem 1rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--on-primary);
  background: var(--primary);
  border-radius: 2rem;
}

.hint {
  color: var(--on-surface-variant);
  font-size: 1.1rem;
}

/* ------------------------------------------------------------ Messages */

.msg {
  margin: 1rem 0 0;
  padding: 1rem 1.25rem;
  border-radius: 1.25rem;
  font-weight: 600;
}

.msg.error { color: var(--on-error-container); background: var(--error-container); }
.msg.ok { color: var(--on-ok-container); background: var(--ok-container); }

/* Rules on the host page */
.list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
}

.item {
  margin-top: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--surface-1);
  border-radius: 1.25rem;
}

.item p { margin-bottom: 0.25rem; overflow-wrap: anywhere; }

/* Checkbox row */
.check {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 400;
}

.check input {
  flex: none;
  width: 2rem;
  height: 2rem;
  margin: 0;
  accent-color: var(--primary);
}

.spacer { margin-top: 2.5rem; }

/* Someone's wishlist: text with line breaks, links inside */
.paper {
  margin: 0 0 1rem;
  padding: 1.25rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--surface-1);
  border-radius: 1.75rem;
}

.paper a:not(.card) {
  color: var(--link);
  font-weight: 700;
  text-underline-offset: 3px;
}

/* ------------------------------------------- Wishlist editor and link cards */

.toolbar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.tool {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 4rem;
  padding: 0.35rem 0.5rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: var(--on-secondary-container);
  background: var(--secondary-container);
  border: 0;
  border-radius: 1.25rem;
  cursor: pointer;
  overflow: hidden;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease), transform 0.15s var(--ease);
}

.tool b, .tool i { font-size: 1.5rem; line-height: 1.1; }

.tool:active { transform: scale(0.96); }

.tool[aria-pressed="true"] {
  color: var(--on-primary);
  background: var(--primary);
}

.editor,
.paper {
  font-size: 1.375rem;
  line-height: 1.5;
}

.editor {
  min-height: 50vh;
  padding: 1rem;
  background: #ffffff;
  border: 2px solid var(--outline);
  border-radius: 1.25rem;
  overflow-wrap: anywhere;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.editor:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary);
}

.editor.is-empty > p:first-child::before {
  content: attr(placeholder);
  color: var(--on-surface-variant);
  opacity: 0.8;
  pointer-events: none;
}

.editor p, .paper p { margin: 0 0 0.6rem; }

.editor ul, .paper ul { margin: 0 0 0.6rem; padding-left: 1.6rem; }

.editor li, .paper li { margin-bottom: 0.25rem; }

.paper { white-space: normal; }

/* The link card, like the preview in a chat app */
.card {
  position: relative;
  display: block;
  margin: 0.25rem 0 0.9rem;
  overflow: hidden;
  color: var(--on-surface);
  text-decoration: none;
  background: var(--surface-2);
  border-radius: 1.25rem;
  animation: enter 0.35s var(--ease) both;
}

a.card:hover { background: var(--primary-container); }

.card-picture {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--surface-1);
}

.card-picture img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-body { display: block; padding: 0.75rem 1rem 0.9rem; }

.card-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.3;
}

.card-desc {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 0.25rem;
  font-size: 1.05rem;
  line-height: 1.35;
  color: var(--on-surface-variant);
}

.card-site {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.95rem;
  color: var(--on-surface-variant);
}

.card.loading .card-title { opacity: 0.6; animation: pulse 1.2s ease-in-out infinite; }

@keyframes pulse { 0%, 100% { opacity: 0.45; } 50% { opacity: 0.9; } }

.card-remove {
  display: block;
  margin: 0 1rem 1rem;
  min-height: 2.75rem;
  padding: 0.25rem 1.25rem;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--on-secondary-container);
  background: var(--secondary-container);
  border: 0;
  border-radius: 2rem;
  cursor: pointer;
}

.card-remove:hover { background: var(--primary-container); }

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

/* Personal codes on the host page */
.code-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.code-row label {
  flex: 1 1 50%;
  margin: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.code-row input { flex: 1 1 40%; min-width: 0; }
