/* Swamp Goblin: the night swamp. One stylesheet for every page; nothing is inline. Notes: DESIGN.md. */

:root {
  --ink: #0a1310;          /* the night; page background */
  --parchment: #ebe4cf;    /* text */
  --muted: #aaa48d;        /* secondary text */
  --gold: #c8b07a;         /* headings in small caps, rules, the one button, focus */
  --gold-bright: #dcc892;  /* the button on hover */
  --surface: #0d1814;      /* the solid panel the form sits on */
  --field: #13211b;        /* inside an input */
  --edge: #857a58;         /* the outline of an input or a choice */
  --hair: #33382b;         /* hairlines between things */
  --ember: #f0a58a;        /* something needs fixing */
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", P052, "URW Palladio L", "TeX Gyre Pagella", ui-serif, Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--ink); color: var(--parchment); }
html { height: 100%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { min-height: 100%; font: 400 1.0625rem/1.55 var(--serif); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
h1, h2, p, ul, fieldset, figure { margin: 0; padding: 0; }

a { color: var(--parchment); text-decoration: underline; text-decoration-color: rgb(200 176 122 / .6); text-decoration-thickness: 1px; text-underline-offset: .22em; transition: color .2s, text-decoration-color .2s; overflow-wrap: anywhere; }
a:hover { color: var(--gold); text-decoration-color: var(--gold); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 2px; }

.caps { font-variant: small-caps; letter-spacing: .2em; }

/* ---------- the scene (front page): a fixed picture, painted once ---------- */

.scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; object-position: 50% 100%; pointer-events: none; }

/* Moving parts are plain elements that animate only transform and opacity, which the browser composites without
   repainting the picture. Each is placed in the picture's 1600 x 1000 units with the same crop the picture uses
   (cover, anchored to the bottom): scale = max(width/1600, height/1000). The motion is finite: it plays for under a
   minute after load and then the scene rests, so an open tab costs nothing. */
.fx { position: fixed; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; container-type: size; }
.fx i {
  --s: max(calc(100cqw / 1600), calc(100cqh / 1000));
  position: absolute; display: block;
  left: calc(50cqw + (var(--x) - 800) * var(--s));
  top: calc(100cqh - (1000 - var(--y)) * var(--s));
}
.fog {
  width: calc(var(--w) * var(--s)); height: calc(var(--h) * var(--s));
  margin-left: calc(var(--w) * var(--s) / -2); margin-top: calc(var(--h) * var(--s) / -2);
  background: radial-gradient(closest-side, rgb(169 189 177 / .11), rgb(169 189 177 / 0));
}
.fog-a { --x: 760; --y: 618; --w: 1640; --h: 150; animation: drift 40s ease-in-out 1 both; }
.fog-b { --x: 820; --y: 700; --w: 1800; --h: 130; animation: drift 50s ease-in-out 1 reverse both; opacity: .8; }
@keyframes drift { from { transform: translateX(calc(-90 * var(--s))); } to { transform: translateX(calc(90 * var(--s))); } }

.shim {
  width: calc(var(--w) * var(--s)); height: max(1px, calc(2 * var(--s))); margin-left: calc(var(--w) * var(--s) / -2);
  background: #eadfb8; border-radius: 2px; opacity: .14;
  animation: shimmer var(--t) ease-in-out var(--d) 6 both;
}
@keyframes shimmer { 0%, 100% { opacity: .1; } 50% { opacity: .62; } }
.shim:nth-of-type(3n)   { --t: 5s; }
.shim:nth-of-type(3n+1) { --t: 6.5s; }
.shim:nth-of-type(3n+2) { --t: 4.2s; }
.s1  { --x: 850; --y: 652; --w: 100; --d: 0s; }
.s2  { --x: 851; --y: 668; --w: 70;  --d: 4.17s; }
.s3  { --x: 850; --y: 684; --w: 124; --d: 3.34s; }
.s4  { --x: 852; --y: 702; --w: 52;  --d: 2.51s; }
.s5  { --x: 850; --y: 720; --w: 92;  --d: 1.68s; }
.s6  { --x: 851; --y: 742; --w: 62;  --d: .85s; }
.s7  { --x: 848; --y: 764; --w: 108; --d: .02s; }
.s8  { --x: 852; --y: 790; --w: 40;  --d: 4.19s; }
.s9  { --x: 849; --y: 818; --w: 78;  --d: 3.36s; }
.s10 { --x: 853; --y: 850; --w: 30;  --d: 2.53s; }
.s11 { --x: 849; --y: 884; --w: 62;  --d: 1.7s; }
.s12 { --x: 854; --y: 922; --w: 24;  --d: .87s; }

.fly {
  width: calc(22 * var(--s)); height: calc(22 * var(--s)); margin: calc(-11 * var(--s)) 0 0 calc(-11 * var(--s));
  border-radius: 50%; opacity: 0;
  background: radial-gradient(closest-side, #fff4c2, rgb(241 223 142 / .9) 18%, rgb(241 223 142 / 0));
  animation: blink var(--t) ease-in-out var(--d) 4 both;
}
@keyframes blink { 0%, 100% { opacity: 0; } 45%, 55% { opacity: .95; } }
.f1 { --x: 520;  --y: 560; --d: 0s;    --t: 7s; }
.f2 { --x: 610;  --y: 610; --d: -1.2s; --t: 9s; }
.f3 { --x: 1180; --y: 540; --d: -3.5s; --t: 6s; }
.f4 { --x: 1330; --y: 600; --d: -5.1s; --t: 8s; }
.f5 { --x: 300;  --y: 610; --d: -2.4s; --t: 10s; }
.f6 { --x: 1060; --y: 600; --d: -6.3s; --t: 7.5s; }
.f7 { --x: 760;  --y: 575; --d: -4.4s; --t: 9.5s; }
.f8 { --x: 1500; --y: 520; --d: -.6s;  --t: 6.8s; }

/* ---------- front page layout ---------- */

.front {
  position: relative; z-index: 2;
  min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column;
  padding: clamp(2rem, 8vh, 6rem) clamp(1.25rem, 7vw, 9rem) clamp(1.25rem, 4vh, 2.25rem);
}
.col { width: 100%; max-width: 31rem; }

.card { animation: rise 1.2s cubic-bezier(.2, .7, .2, 1) both; }
.wordmark {
  font-weight: 400; font-variant: small-caps; letter-spacing: .24em;
  font-size: clamp(2.1rem, 5.4vw, 3.9rem); line-height: 1.05;
  text-shadow: 0 0 40px rgb(10 19 16 / .9);
}
.rule { width: 4.5rem; height: 1px; background: var(--gold); margin: 1.5rem 0 1.25rem; opacity: .85; }
.tagline {
  max-width: 24rem; font-style: italic; font-size: clamp(1.125rem, 1.7vw, 1.3rem); line-height: 1.4; letter-spacing: .01em;
  color: #c9c3ab; text-shadow: 0 0 14px rgb(10 19 16 / .95), 0 1px 3px rgb(10 19 16 / .9); text-wrap: balance;
}
@keyframes rise { from { opacity: .15; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- the intake: one solid panel ---------- */

.panel {
  margin-top: clamp(2rem, 6vh, 3.25rem);
  padding: 1.5rem 1.25rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--hair);
  border-radius: 4px;
  box-shadow: 0 1.25rem 3rem rgb(3 6 5 / .55);
}
.panel h2 { font-weight: 400; font-variant: small-caps; letter-spacing: .2em; font-size: 1.2rem; line-height: 1.3; color: var(--gold); }
.panel .intro { margin-top: .5rem; color: var(--muted); font-style: italic; }

form { margin-top: 1.5rem; }
.field { display: block; margin: 0 0 1.375rem; border: 0; min-width: 0; }
.field > label, .field > legend { display: block; padding: 0; margin-bottom: .45rem; font-size: 1rem; line-height: 1.35; letter-spacing: .01em; }

input[type="text"], input[type="email"], textarea {
  display: block; width: 100%; margin: 0;
  min-height: 3rem; padding: .7rem .85rem;
  background: var(--field); color: var(--parchment);
  border: 1px solid var(--edge); border-radius: 3px;
  font: 400 1.0625rem/1.5 var(--serif);
  appearance: none;
  transition: border-color .15s, background-color .15s;
}
textarea { min-height: 8.5rem; resize: vertical; }
input[type="text"]:hover, input[type="email"]:hover, textarea:hover { border-color: var(--gold); }
input[type="text"]:focus-visible, input[type="email"]:focus-visible, textarea:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-color: var(--gold); background: #16261f; }
input:-webkit-autofill { -webkit-text-fill-color: var(--parchment); box-shadow: 0 0 0 100px var(--field) inset; caret-color: var(--parchment); }


/* inline validation: the message names the fix, and the field is marked by more than colour */
.err { margin-top: .45rem; padding-left: .75rem; border-left: 2px solid var(--ember); color: var(--ember); font-size: 1rem; line-height: 1.4; }
[aria-invalid="true"] { border-color: var(--ember) !important; border-width: 2px !important; }
.hp { position: absolute; left: -200vw; width: 1px; height: 1px; overflow: hidden; }

.send {
  display: block; width: 100%;
  min-height: 3.375rem; margin-top: 1.75rem; padding: .7rem 1.75rem;
  background: var(--gold); color: var(--ink);
  border: 0; border-radius: 3px;
  font: 400 1.2rem/1.2 var(--serif); font-variant: small-caps; letter-spacing: .18em;
  cursor: pointer;
  transition: background-color .15s, transform .08s;
}
.send:hover { background: var(--gold-bright); }
.send:active { transform: translateY(1px); }
.send:focus-visible { outline-offset: 4px; }
.send[aria-disabled="true"] { cursor: progress; background: #a39368; }

/* the lock line under the button: small, quiet, and true (CONTACT-ENDPOINT.md says what backs it) */
.secure { display: flex; align-items: flex-start; gap: .5rem; margin-top: .9rem; color: var(--muted); font-size: .9375rem; line-height: 1.45; }
.lock { flex: none; width: 1em; height: 1em; margin-top: .2em; }
.lock .shackle { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.lock .body { fill: currentColor; }
.locked .lock { display: inline-block; width: .62em; height: .62em; margin: 0 .4em 0 0; vertical-align: .02em; color: var(--gold); }

.failed { margin: 1.5rem 0 -.5rem; padding: .8rem 1rem; border: 1px solid var(--ember); border-radius: 3px; background: #1d1713; }

/* sent: stays on the page, in the same panel */
.opened { margin: 1.25rem 0 0; padding: .8rem 1rem; border: 1px solid var(--line, #3a4a3f); border-radius: 3px; }
.done { margin-top: 1.25rem; }
.done:focus-visible { outline: 0; }
.done-moon { display: block; width: 4.5rem; height: 4.5rem; }
.done-moon .disc { fill: #e8dbb4; transform-origin: 50% 50%; animation: moonrise .7s cubic-bezier(.2, .8, .2, 1) both; }
.done-moon .ring { fill: none; stroke: #e9dcb4; stroke-opacity: .3; animation: fade .9s .3s ease-out both; }
.done-moon .shackle { fill: none; stroke: var(--ink); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 34; stroke-dashoffset: 34; animation: draw .45s .55s ease-out forwards; }
.done-moon .body { fill: var(--ink); animation: fade .35s .45s ease-out both; }
@keyframes moonrise { from { opacity: 0; transform: translateY(14px) scale(.7); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
.done h2 { margin-top: 1rem; font-variant: normal; letter-spacing: .01em; font-size: 1.9rem; line-height: 1.15; color: var(--parchment); }
.done p { margin-top: .6rem; }
.done .echo { color: var(--muted); }
.done .echo b { font-weight: 400; color: var(--parchment); overflow-wrap: anywhere; }

.fallback { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--hair); color: var(--muted); }
[hidden] { display: none !important; }

/* ---------- footers ---------- */

.foot { margin-top: auto; padding-top: clamp(2.5rem, 8vh, 4rem); font-size: .9rem; line-height: 1.7; color: #c3bda6; }
.foot .caps { letter-spacing: .16em; }
.front .foot { animation: rise 1.2s .3s cubic-bezier(.2, .7, .2, 1) both; text-shadow: 0 0 12px rgb(10 19 16 / .95), 0 1px 3px rgb(10 19 16 / .9); }
.foot a { color: inherit; }
.foot a:hover { color: var(--gold); }
.foot .links a { display: inline-block; padding: .35rem 0; margin-right: 1.5rem; }

/* ---------- the inside pages: tools, policies, sent ---------- */

.band { position: relative; height: clamp(9rem, 24vw, 15rem); overflow: hidden; }
.band img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 54%; }
.band::after { content: ""; position: absolute; inset: auto 0 0 0; height: 55%; background: linear-gradient(to bottom, rgb(10 19 16 / 0), var(--ink)); }

.doc { max-width: 42rem; margin: 0 auto; padding: 1.25rem 1.25rem 3rem; }
.band + .doc { margin-top: -2.25rem; position: relative; }
.back { font-variant: small-caps; letter-spacing: .18em; font-size: .9rem; }
.back a { display: inline-block; padding: .4rem 0; }
.doc h1 { font-weight: 400; font-variant: small-caps; letter-spacing: .2em; font-size: clamp(1.9rem, 5vw, 2.6rem); line-height: 1.1; margin: 1rem 0 .4rem; }
.doc .updated, .doc .intro { color: var(--muted); font-style: italic; }
.doc .rule { margin: 1.3rem 0 1.6rem; }
.doc h2 { font-weight: 400; font-variant: small-caps; letter-spacing: .2em; font-size: 1.15rem; line-height: 1.3; color: var(--gold); margin: 2.25rem 0 .6rem; }
.doc p, .doc li { margin-bottom: .7rem; }
.doc ul { padding-left: 1.2rem; }
.doc li::marker { color: var(--gold); }
.doc strong { font-weight: 700; color: #f3edda; }
.doc .foot { margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--hair); }
.doc .foot p { margin: 0; }

.tools { list-style: none; padding: 0 !important; margin-top: 1.75rem; border-bottom: 1px solid var(--hair); }
.tools li { margin: 0; padding: 1.15rem 0 1.25rem; border-top: 1px solid var(--hair); }
.tools p { margin: 0; }
.tools .name { font-size: 1.35rem; line-height: 1.25; letter-spacing: .02em; }
.tools .job { margin-top: .3rem; }
.tools .price { margin-top: .35rem; color: var(--gold); }
.note { margin-top: 1.25rem; color: var(--muted); }

/* ---------- widths and heights ---------- */

@media (min-width: 40rem) {
  .panel { padding: 2rem 2rem 1.5rem; }
  .send { display: inline-block; width: auto; min-width: 14rem; }
}
/* portrait screens: leave the middle of the first screen to the moon, and start the panel under it */
@media (max-aspect-ratio: 1/1) {
  .front { padding-top: 7vh; }
  .card { min-height: 58vh; min-height: 58svh; }
  .panel { margin-top: 0; }
}
@media (max-height: 620px) and (max-width: 460px) {
  .front { padding-top: 1.1rem; }
  .wordmark { font-size: 1.75rem; }
  .rule { margin: 1rem 0 .9rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .fly { opacity: .6; }
  .done-moon .shackle { stroke-dashoffset: 0; }
}
