/* ===============================================================
   Beautiful Economics
   "The plate" — a finely printed journal, set for the screen.

   Everything you are likely to change lives in :root below.
   Change --plot and --mark and the whole site changes with them.
   =============================================================== */

:root {
  /* ---- paper and ink ---- */
  --paper:      #F7F7F3;   /* page background */
  --paper-lift: #FDFDFB;   /* raised cards, quote boxes */
  --paper-sunk: #EFEFE9;   /* recessed bands */
  --rule:       #DADBD3;   /* hairlines */
  --rule-soft:  #E6E7E0;

  --ink:        #14191B;   /* body text */
  --ink-soft:   #4A565A;   /* secondary text */
  --ink-faint:  #7C878A;   /* captions, datelines */

  /* ---- the two accents. Change these two lines to re-colour the site. ---- */
  --plot:       #0E5B52;   /* deep teal: curves, links, focus */
  --mark:       #8C1A38;   /* deep crimson: annotation, only where it means something */
  --plot-wash:  #0E5B521f;

  /* ---- type ---- */
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --text:    "Newsreader", Georgia, "Times New Roman", serif;
  --mono:    "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* ---- measure and rhythm ---- */
  --measure: 36rem;        /* reading width */
  --wide:    74rem;        /* outer shell */
  --gutter:  1.5rem;
  --step:    clamp(3.4rem, 8vw, 6rem);   /* space between major bands */
}

@media (min-width: 48em) { :root { --gutter: 2.5rem; } }

/* ---------------------------------------------------------------
   Dark mode. Designed, not inverted: the paper becomes a deep
   blue-green slate and both accents are lifted so they still read.
   --------------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:      #0F1417;
    --paper-lift: #151B1F;
    --paper-sunk: #121819;
    --rule:       #263033;
    --rule-soft:  #1D2528;

    --ink:        #E9E6DE;
    --ink-soft:   #A3AFB2;
    --ink-faint:  #768286;

    --plot:       #58B9A9;
    --mark:       #E3879F;
    --plot-wash:  #58B9A922;
  }
}
:root[data-theme="dark"] {
  --paper:      #0F1417;
  --paper-lift: #151B1F;
  --paper-sunk: #121819;
  --rule:       #263033;
  --rule-soft:  #1D2528;
  --ink:        #E9E6DE;
  --ink-soft:   #A3AFB2;
  --ink-faint:  #768286;
  --plot:       #58B9A9;
  --mark:       #E3879F;
  --plot-wash:  #58B9A922;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.125rem;
  line-height: 1.7;
  font-weight: 400;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
@media (min-width: 46em) { body { font-size: 1.1875rem; } }

/* ---------------------------- layout -------------------------- */
.shell  { width: 100%; max-width: var(--wide); margin: 0 auto; padding: 0 var(--gutter); }
.column { width: 100%; max-width: var(--measure); }
.column-centred { margin-left: auto; margin-right: auto; }

/* ---------------------------- masthead ------------------------ */
.masthead { border-bottom: 1px solid var(--rule); background: var(--paper); }
.masthead__inner {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem 2rem; padding-block: 1.15rem; flex-wrap: wrap;
}
.wordmark {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: -0.014em;
  font-variation-settings: "SOFT" 0, "WONK" 1, "opsz" 14;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex; align-items: baseline; gap: .5rem;
}
.wordmark:hover { color: var(--plot); }
.wordmark__dot {
  width: .4rem; height: .4rem; border-radius: 50%;
  background: var(--mark); display: inline-block; flex: none;
  transform: translateY(-.12rem);
}
.masthead--home .wordmark__text { display: none; }
.masthead--home .masthead__inner { justify-content: flex-end; }
.masthead--home .wordmark { margin-right: auto; }

.nav { display: flex; gap: 1.5rem; align-items: baseline; flex-wrap: wrap; }
.nav a {
  font-family: var(--text);
  font-size: 1rem;
  color: var(--ink-soft);
  text-decoration: none;
  padding-bottom: 3px;
  border-bottom: 1px solid transparent;
  transition: color .18s ease, border-color .18s ease;
}
.nav a:hover, .nav a:focus-visible { color: var(--ink); border-bottom-color: var(--mark); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--plot); }
@media (max-width: 30em) {
  .nav { gap: 1rem; }
  .nav a { font-size: .9rem; }
}

