@font-face {
  font-family: "Source Serif 4";
  src: url("/assets/source-serif-4-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f3f0e8;
  --card: #fffcf7;
  --field: #ffffff;
  --text: #1a1916;
  --muted: #5c564c;
  --line: #d9d3c7;
  --line-strong: #c3bbaa;
  --danger: #9f1239;
  --ink: #1c1a17;
  --ink-2: #26231f;
  --on-ink: #f3ede2;
  --on-ink-muted: #c9bfae;
  --brand: #e07a45;
  --accent: #a3451c;
  --accent-tint: #f6e4d8;
  --accent-soft: #fbf1ea;
  --accent-light: #ffb08a;
  --radius-lg: 18px;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(26, 25, 22, 0.05);
  --shadow-lift: 0 14px 30px -18px rgba(26, 25, 22, 0.35);
  --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
}

[data-group="garden"] {
  --accent: #4d6b33;
  --accent-tint: #e4ecd8;
  --accent-soft: #f2f6ec;
  --accent-light: #bcd99c;
}

[data-group="frame"] {
  --accent: #8a5a14;
  --accent-tint: #f2e5cd;
  --accent-soft: #f9f2e4;
  --accent-light: #f0c27a;
}

[data-group="finish"] {
  --accent: #34587d;
  --accent-tint: #dfe7f0;
  --accent-soft: #eff4f8;
  --accent-light: #a9c8ea;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 120ms ease;
}

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

h1, h2 { font-family: var(--serif); font-weight: 400; letter-spacing: -0.015em; }

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  z-index: 10;
}

.skip:focus { top: 12px; }

.header-inner,
.hero-inner,
.tool-hero-inner,
.page-hero-inner,
.tool-form,
.notes,
.home,
.prose,
.footer-inner,
.footer-base {
  max-width: 1120px;
  margin-left: auto;
  margin-right: auto;
}

/* Header */

.site-header {
  background: var(--ink);
  color: var(--on-ink);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  padding: 12px 24px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: -0.03em;
  text-decoration: none;
  color: var(--on-ink);
}

.wordmark:hover { color: #fff; }

.logo { display: block; flex: none; }

.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
}

.header-link {
  color: var(--on-ink);
  text-decoration: none;
  font-weight: 500;
}

.header-link:hover { color: var(--accent-light); text-decoration: underline; }

.site-header :focus-visible,
.site-footer :focus-visible,
.hero :focus-visible { outline-color: var(--on-ink); }

.site-header .segment {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.22);
  border-radius: 999px;
}

.site-header .segment-item {
  min-width: 52px;
  padding: 6px 14px;
  border-color: rgba(255, 255, 255, 0.22);
  font-weight: 600;
  font-size: 0.95rem;
}

.site-header .segment-item:hover { background: rgba(255, 255, 255, 0.08); }

.site-header .segment-item:has(input:checked) {
  background: var(--brand);
  color: var(--ink);
}

.site-header .segment-item:focus-within { outline-color: var(--on-ink); }

/* Home hero */

.hero {
  color: var(--on-ink);
  background:
    radial-gradient(circle at 82% 18%, rgba(224, 122, 69, 0.24), transparent 52%),
    radial-gradient(circle at 8% 100%, rgba(240, 194, 122, 0.12), transparent 45%),
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(180deg, var(--ink), var(--ink-2));
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  align-items: center;
  gap: 40px;
  padding: 56px 24px 72px;
}

.eyebrow {
  margin: 0 0 14px;
  color: #f0c27a;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0 0 18px;
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  line-height: 1.06;
  letter-spacing: -0.025em;
}

.hero .lede {
  max-width: 46ch;
  margin: 0 0 26px;
  color: var(--on-ink-muted);
  font-size: 1.15rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 26px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: var(--ink);
  font-weight: 650;
  text-decoration: none;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.button:hover { background: #ec8c5a; border-color: #ec8c5a; color: var(--ink); }

.button-ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.3);
  color: var(--on-ink);
}

