:root {
  --bg: #fbfbf7;
  --fg: #111111;
  --muted: #777777;
  --line: #e8e6dd;
  --accent: #c83a17;
  --card: #ffffff;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.04), 0 24px 60px -28px rgba(0, 0, 0, 0.18);
  --serif: ui-serif, "Iowan Old Style", "Georgia", "Charter", serif;
  --mono: ui-monospace, "SF Mono", "Menlo", "Consolas", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0e0c;
    --fg: #f3f1ea;
    --muted: #8a8a82;
    --line: #2a2a26;
    --accent: #ff7a52;
    --card: #161614;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.6), 0 24px 60px -28px rgba(0, 0, 0, 0.7);
  }
}

* {
  box-sizing: border-box;
}

/* Screen-reader-only text. Used for the page H1: the design is a single card
   with no room for a visible title, but a page with no heading is unreadable to
   a screen reader and headless to a crawler. Standard clip-rect pattern, so the
   text is exposed to assistive tech and not painted. */
.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;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: 1fr auto;
}

main {
  display: grid;
  place-items: center;
  padding: 5vh 5vw;
  position: relative;
}

.card {
  width: min(680px, 100%);
  min-height: 320px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 36px 40px 28px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 28px;
  transition: transform 120ms ease, opacity 120ms ease;
}

.card[data-deal="1"] {
  animation: deal 240ms ease both;
}

@keyframes deal {
  from { transform: translateY(6px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  color: var(--muted);
}

.category {
  color: var(--accent);
}

.id {
  color: inherit;
  text-decoration: none;
}

.id:hover,
.id:focus-visible {
  color: var(--accent);
}

.id::before {
  content: "#";
}

.text {
  font-family: var(--serif);
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.35;
  margin: 0;
  color: var(--fg);
}

.text kbd {
  font-family: var(--mono);
  font-size: 0.7em;
  background: var(--line);
  border-radius: 6px;
  padding: 2px 6px;
  color: var(--fg);
}

.rationale {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
  margin: 0;
  border-top: 1px dashed var(--line);
  padding-top: 14px;
}

.card-foot {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.escalation {
  letter-spacing: 0.2em;
  color: var(--accent);
  min-width: 4ch;
}

.hint kbd {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--fg);
  margin: 0 2px;
}

.hint-btn {
  background: none;
  border: 0;
  margin: 0;
  padding: 0;
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
  cursor: pointer;
}

.page-foot-tag {
  font-style: italic;
}

@media (max-width: 520px) {
  .page-foot-tag { display: none; }
}

.page-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 22px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

.page-foot a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted var(--accent);
  padding-left: 10px;
}

.version {
  color: var(--muted);
  font-family: var(--mono);
}

.page-foot a:hover { color: var(--accent); border-color: var(--accent); }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--fg);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: opacity 160ms ease;
  pointer-events: none;
  z-index: 10;
}

.toast[data-show="1"] {
  opacity: 1;
}

@media (max-width: 520px) {
  .card { padding: 26px 24px 20px; min-height: 260px; }
  .card-foot { flex-direction: column; align-items: flex-start; gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .card { animation: none !important; transition: none; }
  .toast { transition: none; }
}

/* ---------------------------------------------------------------------- */
/* Blog                                                                    */
/* ---------------------------------------------------------------------- */

body.blog {
  display: block;
  min-height: auto;
}

.blog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 32px;
  font-family: var(--mono);
  font-size: 13px;
  border-bottom: 1px solid var(--line);
}

.blog-home {
  color: var(--fg);
  text-decoration: none;
  font-weight: 600;
}

.blog-home:hover { color: var(--accent); }

.blog-nav a {
  color: var(--muted);
  text-decoration: none;
  margin-left: 4px;
}

.blog-nav a:hover { color: var(--accent); }

.blog-main {
  max-width: 680px;
  margin: 0 auto;
  padding: 56px 24px 80px;
}

.blog-h1 {
  font-family: var(--serif);
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.2;
  margin: 0 0 14px;
  color: var(--fg);
  letter-spacing: -0.01em;
}

.blog-lede {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0 0 48px;
}

.blog-date {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.blog-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 36px;
}

.blog-item-title {
  font-family: var(--serif);
  font-size: clamp(20px, 2.4vw, 24px);
  line-height: 1.3;
  margin: 6px 0 8px;
  letter-spacing: -0.005em;
}

.blog-item-title a {
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 120ms ease, color 120ms ease;
}

.blog-item-title a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.blog-item-desc {
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--muted);
  margin: 0;
}

.blog-article-head {
  margin: 0 0 36px;
  padding: 0 0 24px;
  border-bottom: 1px dashed var(--line);
}

.blog-article-head .blog-date {
  display: block;
  margin-bottom: 10px;
}

.blog-body {
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.65;
  color: var(--fg);
}

.blog-body p {
  margin: 0 0 1.2em;
}

.blog-body h2 {
  font-family: var(--sans);
  font-size: 22px;
  line-height: 1.3;
  margin: 2em 0 0.6em;
  color: var(--fg);
  letter-spacing: -0.005em;
}

.blog-body h3 {
  font-family: var(--sans);
  font-size: 18px;
  margin: 1.6em 0 0.4em;
  color: var(--fg);
}

.blog-body a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}

.blog-body a:hover { opacity: 0.8; }

.blog-body blockquote {
  margin: 1.2em 0;
  padding: 4px 0 4px 20px;
  border-left: 3px solid var(--accent);
  font-family: var(--serif);
  font-style: italic;
  color: var(--fg);
}

.blog-body code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--line);
  border-radius: 4px;
  padding: 1px 5px;
}

.blog-body pre {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.5;
}

.blog-body pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

.blog-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.4em 0;
  font-family: var(--sans);
  font-size: 14px;
}

.blog-body th,
.blog-body td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}

.blog-body th {
  font-weight: 600;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.blog-body ul,
.blog-body ol {
  padding-left: 24px;
  margin: 0 0 1.2em;
}

.blog-body li { margin: 0.4em 0; }

.blog-body hr {
  border: 0;
  border-top: 1px dashed var(--line);
  margin: 2em 0;
}

.blog-foot {
  border-top: 1px solid var(--line);
  margin-top: 40px;
}

.blog-foot a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted var(--accent);
}
