/* berlin-opus -- See Attached Figure's theme, in pgk.io's clothes.
   Hand-written CSS, no build step. Tokens, type ladder and link styles are
   pgk.io's (src/styles/global.css, src/data/palette.ts there); keep the
   two in step by hand. */

/* ---- fonts: the same self-hosted faces as pgk.io ---------------------- */
@font-face {
  font-family: "Hanken Grotesk";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/hanken-grotesk-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Hanken Grotesk";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/hanken-grotesk-latinext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Hanken Grotesk";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/hanken-grotesk-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Hanken Grotesk";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/hanken-grotesk-italic-latinext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Barlow Condensed";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/barlow-condensed-700-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Barlow Condensed";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/barlow-condensed-700-latinext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---- tokens: pgk.io's palette, light then dark ------------------------ */
:root {
  --font-display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --font-body: "Hanken Grotesk", system-ui, sans-serif;

  --color-bg: #ffffff;
  --color-ink: #1a1a1a;
  --color-ink-soft: #4a4a4a;
  --color-ink-faint: #767676;
  --color-line: color-mix(in srgb, var(--color-ink-faint) 40%, var(--color-bg));
  --color-blue: #2a4b7c;
  --color-teal: #0a6f69;
  --color-green: #008658;
  --color-berry: #b91428;
  --color-pink: #fa018b;

  /* Tailwind's ladder on a 17px root, as on the site. */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-3xl: 1.875rem;
}
@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #120a1a;
    --color-ink: #f1eaf7;
    --color-ink-soft: #dcd6e2;
    --color-ink-faint: #958f9c;
    --color-blue: #94c1f8;
    --color-teal: #4aa39b;
    --color-green: #75d696;
    --color-berry: #e04a58;
    --color-pink: #fa018b;
  }
}
/* Ghost's accent colour (Settings → Design) is what Portal paints its own
   UI with; the theme itself paints from the tokens above. */

/* ---- base ------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 17px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  color: var(--color-ink);
  /* Ghost's Design → Typography setting wins if one is chosen; the site's
     faces otherwise. */
  font-family: var(--gh-font-body, var(--font-body));
  line-height: 1.6;
}
main { flex: 1 0 auto; width: 100%; }
main:focus { outline: none; }
img { max-width: 100%; height: auto; }

/* One left edge: the same container everywhere -- header, page, footer. */
.container {
  max-width: 56rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.page { padding: 3rem 1.5rem 4rem; }
.page > * { max-width: 45rem; }

/* ---- type ------------------------------------------------------------- */
h1 {
  margin: 0 0 0.75rem;
  font-family: var(--gh-font-heading, var(--font-body));
  font-weight: 500;
  font-size: var(--text-3xl);
  line-height: 1.15;
}
.subhead {
  display: block;
  margin-top: 0.35rem;
  color: var(--color-ink-soft);
  font-size: var(--text-xl);
  font-weight: 400;
  line-height: 1.25;
}
.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--color-teal);
  font-size: var(--text-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.lede {
  margin: 0 0 2rem;
  color: var(--color-ink-soft);
}
.section-label {
  margin: 0 0 1rem;
  color: var(--color-teal);
  font-size: var(--text-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ---- links: pgk.io's three ------------------------------------------- */
a { color: inherit; text-decoration: none; }
.link,
.gh-content a {
  color: var(--color-blue);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--color-blue) 40%, transparent);
  text-underline-offset: 0.15em;
  border-radius: 0.15em;
  transition: background-color 120ms, box-shadow 120ms, text-decoration-color 120ms;
}
.link { text-decoration: none; }
.link:hover,
.gh-content a:hover {
  text-decoration: underline;
  text-decoration-color: var(--color-blue);
  background-color: color-mix(in srgb, var(--color-blue) 10%, var(--color-bg));
  box-shadow: 0 0 0 0.2em color-mix(in srgb, var(--color-blue) 10%, var(--color-bg));
}
.link-title {
  text-decoration: underline;
  text-decoration-color: var(--color-line);
  text-underline-offset: 2px;
  border-radius: 0.15em;
  transition: background-color 120ms, box-shadow 120ms, color 120ms, text-decoration-color 120ms;
}
.link-title:hover {
  color: var(--color-blue);
  text-decoration-color: var(--color-blue);
  background-color: color-mix(in srgb, var(--color-blue) 10%, var(--color-bg));
  box-shadow: 0 0 0 0.2em color-mix(in srgb, var(--color-blue) 10%, var(--color-bg));
}
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--color-blue);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---- header ----------------------------------------------------------- */
.site-header { border-bottom: 1px solid var(--color-line); }
.site-header-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
}
.wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.75rem;
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--color-ink);
}
.wordmark:hover { color: var(--color-blue); }
.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.site-nav a:hover { color: var(--color-blue); }

