/*
  _ you have me _
  One stylesheet for the whole site. No imports, no outside fonts, nothing loaded
  from anywhere else. Type is set in the serif already on the visitor's device.
*/

:root {
  --paper: #f1f3f0;
  --ink: #18223b;
  --ink-soft: #4a5570;
  --sheet: #ffffff;
  --sheet-fold: #d9dee4;
  --sheet-under: #dde1e3;
  --manila: #e7c987;
  --on-manila: #18223b;
  --alert: #a8231a;
  --shade: 24 34 59;

  /* The left margin of every page is the length of the first underscore. */
  --margin: clamp(1.25rem, 9vw, 8rem);
  --measure: 36rem;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
    "TeX Gyre Pagella", "URW Palladio L", Georgia, serif;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121829;
    --ink: #e8ebf1;
    --ink-soft: #aab3c7;
    --sheet: #1f2944;
    --sheet-fold: #34416a;
    --sheet-under: #19213a;
    --manila: #d2b470;
    --alert: #ff9a90;
    --shade: 0 0 0;
  }
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.6;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 0.12em;
}

a:focus-visible,
button:focus-visible,
input[type="checkbox"]:focus-visible {
  outline: 0.14rem solid var(--ink);
  outline-offset: 0.2rem;
}

h1,
h2,
p {
  margin: 0;
}

/* The name never breaks across lines. */
.name {
  white-space: nowrap;
}


/* ---------- The wordmark: _ you have me _ ----------
   The two underscores are real characters in the page, drawn as rules so the
   first one can set the margin and the last one can run to the edge. */

.wordmark {
  --wm: 1.5rem;
  display: flex;
  align-items: baseline;
  gap: calc(var(--wm) * 0.3);
  margin: 0;
  font-size: var(--wm);
  font-weight: 400;
  line-height: 1.2;
  color: var(--ink);
  text-decoration: none;
}

.wordmark .wm-text {
  white-space: nowrap;
}

.wordmark .u {
  position: relative;
  top: calc(var(--wm) * 0.13);
  height: 0;
  border-bottom: calc(var(--wm) * 0.07) solid currentColor;
  font-size: 0;
  line-height: 0;
}

.wordmark .u:first-child {
  flex: 0 0 calc(var(--margin) - var(--wm) * 0.3);
}

.wordmark .u:last-child {
  flex: 1 1 auto;
}

.site-header {
  padding-top: clamp(1.5rem, 4vw, 2.75rem);
}

.wordmark-hero {
  --wm: clamp(2.75rem, 12.5vw, 6.5rem);
  line-height: 1.1;
  padding-top: clamp(0.5rem, 3vw, 2rem);
}

@media (prefers-reduced-motion: no-preference) {
  .wordmark-hero .u:last-child {
    transform-origin: left center;
    animation: draw-rule 1100ms cubic-bezier(0.2, 0.7, 0.2, 1) 200ms both;
  }
}

@keyframes draw-rule {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}


/* ---------- Page frame ---------- */

main {
  padding: 0 var(--margin);
}

.site-footer {
  margin-top: clamp(4rem, 10vw, 7rem);
  padding-bottom: 3rem;
  font-size: 1rem;
}

.wordmark-foot {
  --wm: 1rem;
  color: var(--ink-soft);
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.75rem;
  padding: 0.9rem var(--margin) 0;
}

.site-footer nav a {
  padding: 0.35rem 0;
}

.site-footer .legal {
  padding: 0.5rem var(--margin) 0;
  color: var(--ink-soft);
}


/* ---------- Home ---------- */

.statement {
  max-width: 25em;
  margin-top: clamp(1.75rem, 4vw, 2.75rem);
  font-size: clamp(1.375rem, 2.7vw, 1.875rem);
  line-height: 1.35;
  text-wrap: pretty;
}

.made {
  display: grid;
  gap: 2.5rem;
  margin-top: clamp(4rem, 10vw, 7rem);
  max-width: 64rem;
}

@media (min-width: 54rem) {
  .made {
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
  }
}

.made h2 {
  font-size: 1.75rem;
  font-weight: 400;
  line-height: 1.2;
}

.made p {
  margin-top: 0.6rem;
  max-width: 26em;
}

.made .status {
  margin-top: 1.4rem;
  font-size: 1rem;
  font-style: italic;
}