/* ---------------------------- the cover ----------------------- */
.cover { padding: clamp(3rem, 9vw, 6.5rem) 0 clamp(2.5rem, 6vw, 4rem); }

.cover__rule {
  border: 0; height: 1px; background: var(--ink);
  max-width: 7rem; margin: 0 auto; opacity: .85;
}
.cover__rule--thin { max-width: 3rem; opacity: .4; margin-top: .3rem; }

.cover__title {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(2.9rem, 11.5vw, 7.25rem);
  line-height: .92;
  letter-spacing: -0.035em;
  font-variation-settings: "SOFT" 0, "WONK" 1, "opsz" 144;
  text-align: center;
  margin: 1.6rem auto 1.5rem;
  max-width: 14ch;
  text-wrap: balance;
}

.cover__lede {
  font-size: clamp(1.1rem, 2.4vw, 1.35rem);
  line-height: 1.55;
  color: var(--ink-soft);
  text-align: center;
  max-width: 34rem;
  margin: 0 auto;
  text-wrap: pretty;
}

.cover__actions {
  display: flex; flex-wrap: wrap; gap: 1rem 1.75rem;
  align-items: center; justify-content: center;
  margin-top: 2.2rem;
}

/* ---------------------------- the plate ----------------------- */
.plate { margin: clamp(2.8rem, 7vw, 4.5rem) auto 0; max-width: 46rem; }
.plate__label {
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .14em;
  color: var(--ink-faint);
  text-align: center;
  margin: 0 0 1rem;
}
.plate__frame {
  border: 1px solid var(--rule);
  background: var(--paper-lift);
  padding: 1.4rem 1rem 1.1rem;
}
@media (min-width: 40em) { .plate__frame { padding: 1.8rem 1.75rem 1.4rem; } }
.plate__caption {
  font-size: .95rem;
  text-wrap: balance;
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 1.1rem auto 0;
  max-width: 40rem;
  text-align: center;
  text-wrap: pretty;
}
.plate__caption b { font-weight: 600; color: var(--ink); }

/* ---------------------------- the chart ----------------------- */
.plot { width: 100%; height: auto; display: block; }
.plot text { font-family: var(--mono); font-size: 11px; fill: var(--ink-faint); }
.plot .plot__series { font-family: var(--text); font-size: 14px; font-weight: 500; }
.plot .plot__note   { font-family: var(--text); font-size: 12.5px; fill: var(--mark); font-weight: 500; }
.plot__axis  { stroke: var(--rule); stroke-width: 1; }
.plot__decay { fill: none; stroke: var(--mark); stroke-width: 2.25; stroke-linecap: round; }
.plot__flat  { fill: none; stroke: var(--plot); stroke-width: 2.25; stroke-linecap: round; }
.plot__under { fill: var(--plot-wash); }
.plot__dot   { fill: var(--mark); }
.plot__guide { stroke: var(--mark); stroke-width: 1; stroke-dasharray: 3 3; opacity: .5; }
.plot .series-mark { fill: var(--mark); }
.plot .series-plot { fill: var(--plot); }
.plot .axis-title  { font-family: var(--text); font-size: 12px; fill: var(--ink-faint); }

/* The chart scales with its container, so on a phone its labels would
   shrink below legibility. Raise them inside the viewBox instead, and drop
   the axis title, which the caption already says in words. */
@media (max-width: 46em) {
  .plot .axis-title { display: none; }
  .plot text { font-size: 15px; }
  .plot .plot__series { font-size: 17px; }
  .plot .plot__note { font-size: 16px; }
}

/* One orchestrated moment on load: the two curves draw themselves.
   Nothing else on the site animates on arrival. */
@media (prefers-reduced-motion: no-preference) {
  .plot__decay, .plot__flat {
    stroke-dasharray: 640; stroke-dashoffset: 640;
    animation: draw 1.7s cubic-bezier(.22,.61,.36,1) forwards;
  }
  .plot__flat { animation-delay: .4s; }
  .plot__dot, .plot__guide, .plot .plot__note, .plot .plot__series {
    opacity: 0; animation: surface .6s ease forwards 1.7s;
  }
  .plot__guide { animation-name: surface-guide; }
}
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes surface { to { opacity: 1; } }
@keyframes surface-guide { to { opacity: .5; } }