.button-ghost:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.5); color: #fff; }

.hero-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--on-ink-muted);
  font-size: 0.95rem;
}

.hero-facts li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hero-facts li::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
}

.hero-art {
  display: block;
  width: 100%;
  max-width: 440px;
  height: auto;
  justify-self: end;
}

/* Home groups and tool cards */

.home { padding: 52px 24px 72px; }

.group { margin: 0 0 48px; }

.group:last-child { margin-bottom: 0; }

.group-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.group-head h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  font-size: 1.85rem;
  line-height: 1.2;
}

.group-head h2::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 4px;
  background: var(--accent);
}

.group-head p { margin: 0; color: var(--muted); }

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.tool-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--text);
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.tool-card:hover {
  color: var(--text);
  border-color: var(--accent);
  box-shadow: var(--shadow-lift);
  transform: translateY(-2px);
}

.tool-icon {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--accent-tint);
  color: var(--accent);
}

.tool-card-text { display: block; min-width: 0; }

.tool-name {
  display: block;
  margin: 0 0 2px;
  font-family: var(--sans);
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.tool-summary {
  display: block;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.tool-arrow {
  flex: none;
  width: 18px;
  height: 18px;
  margin-left: auto;
  color: var(--line-strong);
  transition: transform 160ms ease, color 160ms ease;
}

.tool-card:hover .tool-arrow { color: var(--accent); transform: translateX(3px); }

/* Calculator hero */

.tool-hero,
.page-hero {
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(rgba(26, 25, 22, 0.035) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(90deg, rgba(26, 25, 22, 0.035) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(135deg, var(--accent-tint) 0%, var(--bg) 72%);
}

.page-hero {
  background:
    linear-gradient(rgba(26, 25, 22, 0.035) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(90deg, rgba(26, 25, 22, 0.035) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(135deg, #e9e1d1 0%, var(--bg) 72%);
}

.tool-hero-inner { padding: 22px 24px 26px; }

.page-hero-inner { padding: 44px 24px 36px; }

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.9rem;
}

.crumbs a { color: var(--muted); }

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

.tool-hero-title {
  display: flex;
  align-items: center;
  gap: 16px;
}

.tool-icon-lg {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 18px -10px var(--accent);
}

.tool-icon-lg .icon { width: 30px; height: 30px; }

.tool-hero h1,
.page-hero h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 1.12;
}

.tool-hero .lede {
  max-width: 62ch;
  margin: 14px 0 14px;
  font-size: 1.1rem;
}

.page-hero .lede {
  max-width: 62ch;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1.1rem;
}

.example-flag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 4px 12px;
  border: 1px dashed var(--accent);
  border-radius: 999px;
  background: rgba(255, 252, 247, 0.75);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
}

.example-flag::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* Calculator form */

.tool-form {
  display: grid;
  grid-template-columns: minmax(0, 480px) minmax(280px, 1fr);
  column-gap: 32px;
  row-gap: 16px;
  padding: 28px 24px 44px;
  align-items: start;
}

.fields-primary,
.fields-secondary {
  grid-column: 1;
  padding: 22px 22px 6px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.fields-secondary:not(:has(> :not([hidden]))) { display: none; }

.result-wrap {
  grid-column: 2;
  grid-row: 1 / span 2;
  position: sticky;
  top: 16px;
  align-self: start;
}

.field { margin: 0 0 18px; }

.field-label,
.field > label {
  display: block;
  margin-bottom: 7px;
  font-weight: 600;
  font-size: 0.97rem;
}

.control {
  display: flex;
  align-items: center;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--field);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.control:hover { border-color: var(--line-strong); }

.control input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 1.05rem;
  min-height: 44px;
  padding: 0 14px;
  font-variant-numeric: tabular-nums;
}

.control input:focus { outline: none; }

.control:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.control:has(input[aria-invalid="true"]) { border-color: var(--danger); }

.unit {
  padding: 3px 9px;
  margin-right: 8px;
  border-radius: 6px;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.hint { margin: 7px 0 0; color: var(--muted); font-size: 0.92rem; }

.error {
  margin: 7px 0 0;
  color: var(--danger);
  font-weight: 600;
  font-size: 0.95rem;
}

.range-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.range-row input[type="range"] {
  flex: 1;
  min-height: 44px;
  accent-color: var(--accent);
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
}

.range-row input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: var(--accent-tint);
}

.range-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -8px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  background: var(--field);
  box-shadow: 0 2px 6px rgba(26, 25, 22, 0.18);
  cursor: pointer;
}

.range-row input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: var(--accent-tint);
}

.range-row input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  background: var(--field);
  box-shadow: 0 2px 6px rgba(26, 25, 22, 0.18);
  cursor: pointer;
}

.range-row output {
  min-width: 3.75rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-tint);
  color: var(--accent);
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 44px;
}