/* Turn Me is a page with its corner turned. */
.sheet {
  --ear: 2.75rem;
  margin-top: 1.5rem;
  /* a hairline edge, then the next page of the book showing underneath */
  filter: drop-shadow(0 0 0.5px rgb(var(--shade) / 0.45))
    drop-shadow(0.35rem 0.35rem 0 var(--sheet-under));
}

.sheet-face {
  position: relative;
  height: 100%;
  padding: 2rem 2.25rem 2.25rem;
  background: var(--sheet);
  clip-path: polygon(0 0, calc(100% - var(--ear)) 0, 100% var(--ear), 100% 100%, 0 100%);
}

.sheet-face::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: var(--ear);
  height: var(--ear);
  background: linear-gradient(to top right, var(--sheet-fold) 50%, transparent 50%);
}

.sheet-face h2 {
  padding-right: var(--ear);
}

.sheet-face .status {
  color: var(--ink-soft);
}

/* Working Folder Starter is a folder with a tab. */
.folder {
  position: relative;
  margin-top: 1.5rem;
  padding: 2rem 2.25rem 2.25rem;
  background: var(--manila);
  color: var(--on-manila);
  border-radius: 0 0.5rem 0.5rem 0.5rem;
}

.folder::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: calc(100% - 1px);
  width: min(10rem, 45%);
  height: 1.5rem;
  background: var(--manila);
  border-radius: 0.5rem 0.4rem 0 0;
  clip-path: polygon(0 0, calc(100% - 1.1rem) 0, 100% 100%, 0 100%);
}

.folder a:focus-visible {
  outline-color: var(--on-manila);
}


/* ---------- Waitlist ---------- */

.waitlist {
  max-width: var(--measure);
  margin-top: clamp(2.25rem, 5vw, 3.25rem);
  scroll-margin-top: 2rem;
}

.waitlist h2 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 400;
  line-height: 1.2;
  text-wrap: balance;
}

.waitlist > p {
  margin-top: 0.6rem;
}

/* Shown only when the sign-up address sends a visitor back here. */
.form-note {
  display: none;
  scroll-margin-top: 6rem;
  color: var(--alert);
}

.form-note:target,
.form-note.shown {
  display: block;
}

.waitlist form {
  margin-top: 1.5rem;
}

.waitlist label[for="email"] {
  display: block;
  padding: 0;
  font-size: 1rem;
  color: var(--ink-soft);
}

/* The email field is a blank to fill in: one more underscore. */
.waitlist input[type="email"] {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.3rem 0 0.35rem;
  border: 0;
  border-bottom: 0.12rem solid var(--ink);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 1.5rem;
  line-height: 1.4;
  -webkit-appearance: none;
  appearance: none;
}

.waitlist input[type="email"]::placeholder {
  color: var(--ink-soft);
  opacity: 0.55;
}

.waitlist input[type="email"]:focus {
  outline: 0;
  box-shadow: 0 0.16rem 0 0 var(--ink);
  background: rgb(var(--shade) / 0.05);
}

