/*
  LiamBateman.net public site.
  One stylesheet, no JavaScript. Decisions are written down next to the rules
  they explain, so the next person to edit this knows why a thing is the way it is.
  The admin uses Tailwind separately; nothing here is loaded there.
*/

/* ---------- Type ----------
   Onest, self-hosted so reading a page doesn't send anyone's address to a
   third party. Variable weight, 400 to 600. Licence in app/assets/fonts/OFL.txt. */
@font-face {
  font-family: "Onest";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/assets/onest-latin-ext-44721fb9.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: "Onest";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/assets/onest-latin-9debe597.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;
}

/* ---------- Colour ----------
   Always dark, whatever the system setting. Warm charcoal, not black, with
   warm off-white ink and one amber. Amber does two jobs only: links, and the
   ring round the headshot. Placeholders get a neutral wash, never amber, so
   they can't be mistaken for links. */
:root {
  --paper: #1B1C1E;
  --ink: #E6E1D9;
  --muted: #A39D94;
  --rule: #33332F;
  --wash: #2A2A2B;          /* placeholder highlight */
  --link: #E9A54B;
  --link-line: rgba(233, 165, 75, .42);
  --ring: #E9A54B;          /* the amber of an old truck's clearance lamp */
  --code-bg: #232427;

  --measure: 60rem;         /* reading column */
  --wide: 81rem;            /* the intro is one long sentence, so it gets a wider measure */

  --sans: "Onest", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  color-scheme: dark;
}

/* Photos are dimmed a touch so they don't glare against the dark ground. */
.lexxy-content .attachment img, .pictures img { filter: brightness(.9); }

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.125rem;       /* 18px body, same as the pages this borrows from */
  line-height: 1.65;
  font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

p, ul, ol, dl, figure, blockquote, pre { margin: 0 0 1.1em; }
h1, h2, h3 { line-height: 1.25; font-weight: 600; margin: 0; text-wrap: balance; }
p { text-wrap: pretty; }
img { max-width: 100%; height: auto; display: block; }
strong, b { font-weight: 600; }

/* Links: amber, underlined, never a button. The underline sits low and thin
   so a paragraph full of links still reads as a paragraph. */
a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: var(--link-line);
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
  text-decoration-skip-ink: none;
}
a:hover { text-decoration-color: currentColor; }
a:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
  border-radius: 2px;
  text-decoration: none;
}

/* Placeholders: a bracketed figure or name is a stand-in until it is
   confirmed. A neutral wash makes them easy to find. */
.ph {
  background: var(--wash);
  border-radius: 3px;
  padding: 0 .22em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  color: inherit;
  font-weight: inherit;
}
a .ph { color: var(--link); }
a[href^="mailto"] { white-space: nowrap; }

.skip {
  position: absolute; left: -999px; top: 0;
  background: var(--ink); color: var(--paper); padding: .5rem .8rem; z-index: 2;
}
.skip:focus { left: 1rem; top: 1rem; }

/* ---------- Columns ---------- */
.col { max-width: var(--measure); margin: 0 auto; padding: 0 1.5rem; }
.col-wide { max-width: var(--wide); margin: 0 auto; padding: 0 1.5rem; }

/* ---------- Home: the intro ----------
   Photo, name, the warm line, then the table of contents.
   Centred on wide screens; left-aligned on phones, because centring reads
   well for a line or two, not for a whole wrapped paragraph. */
.intro {
  text-align: center;
  padding-top: 4.5rem;
  padding-bottom: 1rem;
}
.headshot {
  width: 112px; height: 112px;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 30%;
  margin: 0 auto 1.6rem;
  /* The signature: a thin amber ring with a gap of paper, like a lamp bezel.
     It is the only amber on the page that isn't a link. */
  box-shadow: 0 0 0 4px var(--paper), 0 0 0 6px var(--ring);
}
.name {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: .01em;
  margin-bottom: .55rem;
}
.hello {
  font-size: 2.05rem;
  line-height: 1.22;
  font-weight: 600;
  letter-spacing: -.018em;
  margin: 0 auto 1.3rem;
}
.hello .br { display: block; }