/* ---- footer ----------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--color-line);
  margin-top: 4rem;
  color: var(--color-ink-faint);
  font-size: var(--text-sm);
}
.site-footer-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-top: 1.5rem;
  padding-bottom: 2rem;
}
.site-footer-links { display: flex; flex-wrap: wrap; gap: 1.25rem; }

/* ---- signup: the same box as pgk.io's homepage ----------------------- */
.signup-block { margin: 2.5rem 0 0; }
.signup-block-after {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--color-line);
}
.signup-intro { margin: 0 0 0.25rem; font-weight: 600; }
.signup-note { margin: 0 0 1rem; color: var(--color-ink-soft); font-size: var(--text-sm); }
.signup-form { max-width: 28rem; }
.signup-row {
  display: flex;
  border: 1px solid var(--color-line);
  border-radius: 0.5rem;
  background: var(--color-bg);
  padding: 3px;
  transition: border-color 120ms;
}
.signup-row:focus-within { border-color: var(--color-ink-faint); }
.signup-form.error .signup-row { border-color: var(--color-berry); }
.signup-input {
  flex: 1 1 auto;
  min-width: 0;
  background: transparent;
  color: var(--color-ink);
  font: inherit;
  padding: 0.55rem 0.8rem;
  border: 0;
  outline: none;
}
.signup-input::placeholder { color: var(--color-ink-faint); }
.signup-button {
  flex: 0 0 auto;
  background: var(--color-pink);
  color: #ffffff;
  font: inherit;
  font-weight: 600;
  padding: 0.55rem 1rem;
  border: 0;
  border-radius: 0.35rem;
  cursor: pointer;
  transition: opacity 120ms;
}
.signup-button:hover { opacity: 0.9; }
.signup-form.loading .signup-button { opacity: 0.6; cursor: default; }
.signup-msg { display: none; margin: 0.6rem 0 0; font-size: var(--text-sm); }
/* The one thing on the page after a signup -- make it read from across the room. */
.signup-ok { color: var(--color-green); font-weight: 700; font-size: var(--text-xl); margin-top: 0.25rem; }
/* The bit people miss: the magic link still has to be clicked, and it lands
   in junk often enough to be worth saying out loud. Shown with .signup-ok. */
.signup-confirm { color: var(--color-ink-soft); max-width: 28rem; }
.signup-err { color: var(--color-berry); }
.signup-form.success .signup-row { display: none; }
.signup-form.success .signup-ok,
.signup-form.success .signup-confirm { display: block; }
.signup-form.error .signup-err { display: block; }

/* ---- the letters list -------------------------------------------------- */
.letters { margin-top: 3.5rem; }
.letters-soon { color: var(--color-ink-soft); font-size: var(--text-lg); }
.letter-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--color-line);
}
.letter-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1.5rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--color-line);
}
.letter-list a { font-weight: 600; }
.letter-list time { color: var(--color-ink-faint); font-size: var(--text-sm); white-space: nowrap; }
.pagination {
  display: flex;
  justify-content: space-between;
  margin-top: 1.5rem;
  font-size: var(--text-sm);
}
.pagination a { color: var(--color-blue); }
.pagination .page-number { color: var(--color-ink-faint); }

/* ---- a letter's body: Ghost's editor output ---------------------------- */
.gh-content { color: var(--color-ink-soft); }
.gh-content > * + * { margin-top: 1.25em; }
.gh-content h2, .gh-content h3, .gh-content h4 {
  color: var(--color-ink);
  font-weight: 600;
  line-height: 1.25;
  margin-top: 2em;
}
.gh-content h2 { font-size: var(--text-xl); }
.gh-content h3 { font-size: var(--text-lg); }
.gh-content h4 { font-size: var(--text-base); }
.gh-content strong { color: var(--color-ink); }
.gh-content blockquote {
  margin: 0;
  padding-left: 1rem;
  border-left: 3px solid var(--color-blue);
  color: var(--color-ink-soft);
}
.gh-content hr { border: 0; border-top: 1px solid var(--color-line); margin: 2.5em 0; }
.gh-content pre {
  overflow-x: auto;
  padding: 1rem;
  border-radius: 0.5rem;
  background: color-mix(in srgb, var(--color-ink) 10%, var(--color-bg));
  font-size: var(--text-sm);
}
.gh-content code { font-size: 0.92em; }
/* Ghost's image / gallery / bookmark cards keep their own layout classes;
   "wide" and "full" images just fill the reading measure here. */
.gh-content figure { margin: 2em 0; }
.gh-content figure img { display: block; width: 100%; }
.gh-content figcaption {
  margin-top: 0.5rem;
  color: var(--color-ink-faint);
  font-size: var(--text-sm);
}
.gh-content .kg-width-wide, .gh-content .kg-width-full { max-width: 100%; }

/* ---- utilities --------------------------------------------------------- */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: absolute;
  left: 1rem;
  top: -100%;
  z-index: 50;
  padding: 0.5rem 0.9rem;
  background: var(--color-blue);
  color: #ffffff;
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: 0 0 0.25rem 0.25rem;
}
.skip-link:focus { top: 0; outline: 2px solid #ffffff; outline-offset: -4px; }

@media (max-width: 40rem) {
  .signup-row { flex-direction: column; gap: 3px; }
  .signup-button { width: 100%; }
}