/* A field people never see. Automated sign-ups fill it in and are ignored. */
.leave-empty {
  position: absolute;
  left: -200vw;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.button {
  display: inline-block;
  margin-top: 1.5rem;
  padding: 0.8rem 1.6rem;
  border: 0;
  border-radius: 0.25rem;
  background: var(--ink);
  color: var(--paper);
  font: inherit;
  font-size: 1.125rem;
  line-height: 1.3;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  opacity: 0.88;
}

.button:active {
  transform: translateY(1px);
}

/* A second-rank button: outlined, for actions that undo or remove. */
.button-quiet {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 0.09rem var(--ink);
}

.button-small {
  margin-top: 0;
  padding: 0.35rem 0.8rem;
  font-size: 1rem;
}

.waitlist .fine {
  margin-top: 1.25rem;
  font-size: 1rem;
  color: var(--ink-soft);
}

.waitlist .fine a {
  white-space: nowrap;
}


/* ---------- Email choices (the page the waitlist Worker serves) ---------- */

.choices-form {
  margin-top: 2rem;
}

.choices-form fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.choices-form legend {
  padding: 0;
  font-size: 1rem;
  color: var(--ink-soft);
}

.choices {
  display: flex;
  flex-direction: column;
  margin-top: 0.15rem;
}

.choices label {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.75rem;
  cursor: pointer;
}

.choices input {
  width: 1.15rem;
  height: 1.15rem;
  margin: 0;
  accent-color: var(--ink);
}

.choices-form .fine {
  margin-top: 1.25rem;
  font-size: 1rem;
  color: var(--ink-soft);
}


/* ---------- Pages the waitlist Worker serves: invite link, notes, admin ---------- */

/* A link shown in a box, so it can be selected and copied in one go. */
.copy {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.6rem 0.75rem;
  border: 0.09rem solid var(--ink);
  border-radius: 0.25rem;
  background: var(--sheet);
  color: var(--ink);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9375rem;
}

.share {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.75rem;
}

.note-form {
  margin-top: 1.25rem;
}

.note-form label {
  display: block;
  font-size: 1rem;
  color: var(--ink-soft);
}

.note-form label + input + label {
  margin-top: 1rem;
}

.note-form input[type="text"],
.note-form textarea {
  display: block;
  width: 100%;
  margin: 0.3rem 0 0;
  padding: 0.6rem 0.75rem;
  border: 0.09rem solid var(--ink);
  border-radius: 0.25rem;
  background: var(--sheet);
  color: var(--ink);
  font: inherit;
  line-height: 1.5;
  resize: vertical;
}

.copy:focus-visible,
.note-form input[type="text"]:focus-visible,
.note-form textarea:focus-visible {
  outline: 0.14rem solid var(--ink);
  outline-offset: 0.15rem;
}

.reading.admin {
  max-width: none;
}

.admin .table-wrap {
  margin-top: 1rem;
  overflow-x: auto;
}

.admin table {
  width: 100%;
  max-width: 68rem;
  border-collapse: collapse;
  font-size: 1rem;
}

.admin th,
.admin td {
  padding: 0.5rem 1rem 0.5rem 0;
  border-bottom: 1px solid rgb(var(--shade) / 0.18);
  text-align: left;
  vertical-align: middle;
}

.admin th {
  font-weight: 400;
  color: var(--ink-soft);
}

.admin .notes {
  max-width: var(--measure);
  padding: 0;
  list-style: none;
}

.admin .notes li {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgb(var(--shade) / 0.18);
}

.admin .notes p {
  margin-top: 0.4rem;
}

.admin .note-from {
  font-size: 1rem;
  color: var(--ink-soft);
}

.admin .note-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.admin .note-actions {
  margin-top: 0.6rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.5rem;
  font-size: 1rem;
}


/* ---------- Stories: the home page section, and lists of stories ---------- */

.story {
  max-width: var(--measure);
  margin-top: clamp(4rem, 10vw, 7rem);
}

.story h2 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 400;
  line-height: 1.2;
}

.story p {
  margin-top: 0.85rem;
}

/* A list of stories: the title is the link, with a line about it underneath. */
.story-list,
.reading .story-list {
  list-style: none;
  margin: 1.25rem 0 0;
  padding: 0;
}

.story-list li,
.reading .story-list li + li {
  margin-top: 1.1rem;
}

.story-list a {
  font-size: 1.3125rem;
  line-height: 1.3;
}

.story-list span {
  display: block;
  margin-top: 0.15rem;
  color: var(--ink-soft);
}


/* ---------- Reading pages: privacy, support, thanks, not found ---------- */

.reading {
  max-width: calc(var(--measure) + 2 * var(--margin));
}

.reading h1 {
  margin-top: clamp(2.5rem, 7vw, 4.5rem);
  font-size: clamp(2.25rem, 6vw, 3.5rem);
  font-weight: 400;
  line-height: 1.12;
  text-wrap: balance;
}

.reading .lede {
  margin-top: 1rem;
  font-size: 1.3125rem;
  line-height: 1.45;
}

.reading .dateline {
  margin-top: 0.75rem;
  font-size: 1rem;
  font-style: italic;
  color: var(--ink-soft);
}

.reading h2 {
  margin-top: 2.75rem;
  font-size: 1.5rem;
  font-weight: 400;
  line-height: 1.25;
}

.reading p,
.reading ul {
  margin-top: 0.85rem;
}

.reading ul {
  margin-bottom: 0;
  padding-left: 1.15em;
}

.reading li + li {
  margin-top: 0.4rem;
}

/* Things a person types, and the names of files and folders. */
code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.88em;
}

.reading .address {
  font-size: clamp(1.3125rem, 4.4vw, 1.75rem);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.reading .folder {
  margin-top: 4rem;
}

.reading .folder h2 {
  margin-top: 0;
}

.folder .button {
  background: var(--on-manila);
  color: var(--manila);
}
