/* Werkraum website. The app's Journal design (docs/DESIGN.md): paper, ink, one red-pencil accent,
   Newsreader and Instrument Sans, hairline rules instead of cards, contour lines only on the home
   page. No scripts and no inline styles: the Content-Security-Policy allows neither. */

@font-face {
  font-family: "Newsreader";
  src: url("/fonts/newsreader.woff2") format("woff2");
  font-weight: 300 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("/fonts/newsreader-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/fonts/instrument-sans.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --paper: #F4EFE6;
  --sheet: #FBF8F2;
  --ink: #1D1A16;
  --ink2: #5E574C;
  --rule: #D8CFBF;
  --accent: #A23B22;
  --tint: #EADDCF;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --side: 32px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #191714;
    --sheet: #22201C;
    --ink: #EDE6D8;
    --ink2: #A69E8F;
    --rule: #3A352E;
    --accent: #E28C6C;
    --tint: #33271F;
  }
}

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

html {
  background: var(--paper);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  isolation: isolate;
}

.page {
  max-width: calc(680px + 2 * var(--side));
  margin: 0 auto;
  padding: 0 var(--side);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; padding-bottom: 72px; }

a { color: inherit; text-decoration: underline; text-decoration-color: var(--rule); text-decoration-thickness: 1px; text-underline-offset: 3px; transition: text-decoration-color .3s; }
a:hover { text-decoration-color: var(--accent); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; text-decoration: none; }

::selection { background: var(--tint); }

/* Top: the wordmark, small, like the app's label line. */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 88px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--serif);
  font-size: 21px;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.brand svg { width: 28px; height: 28px; flex: none; }
.brand .w { stroke: var(--ink); }
.brand .u { stroke: var(--accent); }

/* Type, from the app's scale. */
.label {
  margin: 0;
  font-family: var(--sans);
  font-size: 11px;
  line-height: 16px;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink2);
}
h1, h2, h3 { font-family: var(--serif); font-weight: 400; font-variant-numeric: lining-nums; text-wrap: balance; }
h1 {
  margin: 12px 0 0;
  font-size: clamp(40px, 9vw, 64px);
  line-height: 1.02;
  letter-spacing: -0.025em;
}
.doc h1 { font-size: clamp(36px, 7vw, 44px); line-height: 1.1; letter-spacing: -0.02em; }
h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -0.015em;
}
h3 {
  margin: 32px 0 0;
  font-size: 20px;
  line-height: 1.25;
}
.lead {
  margin: 16px 0 0;
  max-width: 34em;
  font-family: var(--serif);
  font-style: italic;
  font-size: 21px;
  line-height: 1.4;
  color: var(--ink2);
  text-wrap: pretty;
}
p { margin: 12px 0 0; text-wrap: pretty; }
strong { font-weight: 600; }

/* The hand-drawn red-pencil stroke under the main title. */
.pen {
  display: block;
  width: 168px;
  height: 10px;
  margin-top: 6px;
  color: var(--accent);
  overflow: visible;
}
.pen path, .tick path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* The margin note: one italic accent sentence, slightly rotated. */
.note {
  margin: 28px 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
  line-height: 1.3;
  color: var(--accent);
  transform: rotate(-1.2deg);
  transform-origin: left center;
}

/* Sections start with an ink rule. */
section { margin-top: 64px; }
.rule-top { border-top: 1px solid var(--ink); padding-top: 20px; }

/* Ledger: label column and serif value, rows divided by hairlines. */
.ledger {
  margin: 32px 0 0;
  padding: 0;
  border-top: 1px solid var(--ink);
}
.ledger > div {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  column-gap: 16px;
  align-items: baseline;
  padding: 15px 0 14px;
  border-bottom: 1px solid var(--rule);
}
.ledger dt { margin: 0; }
.ledger dd {
  margin: 0;
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.3;
}
.ledger dd span { display: block; margin-top: 3px; font-family: var(--sans); font-size: 13.5px; line-height: 1.45; color: var(--ink2); }
.ledger dd.accent { font-style: italic; color: var(--accent); }

