/* Enchanted Pages: styles for every public page (welcome, sign up, confirm, sign in, account,
 * privacy, demos list and 404).
 *
 * The site Content Security Policy allows only same-origin stylesheets and scripts. That means
 * no <style> blocks, no style="" attributes and no inline scripts anywhere in web/. Keep every
 * rule in this file, use system fonts only, and point url() at same-origin paths.
 *
 * Palette (text pairs checked for WCAG AA, at least 4.5:1):
 *   ink #2a1838 on paper #fbf4e6 (14.9:1)     plum #4b2a63 on paper (10.5:1)
 *   ink-soft #5a4868 on paper (7.6:1)         gold-ink #7a5c0e on paper (5.7:1)
 *   cream #fff7e6 on plum (10.6:1)            ink on gold #f3d27a (11.2:1)
 *   rose-ink #8a2442 on rose-wash #fbe3ea (7.4:1)   sage-ink #24563a on sage-wash #e3f1e6 (7.6:1)
 * The gold #b8911f is for borders, rules and sparkles only, never for text.
 */

:root {
  color-scheme: light;
  --paper: #fbf4e6;
  --paper-deep: #f4e8cf;
  --card: #fffdf7;
  --ink: #2a1838;
  --ink-soft: #5a4868;
  --plum: #4b2a63;
  --plum-deep: #2f1a40;
  --cream: #fff7e6;
  --gold: #b8911f;
  --gold-soft: #f3d27a;
  --gold-ink: #7a5c0e;
  --rose: #e58aa5;
  --rose-wash: #fbe3ea;
  --rose-ink: #8a2442;
  --sage: #9cc9a7;
  --sage-wash: #e3f1e6;
  --sage-ink: #24563a;
  --lilac: #b9a4e0;
  --lilac-wash: #efe8fa;
  --line: #d9c9a8;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 14px;
  --shadow: 0 1px 0 rgba(42, 24, 56, 0.06), 0 10px 28px -14px rgba(42, 24, 56, 0.35);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  font: 1.0625rem/1.6 var(--sans);
  /* paper grain: a faint dot grid, like a dotted journal page */
  background-color: var(--paper);
  background-image: radial-gradient(circle at 1px 1px, rgba(75, 42, 99, 0.13) 1px, transparent 1.4px);
  background-size: 22px 22px;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--plum);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--plum);
  outline-offset: 3px;
  border-radius: 4px;
  box-shadow: 0 0 0 6px var(--gold-soft);
}

h1,
h2,
h3 {
  font-family: var(--serif);
  color: var(--plum);
  line-height: 1.2;
  margin: 0 0 0.5em;
}

h1 {
  font-size: clamp(2rem, 1.4rem + 3vw, 3.1rem);
  letter-spacing: -0.01em;
}

h2 {
  font-size: clamp(1.35rem, 1.1rem + 1vw, 1.75rem);
}

h3 {
  font-size: 1.2rem;
}

p {
  margin: 0 0 1em;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: 0.6rem 1rem;
  background: var(--plum);
  color: var(--cream);
  border-radius: 8px;
}

.skip-link:focus {
  top: 1rem;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---- frame: masthead, main, footer ------------------------------------------------------- */

.wrap {
  width: 100%;
  max-width: 68rem;
  margin: 0 auto;
  padding-inline: clamp(1rem, 4vw, 2rem);
}

.masthead {
  border-bottom: 2px dashed var(--line);
  background: rgba(251, 244, 230, 0.92);
}

.masthead .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-block: 0.75rem;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--plum);
  text-decoration: none;
}

.wordmark img {
  width: 44px;
  height: 44px;
}

.wordmark-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.wordmark-name {
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 700;
}

.wordmark-line {
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold-ink);
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: inline-block;
  padding: 0.35rem 0.1rem;
  font-weight: 600;
}

.site-nav a[aria-current="page"] {
  text-decoration-thickness: 3px;
  text-decoration-color: var(--gold);
}

main {
  flex: 1 0 auto;
  padding-block: clamp(1.5rem, 4vw, 3rem);
}

.colophon {
  border-top: 2px dashed var(--line);
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.colophon .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-block: 1.1rem 1.4rem;
}

.colophon p {
  margin: 0;
}

.colophon ul {
  display: flex;
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ---- buttons --------------------------------------------------------------------------- */

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 48px;
  padding: 0.65rem 1.4rem;
  border: 2px solid var(--plum);
  border-radius: 999px;
  background: var(--plum);
  color: var(--cream);
  font: 600 1.02rem/1.2 var(--sans);
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--plum-deep);
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.button:hover,
button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 0 var(--plum-deep);
}

.button:active,
button:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--plum-deep);
}

