/* Short Order of Success — editorial stylesheet
   Palette: order-ticket cream, kitchen ink, tomato red, pickle green. */
:root {
  --paper: #f6f1e7;
  --paper-2: #efe7d6;
  --card: #fffdf8;
  --ink: #1c1a17;
  --ink-2: #4a453d;
  --ink-3: #6f685c;
  --rule: #d9cfbc;
  --tomato: #c8381f;
  --tomato-dark: #9d2a15;
  --pickle: #3d6b4f;
  --mustard: #c9921b;
  --slate: #3a5a78;
  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --measure: 70ch;
  --wrap: 1180px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 1.0625rem; line-height: 1.65;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--tomato-dark); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--tomato); }
:focus-visible { outline: 3px solid var(--mustard); outline-offset: 2px; }
.skip { position: absolute; left: -9999px; top: 0; background: var(--ink); color: #fff; padding: .6rem 1rem; z-index: 100; }
.skip:focus { left: 1rem; top: 1rem; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 1.25rem; }

/* ---------- Masthead ---------- */
.topbar { background: var(--ink); color: #e9e2d3; font-family: var(--mono); font-size: .75rem; letter-spacing: .04em; }
.topbar .wrap { display: flex; justify-content: space-between; gap: 1rem; padding-top: .45rem; padding-bottom: .45rem; flex-wrap: wrap; }
.topbar a { color: #e9e2d3; text-decoration: none; }
.topbar a:hover { color: #fff; text-decoration: underline; }
.masthead { border-bottom: 3px double var(--ink); background: var(--paper); }
.masthead .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; padding-top: 1.1rem; padding-bottom: 1rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .8rem; text-decoration: none; color: var(--ink); }
.brand svg { width: 46px; height: 46px; flex: none; }
.brand-name { font-family: var(--serif); font-weight: 700; font-size: 1.65rem; line-height: 1; letter-spacing: -.01em; }
.brand-tag { display: block; font-family: var(--mono); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin-top: .35rem; }
.nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: .25rem; flex-wrap: wrap; }
.nav a { display: block; padding: .5rem .8rem; text-decoration: none; color: var(--ink); font-weight: 600; font-size: .95rem; border-radius: 3px; }
.nav a:hover, .nav a[aria-current="page"] { background: var(--ink); color: var(--paper); }

/* ---------- Type ---------- */
h1, h2, h3, h4 { font-family: var(--serif); line-height: 1.15; letter-spacing: -.015em; color: var(--ink); }
h1 { font-size: clamp(2.1rem, 4.6vw, 3.5rem); font-weight: 700; margin: .2em 0 .35em; }
h2 { font-size: clamp(1.5rem, 2.6vw, 2.05rem); margin: 2.2em 0 .6em; font-weight: 650; }
h3 { font-size: 1.3rem; margin: 1.8em 0 .5em; font-weight: 650; }
p { margin: 0 0 1.1em; }
.kicker { font-family: var(--mono); font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: var(--tomato-dark); font-weight: 600; }
.lede { font-family: var(--serif); font-size: 1.3rem; line-height: 1.5; color: var(--ink-2); max-width: 62ch; }
.muted { color: var(--ink-3); }
.small { font-size: .88rem; }

/* ---------- Hero ---------- */
.hero { padding: 3.5rem 0 2.5rem; border-bottom: 1px solid var(--rule); }
.hero-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 3rem; align-items: end; }
.hero h1 { font-size: clamp(2.4rem, 5.5vw, 4.2rem); }
.hero h1 em { font-style: italic; color: var(--tomato); }
.stat-rail { display: grid; gap: .9rem; }
.stat { background: var(--card); border: 1px solid var(--rule); border-left: 5px solid var(--tomato); padding: 1rem 1.1rem; }
.stat b { display: block; font-family: var(--serif); font-size: 2.1rem; line-height: 1; }
.stat > span { font-size: .9rem; color: var(--ink-2); }
.stat .label { margin-top: .5rem; }

/* ---------- Order ticket cards ---------- */
.section { padding: 3rem 0; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; border-bottom: 2px solid var(--ink); margin-bottom: 1.6rem; padding-bottom: .5rem; }
.section-head h2 { margin: 0; }
.tickets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4rem; }
.ticket {
  position: relative; background: var(--card); border: 1px solid var(--rule);
  padding: 1.4rem 1.35rem 1.3rem; display: flex; flex-direction: column;
  box-shadow: 0 1px 0 var(--rule), 0 10px 24px -18px rgba(28,26,23,.45);
}
.ticket::before { /* perforated top edge */
  content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 8px;
  background: radial-gradient(circle at 6px -2px, var(--paper) 5px, transparent 5.5px) 0 0/12px 8px repeat-x;
}
.ticket-no { font-family: var(--mono); font-size: .72rem; letter-spacing: .1em; color: var(--ink-3); display: flex; justify-content: space-between; border-bottom: 1px dashed var(--rule); padding-bottom: .55rem; margin-bottom: .8rem; }
.ticket h3 { margin: 0 0 .6rem; font-size: 1.35rem; }
.ticket h3 a { color: var(--ink); text-decoration: none; }
.ticket h3 a:hover { color: var(--tomato-dark); text-decoration: underline; }
.ticket p { color: var(--ink-2); font-size: .98rem; flex: 1; }
.ticket .more { font-weight: 700; text-decoration: none; }
.ticket .more::after { content: " →"; }