/* The identity sentence is a table of contents, so it stays quieter than
   the real links further down: grey text, grey underlines. */
.roles {
  font-size: 1.2rem;
  line-height: 1.6;
  color: var(--muted);
  margin: 0 auto;
  max-width: 69rem;
  text-wrap: balance;
}
.roles a {
  color: var(--muted);
  text-decoration-color: color-mix(in srgb, var(--muted) 45%, transparent);
}
.roles a:hover { color: var(--ink); text-decoration-color: currentColor; }
.roles .ph { color: inherit; }
/* A role split across two lines breaks its underline in half. On wide
   screens there's room to keep each one whole. */
@media (min-width: 48rem) {
  .roles a { white-space: nowrap; }
}

/* ---------- Sections ----------
   The home page is a run of headed sections. Each one sets its own column,
   so pictures can run wider than the text around them. */
.section { margin-top: 3.4rem; scroll-margin-top: 1.5rem; }
.section--lead, .section--closing { margin-top: 3rem; }
.section h2 {
  font-size: 1.35rem;
  letter-spacing: -.01em;
  margin-bottom: .55rem;
}
.section h2 .when {
  font-weight: 400;
  color: var(--muted);
  font-size: .95rem;
  letter-spacing: 0;
  margin-left: .35rem;
  font-variant-numeric: tabular-nums;
}

/* "Lately": dated titles, in the order they were written. */
.lately { list-style: none; padding: 0; margin: 0 0 1.1em; }
.lately li {
  display: grid;
  grid-template-columns: 6.2rem 1fr;
  gap: 0 1rem;
  padding: .28rem 0;
}
.lately time, .dates {
  color: var(--muted);
  font-size: .9rem;
  padding-top: .18rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tag {
  color: var(--muted);
  font-size: .85rem;
  white-space: nowrap;
}

/* ---------- Pictures ----------
   DHH ends with race photos; this ends with the wall and the garage.
   The photos are allowed a little wider than the text, and nothing else is. */
.pictures { max-width: 69rem; margin: 3.4rem auto 0; padding: 0 1.5rem; }
.pictures hr { border: 0; border-top: 1px solid var(--rule); margin: 0 0 1.6rem; }
.pictures figure { margin: 0 0 1rem; }
.pictures img { width: 100%; border-radius: 4px; }

/* ---------- Closing and footer ---------- */
/* A rule, the copyright on the left and the key pages on the right. On a
   phone the two halves stack. */
.foot {
  max-width: var(--measure);
  margin: 3.5rem auto 0;
  padding: 0 1.5rem 3rem;
  color: var(--muted);
  font-size: .9rem;
}
.foot hr { border: 0; border-top: 1px solid var(--rule); margin: 0 0 1.1rem; }
.foot-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .5rem 1.5rem; }
.foot .copyright { margin: 0; }
.foot-links { display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; }
.foot a[aria-current="page"] { color: var(--ink); text-decoration: none; }
.foot a { color: var(--muted); text-decoration-color: color-mix(in srgb, var(--muted) 45%, transparent); }
.foot a:hover { color: var(--ink); }
.foot a { white-space: nowrap; }

/* ---------- Inner pages ---------- */
/* The same photo and name as the home page, linking back to it. */
.masthead { text-align: center; padding-top: 3.5rem; }
.masthead-link { display: inline-block; color: var(--ink); text-decoration: none; }
.masthead-link .headshot { display: block; }
.masthead-link .name { display: block; margin-bottom: 0; }
.masthead-link:hover .name { text-decoration: underline; text-decoration-color: var(--rule); }

.page-head { padding-top: 2.4rem; }
.page-head h1 {
  font-size: 2.05rem;
  letter-spacing: -.018em;
  line-height: 1.2;
  margin-bottom: .9rem;
}
.page-head .standfirst { font-size: 1.2rem; color: var(--muted); line-height: 1.55; margin: 0; }

/* ---------- Forms: sign-in and password pages ----------
   Labels above the fields rather than placeholders, so they stay visible while
   typing. The button is ink on paper, not amber: amber is for links. */
.form { margin-top: 2rem; max-width: 28rem; }
/* The sign-in and password pages are a single short form, so they sit in the
   middle under the photo; the labels and fields inside stay left-aligned. */
