/* The text pages in Blue hour: the night sky over the top of the page, one reading column below. */

/* Archivo at weights 400–800 and widths 100–125, cut to Latin (SIL OFL, see /fonts/OFL.txt). */
@font-face {
  font-family: "Archivo"; font-weight: 400 800; font-stretch: 100% 125%; font-display: swap;
  src: url("/fonts/archivo-400-800.woff2") format("woff2");
}

:root {
  color-scheme: dark;
  --sky: #0C1630;
  --ground: #18213A;
  --floor: #202C45;
  --edge: #3A4B6B;
  --edge-hi: #52668C;
  --frost: #F2F6FC;
  --frost-2: #C3CDDC;
  --slate: #A8B5CB;
  --slate-2: #8B98AF;
  --ice: #9CBCD6;
  --brass: #C29A52;
  --brass-wash: rgba(194, 154, 82, .10);
  --brass-line: rgba(194, 154, 82, .55);
  --focus: rgba(243, 208, 147, .26);
  --action-top: #8EDCFF;
  --action: #4FB7EE;
  --action-bottom: #2584C1;
  --action-ink: #06182A;
  --error: #FF8A7A;
  --font: "Archivo", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --column: 44rem;
  --gutter: max(20px, calc((100% - var(--column)) / 2));
  --sky-height: 260px;
  --sky-size: auto 260px;
  --sky-top: 0px;
}

html { background: var(--ground); }
body {
  margin: 0; min-height: 100vh;
  font: 16px/1.65 var(--font); color: var(--frost);
  background:
    url("/sky.svg") center var(--sky-top) / var(--sky-size) no-repeat,
    linear-gradient(var(--sky), var(--sky)) top / 100% calc(var(--sky-height) - 120px) no-repeat,
    var(--ground);
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }

a { color: var(--ice); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--frost); }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; border-radius: 4px; }

/* ---------- Header: the name and the language switch over the sky ---------- */

.band {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 16px var(--gutter) 0;
}
.wordmark {
  font: 800 .72rem/1 var(--font); font-stretch: 125%; letter-spacing: .14em; text-transform: uppercase;
  color: var(--frost); text-decoration: none;
}
.langbar {
  display: inline-flex; gap: 2px; padding: 3px;
  border: 1px solid var(--edge-hi); border-radius: 999px; background: rgba(12, 22, 48, .55);
}
.langbar a {
  padding: .28rem .8rem; border-radius: 999px;
  font-size: .8rem; font-weight: 600; letter-spacing: .03em; color: var(--slate); text-decoration: none;
}
.langbar a[aria-current="true"] { background: var(--brass-wash); color: var(--brass); box-shadow: inset 0 0 0 1px var(--brass-line); }

/* ---------- The reading column ---------- */

section { padding: 0 var(--gutter); }
/* Every link opens a page at #en or #sv; land at the top, header and sky included. */
section[id] { scroll-margin-top: 100vh; }

/* The title sits on the sky; the text starts where the mountains have faded out. */
.lead { min-height: calc(var(--sky-height) - 66px); box-sizing: border-box; padding-top: 18px; }
/* Without JS both languages stack, and only the first has the sky behind its title. */
section + section { margin-top: 3rem; border-top: 1px solid var(--edge); padding-top: 1.5rem; }
section + section .lead { min-height: 0; padding-top: 0; }
body:has(section[hidden]) section + section { margin-top: 0; border-top: 0; padding-top: 0; }
body:has(section[hidden]) section + section .lead { min-height: calc(var(--sky-height) - 66px); padding-top: 18px; }

h1 {
  font: 800 2.1rem/1.12 var(--font); font-stretch: 118%; letter-spacing: .01em;
  margin: 0; text-wrap: balance; text-shadow: 0 2px 14px rgba(12, 22, 48, .9);
}
.updated { font-size: .82rem; letter-spacing: .02em; color: var(--frost-2); margin: .55rem 0 0; text-shadow: 0 1px 8px rgba(12, 22, 48, .9); }
h2 { font: 700 1.55rem/1.25 var(--font); font-stretch: 110%; margin: 2.6rem 0 .7rem; text-wrap: balance; }
h3 { font: 700 1.25rem/1.3 var(--font); margin: 1.8rem 0 .45rem; color: var(--frost-2); }
p { margin: 0 0 .8rem; }
ul, ol { padding-left: 1.15rem; margin: 0 0 .8rem; }
li { margin: .35rem 0; }
ul li::marker { color: var(--brass); }
strong { font-weight: 650; color: var(--frost); }
em { font-style: normal; color: var(--frost-2); background: var(--floor); padding: .05em .35em; border-radius: 4px; }

