/* ---------------------------------------------------------------
   cengen.no — minimal, text-forward, light + dark.
   One stylesheet on purpose: it's small enough to read top to bottom.
   --------------------------------------------------------------- */

:root {
  --bg: #fdfdfc;
  --fg: #1a1a18;
  --muted: #6b6b63;
  --rule: #e2e2dc;
  --accent: #8a3324; /* rust — used sparingly, for links only */
  --accent-hover: #6d2719;
  --tag-bg: #f0efe9;

  --font-body: ui-serif, "Iowan Old Style", Georgia, Cambria, "Times New Roman",
    serif;
  --font-ui: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
    monospace;

  --measure: 34rem; /* ~68 characters at this body size */
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16161a;
    --fg: #e8e8e3;
    --muted: #9a9a92;
    --rule: #2e2e34;
    --accent: #e08a6f;
    --accent-hover: #f0a88d;
    --tag-bg: #24242a;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  max-width: var(--measure);
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

/* --- Links --- */

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

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

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--rule);
  z-index: 10;
}

/* --- Header --- */

.site-header {
  margin-bottom: 3rem;
}

.site-nav ul,
.site-social {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--font-ui);
}

.site-nav ul {
  font-size: 0.9375rem;
}

.site-nav a {
  color: var(--fg);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
}

.site-nav a:hover {
  border-bottom-color: var(--accent);
}

.site-nav a[aria-current="page"] {
  border-bottom-color: var(--fg);
}

.site-social {
  margin-top: 0.6rem;
  font-size: 0.8125rem;
}

.site-social a {
  color: var(--muted);
  text-decoration: none;
}

.site-social a:hover {
  color: var(--accent);
}

/* --- Typography --- */

h1,
h2,
h3 {
  font-family: var(--font-ui);
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.011em;
}

h1 {
  font-size: 1.75rem;
  margin: 0 0 1.25rem;
}

h2 {
  font-size: 1.1875rem;
  margin: 2.5rem 0 0.75rem;
}

h3 {
  font-size: 1.0625rem;
  margin: 1.75rem 0 0.5rem;
}

p,
ul,
ol {
  margin: 0 0 1.15rem;
}

.prose ul,
.prose ol {
  padding-left: 1.35rem;
}

.prose li + li {
  margin-top: 0.35rem;
}

.lede {
  color: var(--muted);
  font-size: 1.125rem;
}

.meta {
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  color: var(--muted);
}

blockquote {
  margin: 1.5rem 0;
  padding-left: 1rem;
  border-left: 2px solid var(--rule);
  color: var(--muted);
}

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 2.5rem 0;
}

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--tag-bg);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

pre {
  overflow-x: auto;
  padding: 1rem;
  background: var(--tag-bg);
  border-radius: 4px;
  font-size: 0.875rem;
  line-height: 1.5;
}

pre code {
  background: none;
  padding: 0;
  font-size: 1em;
}

img {
  max-width: 100%;
  height: auto;
  border-radius: 3px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  margin-bottom: 1.15rem;
}

th,
td {
  text-align: left;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--rule);
}

/* --- "At a glance" list on the homepage --- */

.glance {
  list-style: none;
  padding: 0;
  border-top: 1px solid var(--rule);
}

.glance li {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--rule);
  margin: 0;
}

.glance .label {
  flex: 0 0 5.5rem;
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  color: var(--muted);
  padding-top: 0.15rem;
}

.glance .value {
  flex: 1 1 14rem;
}

/* --- Index listings (posts, recipes, projects) --- */

.listing {
  list-style: none;
  padding: 0;
}

.listing > li {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--rule);
  margin: 0;
}

.listing > li:first-child {
  border-top: 1px solid var(--rule);
}

.listing h2,
.listing h3 {
  font-size: 1.0625rem;
  margin: 0 0 0.15rem;
  font-weight: 500;
}

.listing h2 a,
.listing h3 a {
  color: var(--fg);
  text-decoration: none;
}

.listing h2 a:hover,
.listing h3 a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.listing p {
  margin: 0.15rem 0 0;
  font-size: 0.9375rem;
  color: var(--muted);
}

.tag {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  background: var(--tag-bg);
  color: var(--muted);
  padding: 0.1rem 0.45rem;
  border-radius: 3px;
}

.draft-flag {
  color: var(--accent);
}

/* --- Recipes --- */

.recipe-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0 2rem;
  margin: 0 0 2rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-ui);
  font-size: 0.875rem;
}

.recipe-meta dt {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.recipe-meta dd {
  margin: 0.1rem 0 0;
}

.ingredients ul {
  list-style: none;
  padding-left: 0;
}

.ingredients li {
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--rule);
}

.ingredient-group {
  margin-top: 1.5rem;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.steps ol {
  padding-left: 1.35rem;
}

.steps li {
  margin-bottom: 0.75rem;
}

/* --- Footer --- */

.site-footer {
  margin-top: 4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  color: var(--muted);
}

.site-footer p {
  margin: 0;
}

.post-nav {
  margin-top: 3rem;
  font-family: var(--font-ui);
  font-size: 0.875rem;
}

/* --- Print: recipes on paper, without the site chrome --- */

@media print {
  .site-header,
  .site-footer,
  .post-nav,
  .skip-link {
    display: none;
  }

  body {
    max-width: none;
    color: #000;
    background: #fff;
    font-size: 11pt;
  }

  a {
    color: #000;
    text-decoration: none;
  }
}
