@tailwind base;
@tailwind components;
@tailwind utilities;

/* Tailwind is kept for its reset and for utility classes used in admin-authored
   snippets (exit modals, focus items). The site's own look lives in site.css
   and syntax.css, which load after this file. */
/* Beyond Abstraction: "Swiss" theme.
   Light mode is the colour-block look (blue masthead, yellow second accent).
   Dark mode is the ink look (black ground, white rules, a lighter blue).
   The theme is chosen by data-theme on <html>, set by layouts/_theme_head. */

:root {
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --gutter: clamp(20px, 4%, 48px);

  color-scheme: light;
  --bg: #ffffff;
  --fg: #0a0a0a;
  --dim: #595959;
  --accent: #1f3fff;
  --on-accent: #ffffff;
  --rule: #0a0a0a;
  --hairline: #d0d0d0;
  --chip: #ececec;
  --mast-bg: #1f3fff;
  --mast-fg: #ffffff;
  --mast-rule: 0px;
  --mark-bg: #ffd400;
  --mark-fg: #0a0a0a;
  --foot-rule: 0px;
  --code-bg: #0a0a0a;
  --code-fg: #f2f2f2;
  --code-line: #333333;
  --code-num: #8a8a8a;
  --tok-keyword: #ffd400;
  --tok-string: #9fe8b5;
  --tok-number: #ff9d7a;
  --tok-comment: #a3a3a3;
  --tok-name: #ffffff;
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0a0a0a;
  --fg: #f2f2f2;
  --dim: #a8a8a8;
  --accent: #8497ff;
  --on-accent: #0a0a0a;
  --rule: #f2f2f2;
  --hairline: #333333;
  --chip: #1f1f1f;
  --mast-bg: #0a0a0a;
  --mast-fg: #f2f2f2;
  --mast-rule: 6px;
  --mark-bg: #8497ff;
  --mark-fg: #0a0a0a;
  --foot-rule: 6px;
  --code-bg: #161616;
  --code-fg: #e8e8e8;
  --code-line: #333333;
  --code-num: #8a8a8a;
  --tok-keyword: #8497ff;
  --tok-string: #8fe3b0;
  --tok-number: #ffb86b;
  --tok-comment: #9a9a9a;
  --tok-name: #ffffff;
}

/* Without JavaScript nothing sets data-theme, so follow the system here. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #0a0a0a;
    --fg: #f2f2f2;
    --dim: #a8a8a8;
    --accent: #8497ff;
    --on-accent: #0a0a0a;
    --rule: #f2f2f2;
    --hairline: #333333;
    --chip: #1f1f1f;
    --mast-bg: #0a0a0a;
    --mast-fg: #f2f2f2;
    --mast-rule: 6px;
    --mark-bg: #8497ff;
    --mark-fg: #0a0a0a;
    --foot-rule: 6px;
    --code-bg: #161616;
    --code-fg: #e8e8e8;
    --tok-keyword: #8497ff;
    --tok-string: #8fe3b0;
    --tok-number: #ffb86b;
    --tok-comment: #9a9a9a;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.masthead :focus-visible, .site-footer :focus-visible { outline-color: currentColor; }

.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 8px; top: 8px; z-index: 10; background: var(--bg); color: var(--fg); padding: 12px 16px; }

/* ---- Masthead: nav bar plus an optional hero ---- */

.masthead { background: var(--mast-bg); color: var(--mast-fg); font-family: var(--font-display); padding: 0 var(--gutter); }
.masthead a:hover { color: inherit; text-decoration: underline; }
.masthead__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 32px; padding: 16px 0; font-size: 15px; font-weight: 500; border-bottom: var(--mast-rule) solid var(--rule); }
.masthead__name { font-weight: 700; letter-spacing: -0.02em; text-decoration: none; padding: 12px 0; }
.masthead__nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0 28px; }
.masthead__nav a { text-decoration: none; padding: 12px 0; }
.masthead__nav a[aria-current='page'] { text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 2px; }

