/*
  Shared chrome for every PixelFiftyFive public page.

  This file owns *structure* — layout, rhythm, type scale, component shapes — and nothing else.
  Colour and typeface come from a per-project stylesheet in assets/projects/, loaded after this
  one, which sets the custom properties below. That split is the whole point: a second project
  drops in its own palette without touching a line of shared CSS, and a fix to the reading column
  reaches every project at once.

  Defaults here are deliberately neutral (system font, greyscale) so a project that forgets its
  own stylesheet still renders a legible page rather than an unstyled one.
*/

:root {
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: var(--font-body);

  --surface: #ffffff;
  --surface-sunken: #f4f4f4;
  --surface-raised: #ffffff;
  --on-surface: #1a1a1a;
  --on-surface-muted: #555555;
  --outline: #d8d8d8;
  --accent: #1a1a1a;
  --on-accent: #ffffff;
  --accent-quiet: #f0f0f0;

  --radius-sm: 0.5rem;
  --radius: 1rem;
  --radius-lg: 1.5rem;

  --measure: 38rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --surface: #121212;
    --surface-sunken: #1a1a1a;
    --surface-raised: #1e1e1e;
    --on-surface: #ececec;
    --on-surface-muted: #a8a8a8;
    --outline: #333333;
    --accent: #ececec;
    --on-accent: #121212;
    --accent-quiet: #242424;
  }
}

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

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

body {
  margin: 0;
  padding: 0;
  background: var(--surface);
  color: var(--on-surface);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

@media (min-width: 48rem) {
  .page {
    padding: 4rem 2rem 6rem;
  }
}

/* ---------- masthead ---------- */

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-bottom: 1.5rem;
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--outline);
}

.masthead__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
  color: var(--on-surface);
  text-decoration: none;
}

.masthead__brand:hover {
  color: var(--accent);
}

.masthead__mark {
  width: 1.75rem;
  height: 1.75rem;
  flex: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--on-accent);
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0;
}

/* ---------- language switcher ---------- */

.langs {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.2rem;
  border-radius: var(--radius-sm);
  background: var(--accent-quiet);
  font-size: 0.8125rem;
}

.langs a,
.langs span {
  padding: 0.2rem 0.6rem;
  border-radius: calc(var(--radius-sm) - 0.2rem);
  text-decoration: none;
  color: var(--on-surface-muted);
}

.langs a:hover {
  color: var(--on-surface);
}

.langs [aria-current="true"] {
  background: var(--surface-raised);
  color: var(--on-surface);
  font-weight: 600;
}

/* ---------- type ---------- */

h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem;
}

@media (max-width: 30rem) {
  h1 {
    font-size: 1.625rem;
  }
}

h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin: 2.75rem 0 0.75rem;
}

h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  margin: 1.75rem 0 0.5rem;
}

p {
  margin: 0 0 1rem;
}

ul {
  margin: 0 0 1rem;
  padding-left: 1.15rem;
}

li {
  margin-bottom: 0.4rem;
}

li::marker {
  color: var(--accent);
}

a {
  color: var(--accent);
  text-underline-offset: 0.15em;
  text-decoration-thickness: 1px;
}

strong {
  font-weight: 600;
}

.lede {
  font-size: 1.0625rem;
  color: var(--on-surface-muted);
  margin-bottom: 2rem;
}

.effective {
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--on-surface-muted);
  margin: 0 0 2rem;
}

/* ---------- callout ---------- */

.callout {
  background: var(--surface-sunken);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 1rem 1.15rem;
  margin: 0 0 1.5rem;
}

.callout > :last-child {
  margin-bottom: 0;
}

/* ---------- link cards (hub pages) ---------- */

.cards {
  display: grid;
  gap: 0.75rem;
  margin: 2rem 0;
  padding: 0;
  list-style: none;
}

.card {
  display: block;
  padding: 1.15rem 1.25rem;
  border: 1px solid var(--outline);
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.card__title {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--on-surface);
  margin-bottom: 0.15rem;
}

.card__note {
  font-size: 0.9375rem;
  color: var(--on-surface-muted);
}

/* ---------- footer ---------- */

.footer {
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--outline);
  font-size: 0.9375rem;
  color: var(--on-surface-muted);
}

.footer p {
  margin-bottom: 0.5rem;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