.auth .page-head { text-align: center; }
.auth .form, .auth .flash { margin-left: auto; margin-right: auto; }
.auth .form-actions { justify-content: center; }
.auth .button { width: 100%; }
.field { margin-bottom: 1.2rem; }
.field label { display: block; font-size: .95rem; color: var(--muted); margin-bottom: .4rem; }
.field input {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--code-bg);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: .65rem .8rem;
}
.field input:focus { outline: 2px solid var(--link); outline-offset: 1px; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem 1.4rem; margin-top: 1.6rem; }
.button {
  font: inherit;
  font-weight: 600;
  color: var(--paper);
  background: var(--ink);
  border: 0;
  border-radius: 6px;
  padding: .65rem 1.3rem;
  cursor: pointer;
}
.button:hover { background: color-mix(in srgb, var(--ink) 85%, var(--paper)); }
.button:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; }
.flash { margin: 1.6rem 0 0; max-width: 28rem; padding: .7rem .9rem; border-radius: 6px; background: var(--wash); }
.flash--alert { border-left: 3px solid #E5735C; }
.flash--notice { border-left: 3px solid var(--link); }

/* ---------- Writing index ---------- */
.year {
  font-size: 1rem;
  color: var(--muted);
  font-weight: 600;
  margin: 2.6rem 0 .4rem;
  font-variant-numeric: tabular-nums;
}
.posts { list-style: none; padding: 0; margin: 0; }
.posts li {
  display: grid;
  grid-template-columns: 5.2rem 1fr;
  gap: 0 1rem;
  padding: .55rem 0;
}
.posts .t { font-weight: 500; }
.posts .line { display: block; color: var(--muted); font-size: 1rem; line-height: 1.5; margin-top: .1rem; }
.posts .d { color: var(--muted); font-size: .9rem; padding-top: .2rem; line-height: 1.4; }
.posts .d time, .posts .d .tag { display: block; white-space: nowrap; font-variant-numeric: tabular-nums; }
.posts .d .tag { font-size: .82rem; margin-top: .15rem; }
.empty { color: var(--muted); }

/* ---------- Article ---------- */
.article-head { padding-top: 2.4rem; }
.article-head .back { font-size: .95rem; margin-bottom: .6rem; }
.article-head .back a { color: var(--muted); text-decoration-color: color-mix(in srgb, var(--muted) 45%, transparent); }
.article-head .back a:hover { color: var(--ink); }
.article-head .meta { color: var(--muted); font-size: .95rem; margin-bottom: 1rem; }
.article-head h1 { font-size: 2.2rem; letter-spacing: -.02em; line-height: 1.15; margin-bottom: .7rem; }
.prose { font-size: 1.16rem; line-height: 1.68; }
.byline {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 0 1rem;
  align-items: start;
  margin-top: 3rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--rule);
  font-size: 1rem;
}
.byline img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; object-position: 50% 30%; }
.byline p { margin: 0 0 .4rem; }
.byline p:last-child { margin-bottom: 0; }
.byline .who { font-weight: 600; }
.next { margin-top: 1.8rem; }
.next p { margin: 0 0 .6rem; }

/* ---------- Rich text from the admin ----------
   Posts are written in Lexxy, which produces plain semantic HTML: p, h2 to
   h4, lists, blockquote, pre, tables and figures for attachments. These
   rules set that HTML in the house style. */
.lexxy-content > * { margin: 0 0 1.1em; }
.lexxy-content > :last-child { margin-bottom: 0; }
/* Posts written in the old editor use h1 for subheadings. They get the
   same size as h2 so nothing in a post outranks its title. */
.lexxy-content :is(h1, h2) { font-size: 1.3rem; letter-spacing: -.01em; margin: 2.4rem 0 .6rem; }
.lexxy-content h3 { font-size: 1.05rem; margin: 1.5rem 0 .35rem; }
.lexxy-content h4 { font-size: 1rem; margin: 1.2rem 0 .3rem; }
.lexxy-content :is(h1, h2, h3, h4):first-child { margin-top: 0; }