/* ---------- Article ---------- */
.crumbs { font-size: .85rem; margin: 1.4rem 0 0; color: var(--ink-3); }
.crumbs ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .35rem; }
.crumbs li + li::before { content: "/"; margin-right: .35rem; color: var(--rule); }
.crumbs a { color: var(--ink-3); }
.article-head { padding: 1.5rem 0 2rem; border-bottom: 1px solid var(--rule); }
.byline { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; font-size: .92rem; color: var(--ink-2); margin-top: 1.2rem; }
.byline img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--paper-2); }
.byline .sep { color: var(--rule); }
.article-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 3.5rem; padding: 2rem 0 3rem; }
.prose { max-width: var(--measure); min-width: 0; overflow-wrap: break-word; }
.prose h2 { border-top: 1px solid var(--rule); padding-top: 1.4rem; }
.prose ul, .prose ol { padding-left: 1.3rem; margin: 0 0 1.2em; }
.prose li { margin-bottom: .45em; }
.toc { position: sticky; top: 1rem; align-self: start; font-size: .92rem; }
.toc-box { background: var(--card); border: 1px solid var(--rule); padding: 1rem 1.1rem; margin-bottom: 1rem; }
.toc-box h2 { font-family: var(--mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; margin: 0 0 .6rem; color: var(--ink-3); border: 0; padding: 0; }
.toc ol { margin: 0; padding-left: 1.1rem; }
.toc li { margin-bottom: .35rem; }
.toc a { color: var(--ink); text-decoration: none; }
.toc a:hover { text-decoration: underline; }

.keyfinds { background: var(--ink); color: #f3ecdd; padding: 1.5rem 1.6rem; margin: 0 0 2rem; }
.keyfinds h2 { color: #fff; margin: 0 0 .8rem; font-size: 1.15rem; font-family: var(--mono); letter-spacing: .1em; text-transform: uppercase; border: 0; padding: 0; }
.keyfinds ul { margin: 0; padding-left: 1.2rem; }
.keyfinds li { margin-bottom: .55rem; }
.keyfinds a { color: #ffcf9e; }
.keyfinds strong { color: #fff; }

.callout { border-left: 5px solid var(--mustard); background: #fbf3df; padding: 1rem 1.2rem; margin: 1.5rem 0; }
.callout.red { border-color: var(--tomato); background: #fbe9e4; }
.callout.green { border-color: var(--pickle); background: #e8f0ea; }
.callout p:last-child { margin: 0; }

.table-wrap { overflow-x: auto; margin: 1.4rem 0 1.8rem; border: 1px solid var(--rule); background: var(--card); }
table { border-collapse: collapse; width: 100%; font-size: .93rem; }
caption { text-align: left; font-family: var(--mono); font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; padding: .75rem .9rem; color: var(--ink-3); border-bottom: 1px solid var(--rule); }
th, td { padding: .65rem .9rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule); }
th { background: var(--paper-2); font-weight: 700; }
td.num { font-family: var(--serif); font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }

/* Confidence labels */
.cl { display: inline-block; font-family: var(--mono); font-size: .66rem; letter-spacing: .06em; text-transform: uppercase; padding: .15rem .45rem; border-radius: 2px; font-weight: 700; vertical-align: middle; white-space: nowrap; }
.cl-fl { background: var(--pickle); color: #fff; }
.cl-nat { background: var(--slate); color: #fff; }
.cl-mod { background: var(--mustard); color: #1c1a17; }
.cl-hyp { background: var(--ink-3); color: #fff; }
.legend { display: flex; flex-wrap: wrap; gap: .6rem 1.1rem; font-size: .85rem; color: var(--ink-2); margin: .5rem 0 1.5rem; }

.faq details { border-top: 1px solid var(--rule); padding: .9rem 0; }
.faq details:last-child { border-bottom: 1px solid var(--rule); }
.faq summary { cursor: pointer; font-weight: 700; font-family: var(--serif); font-size: 1.12rem; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "+"; display: inline-block; width: 1.3em; color: var(--tomato); font-family: var(--mono); }
.faq details[open] summary::before { content: "–"; }
.faq details p { margin: .6rem 0 0 1.3em; }

.sources ol { font-size: .9rem; padding-left: 1.3rem; }
.sources li { margin-bottom: .5rem; word-break: break-word; }
.cite-box { background: var(--card); border: 1px dashed var(--ink-3); padding: 1rem 1.1rem; font-size: .88rem; }
.cite-box code { font-family: var(--mono); font-size: .8rem; display: block; white-space: pre-wrap; color: var(--ink-2); margin-top: .4rem; }

.author-card { display: grid; grid-template-columns: 96px 1fr; gap: 1.2rem; align-items: start; background: var(--card); border: 1px solid var(--rule); padding: 1.3rem; margin: 2.5rem 0 0; }
.author-card img { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; background: var(--paper-2); }
.author-card h2 { margin: 0 0 .3rem; font-size: 1.25rem; border: 0; padding: 0; }
.author-card p { font-size: .95rem; margin-bottom: .6rem; }

.pill-links { display: flex; flex-wrap: wrap; gap: .5rem; padding: 0; margin: .4rem 0 0; list-style: none; }
.pill-links a { display: inline-block; border: 1px solid var(--ink); padding: .3rem .7rem; font-size: .85rem; text-decoration: none; color: var(--ink); font-weight: 600; border-radius: 999px; }
.pill-links a:hover { background: var(--ink); color: var(--paper); }

.btn { display: inline-block; background: var(--tomato); color: #fff; padding: .75rem 1.2rem; font-weight: 700; text-decoration: none; border-radius: 3px; border: 0; cursor: pointer; font-size: 1rem; }
.btn:hover { background: var(--tomato-dark); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink); border: 2px solid var(--ink); }
.btn.ghost:hover { background: var(--ink); color: var(--paper); }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; }
.panel { background: var(--card); border: 1px solid var(--rule); padding: 1.6rem; }
.panel h2, .panel h3 { margin-top: 0; }
.coming { border: 2px dashed var(--rule); padding: 1.4rem; text-align: left; background: transparent; }

/* ---------- Footer ---------- */
.footer { background: var(--ink); color: #d8d0c0; margin-top: 3rem; padding: 3rem 0 1.5rem; font-size: .93rem; }
.footer a { color: #f3ecdd; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 2rem; }
.footer h2 { color: #fff; font-family: var(--mono); font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; margin: 0 0 .8rem; }
.footer ul { list-style: none; padding: 0; margin: 0; }
.footer li { margin-bottom: .45rem; }
.footer .fine { border-top: 1px solid #3a362f; margin-top: 2.2rem; padding-top: 1.1rem; font-size: .8rem; color: #a49b8a; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.footer .brand-name { color: #fff; font-size: 1.35rem; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero-grid, .article-grid, .split { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
  .tickets { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .toc { position: static; }
}
@media (max-width: 640px) {
  .tickets, .footer-grid { grid-template-columns: 1fr; }
  .nav a { padding: .4rem .55rem; font-size: .9rem; }
  .author-card { grid-template-columns: 64px 1fr; }
  .author-card img { width: 64px; height: 64px; }
}
@media print {
  .topbar, .nav, .toc, .footer, .skip { display: none !important; }
  body { background: #fff; }
  .article-grid { display: block; }
  a { color: #000; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
.checklist { list-style: none; padding-left: 0 !important; }
.checklist li { position: relative; padding-left: 2rem; }
.checklist li::before { content: ""; position: absolute; left: 0; top: .25em; width: 1.1rem; height: 1.1rem; border: 2px solid var(--ink); border-radius: 2px; background: var(--card); }
@media (max-width: 640px) { .topbar .wrap > span:first-child { display: none; } .brand-tag { font-size: .6rem; } }
