/* The Sunday Letter (blog.tarkika.com): essays, the letter's front page and topic pages, on the Tarkika system
   (system.css). Lives under /assets/ because the blog domain rewrites every other path to /blog/*.
   Essay bodies are hand-written HTML; every class they use is styled here (key, sc, mark, snref/sn, fig, code,
   dtab, pull, slip). Pages come from tools/essays.py. */

.read { max-width: 692px; margin: 0 auto; padding: 0 var(--gut); }

/* ---------- essay header */
.ehead { padding-top: 48px; }
.ehead .tag { font-size: 14px; font-weight: 600; color: var(--teal); }
.ehead h1 { margin-top: 12px; font-weight: 600; font-size: clamp(32px, 6.6vw, 52px); line-height: 1.08; letter-spacing: -0.012em; text-wrap: balance; }
.ehead .dek { margin-top: 16px; font-size: clamp(19px, 2.6vw, 23px); line-height: 1.38; letter-spacing: .005em; color: var(--ink-48); text-wrap: pretty; }
.byline { margin-top: 24px; padding: 16px 0; border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 14px; color: var(--ink-48); }
.byline b { color: var(--ink); font-weight: 600; }

/* ---------- the key-number tile: each essay's one number, on the dark ground */
.kc { container-type: inline-size; position: relative; display: flex; flex-direction: column; justify-content: flex-end; gap: 8px; min-height: 300px; padding: 28px; border-radius: 28px; overflow: hidden;
  background: #000000; color: var(--ink-on-dark); }
.kc .kck { position: absolute; left: 28px; top: 24px; font-size: 14px; font-weight: 600; color: #f56300; }
/* sized to fit its own tile: --n is the number of characters (set by tools/essays.py) */
.kc .kcn { white-space: nowrap; font-weight: 600; font-size: clamp(40px, calc((100cqw - 64px) / (var(--n, 4) * .6)), 168px); line-height: .95; letter-spacing: -0.03em; color: #f5f5f7; }
.kc .kcn small { font-size: .4em; letter-spacing: 0; }
.kc .kcc { max-width: 34ch; font-size: clamp(17px, 2.4vw, 21px); line-height: 1.3; color: var(--ink-on-dark-muted); }
.ecover { margin: 32px auto 0; max-width: 980px; }
@media (min-width: 768px) { .kc { min-height: 400px; padding: 44px; } .kc .kck { left: 44px; top: 36px; } }

/* ---------- the 60-second version */
.tldr { margin-top: 32px; border-radius: 18px; background: var(--parchment); }
.tldr summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; font-weight: 600; }
.tldr summary::-webkit-details-marker { display: none; }
.tldr summary span { display: none; }
.tldr summary::after { content: ""; width: 9px; height: 9px; border-right: 1.5px solid var(--ink-48); border-bottom: 1.5px solid var(--ink-48); transform: translateY(-3px) rotate(45deg); transition: transform .3s var(--ease); }
.tldr[open] summary::after { transform: translateY(2px) rotate(225deg); }
.tldr ul { padding: 0 22px 20px; display: grid; gap: 12px; }
.tldr li { position: relative; padding-left: 20px; color: var(--ink-80); }
.tldr li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 6px; height: 6px; border-radius: 50%; background: var(--teal); }

/* ---------- the essay body */
.body { margin-top: 40px; color: var(--ink-80); }
.body > * + * { margin-top: 1.15em; }
.body p, .body li { font-size: 17px; line-height: 1.6; text-wrap: pretty; }
@media (min-width: 768px) { .body p, .body li { font-size: 19px; line-height: 1.58; } }
.body b, .body strong { color: var(--ink); font-weight: 600; }
.body em { font-style: italic; }
.body a { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.body h2 { margin-top: 2em; color: var(--ink); font-weight: 600; font-size: clamp(24px, 4vw, 32px); line-height: 1.15; letter-spacing: -0.006em; text-wrap: balance; }
.body h2 + * { margin-top: .6em; }
.body h3 { margin-top: 1.6em; color: var(--ink); font-weight: 600; font-size: 21px; }
.body ul { list-style: disc; padding-left: 1.2em; } .body ol { list-style: decimal; padding-left: 1.4em; }
.body li + li { margin-top: .45em; }
.body .sc { color: var(--ink); font-weight: 600; }
.body mark { color: var(--ink); background: linear-gradient(180deg, transparent 52%, rgba(255,214,10,.45) 52%); padding: 0 .08em; }
.body .key { margin: 1.6em 0; padding-left: 20px; border-left: 3px solid var(--teal); color: var(--ink); font-weight: 600; font-size: clamp(21px, 3.2vw, 26px); line-height: 1.3; letter-spacing: -0.006em; }
.body blockquote.pull { margin: 1.6em 0; color: var(--ink); font-weight: 600; font-size: clamp(21px, 3.2vw, 26px); line-height: 1.3; text-wrap: balance; }
.body q { quotes: "“" "”" "‘" "’"; }
.body code { font-family: var(--mono); font-size: .86em; background: var(--parchment); border-radius: 6px; padding: .1em .35em; }

/* side notes: tap the number to open on phones; in the margin on wide screens */
.snref { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin: 0 2px; padding: 0 5px; border: 0; border-radius: 10px; background: var(--parchment); color: var(--blue); font-size: 12px; font-weight: 600; line-height: 1; vertical-align: 3px; cursor: pointer; }
.snref[aria-expanded="true"] { background: var(--blue); color: #fff; }
.body aside.sn { display: none; padding: 14px 16px; border-radius: 14px; background: var(--parchment); font-size: 15px; line-height: 1.5; color: var(--ink-80); }
.body aside.sn.open { display: block; }
.body aside.sn b { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-right: 8px; border-radius: 10px; background: var(--blue); color: #fff; font-size: 12px; }
@media (min-width: 1240px) {
  .body { position: relative; }
  .body aside.sn { display: block; float: right; clear: right; width: 230px; margin: 4px -282px 12px 0; padding: 0; background: none; font-size: 13px; color: var(--ink-48); }
  .body aside.sn b { width: 18px; min-width: 18px; height: 18px; font-size: 11px; }
  .snref { cursor: default; }
}

/* figures and charts */
.body .fig { margin: 2em 0; }
.body .fig svg[data-chart] { display: block; width: 100%; height: auto; overflow: visible; }
.body .fig figcaption { margin-top: 12px; font-size: 14px; line-height: 1.43; color: var(--ink-48); }
.body .fimg img { display: block; width: 100%; border-radius: 14px; border: 1px solid var(--hairline); }

/* code */
.body .code { margin: 1.8em 0; border-radius: 18px; background: var(--tile); color: var(--ink-on-dark); overflow: hidden; }
.body .code .bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px 10px 18px; border-bottom: 1px solid var(--hairline-dark); font-size: 13px; color: var(--ink-on-dark-muted); }
.body .code .bar button { min-height: 28px; padding: 0 12px; border: 1px solid var(--hairline-dark); border-radius: 980px; background: none; color: var(--mint); font-size: 13px; cursor: pointer; }
.body .code pre { margin: 0; padding: 16px 18px 18px; overflow-x: auto; font-family: var(--mono); font-size: 14px; line-height: 1.6; letter-spacing: 0; }
.body .code pre code { background: none; padding: 0; font-size: inherit; color: inherit; }
.body .code .k { color: var(--mint); } .body .code .s { color: #d2d2d7; } .body .code .c { color: #86868b; }
.body .code output { display: block; padding: 0 18px 16px; font-family: var(--mono); font-size: 13px; color: var(--mint); white-space: pre-wrap; }
.body .code output:empty, .body .code [data-run] { display: none; }

/* tables */
.body table { display: block; width: 100%; overflow-x: auto; border-collapse: collapse; font-size: 15px; }
.body th, .body td { padding: 10px 14px 10px 0; text-align: left; border-bottom: 1px solid var(--hairline); vertical-align: top; }
.body th { color: var(--ink); font-weight: 600; white-space: nowrap; }

/* sign-up slips (in the body, after the essay, on the front page) */
.slip { padding: 24px; border-radius: 18px; background: var(--parchment); }
.slip > b { display: block; color: var(--ink); font-size: 21px; font-weight: 600; letter-spacing: -0.01em; }
.slip > p { margin-top: 6px !important; font-size: 17px !important; color: var(--ink-48); }
.subf { display: flex; gap: 10px; max-width: 460px; margin-top: 16px; }
.subf input { flex: 1; min-width: 0; min-height: 44px; padding: 0 18px; border: 1px solid var(--hairline); border-radius: 980px; background: #fff; font-size: 17px; }
.subf input:focus { outline: 2px solid var(--blue); outline-offset: 0; border-color: transparent; }
.subf button { min-height: 44px; padding: 0 20px; border: 0; border-radius: 980px; background: var(--blue); color: #fff; font-size: 17px; cursor: pointer; transition: background .2s, transform .15s ease-out; }
.subf button:hover { background: var(--blue-hover); } .subf button:active { transform: scale(.95); }
.subf.busy { opacity: .6; pointer-events: none; }
.tile-dark .subf input { background: var(--tile-1); border-color: var(--hairline-dark); color: var(--ink-on-dark); }
.center .subf { margin-left: auto; margin-right: auto; }
.okmsg.bad { color: var(--danger); }
.body .slip { margin: 2em 0; }
.sub .lead { margin: 12px auto 0; max-width: 34ch; font-size: 19px; }
.sub .a, .sub a { color: var(--mint); text-decoration: underline; text-underline-offset: 3px; }
.tile-dark .okmsg { color: var(--mint); } .tile-dark .okmsg.bad { color: #ff8a80; }

/* ---------- after the essay */
.ends { margin-top: 40px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ends .credit { flex-basis: 100%; margin-top: 8px; font-size: 14px; color: var(--ink-48); }
.fromtb { margin: 56px auto 0; max-width: 980px; display: grid; gap: 24px; align-items: center; padding: 32px 24px; border-radius: 28px; background: var(--parchment); text-align: center; }
.fromtb .pic { display: flex; justify-content: center; }
.fromtb .kick { font-size: 14px; font-weight: 600; color: var(--teal); }
.fromtb h3 { margin-top: 4px; font-size: clamp(28px, 4.6vw, 40px); font-weight: 600; line-height: 1.1; letter-spacing: -0.006em; }
.fromtb p { margin: 10px auto 0; max-width: 36ch; color: var(--ink-48); }
.fromtb .pills { margin-top: 20px; justify-content: center; }
@media (min-width: 768px) { .fromtb { grid-template-columns: 280px 1fr; padding: 40px 48px; text-align: left; } .fromtb p { margin-left: 0; } .fromtb .pills { justify-content: flex-start; } }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 90; transform: translate(-50%, 20px); padding: 12px 18px; border-radius: 980px; background: var(--tile); color: var(--ink-on-dark); font-size: 14px; opacity: 0; transition: opacity .3s, transform .3s var(--ease); pointer-events: none; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- the letter's front page and topic pages */
.lhero { padding: 72px 0 64px; }
.lhero .hero-title { font-size: clamp(44px, 12vw, 88px); }
.feat { display: grid; gap: 24px; }
.feat .kc { min-height: 260px; transition: transform .5s var(--ease); }
.feat a.kcl:hover .kc { transform: scale(1.01); }
.feat h2 { font-size: clamp(26px, 4.4vw, 40px); font-weight: 600; line-height: 1.1; letter-spacing: -0.006em; text-wrap: balance; }
.feat h2 a:hover { color: var(--blue); }
@media (min-width: 900px) { .feat { grid-template-columns: 1.1fr 1fr; align-items: center; gap: 48px; } }
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 calc(-1 * var(--gut)); padding: 0 var(--gut); }
.chips button { flex-shrink: 0; min-height: 36px; padding: 0 16px; border: 1px solid var(--hairline); border-radius: 980px; background: #fff; font-size: 14px; color: var(--ink-80); cursor: pointer; }
.chips button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.rows .row[hidden] { display: none; }
.steps { display: grid; gap: 16px; }
.steps a { display: block; padding: 24px; border-radius: 18px; background: var(--parchment); transition: transform .3s var(--ease); }
.steps a:hover { transform: translateY(-2px); }
.steps .n { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--blue); color: #fff; font-size: 14px; font-weight: 600; }
.steps h3 { margin-top: 14px; font-size: 21px; font-weight: 600; letter-spacing: -0.01em; }
.steps p { margin-top: 6px; color: var(--ink-48); }
.steps .link-more { display: inline-block; margin-top: 12px; }
@media (min-width: 768px) { .steps { grid-template-columns: repeat(3, 1fr); } }