/* Short lists: plain, with a thin en-rule marker instead of bullets.
   .list is the same thing for lists written by hand in a view. */
.lexxy-content ul, .list { list-style: none; padding: 0; }
:is(.lexxy-content ul, .list) li { position: relative; padding-left: 1.2rem; margin-bottom: .35rem; }
:is(.lexxy-content ul, .list) li::before {
  content: ""; position: absolute; left: 0; top: .82em;
  width: .55rem; height: 1px; background: var(--muted);
}
/* Numbered lists: numbers as text, not badges. */
.lexxy-content ol { padding-left: 1.4rem; }
.lexxy-content ol li { margin-bottom: .45rem; padding-left: .2rem; }
.lexxy-content ol li::marker { color: var(--muted); font-variant-numeric: tabular-nums; }
.lexxy-content li > :is(ul, ol) { margin: .35rem 0 0; }

.lexxy-content blockquote {
  padding: 0 0 0 1.2rem;
  border-left: 2px solid var(--ink);
  font-size: 1.2rem;
  line-height: 1.5;
  font-weight: 500;
  letter-spacing: -.01em;
}
.prose .lexxy-content blockquote { margin: 2rem 0; font-size: 1.35rem; line-height: 1.45; }

.lexxy-content code {
  font-family: var(--mono);
  font-size: .86em;
  background: var(--code-bg);
  border-radius: 3px;
  padding: .08em .3em;
}
.lexxy-content pre {
  font-family: var(--mono);
  background: var(--code-bg);
  color: color-mix(in srgb, var(--ink) 78%, var(--paper));
  border-radius: 4px;
  padding: 1.1rem 1.2rem;
  overflow-x: auto;
  white-space: pre;
  font-size: .9rem;
  line-height: 1.6;
}
.prose .lexxy-content pre { margin: 1.4rem 0 1.5rem; }
.lexxy-content pre code { background: none; padding: 0; font-size: inherit; }

.lexxy-content hr { border: 0; border-top: 1px solid var(--rule); margin: 2rem 0; }
.lexxy-content table { border-collapse: collapse; width: 100%; font-size: 1rem; }
.lexxy-content :is(th, td) { text-align: left; vertical-align: top; padding: .5rem .8rem .5rem 0; border-top: 1px solid var(--rule); }
.lexxy-content th { font-weight: 600; }

.lexxy-content .attachment { margin: 2rem 0; }
.lexxy-content .attachment img { border-radius: 4px; }
.lexxy-content .attachment__caption { color: var(--muted); font-size: .92rem; margin-top: .55rem; line-height: 1.5; }
.lexxy-content .attachment__size { margin-left: .4rem; }
.lexxy-content .attachment-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 1rem; margin: 2rem 0; }
.lexxy-content .attachment-gallery .attachment { margin: 0; }

/* ---------- Phones ---------- */
@media (max-width: 40rem) {
  body { font-size: 1.0625rem; }
  .col, .col-wide, .pictures { padding: 0 1.25rem; }
  .intro { text-align: left; padding-top: 2.6rem; }
  .headshot { width: 88px; height: 88px; margin: 0 0 1.3rem 5px; }
  .hello { font-size: 1.62rem; }
  .hello .br { display: inline; }
  .roles { font-size: 1.08rem; }
  .section--lead { margin-top: 2.2rem; }
  .section { margin-top: 2.8rem; }
  .lately li { grid-template-columns: 1fr; }
  .lately time { padding-top: 0; font-size: .85rem; }
  .posts li { grid-template-columns: 1fr; }
  .posts .d { padding-top: 0; font-size: .85rem; }
  .posts .d time, .posts .d .tag { display: inline; font-size: .85rem; }
  .posts .d .tag::before { content: "\00B7"; margin: 0 .4rem; }
  .page-head, .article-head { padding-top: 1.8rem; }
  .page-head h1 { font-size: 1.75rem; }
  .article-head h1 { font-size: 1.8rem; }
  .prose { font-size: 1.08rem; }
  .prose .lexxy-content blockquote { font-size: 1.2rem; }
  .masthead { text-align: left; padding-top: 2.6rem; }
  .foot { padding-left: 1.25rem; padding-right: 1.25rem; }
}