/* ---------------------------- buttons ------------------------- */
.button {
  display: inline-block;
  font-family: var(--text);
  font-size: 1.02rem;
  font-weight: 500;
  line-height: 1;
  padding: .95rem 1.6rem;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  border: 1px solid var(--ink);
  border-radius: 1px;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, color .18s ease;
}
.button:hover, .button:focus-visible {
  background: var(--plot); border-color: var(--plot); color: var(--paper-lift);
}

.textlink {
  font-family: var(--text);
  font-size: 1.02rem;
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 2px;
  transition: color .18s ease, border-color .18s ease;
}
.textlink:hover, .textlink:focus-visible { color: var(--ink); border-bottom-color: var(--mark); }

/* ---------------------------- bands --------------------------- */
.band { padding: var(--step) 0; border-top: 1px solid var(--rule); }
.band--sunk { background: var(--paper-sunk); }
.band--first { border-top: 0; }

.band__heading {
  font-family: var(--display);
  font-size: clamp(1.3rem, 2.6vw, 1.6rem);
  font-weight: 600;
  letter-spacing: -0.016em;
  font-variation-settings: "SOFT" 0, "WONK" 0, "opsz" 24;
  margin: 0 0 2.2rem;
  padding-bottom: .7rem;
  border-bottom: 1px solid var(--ink);
  display: inline-block;
}

/* ---------------------------- entries ------------------------- */
.entries { list-style: none; margin: 0; padding: 0; }
.entry { padding: 1.8rem 0; border-bottom: 1px solid var(--rule-soft); }
.entry:first-child { padding-top: 0; }
.entry:last-child { border-bottom: 0; padding-bottom: 0; }

@media (min-width: 48em) {
  .entry { display: grid; grid-template-columns: 8rem minmax(0,1fr); gap: 2rem; align-items: baseline; }
}

.entry__date {
  font-family: var(--mono); font-size: .76rem; color: var(--ink-faint);
  display: block; margin-bottom: .4rem;
}
@media (min-width: 48em) { .entry__date { margin-bottom: 0; padding-top: .6rem; } }

.entry__title {
  font-family: var(--display);
  font-size: clamp(1.25rem, 2.6vw, 1.5rem);
  font-weight: 600; line-height: 1.22; letter-spacing: -0.018em;
  font-variation-settings: "SOFT" 0, "WONK" 0, "opsz" 24;
  margin: 0 0 .45rem;
}
.entry__title a {
  color: var(--ink); text-decoration: none;
  background-image: linear-gradient(var(--mark), var(--mark));
  background-size: 0% 1px; background-repeat: no-repeat; background-position: 0 100%;
  transition: background-size .3s cubic-bezier(.22,.61,.36,1);
}
.entry__title a:hover, .entry__title a:focus-visible { background-size: 100% 1px; }
.entry__summary {
  margin: 0; color: var(--ink-soft); font-size: 1.02rem; line-height: 1.6;
  max-width: 56ch; text-wrap: pretty;
}

