/* the headings are in a hand: Caveat, from Google Fonts, kept here so the
   page fetches nothing from anywhere else (licence: caveat-OFL.txt) */
@font-face {
  font-family: "Caveat";
  src: url("caveat.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --bg: #f6f3ec;
  --card: #fdfcf9;
  --text: #1b1a18;
  --muted: #6a665e;
  --line: #e0dbd0;
  --soft: #efebe2;
  --accent: #c8321e;
  --on-accent: #fff;
  --shadow: 0 1px 2px rgb(40 30 10 / 0.05), 0 8px 24px rgb(40 30 10 / 0.05);
  --hand: "Caveat", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, cursive;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --foot-bg: #1c1b19;
  --foot-text: #f1eee8;
  --foot-muted: #a8a399;
  --foot-line: #3a3733;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151413;
    --card: #1d1c1a;
    --text: #eceae5;
    --muted: #a19c93;
    --line: #34312d;
    --soft: #262422;
    --accent: #ff6f57;
    --on-accent: #1b1a18;
    --shadow: none;
    --foot-bg: #0d0c0b;
    --foot-line: #2a2825;
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

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

body {
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
  max-width: 72rem;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.55 var(--sans);
}

a { color: inherit; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

h1 { font: 700 2.8rem/1.1 var(--hand); margin: 2.5rem 0 1rem; }
h2 { font: 700 1.75rem/1.2 var(--hand); margin: 2.25rem 0 0.6rem; }
p { margin: 0 0 0.9rem; }
.label { display: block; font-size: 0.76rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin: 0 0 0.5rem; }
.label .small { text-transform: none; letter-spacing: 0; font-weight: 400; margin-left: 0.4rem; }
.small { color: var(--muted); font-size: 0.9rem; }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--mono); }
.bad-text { color: var(--accent); }

/* the head of the page */

header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 2rem;
  padding: 1.1rem 0 0.9rem;
  border-bottom: 1px solid var(--line);
}
.mark { font-size: 1.1rem; text-decoration: none; }
.mark b { font: 700 1.55rem/1 var(--serif); letter-spacing: -0.02em; }
nav { display: flex; gap: 1.4rem; }
nav a { text-decoration: none; color: var(--muted); padding: 0.3rem 0; border-bottom: 2px solid transparent; }
nav a:hover { color: var(--text); }
.site-nav { margin-left: auto; }

/* buttons and fields */