.hero { padding: 40px 0 48px; }
.hero__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; font-size: 15px; font-weight: 600; margin: 0 0 24px; }
.hero__mark { background: var(--mark-bg); color: var(--mark-fg); padding: 2px 8px; }
.hero__title { margin: 0; max-width: 1100px; font-size: clamp(44px, 8.6vw, 112px); line-height: 0.94; font-weight: 700; letter-spacing: -0.045em; text-wrap: balance; overflow-wrap: anywhere; }
.hero__title--wordmark { font-size: clamp(56px, 13.5vw, 176px); line-height: 0.88; letter-spacing: -0.05em; }
.hero__foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px 48px; padding-top: 28px; }
.hero__lede { margin: 0; max-width: 520px; font-size: 22px; line-height: 1.35; font-weight: 500; text-wrap: pretty; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; font-family: var(--font-display); }
.chip { display: inline-block; font-size: 14px; font-weight: 600; line-height: 1.2; text-decoration: none; border: 2px solid currentColor; padding: 11px 16px; }
.chip:hover { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.masthead .chip:hover { background: var(--mast-fg); color: var(--mast-bg); border-color: var(--mast-fg); text-decoration: none; }
.masthead .chip--mark, .masthead .chip--mark:hover { background: var(--mark-bg); color: var(--mark-fg); border-color: var(--mark-bg); }

/* ---- Theme control ---- */

.theme { position: relative; }
.theme > summary { list-style: none; cursor: pointer; padding: 12px 0; }
.theme > summary::-webkit-details-marker { display: none; }
.theme > summary::after { content: ' ▾'; }
.theme__panel { position: absolute; right: 0; top: 100%; z-index: 20; min-width: 240px; display: flex; flex-direction: column; gap: 12px; background: var(--bg); color: var(--fg); border: 2px solid var(--rule); padding: 16px; }
.theme__system { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.theme__system input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); border-radius: 0; }
.theme__choice { display: grid; grid-template-columns: 1fr 1fr; }
.theme__choice button { font: inherit; font-weight: 600; min-height: 44px; background: var(--bg); color: var(--fg); border: 2px solid var(--rule); cursor: pointer; }
.theme__choice button + button { border-left: 0; }
.theme__choice button[aria-pressed='true'] { background: var(--fg); color: var(--bg); }

/* ---- Page furniture ---- */

.page { padding: 0 var(--gutter) 64px; }
.page__admin { display: inline-block; margin-top: 16px; font-family: var(--font-display); font-size: 14px; font-weight: 600; }
.section-title { margin: 56px 0 16px; font-family: var(--font-display); font-size: 15px; font-weight: 600; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(440px, 100%), 1fr)); gap: 16px; padding-top: 16px; font-family: var(--font-display); }
.card { display: flex; flex-direction: column; justify-content: space-between; gap: 40px; min-height: 240px; box-sizing: border-box; border: 2px solid var(--rule); padding: 20px 24px 24px; text-decoration: none; }
.card:hover { background: var(--fg); color: var(--bg); }
.card:hover .card__number, .card:hover .card__date { color: inherit; }
.card__top { display: flex; justify-content: space-between; gap: 16px; font-size: 14px; font-weight: 600; }
.card__number { color: var(--accent); }
.card__body { display: flex; flex-direction: column; gap: 12px; }
.card__title { font-size: clamp(26px, 2.8vw, 36px); line-height: 1.02; font-weight: 700; letter-spacing: -0.035em; text-wrap: balance; overflow-wrap: anywhere; }
.card__date { font-size: 14px; font-weight: 500; color: var(--dim); }

