/*
 * The change-of-address card. A trimmed copy of the site's tokens (www/src/styles.css): this page
 * builds with nothing, so it carries its own — white paper and ink by day, slate at night.
 */

:root {
  --paper: #ffffff;
  --paper-2: #faf9f6;
  --rule: #e2dccf;
  --rule-strong: #cbc3b2;
  --ink: #1d1c18;
  --ink-soft: #4f4b42;
  --ink-faint: #767165;
  --graphite: #8f897c;
  --accent: #0b6e65;
  --accent-ink: #0b6e65;
  --accent-soft: rgba(11, 110, 101, 0.1);
  --accent-line: rgba(11, 110, 101, 0.42);
  --on-accent: #ffffff;
  --serif: 'Iowan Old Style', 'New York', ui-serif, Charter, 'Palatino Linotype', Cambria, Georgia, serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1012;
    --paper-2: #16171b;
    --rule: #25272c;
    --rule-strong: #363940;
    --ink: #ece9e1;
    --ink-soft: #b0aca2;
    --ink-faint: #858178;
    --graphite: #6b6962;
    --accent: #5fd6c9;
    --accent-ink: #5fd6c9;
    --accent-soft: rgba(95, 214, 201, 0.12);
    --accent-line: rgba(95, 214, 201, 0.4);
    --on-accent: #06211f;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-underline-offset: 3px; text-decoration-color: var(--accent-line); }

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

.sheet {
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(48px, 9vh, 96px) 20px 64px;
  text-align: center;
}

.overline {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

h1 {
  margin: 18px 0 0;
  font-family: var(--serif);
  font-size: clamp(2.6rem, 7vw, 4.6rem);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.035em;
}

h1 em { color: var(--accent-ink); }

.lead {
  max-width: 32rem;
  margin: 20px auto 0;
  color: var(--ink-soft);
  font-size: clamp(1rem, 2vw, 1.12rem);
}

.moving {
  margin: clamp(28px, 5vh, 48px) 0 0;
}

.moving svg {
  display: block;
  width: 100%;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}

.old { stroke: var(--graphite); stroke-width: 1.3; }
.new { stroke: var(--accent-ink); stroke-width: 1.6; }
.sign path { stroke: var(--graphite); stroke-width: 1.2; }
.sign text { fill: var(--graphite); font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; }
.route { stroke: var(--accent-line); stroke-width: 1.5; stroke-dasharray: 5 6; }
.route-head { stroke: var(--accent-line); stroke-width: 1.5; }
.box { stroke: var(--ink-soft); stroke-width: 1.3; }
.box .tape { stroke: var(--graphite); }
.box .mini { stroke: var(--accent-ink); stroke-width: 1.2; }
.addr { stroke: none; font-family: var(--mono); font-size: 11.5px; }
.old-addr { fill: var(--graphite); text-decoration: line-through; }
.new-addr { fill: var(--accent-ink); }

/* A luggage label for the new address. */
.label {
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin: 28px auto 0;
  padding: 18px 26px 16px;
  text-align: left;
  background: var(--paper-2);
  border: 1px solid var(--rule-strong);
  border-radius: 10px;
  transform: rotate(-1deg);
}

.label dl { margin: 10px 0 0; display: grid; gap: 8px; }
.label div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.label dt { font-family: var(--mono); font-size: 1rem; }
.label dt a { color: var(--accent-ink); text-decoration: none; }
.label dt a:hover { text-decoration: underline; }
.label dd { margin: 0; font-family: var(--serif); font-style: italic; color: var(--ink-soft); }

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 32px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  font-weight: 560;
  font-size: 0.95rem;
  color: var(--ink);
  text-decoration: none;
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  transition: border-color 0.16s var(--ease), background 0.16s var(--ease);
}

.button:hover { border-color: var(--accent-line); }

.button-primary {
  color: var(--on-accent);
  background: var(--accent);
  border-color: var(--accent);
}

.button-primary:hover { filter: brightness(1.06); }

.yours {
  margin: 48px auto 0;
  max-width: 34rem;
  padding: 22px 24px;
  text-align: left;
  border: 1px dashed var(--rule-strong);
  border-radius: 12px;
}

/* Found diagrams in this browser: the note becomes the most important thing on the page. */
.yours[data-found] {
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
}

.yours h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 400;
}

.yours p { margin: 8px 0 16px; color: var(--ink-soft); font-size: 0.95rem; }
.yours[data-found] .button { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }

.fine {
  margin: 36px 0 0;
  font-size: 0.8rem;
  color: var(--ink-faint);
}

@media (prefers-reduced-motion: no-preference) {
  .old path, .new path { stroke-dasharray: 1 1; animation: draw 0.8s ease-out both; }
  .old path:nth-child(2) { animation-delay: 0.15s; }
  .old path:nth-child(3) { animation-delay: 0.3s; }
  .old path:nth-child(4) { animation-delay: 0.4s; }
  .old path:nth-child(5) { animation-delay: 0.5s; }
  .sign, .old-addr { animation: appear 0.6s ease 0.7s both; }
  .route, .route-head { animation: appear 0.8s ease 0.9s both; }
  /* The box leaves the old house and arrives at the new one, as the new one is inked in. */
  .box { animation: carry 1.9s cubic-bezier(0.5, 0, 0.3, 1) 1s both; }
  .new path { animation-duration: 0.7s; animation-delay: 2.3s; }
  .new path:nth-child(2) { animation-delay: 2.4s; }
  .new path:nth-child(3) { animation-delay: 2.5s; }
  .new path:nth-child(4) { animation-delay: 2.6s; }
  .new path:nth-child(5) { animation-delay: 2.7s; }
  .new path:nth-child(6) { animation-delay: 2.8s; }
  .new path:nth-child(7) { animation-delay: 2.6s; }
  .new-addr { animation: appear 0.6s ease 3s both; }
}

@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes appear { from { opacity: 0; } }

@keyframes carry {
  from { opacity: 0; transform: translate(-170px, -6px) rotate(-6deg); }
  12% { opacity: 1; }
  50% { transform: translate(-40px, 14px) rotate(3deg); }
  to { transform: translate(0, 0) rotate(0); }
}