.button-quiet,
button.button-quiet {
  background: var(--card);
  color: var(--plum);
  box-shadow: 0 3px 0 var(--line);
}

.button-quiet:hover,
button.button-quiet:hover {
  box-shadow: 0 4px 0 var(--line);
}

.button-gold {
  background: var(--gold-soft);
  border-color: var(--gold);
  color: var(--ink);
  box-shadow: 0 3px 0 var(--gold);
}

.button-gold:hover {
  box-shadow: 0 4px 0 var(--gold);
}

button[disabled],
button[aria-disabled="true"] {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.link-button {
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  color: var(--plum);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.link-button:hover,
.link-button:active {
  transform: none;
  box-shadow: none;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  margin: 1.25rem 0 0;
}

/* ---- paper cards with washi tape --------------------------------------------------------- */

.card {
  position: relative;
  padding: clamp(1.25rem, 3vw, 2rem);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card.taped::before {
  content: "";
  position: absolute;
  top: -12px;
  left: 50%;
  width: 110px;
  height: 26px;
  margin-left: -55px;
  transform: rotate(-3deg);
  background: repeating-linear-gradient(45deg, rgba(229, 138, 165, 0.75) 0 8px, rgba(251, 227, 234, 0.75) 8px 16px);
  border-radius: 2px;
}

.card.taped.tape-sage::before {
  background: repeating-linear-gradient(45deg, rgba(156, 201, 167, 0.8) 0 8px, rgba(227, 241, 230, 0.8) 8px 16px);
}

.card.taped.tape-lilac::before {
  background: repeating-linear-gradient(45deg, rgba(185, 164, 224, 0.8) 0 8px, rgba(239, 232, 250, 0.8) 8px 16px);
}

.card.taped.tape-gold::before {
  background: repeating-linear-gradient(45deg, rgba(243, 210, 122, 0.85) 0 8px, rgba(255, 247, 230, 0.85) 8px 16px);
}

/* ---- welcome page ------------------------------------------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: center;
}

.ribbon {
  display: inline-block;
  margin: 0 0 1rem;
  padding: 0.25rem 0.9rem;
  border: 1px solid var(--gold);
  border-radius: 999px;
  background: var(--gold-soft);
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lede {
  font-size: clamp(1.1rem, 1rem + 0.4vw, 1.3rem);
  color: var(--ink-soft);
  max-width: 36rem;
}

.hero-art {
  margin: 0;
  text-align: center;
}

.hero-art img {
  width: min(100%, 340px);
  filter: drop-shadow(0 12px 18px rgba(42, 24, 56, 0.18));
}

.float {
  animation: float 2s ease-in-out 2;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.small-print {
  font-size: 0.92rem;
  color: var(--ink-soft);
}

.features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
  margin-top: clamp(2.5rem, 6vw, 4rem);
  padding: 0;
  list-style: none;
}

.features .card h2 {
  font-size: 1.25rem;
}

.features .card p {
  margin: 0;
  color: var(--ink-soft);
}

.card-icon {
  width: 52px;
  height: 52px;
  margin-bottom: 0.5rem;
}

.peek {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1.5rem;
  align-items: center;
  margin-top: clamp(2.5rem, 6vw, 4rem);
}

.peek img {
  width: 150px;
}

.peek p {
  color: var(--ink-soft);
}

/* ---- forms (sign up, confirm) ---------------------------------------------------------- */

.narrow {
  max-width: 34rem;
  margin: 0 auto;
}

.form-card h1 {
  font-size: clamp(1.8rem, 1.4rem + 2vw, 2.4rem);
}

.field {
  margin: 0 0 1.15rem;
}

.field > label,
.field legend,
.label {
  display: block;
  margin-bottom: 0.3rem;
  font-weight: 700;
  color: var(--ink);
}

fieldset {
  margin: 0 0 1.15rem;
  padding: 0;
  border: 0;
}

.hint {
  display: block;
  margin: 0 0 0.4rem;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

input[type="email"],
input[type="password"],
input[type="text"] {
  width: 100%;
  min-height: 48px;
  padding: 0.6rem 0.8rem;
  border: 2px solid #8f7ea0;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: 1.05rem/1.3 var(--sans);
}

input:focus-visible {
  border-color: var(--plum);
}

input[aria-invalid="true"] {
  border-color: var(--rose-ink);
  background: #fff8fa;
}

.field-error {
  display: block;
  margin-top: 0.35rem;
  color: var(--rose-ink);
  font-size: 0.95rem;
  font-weight: 600;
}

.field-error[hidden] {
  display: none;
}

.pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 0.9rem;
}

.pair label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.code-input {
  max-width: 14rem;
  font-size: 1.4rem;
  letter-spacing: 0.3em;
  font-variant-numeric: tabular-nums;
}

.password-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.password-row input {
  flex: 1 1 auto;
  min-width: 0;
}

.password-row button {
  flex: 0 0 auto;
  min-height: 48px;
  padding-inline: 0.9rem;
  font-size: 0.92rem;
}

.rules {
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.93rem;
  color: var(--ink-soft);
}

.rules li {
  position: relative;
  padding-left: 1.6rem;
}

.rules li::before {
  content: "";
  position: absolute;
  left: 0.2rem;
  top: 0.45em;
  width: 0.7rem;
  height: 0.7rem;
  border: 2px solid #8f7ea0;
  border-radius: 50%;
}

.rules li.met {
  color: var(--sage-ink);
}

.rules li.met::before {
  border-color: var(--sage-ink);
  background: var(--sage);
}

.check {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.6rem;
  align-items: start;
}

.check input {
  width: 1.35rem;
  height: 1.35rem;
  margin: 0.15rem 0 0;
  accent-color: var(--plum);
}

.check label {
  font-weight: 400;
}

.notice {
  margin: 0 0 1.25rem;
  padding: 0.9rem 1.1rem;
  border-radius: 10px;
  border: 1px solid transparent;
}

.notice:focus {
  outline: 3px solid var(--plum);
  outline-offset: 2px;
}

.notice p:last-child {
  margin-bottom: 0;
}

.notice-error {
  background: var(--rose-wash);
  border-color: var(--rose);
  color: var(--rose-ink);
}

.notice-ok {
  background: var(--sage-wash);
  border-color: var(--sage);
  color: var(--sage-ink);
}

.notice-info {
  background: var(--lilac-wash);
  border-color: var(--lilac);
  color: var(--plum);
}

.notice strong {
  color: inherit;
}

.after-form {
  margin-top: 1.25rem;
  text-align: center;
  color: var(--ink-soft);
}

/* kind full-card message (under 13, all done, and so on) */
.message-card {
  text-align: center;
}

.message-card img {
  width: 160px;
  margin: 0 auto 0.75rem;
  display: block;
}

.message-card .actions {
  justify-content: center;
}

/* ---- account page --------------------------------------------------------------------- */

.status-line {
  color: var(--ink-soft);
}

.facts {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.4rem 1rem;
  margin: 1rem 0;
  padding: 1rem 1.1rem;
  background: var(--paper);
  border: 1px dashed var(--line);
  border-radius: 10px;
}

.facts dt {
  font-weight: 700;
}

.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* ---- privacy page ----------------------------------------------------------------------- */

.prose {
  max-width: 44rem;
  margin: 0 auto;
}

.prose h2 {
  margin-top: 1.8em;
}

.prose ul {
  padding-left: 1.3rem;
}

.prose li {
  margin-bottom: 0.4em;
}

.draft-banner {
  margin: 0 0 1.5rem;
  padding: 0.8rem 1.1rem;
  border: 2px dashed var(--gold);
  border-radius: 10px;
  background: #fff4cf;
  color: var(--ink);
  font-weight: 600;
}

/* ---- demos list -------------------------------------------------------------------------- */

.demo-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
  gap: 1.5rem;
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
}

.demo-list .card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.demo-list h2 {
  font-size: 1.25rem;
}

.demo-list p {
  flex: 1 0 auto;
  color: var(--ink-soft);
}

.demo-list a.button {
  align-self: flex-start;
}

.tag {
  display: inline-block;
  margin: 0 0 0.6rem;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  background: var(--lilac-wash);
  border: 1px solid var(--lilac);
  color: var(--plum);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ---- 404 ----------------------------------------------------------------------------------- */

.lost {
  max-width: 36rem;
  margin: 0 auto;
  text-align: center;
}

.lost img {
  width: 170px;
  margin: 0 auto 0.5rem;
  display: block;
}

/* ---- small screens and motion --------------------------------------------------------------- */

@media (max-width: 760px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .hero-art {
    order: -1;
  }

  .hero-art img {
    width: min(70%, 240px);
  }

  .features {
    grid-template-columns: 1fr;
  }

  .peek {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .peek img {
    margin: 0 auto;
  }
}

@media (max-width: 420px) {
  .pair {
    grid-template-columns: 1fr;
  }

  .actions .button,
  .actions button {
    width: 100%;
  }
}

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

@media (forced-colors: active) {
  .button,
  button {
    border: 2px solid ButtonText;
  }
}

.lost .actions {
  justify-content: center;
}

.actions + .small-print {
  margin-top: 1rem;
}

.demo-list p.tag {
  flex: 0 0 auto;
  align-self: flex-start;
}
