/* Café Siller. A clean editorial reading site in blues.
   Palette named from the subject: ink on paper, with the blue of a sharpened pencil, a night sky and a clear day.
   Headline Source Serif 4 (crisp, modern, built for screens), UI and cards Public Sans (plain, sturdy).
   Essays are set in Source Serif 4 for long reading. */

:root {
  --paper: #FFFFFF;           /* page */
  --mist: #F1F5FB;            /* very light blue-grey surface */
  --frost: #E1EBF8;           /* tint for chips, quotes, code */
  --ink: #0B1F3A;             /* deep navy, all primary text */
  --ink-soft: #27406B;        /* secondary text, still clearly blue */
  --cobalt: #1D5FD1;          /* the one action colour */
  --cobalt-deep: #174BA8;     /* pressed */
  --cobalt-lit: #2467DB;      /* hover */
  --ice: #C9DBF5;            /* light blue for text on navy */
  --night: #0B1F3A;           /* navy surfaces */
  --night-lift: #12305A;      /* raised navy */

  --line: rgba(11, 31, 58, 0.13);
  --line-soft: rgba(11, 31, 58, 0.07);
  --shadow-card: 0 1px 2px rgba(11, 31, 58, 0.08), 0 8px 24px -12px rgba(11, 31, 58, 0.22);
  --shadow-lift: 0 2px 4px rgba(11, 31, 58, 0.1), 0 18px 36px -16px rgba(11, 31, 58, 0.35);

  --font-display: "Source Serif 4", "Georgia", "Times New Roman", serif;
  --font-ui: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-read: "Source Serif 4", "Georgia", "Times New Roman", serif;

  --r-card: 14px;
  --r-ctl: 8px;
  --measure: 66ch;
  --gutter: 1.25rem;
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --smooth: cubic-bezier(0.2, 0.8, 0.2, 1);

  --sec: #1D5FD1;
  --sec-tint: #E1EBF8;
}