/* ---------------------------- concepts ------------------------ */
.concept-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; border-top: 1px solid var(--rule); }
@media (min-width: 40em) { .concept-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (min-width: 66em) { .concept-grid { grid-template-columns: repeat(3, minmax(0,1fr)); } }
.concept-grid li { border-bottom: 1px solid var(--rule); border-right: 1px solid var(--rule); }
.concept-grid a {
  display: block; text-decoration: none; color: inherit;
  padding: 1.5rem 1.5rem 1.65rem; height: 100%;
  transition: background .2s ease;
}
.concept-grid a:hover, .concept-grid a:focus-visible { background: var(--paper-lift); }
.concept-grid a:hover .concept-grid__term { color: var(--plot); }
.concept-grid__term {
  font-family: var(--display); font-weight: 600; font-size: 1.16rem;
  letter-spacing: -0.014em; display: block; margin-bottom: .4rem;
  font-variation-settings: "SOFT" 0, "WONK" 0, "opsz" 20;
  transition: color .18s ease;
}
.concept-grid__gloss { font-size: .98rem; line-height: 1.55; color: var(--ink-soft); display: block; text-wrap: pretty; }

/* ---------------------------- today --------------------------- */
.today {
  border-left: 2px solid var(--plot);
  padding: .4rem 0 .4rem 1.6rem;
  max-width: 44rem;
}
.today__kicker { font-family: var(--mono); font-size: .72rem; letter-spacing: .12em; color: var(--ink-faint); margin: 0 0 .7rem; }
.today__term {
  font-family: var(--display);
  font-size: clamp(1.6rem, 4vw, 2.1rem); font-weight: 600;
  letter-spacing: -0.024em; margin: 0 0 .6rem; line-height: 1.1;
  font-variation-settings: "SOFT" 0, "WONK" 1, "opsz" 36;
}
.today__term a { color: var(--ink); text-decoration: none; transition: color .18s ease; }
.today__term a:hover { color: var(--plot); }
.today__gloss { margin: 0; color: var(--ink-soft); font-size: 1.08rem; line-height: 1.55; max-width: 48ch; text-wrap: pretty; }

/* ---------------------------- articles ------------------------ */
/* A reading page is narrower than a listing page, and centred, so the
   text column, the sign-up band and "read next" all share one left edge
   instead of stranding the text against a wide empty margin. */
.reading .shell { max-width: 46rem; }
.reading .column { max-width: 100%; }

.article { padding: clamp(3rem, 7vw, 5rem) 0 1rem; }
.article__meta { font-family: var(--mono); font-size: .74rem; letter-spacing: .1em; color: var(--ink-faint); margin: 0 0 1.4rem; }
.article h1 {
  font-family: var(--display);
  font-size: clamp(2.1rem, 6.5vw, 3.4rem);
  font-weight: 600; line-height: 1.05; letter-spacing: -0.032em;
  font-variation-settings: "SOFT" 0, "WONK" 1, "opsz" 72;
  margin: 0 0 1.2rem; text-wrap: balance;
}
.article__standfirst {
  font-size: clamp(1.15rem, 2.4vw, 1.3rem); line-height: 1.5;
  color: var(--ink-soft); margin: 0 0 2.6rem;
  padding-bottom: 2rem; border-bottom: 1px solid var(--rule);
  text-wrap: pretty;
}

.prose > * + * { margin-top: 1.3em; }
.prose h2 {
  font-family: var(--display);
  font-size: clamp(1.4rem, 3vw, 1.7rem); font-weight: 600; line-height: 1.2;
  letter-spacing: -0.02em; margin-top: 2.6em; margin-bottom: -.3em;
  font-variation-settings: "SOFT" 0, "WONK" 0, "opsz" 28;
}
.prose h3 {
  font-family: var(--display); font-size: 1.2rem; font-weight: 600;
  margin-top: 2.2em; margin-bottom: -.45em;
}
.prose a {
  color: var(--ink); text-decoration: underline;
  text-decoration-color: var(--mark); text-underline-offset: 4px; text-decoration-thickness: 1px;
  transition: color .18s ease;
}
.prose a:hover { color: var(--mark); }
.prose strong { font-weight: 600; }
.prose blockquote {
  margin-left: 0; margin-right: 0; padding-left: 1.4rem;
  border-left: 2px solid var(--plot); color: var(--ink-soft); font-style: italic;
}
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li + li { margin-top: .5em; }
.prose li::marker { color: var(--ink-faint); }
.prose code {
  font-family: var(--mono); font-size: .86em;
  background: var(--paper-sunk); padding: .12em .4em; border-radius: 2px;
}
.prose img { max-width: 100%; height: auto; display: block; }
.prose figure { margin: 2.4rem 0; }
.prose figcaption { font-size: .88rem; color: var(--ink-faint); margin-top: .7rem; }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 3rem auto; max-width: 8rem; }

/* ---------------------------- subscribe ----------------------- */
.subscribe__heading {
  font-family: var(--display);
  font-size: clamp(1.6rem, 4.2vw, 2.3rem); font-weight: 600;
  line-height: 1.13; letter-spacing: -0.026em; margin: 0 0 1rem;
  max-width: 20ch; text-wrap: balance;
  font-variation-settings: "SOFT" 0, "WONK" 1, "opsz" 40;
}
.subscribe__body { color: var(--ink-soft); margin: 0 0 1.9rem; max-width: 46ch; font-size: 1.06rem; text-wrap: pretty; }