.check input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--accent);
}

.check .field-label { margin-bottom: 2px; }

.check .hint { display: block; margin-top: 0; }

.segment {
  display: flex;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--field);
}

.segment-item {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 14px;
  margin: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: -1px;
  cursor: pointer;
  text-align: center;
  transition: background-color 120ms ease, color 120ms ease;
}

.segment-item:last-child { border-right: 0; }

.segment-item:hover { background: var(--accent-soft); }

.segment-item input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.segment-item:has(input:checked) {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.segment-item:focus-within {
  outline: 2px solid var(--text);
  outline-offset: -4px;
  z-index: 1;
}

.mode-switch { margin-bottom: 18px; }

.disclosure {
  margin: 0 0 16px;
  border-top: 1px solid var(--line);
  padding-top: 6px;
}

.disclosure summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  cursor: pointer;
  font-weight: 600;
  color: var(--accent);
}

/* Result card */

.result-card {
  position: relative;
  overflow: hidden;
  padding: 26px 26px 20px;
  border-radius: var(--radius-lg);
  color: var(--on-ink);
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 255, 255, 0.09), transparent 45%),
    linear-gradient(160deg, var(--ink-2), var(--ink));
  box-shadow: 0 24px 44px -28px rgba(26, 25, 22, 0.7);
}

.result-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--accent-light);
}

.result-label {
  margin: 0 0 4px;
  color: var(--on-ink-muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.result-headline {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.9rem, 5.5vw, 4.5rem);
  line-height: 1.04;
  color: var(--accent-light);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

.result-pack {
  margin: 10px 0 0;
  color: var(--on-ink);
  font-weight: 600;
}

.result-precise,
.result-physical {
  margin: 6px 0 0;
  color: var(--on-ink-muted);
  font-variant-numeric: tabular-nums;
}

.reset-note {
  display: inline-block;
  margin: 0 0 12px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent-light);
  font-size: 0.85rem;
}

.result-breakdown,
.result-extras,
.result-notes {
  margin: 16px 0 0;
  padding: 10px 14px;
  list-style: none;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.result-breakdown li,
.result-extras li,
.result-notes li {
  padding: 6px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
  font-size: 0.97rem;
}

.result-breakdown li:last-child,
.result-extras li:last-child,
.result-notes li:last-child { border-bottom: 0; }

.result-extras li { font-variant-numeric: tabular-nums; }

.result-notes { background: transparent; border-left: 3px solid var(--accent-light); border-radius: 4px 12px 12px 4px; }

.result-notes li { color: var(--on-ink-muted); }

.result-source {
  margin: 18px 0 0;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--on-ink-muted);
  font-size: 0.9rem;
}

/* Notes under the calculator */

.notes { padding: 8px 24px 64px; }

.note-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  counter-reset: note;
}

.note-card {
  padding: 22px 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.note-card h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 12px;
  font-size: 1.35rem;
}