button, .button, input, select, textarea {
  font: inherit;
  color: inherit;
  min-height: 2.6rem;
  padding: 0.45rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: var(--card);
}
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; cursor: pointer; text-decoration: none; line-height: 1.6; font-weight: 500; transition: border-color 0.15s, background 0.15s; }
button:hover, .button:hover { border-color: var(--muted); }
button:disabled { cursor: default; opacity: 0.5; }
button:disabled:hover { border-color: var(--line); }
.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.primary:hover { border-color: var(--text); }
.primary:disabled:hover { border-color: var(--accent); }
.big { min-height: 3rem; padding: 0.6rem 1.4rem; font-size: 1.05rem; }
.wide { width: 100%; }
input[type="range"] { width: 100%; min-height: 0; padding: 0; border: 0; background: none; accent-color: var(--accent); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.icon { width: 1.1em; height: 1.1em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

#notice {
  position: sticky;
  top: 0.75rem;
  z-index: 3;
  margin: 1rem 0 0;
  padding: 0.7rem 1rem;
  border-radius: 0.6rem;
  background: var(--text);
  color: var(--bg);
  box-shadow: var(--shadow);
}
#notice.bad { background: var(--accent); color: var(--on-accent); }

/* cards and figures */

.card { padding: 1.25rem 1.4rem; border: 1px solid var(--line); border-radius: 1rem; background: var(--card); box-shadow: var(--shadow); }
.card > :last-child { margin-bottom: 0; }
.figure { margin: 1rem 0 0.3rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.figure strong { font: 700 2.8rem/1.05 var(--serif); letter-spacing: -0.02em; color: var(--text); margin-right: 0.15rem; }

/* the start */

.hero { padding: 4.5rem 0 3.5rem; text-align: center; }
.hero-name { font: 700 clamp(3.6rem, 11vw, 6.6rem)/1 var(--hand); margin: 0; }
.hero-line { font: italic clamp(1.25rem, 2.6vw, 1.75rem)/1.4 var(--serif); max-width: 34ch; margin: 1.4rem auto 2.4rem; text-wrap: balance; }
.hero-go { margin: 0 0 0.8rem; }
.hero-go .button { width: min(100%, 24rem); }
.hero .small { max-width: 38rem; margin: 0 auto; }
body.dragging .hero-go .button { outline: 3px dashed var(--accent); outline-offset: 6px; }

.narrow { max-width: 38rem; margin: 0 auto; }
.narrow h2 { margin-top: 0; }
.steps { padding-left: 1.3rem; margin: 0; }
.steps li { margin: 0 0 0.9rem; padding-left: 0.3rem; }
.steps li::marker { font: 700 1rem var(--serif); color: var(--accent); }

/* the work: the font beside, the photo and the letters */

#work { display: grid; grid-template-columns: 21rem minmax(0, 1fr); gap: 2.5rem; align-items: start; padding-top: 2rem; }
.side { display: grid; gap: 1.25rem; position: sticky; top: 1.25rem; }
.side input:not([type]), .side input[type="text"] { width: 100%; }
#missing { margin: 0.3rem 0 1rem; overflow-wrap: anywhere; }
#problem { margin: 0 0 1rem; }
.sample { display: block; width: 100%; min-height: 9rem; resize: vertical; font-size: 40px; line-height: 1.25; padding: 0.6rem 0.8rem; }
.size-label { margin-top: 1rem; }

.photo-card { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1.4rem; align-items: start; }
.photo { display: block; width: 100%; height: auto; border-radius: 0.4rem; border: 1px solid var(--line); background: #fff; }
.controls input:not([type="range"]) { width: 100%; margin-bottom: 1.1rem; font-size: 0.9rem; }
.controls input[type="range"] { margin-bottom: 1rem; }
.controls .row { margin: 0; }
#work h2 { margin-top: 2rem; }

.letters {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(6.2rem, 1fr));
  gap: 0.6rem;
}
.letters li { position: relative; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 0.7rem; background: var(--card); overflow: hidden; }
.letters li.line-start { grid-column-start: 1; }
.letters .glyph { display: grid; place-items: end center; height: 6rem; padding: 0.6rem 0.5rem 0.5rem; color: var(--text); }
.letters .glyph svg { max-width: 100%; max-height: 100%; fill: currentColor; overflow: visible; }
.letters input { width: 100%; min-height: 2.2rem; border: 0; border-top: 1px solid var(--line); border-radius: 0; text-align: center; font: 600 1.15rem var(--mono); background: var(--soft); padding: 0.2rem; }
.letters li.off .glyph { opacity: 0.3; }
.letters li.twice { border-color: var(--accent); }
.letters li.twice input { color: var(--accent); }
.letters .tools { position: absolute; top: 0.25rem; right: 0.25rem; display: flex; gap: 0.15rem; opacity: 0; transition: opacity 0.15s; }
.letters li:hover .tools, .letters li:focus-within .tools { opacity: 1; }
.letters .tools button { min-height: 0; width: 1.6rem; height: 1.6rem; padding: 0; border-radius: 0.4rem; font-size: 0.95rem; line-height: 1; color: var(--muted); }
.letters .tools button:hover { color: var(--text); }
.letters .number { position: absolute; top: 0.3rem; left: 0.45rem; font-size: 0.7rem; color: var(--muted); font-variant-numeric: tabular-nums; }
@media (hover: none) { .letters .tools { opacity: 1; } }

/* the foot of the page: a dark band across the whole width */

.site-footer {
  display: block;
  margin: 6rem 0 -4rem;
  padding: 3rem 0 1.5rem;
  background: var(--foot-bg);
  box-shadow: 0 0 0 100vmax var(--foot-bg);
  clip-path: inset(0 -100vmax);
  color: var(--foot-muted);
  font-size: 0.92rem;
}
.footer-inner { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1.4fr); gap: 2.5rem; }
.footer-brand .mark { color: var(--foot-text); text-decoration: none; }
.footer-brand p { margin: 0.8rem 0 0; max-width: 22rem; line-height: 1.5; }
.footer-head { margin: 0 0 0.7rem; color: var(--foot-text); font-size: 0.74rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.footer-col { display: flex; flex-direction: column; gap: 0.45rem; }
.footer-col a { color: var(--foot-muted); text-decoration: none; border: 0; padding: 0; }
.footer-col a:hover { color: var(--foot-text); text-decoration: underline; }
.footer-sisters a { display: flex; flex-direction: column; gap: 0.05rem; margin-bottom: 0.4rem; }
.footer-sisters strong { color: var(--foot-text); font-weight: 600; }
.footer-bottom { margin: 2.5rem 0 0; padding-top: 1.2rem; border-top: 1px solid var(--foot-line); font-size: 0.8rem; }

/* on a narrow screen everything is one column */

@media (max-width: 56rem) {
  body { padding: 0 1rem 3rem; }
  h1 { font-size: 2.3rem; margin-top: 2rem; }
  #work { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; padding-top: 1.25rem; }
  .side { position: static; order: 2; }
  .photo-card { grid-template-columns: minmax(0, 1fr); }
  .site-footer { margin-bottom: -3rem; }
  .footer-inner { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2rem; }
  .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 30rem) { .footer-inner { grid-template-columns: minmax(0, 1fr); } }