.signup { display: flex; flex-wrap: wrap; gap: .7rem; max-width: 30rem; }
.signup input[type="email"] {
  flex: 1 1 14rem; min-width: 0;
  font-family: var(--text); font-size: 1.05rem;
  padding: .9rem 1rem; color: var(--ink);
  background: var(--paper-lift);
  border: 1px solid var(--rule); border-radius: 1px;
}
.signup input[type="email"]::placeholder { color: var(--ink-faint); }
.signup input[type="email"]:focus-visible { outline: 2px solid var(--plot); outline-offset: 1px; border-color: var(--plot); }
.signup__note { font-size: .9rem; color: var(--ink-faint); margin: 1rem 0 0; }
.signup--pending {
  font-family: var(--mono); font-size: .82rem; line-height: 1.6; color: var(--mark);
  border: 1px dashed var(--mark); padding: 1rem 1.1rem; border-radius: 1px; max-width: 36rem;
}

/* ---------------------------- library ------------------------- */
.shelf { list-style: none; margin: 0; padding: 0; }
.shelf li { padding: 1.6rem 0; border-bottom: 1px solid var(--rule-soft); display: grid; gap: .4rem; }
.shelf li:first-child { padding-top: 0; }
.shelf__title { font-family: var(--display); font-size: 1.2rem; font-weight: 600; letter-spacing: -0.014em; margin: 0; }
.shelf__title a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--rule); transition: color .18s ease, border-color .18s ease; }
.shelf__title a:hover { color: var(--mark); border-bottom-color: var(--mark); }
.shelf__meta { font-family: var(--mono); font-size: .74rem; color: var(--ink-faint); }
.shelf__note { margin: 0; color: var(--ink-soft); font-size: 1rem; line-height: 1.6; max-width: 58ch; }

/* ---------------------------- footer -------------------------- */
.footer { padding: var(--step) 0 calc(var(--step) * .8); border-top: 1px solid var(--rule); font-size: .98rem; color: var(--ink-soft); }
.footer__mark {
  font-family: var(--display); font-size: 1.4rem; font-weight: 600;
  letter-spacing: -0.02em; color: var(--ink); margin: 0 0 1.4rem;
  font-variation-settings: "SOFT" 0, "WONK" 1, "opsz" 24;
}
.footer__links { display: flex; flex-wrap: wrap; gap: .6rem 1.8rem; margin: 0 0 1.8rem; padding: 0; list-style: none; }
.footer a { color: var(--ink-soft); text-decoration: none; border-bottom: 1px solid var(--rule); transition: color .18s ease, border-color .18s ease; }
.footer a:hover, .footer a:focus-visible { color: var(--ink); border-bottom-color: var(--mark); }
.footer__fine { color: var(--ink-faint); font-size: .88rem; margin: 0; max-width: 52ch; line-height: 1.6; }

/* ---------------------------- utilities ----------------------- */
.year-heading {
  font-family: var(--mono); font-size: .76rem; letter-spacing: .14em; color: var(--ink-faint);
  margin: 3rem 0 1.2rem; padding-bottom: .5rem; border-bottom: 1px solid var(--rule);
}
.year-heading:first-child { margin-top: 0; }

.page-title {
  font-family: var(--display);
  font-size: clamp(2.1rem, 6vw, 3.1rem); font-weight: 600;
  letter-spacing: -0.03em; line-height: 1.05; margin: 0 0 1rem;
  font-variation-settings: "SOFT" 0, "WONK" 1, "opsz" 60;
  text-wrap: balance;
}
.page-intro { color: var(--ink-soft); margin: 0; font-size: 1.1rem; max-width: 46rem; text-wrap: pretty; }
.page-head { margin-bottom: 3rem; }

.empty {
  font-size: 1rem; color: var(--ink-soft);
  border: 1px dashed var(--rule); padding: 1.4rem 1.5rem; border-radius: 1px; max-width: 44rem;
}

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: -9999px;
  background: var(--ink); color: var(--paper);
  padding: .8rem 1.1rem; font-size: .95rem; z-index: 50;
}
.skip:focus { left: 1rem; top: 1rem; }

:focus-visible { outline: 2px solid var(--plot); outline-offset: 3px; }

::selection { background: var(--plot-wash); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