/* Exercises: three pictograms like the library's, body in ink, equipment in accent. */
.pictos {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}
.pictos li { border-bottom: 1px solid var(--rule); padding-bottom: 14px; }
.pictos svg { display: block; width: 72px; height: 72px; }
.pictos path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.pictos .g { stroke: var(--rule); stroke-width: 1; }
.pictos .b { stroke: var(--ink); stroke-width: 1.4; }
.pictos .l { stroke: var(--accent); stroke-width: 1.4; }
.pictos .name { margin: 6px 0 0; font-family: var(--serif); font-size: 18px; line-height: 1.25; }
.pictos .meta { margin: 2px 0 0; font-size: 12.5px; line-height: 16px; color: var(--ink2); }

/* Plain lists with a short drawn tick instead of bullets. */
.ticks { margin: 20px 0 0; padding: 0; list-style: none; }
.ticks li {
  position: relative;
  padding: 12px 0 12px 32px;
  border-bottom: 1px solid var(--rule);
}
.ticks li:first-child { border-top: 1px solid var(--rule); }
.ticks .tick { position: absolute; left: 0; top: 14px; width: 20px; height: 20px; color: var(--ink); }

/* "Availability" line: the one clear thing to do. */
.cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 40px;
  min-height: 56px;
  padding: 0 22px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  font-weight: 500;
  letter-spacing: .01em;
}
.cta .soon { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--ink2); }

/* Legal pages: comfortable reading measure. */
.doc main { max-width: 40em; }
.doc .updated { margin-top: 16px; }
.doc h2 { margin-top: 48px; padding-top: 18px; border-top: 1px solid var(--ink); font-size: 24px; }
.doc ul { margin: 12px 0 0; padding-left: 1.2em; }
.doc li { margin-top: 8px; padding-left: 4px; }
.doc li::marker { color: var(--ink2); }
code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .88em; }
address { font-style: normal; font-family: var(--serif); font-size: 19px; line-height: 1.45; margin-top: 12px; }
.mail { font-family: var(--serif); font-size: 19px; }

/* Bottom: links on a hairline. */
.foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding: 22px 0 32px;
  border-top: 1px solid var(--rule);
}
.foot nav { display: flex; flex-wrap: wrap; gap: 4px 22px; }
.foot a { display: inline-block; padding: 12px 0; text-decoration: none; color: var(--ink2); transition: color .3s; }
.foot a:hover, .foot a[aria-current="page"] { color: var(--ink); }
.foot small { font-size: 12.5px; color: var(--ink2); }

/* Contour lines: a faint corner behind the home page's top. They mean nothing. */
/* The frame spans the window and clips the corner at its right edge, so it never widens the page. */
.topo-frame {
  position: absolute;
  z-index: -1;
  top: 0;
  left: 0;
  right: 0;
  height: 320px;
  overflow: hidden;
  pointer-events: none;
}
.topo {
  position: absolute;
  top: 30px;
  /* 120 px past the right edge of the text column, wherever that is. */
  right: calc(max(0px, 50vw - 372px) - 120px);
  width: 340px;
  height: 248px;
  overflow: visible;
}
/* Drawn at a fixed thickness however large the corner is: thinner than a hairline. */
.topo path { fill: none; stroke: var(--rule); stroke-width: .8px; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.topo .o { stroke-width: .6px; }

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

/* Motion: content rises in, the pen and the contour lines draw themselves. */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.in { animation: rise .6s var(--ease) both; }
.d1 { animation-delay: .06s; }
.d2 { animation-delay: .12s; }
.d3 { animation-delay: .18s; }
.d4 { animation-delay: .24s; }
.pen path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw .8s cubic-bezier(.5, 0, .2, 1) .45s forwards; }
.topo path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.8s cubic-bezier(.4, 0, .2, 1) .35s forwards; }
.topo path:nth-child(2) { animation-delay: .5s; }
.topo path:nth-child(3) { animation-delay: .65s; }
.topo path:nth-child(4) { animation-delay: .8s; }
.topo path:nth-child(5) { animation-delay: .95s; }
@media (prefers-reduced-motion: reduce) {
  .in { animation: none; }
  .pen path, .topo path { animation: none; stroke-dashoffset: 0; }
}

@media (max-width: 520px) {
  .top { height: 72px; }
  .ledger > div { grid-template-columns: 1fr; row-gap: 4px; }
  .pictos { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .pictos svg { width: 56px; height: 56px; }
  .pictos .name { font-size: 16px; }
  .topo { right: -170px; top: 18px; }
  .cta { flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; padding: 12px 18px; }
}

@media print {
  .topo, .foot nav { display: none; }
  .in, .pen path { animation: none; opacity: 1; stroke-dashoffset: 0; }
}