.note-card h2::before {
  counter-increment: note;
  content: counter(note, decimal-leading-zero);
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent-tint);
  color: var(--accent);
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  font-variant-numeric: tabular-nums;
}

.note-card p { margin: 0 0 10px; }

.note-card p:last-child { margin-bottom: 0; }

.section-title {
  margin: 40px 0 0;
  font-size: 1.6rem;
}

.notice {
  margin: 20px 0 0;
  padding: 14px 18px;
  border: 1px solid var(--accent-tint);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
}

/* Article pages */

.prose { padding: 32px 24px 64px; }

.prose-card {
  max-width: 760px;
  padding: 30px 34px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  line-height: 1.7;
}

.prose-card p { margin: 0 0 14px; }

.prose-card p:last-child { margin-bottom: 0; }

.prose-card h1 { margin: 0 0 16px; font-size: 2rem; }

.admin .prose-card { max-width: none; }

.admin h2 { margin: 30px 0 4px; font-size: 1.35rem; }

.admin th, .admin td { white-space: nowrap; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.stat-card {
  padding: 16px 18px;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.stat-card p { margin: 0; }

a.stat-card {
  display: block;
  color: inherit;
  text-decoration: none;
}

a.stat-card[aria-current="true"] { border-color: var(--ink); }

.stat-label { color: var(--muted); font-size: 0.9rem; }

.stat-value {
  font-family: var(--serif);
  font-size: 2rem;
  line-height: 1.2;
}

.stat-value span { font-family: var(--sans); font-size: 1rem; color: var(--muted); }

.stat-sub { color: var(--muted); font-size: 0.9rem; }

.filter-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 18px;
  margin: 12px 0 16px;
}

.filter-form .field { margin: 0; min-width: 180px; }

.filter-form .check { min-height: 44px; align-items: center; }

.filter-form select,
.filter-form input[type="date"] {
  min-height: 44px;
  padding: 0 12px;
  font: inherit;
  background: var(--field);
  color: inherit;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  margin: 12px 0;
}

.pager span { color: var(--muted); }

.badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  font-size: 0.78rem;
  color: var(--muted);
  background: #f0e9da;
  border-radius: 999px;
  white-space: nowrap;
}