/* A real sequence, so its steps are numbered in brass. */
ol { list-style: none; padding: 0; counter-reset: step; }
ol > li { counter-increment: step; position: relative; padding-left: 2.4rem; margin: .7rem 0; }
ol > li::before {
  content: counter(step); position: absolute; left: 0; top: .05rem;
  width: 1.65rem; height: 1.65rem; border-radius: 50%; box-sizing: border-box;
  display: grid; place-items: center;
  font: 800 .78rem/1 var(--font); font-stretch: 112%; font-variant-numeric: tabular-nums;
  color: var(--brass); background: var(--brass-wash); border: 1px solid var(--brass-line);
}

/* A step's picture: a cropped app screen under its text, beside it from 48rem. Steps with a picture
   wrap their text in <p>, since a bare <strong> would become its own grid item. */
ol > li > p { margin: 0; }
.shot { margin: .7rem 0 1.1rem; max-width: 240px; }
.shot img {
  display: block; width: 100%; height: auto; box-sizing: border-box;
  border: 1px solid var(--edge); border-radius: 18px; background: var(--floor);
  box-shadow: 0 6px 18px rgba(4, 9, 22, .45);
}
.shot figcaption { margin-top: .45rem; font-size: .82rem; line-height: 1.45; color: var(--slate-2); }

.summary { margin: 0 0 1.6rem; padding: 1rem 1.05rem 1.05rem; background: var(--floor); border: 1px solid var(--edge); border-radius: 14px; }
.summary p { margin: 0; color: var(--frost-2); }
.summary p + p { margin-top: .6rem; }
.summary strong:first-child { color: var(--brass); }
.note { color: var(--slate-2); font-size: .86rem; }
.invite-code { font: 800 1.9rem/1.2 var(--font); font-stretch: 112%; letter-spacing: .08em; color: var(--frost); margin: .2rem 0 1.2rem; }

/* ---------- Tables: columns on a laptop, one block per row on a phone ---------- */

.table { margin: .8rem 0 1rem; border: 1px solid var(--edge); border-radius: 12px; overflow: hidden; background: var(--floor); }
table { border-collapse: collapse; width: 100%; font-size: .93rem; }
th, td { text-align: left; vertical-align: top; padding: .65rem .85rem; }
th {
  font: 700 .66rem/1.3 var(--font); font-stretch: 125%; letter-spacing: .14em; text-transform: uppercase;
  color: var(--slate-2); background: rgba(12, 22, 48, .35);
}
tr + tr td { border-top: 1px solid var(--edge); }
td { color: var(--frost-2); }
td:first-child { color: var(--frost); font-weight: 600; min-width: 8rem; }

@media (max-width: 40rem) {
  .table { border: 0; background: none; overflow: visible; }
  table, tbody, tr, td { display: block; }
  tr:first-child:has(th) { display: none; }
  tr { background: var(--floor); border: 1px solid var(--edge); border-radius: 12px; padding: .75rem .9rem; }
  tr + tr { margin-top: 10px; }
  tr + tr td { border-top: 0; }
  td { padding: 0; }
  td + td { margin-top: .4rem; }
  td:first-child { min-width: 0; }
  td:not(:first-child)[data-label]::before {
    content: attr(data-label); display: block; margin-bottom: .1rem;
    font: 700 .64rem/1.3 var(--font); font-stretch: 125%; letter-spacing: .14em; text-transform: uppercase; color: var(--slate-2);
  }
}

/* ---------- Forms ---------- */

.button {
  display: inline-block; padding: .78rem 1.6rem; border: 0; border-radius: 12px; cursor: pointer;
  background: linear-gradient(var(--action-top), var(--action) 45%, var(--action-bottom)); color: var(--action-ink);
  font: 800 .82rem/1 var(--font); font-stretch: 118%; letter-spacing: .1em; text-transform: uppercase; text-decoration: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 6px 16px rgba(0, 0, 0, .3);
}
.button:hover { color: var(--action-ink); filter: brightness(1.05); }
.button:disabled { opacity: .6; cursor: default; filter: none; }

