/* Reset, typography and the shared controls (fields, buttons, flashes). */

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

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-text);
  font-size: var(--text-m);
  font-weight: 400;
  line-height: 1.55;
  color: var(--ivory-100);
  background-color: var(--velvet-950);
  overflow-x: clip;
}

img,
svg {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
p {
  margin: 0;
}

a {
  color: var(--gold-300);
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--gold-300);
  outline-offset: 3px;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

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

.icon {
  width: 1.125rem;
  height: 1.125rem;
  flex: none;
}

/* ---------------------------------------------------------------- type */

.title-serif {
  font-family: var(--font-display);
  font-variation-settings: var(--display-opsz);
  font-weight: var(--display-weight);
  font-size: var(--text-xl);
  line-height: 1.05;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

/* ------------------------------------------------------------- controls */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  min-height: 3rem;
  padding: 0.75rem 1.5rem;
  border: 0;
  border-radius: var(--radius-paper);
  font-family: var(--font-text);
  font-size: var(--text-m);
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--duration-quick) ease, transform var(--duration-quick) var(--ease-out);
}

.button:active:not(:disabled) {
  transform: scale(0.97);
}

.button:disabled {
  opacity: 0.4;
  cursor: default;
}

.button-gold {
  background: var(--gold-500);
  color: var(--ink-900);
}

.button-gold:hover {
  background: var(--gold-300);
}

.button-wax {
  background: var(--wax-600);
  color: var(--ivory-50);
  box-shadow: inset 0 1px 0 var(--wax-300), 0 10px 22px -12px var(--shadow-deep);
}

.button-wax:hover {
  background: var(--wax-500);
}

.button-ghost {
  background: transparent;
  color: var(--gold-300);
  box-shadow: inset 0 0 0 1px var(--velvet-400);
}

.button-ghost:hover {
  box-shadow: inset 0 0 0 1px var(--gold-500);
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--gold-300);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}

/* Paper surfaces (forms on the stage, sheets in the backstage). */
.paper {
  color-scheme: light;
  background: var(--ivory-100);
  color: var(--ink-900);
  border-radius: var(--radius-paper);
  box-shadow: 0 1px 0 var(--ivory-50) inset, 0 24px 40px -24px var(--shadow-deep), 0 2px 6px var(--shadow-soft);
}

.paper a,
.paper .link-button {
  color: var(--wax-700);
}

.paper :focus-visible {
  outline-color: var(--gold-700);
}

.field {
  display: grid;
  gap: var(--space-2xs);
}

.field-label {
  font-size: var(--text-s);
  color: var(--ink-600);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 3rem;
  padding: 0.65rem 0.8rem;
  background: var(--ivory-50);
  color: var(--ink-900);
  border: 1px solid var(--ivory-500);
  border-radius: var(--radius-paper);
}

.field textarea {
  min-height: 6rem;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--gold-700);
}

.field-static {
  display: grid;
  gap: var(--space-2xs);
}

.form-error {
  padding: var(--space-s) var(--space-m);
  background: var(--wax-800);
  color: var(--ivory-50);
  border-radius: var(--radius-paper);
}

.paper .form-error {
  background: var(--wax-600);
}

/* ---------------------------------------------------------------- flash */

.flashes {
  display: grid;
  gap: var(--space-xs);
  margin-bottom: var(--space-l);
}

.flash {
  padding: var(--space-s) var(--space-m);
  background: var(--velvet-800);
  color: var(--ivory-100);
  border-radius: var(--radius-paper);
  box-shadow: inset 0 0 0 1px var(--velvet-600);
}

.flash-sealed {
  color: var(--gold-300);
}

.flash-error {
  background: var(--wax-800);
  color: var(--ivory-50);
  box-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-property: opacity, color, background-color, box-shadow !important;
    scroll-behavior: auto !important;
  }
}