.badge-person { background: #e3efe0; color: #245c32; }
.badge-search { background: #e3ebf6; color: #1d4e89; }
.badge-scanner { background: #f8e6dc; color: #8a3b12; }
.badge-local { background: #eeeae4; color: #5c564c; }

td.ua {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.88rem;
}

/* Guides */

.guide .prose-card h2 {
  margin: 30px 0 10px;
  font-size: 1.45rem;
  line-height: 1.25;
}

.guide .prose-card section:first-of-type h2 { margin-top: 24px; }

.guide .section-title,
.guide .tool-grid { max-width: 760px; }

.table-wrap { overflow-x: auto; margin: 16px 0 8px; }

.table-wrap table { margin: 0; }

.guide-table caption {
  padding: 0 0 8px;
  text-align: left;
  color: var(--muted);
  font-size: 0.92rem;
}

.guide-table th, .guide-table td { white-space: nowrap; }

.guide-table tbody th { font-weight: 600; }

.guide-note {
  margin-top: 26px !important;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
}

.guide-link {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 20px 0 0;
  padding: 16px 18px;
  color: var(--text);
  text-decoration: none;
  background: var(--accent-soft);
  border: 1px solid var(--accent-tint);
  border-radius: var(--radius);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.guide-link:hover { color: var(--text); border-color: var(--accent); box-shadow: var(--shadow-lift); }

.guide-link > span:nth-child(2) { flex: 1; min-width: 0; }

.guide-link-label {
  display: block;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.guide-link-title { display: block; font-weight: 600; font-size: 1.05rem; }

.guide-link:hover .tool-arrow { color: var(--accent); }

.guide-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 4px 24px;
  margin: 18px 0 20px;
  padding: 0;
  list-style: none;
}

.guide-list li {
  padding: 8px 0 8px 18px;
  border-bottom: 1px solid var(--line);
  position: relative;
}

.guide-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1.05em;
  width: 8px;
  height: 8px;
  border-radius: 3px;
  background: var(--accent);
}

.guide-list a { color: var(--text); text-decoration: none; font-weight: 550; }

.guide-list a:hover { color: var(--accent); text-decoration: underline; }

.home .button-ghost,
.prose .button-ghost {
  color: var(--text);
  border-color: var(--line-strong);
}

.home .button-ghost:hover,
.prose .button-ghost:hover { color: var(--text); background: var(--card); border-color: var(--ink); }

/* Footer */

.site-footer {
  background: var(--ink);
  color: var(--on-ink-muted);
}

.footer-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2.6fr);
  gap: 40px;
  padding: 52px 24px 36px;
}

.footer-brand p { margin: 12px 0 0; max-width: 28ch; }

.footer-cols {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
}

.footer-heading {
  margin: 0 0 12px;
  color: var(--accent-light);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.footer-cols ul { margin: 0; padding: 0; list-style: none; }

.footer-cols li { margin: 0 0 8px; }

.site-footer a { color: #e9e1d3; text-decoration: none; }

.site-footer a:hover { color: #fff; text-decoration: underline; }

.footer-base {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding: 20px 24px 40px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.9rem;
}

.footer-base p { margin: 0; max-width: 70ch; }

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
}

.inline-form { display: inline; margin: 0; }

.site-footer button {
  min-height: 36px;
  background: transparent;
  border-color: rgba(255, 255, 255, 0.3);
  color: var(--on-ink);
}

.site-footer button:hover { background: rgba(255, 255, 255, 0.08); }

/* Admin tables and forms */

table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  margin: 16px 0 8px;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th + th, td + td { border-left: 1px solid var(--line); }

thead th { background: #f0e9da; font-weight: 650; }

tbody tr:last-child td { border-bottom: 0; }

tbody tr:hover td { background: var(--accent-soft); }

textarea {
  width: 100%;
  min-height: 8rem;
  padding: 10px 12px;
  font: inherit;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--field);
  color: inherit;
  transition: border-color 120ms ease;
}

textarea:hover { border-color: var(--line-strong); }

button {
  min-height: 44px;
  padding: 0 18px;
  font: inherit;
  font-weight: 600;
  background: var(--ink);
  color: var(--on-ink);
  border: 1px solid var(--ink);
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 120ms ease;
}

button:hover { background: #34322d; }

@media (prefers-reduced-motion: reduce) {
  .tool-card, .tool-arrow { transition: none; }
  .tool-card:hover, .tool-card:hover .tool-arrow { transform: none; }
}

@media (max-width: 959px) {
  .hero-inner {
    grid-template-columns: 1fr;
    gap: 28px;
    padding: 40px 16px 48px;
  }

  .hero-art { justify-self: center; max-width: 360px; }

  .tool-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 18px 16px 32px;
  }

  .fields-primary { order: 1; }
  .result-wrap { order: 2; position: static; }
  .fields-secondary { order: 3; }

  .fields-primary,
  .fields-secondary { padding: 18px 16px 4px; }

  .header-inner,
  .tool-hero-inner,
  .page-hero-inner,
  .notes,
  .home,
  .prose,
  .footer-inner,
  .footer-base { padding-left: 16px; padding-right: 16px; }

  .home { padding-top: 36px; }
  .note-grid { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; gap: 28px; padding-top: 40px; }
  .footer-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .prose-card { padding: 22px 20px; }
}

@media (max-width: 520px) {
  .tool-hero-title { gap: 12px; }
  .tool-icon-lg { width: 48px; height: 48px; border-radius: 14px; }
  .tool-icon-lg .icon { width: 26px; height: 26px; }
  .result-card { padding: 22px 20px 18px; }
  .tool-grid { grid-template-columns: 1fr; }
}