form { margin-top: 1.6rem; }
form > p, fieldset { margin: 0 0 1.6rem; }
fieldset { border: 0; padding: 0; min-width: 0; }
legend, .question { display: block; font-weight: 650; line-height: 1.4; margin: 0 0 .5rem; padding: 0; }
.hint { display: block; color: var(--slate-2); font-size: .86rem; margin: -.25rem 0 .55rem; }
input[type="text"], input[type="number"], textarea {
  box-sizing: border-box; width: 100%; padding: .6rem .75rem;
  font: inherit; color: var(--frost); background: var(--sky);
  border: 1px solid var(--edge); border-radius: 10px;
}
input[type="number"] { max-width: 7.5rem; font-variant-numeric: tabular-nums; }
textarea { min-height: 5.5rem; resize: vertical; }
input[type="text"]:focus, input[type="number"]:focus, textarea:focus { outline: none; border-color: var(--brass); box-shadow: 0 0 0 3px var(--focus); }
.follow { margin-top: .75rem; }

.choice { display: flex; align-items: flex-start; gap: .55rem; margin: .4rem 0; }
.choice input { margin: .3rem 0 0; accent-color: var(--brass); width: 1.05rem; height: 1.05rem; flex: none; }

/* A question's answers as pills; the input stays in place, invisible, so it takes taps and keys. */
@supports selector(:has(*)) {
  fieldset .choice {
    position: relative; display: inline-flex; align-items: center; gap: .45rem; margin: 0 .35rem .5rem 0;
    padding: .45rem 1rem; border: 1px solid var(--edge-hi); border-radius: 999px;
    color: var(--frost-2); font-weight: 600; font-size: .93rem; line-height: 1.3; cursor: pointer;
  }
  fieldset .choice input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
  fieldset .choice:has(input:checked) { background: var(--brass-wash); color: var(--brass); border-color: var(--brass); }
  fieldset .choice:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--focus); }
  fieldset .choice:has(input[type="checkbox"]:checked)::before {
    content: ""; width: .32rem; height: .62rem; margin: -.15rem .1rem 0 0;
    border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg);
  }
  .scale { display: flex; gap: .4rem; max-width: 20rem; }
  .scale .choice { flex: 1; justify-content: center; margin: 0; padding: .5rem 0; font-variant-numeric: tabular-nums; }
}
.scale-ends { display: flex; justify-content: space-between; gap: 1rem; max-width: 20rem; margin-top: .45rem; color: var(--slate-2); font-size: .84rem; }

/* The field a bot fills in and a person never sees. */
.trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.status { font-weight: 650; padding: .85rem 1rem; border-radius: 12px; background: var(--floor); border: 1px solid var(--edge); }
.status.sent { color: var(--frost); border-color: var(--brass-line); }
.status.error { color: var(--error); border-color: rgba(255, 138, 122, .45); }

/* ---------- Footer: where else to go, per language ---------- */

.back { margin-top: 1.6rem; }
.back a { display: inline-flex; align-items: center; gap: .4rem; }
.back a::before { content: "\2190"; }

section > footer { margin: 3rem calc(-1 * var(--gutter)) 0; padding: 1.4rem var(--gutter) 2.2rem; border-top: 1px solid var(--edge); font-size: .86rem; color: var(--slate-2); }
section > footer nav { display: flex; flex-wrap: wrap; gap: .35rem 1.1rem; margin-top: .75rem; }
section > footer a { color: var(--slate); }
section > footer .wordmark { color: var(--frost); text-decoration: none; }
section > footer a[aria-current="page"] { color: var(--brass); text-decoration: none; }

/* ---------- Laptop and wider ---------- */

@media (min-width: 48rem) {
  :root {
    --sky-height: max(330px, 100vw * 260 / 1600);
    --sky-size: max(100%, 1600px) auto;
    --sky-top: calc(var(--sky-height) - max(100vw, 1600px) * 260 / 1600);
  }
  .band { padding-top: 22px; }
  .lead { padding-top: 60px; min-height: calc(var(--sky-height) - 76px); }
  body:has(section[hidden]) section + section .lead { min-height: calc(var(--sky-height) - 76px); padding-top: 60px; }
  h1 { font-size: 2.8rem; }
  h2 { font-size: 1.75rem; }
  h3 { font-size: 1.35rem; }
  ol > li:has(> .shot) { display: grid; grid-template-columns: minmax(0, 1fr) 220px; column-gap: 1.6rem; align-items: start; }
  ol > li:has(> .shot) > p { grid-column: 1; grid-row: span 3; }
  ol > li > .shot { grid-column: 2; margin-top: 0; }
  section > footer { padding-bottom: 3rem; }
}