/* Section colours: a range of blues, each AA on white and on its own tint. */
.sec--everyday-life { --sec: #1D5FD1; --sec-tint: #E1EBF8; }
.sec--mental-models { --sec: #0B6585; --sec-tint: #DDF0F7; }
.sec--body-and-mind { --sec: #2A5C9E; --sec-tint: #E3ECF7; }
.sec--thinkers      { --sec: #1F4A8C; --sec-tint: #DEE7F5; }
.sec--therapies     { --sec: #086F8A; --sec-tint: #D9F1F6; }
.sec--philosophy    { --sec: #34469A; --sec-tint: #E2E6F7; }

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

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

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-x: hidden;
}

img, svg { max-width: 100%; }

a { color: var(--cobalt); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--cobalt-deep); text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 3px; border-radius: 3px; }

.skip {
  position: absolute; left: var(--gutter); top: -4rem; z-index: 20;
  padding: 0.75rem 1rem; background: var(--ink); color: #fff;
  font-weight: 600;
}
.skip:focus { top: 0.5rem; }

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

.masthead { padding: 0 var(--gutter); background: var(--paper); border-bottom: 1px solid var(--line); }
.masthead__inner {
  max-width: 72rem; margin: 0 auto;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 1.5rem;
  padding: 0.35rem 0;
}
.masthead__name {
  min-height: 44px; display: inline-flex; align-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; line-height: 1.2;
  letter-spacing: -0.015em; color: var(--ink); text-decoration: none;
}
.masthead__name:hover { color: var(--cobalt); }
.masthead__mark { display: block; width: 40px; height: 40px; border-radius: 10px; transition: transform 0.2s var(--smooth); }
.masthead__name:hover .masthead__mark { transform: translateY(-1px); }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

.nav { display: flex; flex-wrap: wrap; gap: 0 0.25rem; margin: 0 -0.75rem; }
.nav__link {
  position: relative; display: inline-flex; align-items: center; min-height: 44px; padding: 0 0.75rem;
  font-weight: 500; font-size: 1rem; color: var(--ink); text-decoration: none;
}
.nav__link::after {
  content: ""; position: absolute; left: 0.75rem; right: 0.75rem; bottom: 6px; height: 2px; border-radius: 2px;
  background: var(--cobalt); transform: scaleX(0); transform-origin: left; transition: transform 0.25s var(--smooth);
}
.nav__link:hover { color: var(--cobalt); }
.nav__link:hover::after, .nav__link[aria-current="page"]::after { transform: scaleX(1); }

.nav__more { position: relative; }
.nav__summary { cursor: pointer; list-style: none; }
.nav__summary::-webkit-details-marker { display: none; }
.nav__menu {
  position: absolute; right: 0; top: 100%; z-index: 10; min-width: 13rem; padding: 0.35rem;
  display: flex; flex-direction: column; background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r-ctl); box-shadow: var(--shadow-lift);
}

/* ---------- hero ---------- */

.hero {
  position: relative; overflow: hidden; padding: 2.25rem var(--gutter) 3rem;
  background: linear-gradient(180deg, #E4EEFB 0%, #F4F8FD 70%, var(--paper) 100%);
}
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(29, 95, 209, 0.22) 1.2px, transparent 1.6px);
  background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(115deg, #000 0%, transparent 55%);
          mask-image: linear-gradient(115deg, #000 0%, transparent 55%);
}
.hero__inner { position: relative; max-width: 72rem; margin: 0 auto; display: grid; gap: 2rem; }
.hero__title {
  margin: 0 0 1rem; max-width: 20ch;
  font-family: var(--font-display); font-weight: 700; font-size: 2.25rem; line-height: 1.08; letter-spacing: -0.025em;
  text-wrap: balance;
}
.hero__lede { margin: 0 0 1.5rem; max-width: 36ch; font-size: 1.1875rem; line-height: 1.5; color: var(--ink-soft); }

.trust { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.25rem; }
.trust__item { display: flex; align-items: center; gap: 0.6rem; font-weight: 500; font-size: 1rem; line-height: 1.4; min-height: 28px; }
.trust__icon { flex: 0 0 auto; width: 20px; height: 20px; color: var(--cobalt); }

/* ---------- sign-up (hero and footer share it) ---------- */

.signup {
  max-width: 34rem; padding: 1.5rem 1.25rem 1.25rem;
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow-lift);
}
.signup__title { margin: 0 0 0.25rem; font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; line-height: 1.2; letter-spacing: -0.015em; }
.signup__lede { margin: 0 0 1.1rem; font-size: 1rem; line-height: 1.5; color: var(--ink-soft); }
.signup__label { display: block; margin-bottom: 0.35rem; font-weight: 600; font-size: 0.9375rem; }
.signup__row { display: flex; flex-direction: column; gap: 0.6rem; }
.signup__input {
  width: 100%; min-height: 48px; padding: 0 0.9rem;
  border: 1px solid rgba(11, 31, 58, 0.5); border-radius: var(--r-ctl);
  background: #fff; color: var(--ink); font-family: var(--font-ui); font-size: 1rem;
  transition: border-color 0.2s var(--smooth), box-shadow 0.2s var(--smooth);
}
.signup__input::placeholder { color: #4A5F82; opacity: 1; }
.signup__input:hover { border-color: var(--cobalt); }
.signup__input:focus-visible { outline: 0; border-color: var(--cobalt); box-shadow: 0 0 0 4px rgba(29, 95, 209, 0.28); }
.signup__input:user-invalid { border-color: #A3201A; box-shadow: 0 0 0 3px rgba(163, 32, 26, 0.18); }
.signup__trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.signup__consent { margin: 0.75rem 0 0; font-size: 0.875rem; line-height: 1.5; color: var(--ink-soft); }
.signup__note { margin: 0.75rem 0 0; padding: 0.6rem 0.8rem; background: #FBE5E3; border: 1px solid #A3201A; border-radius: var(--r-ctl); font-size: 0.9375rem; color: #5E1410; }
.signup__note[hidden] { display: none; }

/* ---------- buttons and links ---------- */

.button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 1.4rem;
  border: 0; border-radius: var(--r-ctl);
  background: var(--cobalt); color: #fff;
  font-family: var(--font-ui); font-weight: 600; font-size: 1rem; text-decoration: none; white-space: nowrap;
  cursor: pointer; box-shadow: 0 3px 0 var(--cobalt-deep), 0 8px 16px -8px rgba(23, 75, 168, 0.6);
  transition: background-color 0.15s var(--smooth), box-shadow 0.2s var(--spring), transform 0.2s var(--spring);
}
.button:hover { background: var(--cobalt-lit); color: #fff; transform: translateY(-1px); }
.button:active { transform: translateY(3px); box-shadow: 0 0 0 var(--cobalt-deep), 0 2px 6px -2px rgba(23, 75, 168, 0.6); background: var(--cobalt-deep); }
.button[aria-busy="true"] { cursor: progress; background: var(--cobalt-deep); }

.textlink {
  display: inline-flex; align-items: center; min-height: 44px;
  font-weight: 600; font-size: 1rem;
}

/* ---------- blocks ---------- */

.block { padding: 2.75rem var(--gutter) 3rem; }
.block--tight { padding-top: 1.5rem; }
.block__inner { max-width: 72rem; margin: 0 auto; }
.block__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 1.5rem; margin-bottom: 1.25rem; }
.block__title { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 1.75rem; line-height: 1.15; letter-spacing: -0.02em; }
.block__lede { margin: 0; font-size: 1.0625rem; }

.block--deep { background: var(--night); color: #fff; }
.block--deep .block__lede { color: var(--ice); }

/* ---------- essay entries: the one list component ---------- */

.entries { list-style: none; margin: 0; padding: 0; }
.entries__empty { margin: 1rem 0; font-family: var(--font-display); font-size: 1.375rem; line-height: 1.4; }
.entry { margin: 0; }
.entry__link {
  display: flex; flex-direction: column; gap: 0.35rem; height: 100%;
  color: var(--ink); text-decoration: none;
}
.entry__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.75rem; font-size: 0.875rem; font-weight: 500; color: var(--ink-soft); }
.entry__meta time { font-variant-numeric: tabular-nums; }
.entry__title { font-family: var(--font-display); font-weight: 700; font-size: 1.3125rem; line-height: 1.22; letter-spacing: -0.015em; text-wrap: balance; }
.entry__desc { font-size: 1rem; line-height: 1.55; color: var(--ink-soft); }
.entry__more { margin-top: auto; padding-top: 0.35rem; font-size: 0.9375rem; font-weight: 600; color: var(--cobalt); }

.chip {
  display: inline-flex; align-items: center; min-height: 26px; padding: 0 0.65rem; border-radius: 99px;
  background: var(--sec-tint); color: var(--sec);
  font-size: 0.8125rem; font-weight: 600; line-height: 1;
}

/* cards: latest articles */
.entries--cards { display: grid; gap: 1rem; }
.entries--cards .entry__link {
  padding: 1.25rem; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s var(--smooth), background-color 0.2s var(--smooth);
}
.entries--cards .entry__link:hover { border-color: rgba(29, 95, 209, 0.55); background: var(--mist); }
.entries--cards .entry__link:hover .entry__title { color: var(--cobalt-deep); }

/* rows: essays index, section pages */
.entries--rows { max-width: 52rem; }
.entries--rows .entry { border-bottom: 1px solid var(--line); }
.entries--rows .entry:first-child { border-top: 1px solid var(--line); }
.entries--rows .entry__link { padding: 1.1rem 0.75rem; margin: 0 -0.75rem; border-radius: var(--r-ctl); transition: background-color 0.18s var(--smooth); }
.entries--rows .entry__link:hover { background: var(--mist); }
.entries--rows .entry__link:hover .entry__title { color: var(--cobalt-deep); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.15em; }

/* ranked: start here, on navy */
.entries--ranked { display: grid; gap: 1rem; counter-reset: rank; }
.entries--ranked .entry { counter-increment: rank; }
.entries--ranked .entry__link {
  position: relative; padding: 1.25rem 1.25rem 1.25rem 4.25rem; background: var(--paper); border-radius: var(--r-card);
  box-shadow: 0 14px 28px -16px rgba(0, 0, 0, 0.55);
  transition: transform 0.25s var(--smooth);
}
.entries--ranked .entry__link::before {
  content: counter(rank); position: absolute; left: 1.1rem; top: 0.95rem;
  font-family: var(--font-display); font-weight: 700; font-size: 2.5rem; line-height: 1; font-variant-numeric: lining-nums tabular-nums;
  color: var(--cobalt);
}
.entries--ranked .entry__link:hover { transform: translateY(-3px); }

/* ---------- topics (one block per non-empty section) ---------- */

.topics { display: grid; gap: 1rem; }
.topic { display: flex; flex-direction: column; gap: 0.35rem; min-height: 44px; padding: 1.25rem; background: var(--sec-tint); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow-card); color: var(--ink); text-decoration: none; transition: transform 0.18s var(--smooth), border-color 0.18s var(--smooth); }
.topic:hover { transform: translateY(-3px); border-color: var(--sec); }
.topic__title { font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; line-height: 1.2; letter-spacing: -0.015em; }
.topic:hover .topic__title { color: var(--sec); text-decoration: underline; text-underline-offset: 0.15em; }
.topic__blurb { max-width: 60ch; text-wrap: pretty; font-size: 1rem; line-height: 1.5; }
.topic__count { margin-top: auto; padding-top: 0.5rem; font-weight: 600; font-size: 1rem; color: var(--sec); }

/* ---------- page head and plain pages ---------- */

.pagehead { padding: 2.25rem var(--gutter) 1.75rem; background: linear-gradient(180deg, #E8F0FB 0%, var(--paper) 100%); }
.pagehead.sec { background: linear-gradient(180deg, var(--sec-tint) 0%, var(--paper) 100%); }
.pagehead__inner { max-width: 52rem; margin: 0 auto; }
.pagehead__crumb { margin: 0 0 0.25rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0 0.5rem; font-size: 0.9375rem; font-weight: 500; }
.pagehead__title { margin: 0 0 0.75rem; font-family: var(--font-display); font-weight: 700; font-size: 2.25rem; line-height: 1.1; letter-spacing: -0.025em; text-wrap: balance; }
.pagehead__lede { margin: 0 0 1rem; max-width: 52ch; font-size: 1.125rem; line-height: 1.55; color: var(--ink-soft); }
.pagehead__actions { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.5rem; }

.plain { padding: 1rem var(--gutter) 3.5rem; }
.plain__inner { max-width: 52rem; margin: 0 auto; }
.plain__inner.prose > * { max-width: var(--measure); }
.plain__inner.prose > .facts { max-width: 40rem; }

/* ---------- prose (essays, about, privacy) ---------- */

.prose { max-width: var(--measure); font-family: var(--font-read); font-size: 1.1875rem; line-height: 1.72; }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol, .prose dl { margin: 0 0 1.3rem; }
.prose h2 { margin: 2.5rem 0 0.75rem; font-family: var(--font-display); font-weight: 700; font-size: 1.625rem; line-height: 1.2; letter-spacing: -0.02em; text-wrap: balance; }
.prose h3 { margin: 2rem 0 0.5rem; font-family: var(--font-display); font-weight: 700; font-size: 1.3125rem; line-height: 1.25; }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li { margin-bottom: 0.45rem; padding-left: 0.2rem; }
.prose li::marker { color: var(--cobalt); font-weight: 600; }
.prose blockquote {
  margin: 1.75rem 0; padding: 1.1rem 1.4rem; background: var(--mist); border-radius: var(--r-card);
  box-shadow: inset 0 0 0 1px var(--line);
  font-style: italic; font-size: 1.25rem; line-height: 1.5;
}
.prose blockquote p { margin: 0; }
.prose strong { font-weight: 700; }
.prose hr { border: 0; height: 1px; background: var(--line); margin: 2.5rem 0; }
.prose table { width: 100%; border-collapse: collapse; margin: 0 0 1.3rem; font-family: var(--font-ui); font-size: 1rem; }
.prose th, .prose td { padding: 0.55rem 0.6rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.prose th { font-weight: 600; }
.prose code { font-size: 0.9em; background: var(--frost); padding: 0.1em 0.35em; border-radius: 4px; overflow-wrap: anywhere; }
.prose a { overflow-wrap: anywhere; }

/* ---------- label / value rows ---------- */

.facts { margin: 1.5rem 0 1.75rem; padding: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; box-shadow: var(--shadow-card); font-family: var(--font-ui); }
.facts__row { display: grid; grid-template-columns: 1fr; gap: 0.1rem; padding: 0.9rem 1.1rem; border-bottom: 1px solid var(--line-soft); }
.facts__row:nth-child(odd) { background: var(--mist); }
.facts__row:last-child { border-bottom: 0; }
.facts__key { font-weight: 700; font-size: 0.9375rem; color: var(--cobalt-deep); }
.facts__value { margin: 0; font-size: 1rem; line-height: 1.5; color: var(--ink); }

/* ---------- essay ---------- */

.essay { padding: 1.75rem var(--gutter) 3.5rem; }
.essay__head, .essay__body, .essay__note { max-width: var(--measure); margin-left: auto; margin-right: auto; }
.essay__head { padding-bottom: 1.25rem; margin-bottom: 1.5rem; border-bottom: 1px solid var(--line); }
.essay__meta { margin: 0 0 0.5rem; font-size: 0.9375rem; font-weight: 500; display: flex; flex-wrap: wrap; align-items: center; gap: 0 0.5rem; }
.essay__meta time { font-variant-numeric: tabular-nums; }
.essay__title { margin: 0 0 0.75rem; font-family: var(--font-display); font-weight: 700; font-size: 2.125rem; line-height: 1.12; letter-spacing: -0.025em; text-wrap: balance; }
.essay__byline { margin: 0; font-size: 1rem; color: var(--ink-soft); }
.essay__note { max-width: var(--measure); margin-top: 2.5rem; padding: 1rem 1.25rem; background: var(--mist); box-shadow: inset 0 0 0 1px var(--line); border-radius: var(--r-card); font-size: 1rem; line-height: 1.6; }

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

.footer { background: var(--night); color: #fff; }
.footer__inner { max-width: 72rem; margin: 0 auto; padding: 2.75rem var(--gutter) 1.75rem; }
.footer .signup { box-shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.6); }
.footer__base { display: grid; gap: 0.5rem; margin-top: 2.25rem; padding-top: 1.25rem; border-top: 1px solid rgba(201, 219, 245, 0.25); }
.footer__line { margin: 0; font-size: 0.9375rem; line-height: 1.5; color: var(--ice); }
.footer__nav { display: flex; flex-wrap: wrap; gap: 0 1.25rem; }
.footer__link { display: inline-flex; align-items: center; min-height: 44px; font-weight: 500; font-size: 1rem; color: #fff; }
.footer__link:hover { color: var(--ice); }
.footer :focus-visible { outline-color: #fff; }

/* ---------- wider screens: re-composed, not squeezed ---------- */

@media (min-width: 40em) {
  .entries--cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .entries--ranked { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .entries--ranked .entry__link { padding: 4.25rem 1.25rem 1.25rem; }
  .entries--ranked .entry__link::before { top: 1rem; left: 1.25rem; font-size: 2.75rem; }
  .signup__row { flex-direction: row; }
  .signup__input { flex: 1 1 auto; min-width: 0; }
  .signup__row .button { flex: 0 0 auto; }
  .facts__row { grid-template-columns: 11rem 1fr; gap: 1rem; align-items: baseline; }
}

@media (min-width: 48em) {
  :root { --gutter: 2rem; }
  .masthead__name { font-size: 1.75rem; }
  .hero { padding: 3.5rem var(--gutter) 3.5rem; }
  .hero__inner { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 3.5rem; align-items: center; }
  .hero__title { font-size: 3.25rem; }
  .signup--hero { justify-self: end; width: 100%; }
  .signup--hero .signup__row { flex-direction: column; }
  .block { padding: 3.5rem var(--gutter) 4rem; }
  .block__title { font-size: 2.125rem; }
  .pagehead { padding-top: 3.5rem; padding-bottom: 2.25rem; }
  .pagehead__title { font-size: 3rem; }
  .essay { padding-top: 2.75rem; }
  .essay__title { font-size: 2.75rem; }
  .prose h2 { font-size: 1.875rem; }
  .footer__base { grid-template-columns: 1fr auto; align-items: center; gap: 0.25rem 1.5rem; }
  .footer__base .footer__nav { grid-column: 1 / -1; grid-row: 2; }
}

@media (min-width: 64em) {
  .entries--cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .topics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topic:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .hero__title { font-size: 3.75rem; }
  .prose { font-size: 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  .button:hover, .button:active, .entries--ranked .entry__link:hover { transform: none; }
}