.rows { margin: 16px 0 0; padding: 0; list-style: none; font-family: var(--font-display); border-top: 2px solid var(--rule); }
.rows a { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 24px; min-height: 48px; box-sizing: border-box; padding: 14px 0; border-bottom: 1px solid var(--hairline); text-decoration: none; font-size: clamp(22px, 2.6vw, 32px); line-height: 1.1; font-weight: 600; letter-spacing: -0.03em; }
.rows small { font-size: 14px; font-weight: 500; letter-spacing: 0; color: var(--dim); }

.years { display: flex; flex-wrap: wrap; gap: 0 40px; margin: 0; padding: 0; list-style: none; font-family: var(--font-display); border-top: 6px solid var(--rule); }
.years a { display: block; font-size: clamp(56px, 9vw, 120px); line-height: 1; font-weight: 700; letter-spacing: -0.06em; text-decoration: none; color: var(--accent); padding: 16px 0; }
.years a:hover { color: var(--fg); }

/* ---- A post or page: side notes plus the text ---- */

.post { display: flex; flex-wrap: wrap; gap: 32px 64px; padding-top: 40px; }
.post__aside { flex: 1 1 240px; display: flex; flex-direction: column; gap: 28px; font-family: var(--font-display); }
.post__lede { margin: 0; font-size: 22px; line-height: 1.3; font-weight: 500; text-wrap: pretty; }
.post__text { flex: 999 1 560px; min-width: 0; max-width: 720px; }
.page-text { max-width: 720px; padding-top: 40px; }

.copy > * { margin: 0 0 24px; }
.copy > :last-child { margin-bottom: 0; }
.copy p, .copy li { text-wrap: pretty; }
.copy h1, .copy h2, .copy h3, .copy h4, .copy h5, .copy h6 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; margin-top: 52px; text-wrap: balance; }
.copy > :first-child { margin-top: 0; }
.copy h1 { font-size: 44px; }
.copy h2 { font-size: 34px; }
.copy h3 { font-size: 28px; }
.copy h4 { font-size: 22px; }
.copy h5, .copy h6 { font-size: 18px; }
.copy a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.copy a:hover { color: var(--fg); }
.copy ul, .copy ol { padding-left: 28px; }
.copy ul { list-style: square; }
.copy ol { list-style: decimal; }
.copy li + li { margin-top: 6px; }
.copy blockquote { border-top: 2px solid var(--rule); border-bottom: 2px solid var(--rule); padding: 20px 0; font-family: var(--font-display); font-size: 24px; line-height: 1.3; font-weight: 500; }
.copy hr { border: 0; border-top: 2px solid var(--rule); margin: 48px 0; }
.copy img, .copy video { max-width: 100%; height: auto; }
.copy table { width: 100%; border-collapse: collapse; font-size: 16px; }
.copy th, .copy td { text-align: left; padding: 8px 12px 8px 0; border-bottom: 1px solid var(--hairline); }
.copy :not(pre) > code { font-family: var(--font-mono); font-size: 0.85em; background: var(--chip); padding: 2px 6px; overflow-wrap: anywhere; }

.btn { display: inline-block; font-family: var(--font-display); font-weight: 600; text-decoration: none; padding: 11px 16px; border: 2px solid var(--rule); }
.btn-primary, .copy a.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); text-decoration: none; }

/* ---- Previous / next ---- */

.pager { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); margin-top: 72px; border-top: 6px solid var(--rule); font-family: var(--font-display); }
.pager a { display: flex; flex-direction: column; gap: 10px; text-decoration: none; padding: 24px 24px 28px 0; }
.pager a:hover { color: inherit; }
.pager a:hover .pager__title { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.pager__label { font-size: 14px; font-weight: 600; color: var(--accent); }
.pager__title { font-size: 30px; line-height: 1.05; font-weight: 600; letter-spacing: -0.03em; }
.pager__next { background: var(--mark-bg); color: var(--mark-fg); padding-left: 24px !important; }
.pager__next .pager__label { color: inherit; }

/* ---- Footer ---- */

.site-footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 32px; background: #0a0a0a; color: #ffffff; border-top: var(--foot-rule) solid var(--rule); padding: 20px var(--gutter); font-family: var(--font-display); font-size: 15px; font-weight: 500; }
.site-footer p { margin: 0; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 0 24px; }
.site-footer a { padding: 12px 0; }
.site-footer a:hover { color: inherit; text-decoration-thickness: 2px; }

/* ---- Diagrams (fenced ```mermaid blocks) ---- */

.diagram { border-top: 2px solid var(--rule); border-bottom: 2px solid var(--rule); padding: 24px 0; overflow-x: auto; }
.diagram pre.mermaid { margin: 0; font-family: var(--font-mono); font-size: 14px; white-space: pre; }
.diagram pre.mermaid[data-processed] { display: flex; justify-content: center; }
.diagram svg { max-width: 100%; height: auto; }
.diagram .node rect, .diagram .cluster rect, .diagram .label-container { rx: 0; ry: 0; stroke-width: 2px; }
.diagram .flowchart-link, .diagram .edgePath path { stroke-width: 2px; }
/* A node marked `:::accent` in the diagram source is the filled one. */
.diagram .node.accent rect, .diagram .node.accent polygon, .diagram .node.accent circle { fill: var(--accent) !important; stroke: var(--accent) !important; }
.diagram .node.accent .nodeLabel, .diagram .node.accent text { color: var(--on-accent) !important; fill: var(--on-accent) !important; }
/* Code blocks, as MarkdownHelper renders them:
   <figure class="code"><figcaption>Language</figcaption>
     <pre class="highlight"><code><span class="line">…</span>…</code></pre></figure>
   Token classes are Rouge's. Colours come from the theme in site.css. */

.code { background: var(--code-bg); color: var(--code-fg); border-top: 4px solid var(--accent); }
.code figcaption { font-family: var(--font-display); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; padding: 10px 20px; border-bottom: 1px solid var(--code-line); }
.code pre { margin: 0; padding: 16px 20px; overflow-x: auto; font-family: var(--font-mono); font-size: 14px; line-height: 1.75; tab-size: 2; counter-reset: line; }
.code code { font-family: inherit; }
.code .line::before { counter-increment: line; content: counter(line); display: inline-block; width: 2ch; margin-right: 20px; text-align: right; color: var(--code-num); }

/* keywords, tags */
.highlight .k, .highlight .kc, .highlight .kd, .highlight .kn, .highlight .kp, .highlight .kr, .highlight .kt, .highlight .kv,
.highlight .nt, .highlight .ow { color: var(--tok-keyword); font-weight: 700; }
/* strings */
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sa, .highlight .sb, .highlight .sc, .highlight .sd, .highlight .se,
.highlight .sh, .highlight .si, .highlight .sx, .highlight .sr, .highlight .ss, .highlight .dl, .highlight .gi { color: var(--tok-string); }
/* numbers, constants, built-ins */
.highlight .m, .highlight .mb, .highlight .mf, .highlight .mh, .highlight .mi, .highlight .il, .highlight .mo, .highlight .mx,
.highlight .no, .highlight .nb, .highlight .bp, .highlight .nv, .highlight .vc, .highlight .vg, .highlight .vi, .highlight .gd { color: var(--tok-number); }
/* comments */
.highlight .c, .highlight .ch, .highlight .cd, .highlight .cm, .highlight .cp, .highlight .cpf, .highlight .c1, .highlight .cs,
.highlight .gh, .highlight .gu, .highlight .gp, .highlight .go { color: var(--tok-comment); font-style: italic; }
/* names being defined or called */
.highlight .nf, .highlight .fm, .highlight .nc, .highlight .nn, .highlight .na, .highlight .nd, .highlight .ne { color: var(--tok-name); font-weight: 700; }
.highlight .ge { font-style: italic; }
.highlight .gs { font-weight: 700; }
/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's
 * vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
 * files in this directory. Styles in this file should be added after the last require_* statement.
 * It is generally better to create a new file per style scope.
 *


 */
