:root {
  --bg: #faf9f7;
  --text: #111111;
  --muted: #666666;
  --rule: #e6e6e6;
  --max: 42rem; /* readable line length */

  /* Accent palette — muted sage green */
  --accent: #6b7c5e;
  --accent-light: #98a88e;
  --accent-bg: #f0f3ed;
  --link-hover: #e9eae0;

  /* Font stacks */
  --sans: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  --serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
}

html {
  font-size: 18px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  line-height: 1.8;
}

.container {
  max-width: var(--max);
  margin: 0 auto;
  padding: 3rem 1.25rem;
}

/* Header / nav (quiet) */
.site-header {
  padding: 1.5rem 0 0.25rem 0;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0;
  margin: 0;

  font-family: var(--sans);
  font-size: 0.95rem;
}

.nav-links {
  display: flex;
  gap: 0.9rem;
}

.site-title {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.site-logo {
  height: 2.4rem;
  width: auto;
}

.logo-cursor {
  color: var(--accent);
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}


/* Links: understated, text-like */
a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(17, 17, 17, 0.35);
  text-underline-offset: 0.18em;
}

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

/* Headings: sans for contrast */
h1, h2, h3 {
  font-family: var(--sans);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 2.2rem;
  font-weight: 300;
  margin: 1.5rem 0 0.75rem;
}

h2 {
  font-size: 1.25rem;
  font-weight: 400;
  margin: 2rem 0 0.6rem;
}

h3 {
  font-size: 1.05rem;
  font-weight: 400;
  margin: 1.5rem 0 0.5rem;
  margin-top: 2rem;
}

p {
  margin: 0.85rem 0;
  text-align: justify;
}

ul, ol {
  margin: 0.85rem 0 0.85rem 1.25rem;
}

li {
  margin: 0.25rem 0;
}

/* Rules: subtle */
hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 2rem 0;
}

/* Footer */
.site-footer {
  margin-top: 3rem;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.95rem;
}

.footer-nav {
  margin-bottom: 0.5rem;
}

.footer-nav a {
  color: var(--muted);
  text-decoration-color: rgba(102, 102, 102, 0.4);
  margin-right: 0.9rem;
}

.footer-nav a:hover {
  color: var(--link-hover);
}

/* Optional: blockquotes for essays */
blockquote {
  margin: 1.5rem 0;
  padding-left: 1rem;
  border-left: 3px solid var(--rule);
  color: #333;
}

blockquote strong {
  font-weight: 600;
}

/* ─── Section label ─── */
.section-label {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 2.5rem 0 0.75rem;
}

.section-label:first-child {
  margin-top: 0;
}

/* ─── Home welcome ─── */
.home-welcome {
  margin-bottom: 2.5rem;
}

.home-welcome h1 {
  font-size: 2.6rem;
  font-weight: 300;
  margin-bottom: 0.25rem;
}

.home-welcome p {
  color: var(--muted);
  font-size: 1.05rem;
  text-align: left;
  margin-top: 0;
}

/* ─── Cards (series, projects) ─── */
.home-card {
  display: block;
  background: var(--accent-bg);
  border-left: 3px solid var(--accent);
  padding: 0.85rem 1rem;
  margin: 0.6rem 0;
  text-decoration: none;
  transition: border-color 0.15s;
}

.home-card:hover {
  border-left-color: var(--accent-light);
  text-decoration: none;
}

.home-card-title {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 1rem;
}

.home-card-meta {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.home-card-desc {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.3rem;
  line-height: 1.4;
}

/* ─── Index entries (ruled-line lists) ─── */
.index-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.index-entry {
  border-bottom: 1px solid var(--rule);
  padding: 0.5rem 0;
}

.index-entry:first-child {
  border-top: 1px solid var(--rule);
}

.index-entry a {
  text-decoration: none;
  font-family: var(--sans);
  font-size: 0.95rem;
}

.index-entry a:hover {
  color: var(--link-hover);
}

.index-entry .entry-meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-left: 0.5rem;
}

/* "All writing →" style link */
.view-all {
  display: inline-block;
  margin-top: 0.75rem;
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--muted);
  text-decoration-color: rgba(102, 102, 102, 0.4);
}

.view-all:hover {
  color: var(--link-hover);
}

/* ─── Notes ─── */

.note-page {
  color: #2a2a2a;         /* slightly softer ink */
  font-size: 0.96em;      /* slightly smaller */
  line-height: 1.85;      /* slightly more airy */
  padding-left: 1rem;     /* creates a margin for the rule */
  border-left: 2px solid var(--accent-light);
}

.note-page p {
  font-size: 0.97em;
}

.note-label {
  font-family: var(--sans);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.9rem 0;
}

.tag-count {
  color: var(--muted);
  font-size: 0.95em;
}

.tags-line {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.95rem;
  margin: 0.5rem 0 0;
}

.tags-label {
  margin-right: 0.4rem;
}

.tag-link {
  text-decoration-color: rgba(102, 102, 102, 0.45);
}

.tag-link:hover {
  color: var(--link-hover);
}

.tag-sep {
  margin: 0 0.15rem;
}

/* Footnotes */

.footnotes {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-size: 0.95em;
  color: var(--muted);
}

.footnotes ol {
  padding-left: 1.25rem;
}

.footnotes li {
  margin: 0.5rem 0;
}

sup {
  font-size: 0.75em;
  vertical-align: super;
}

/* ─── Series sidebar layout ─── */

.series-container {
  max-width: 62rem;
  margin: 0 auto;
  padding: 3rem 1.25rem;
}

.series-layout {
  display: grid;
  grid-template-columns: 15rem 1fr;
  gap: 3rem;
  align-items: start;
}

.series-toc {
  position: sticky;
  top: 2rem;
  font-family: var(--sans);
  font-size: 0.85rem;
  line-height: 1.5;
  border-right: 1px solid var(--rule);
  padding-right: 1.5rem;
}

.series-toc summary {
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--muted);
  list-style: none;
  margin-bottom: 0.75rem;
}

.series-toc summary::-webkit-details-marker {
  display: none;
}

.series-toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.series-toc li {
  margin: 0;
  padding: 0.3rem 0;
}

.series-toc a {
  color: var(--muted);
  text-decoration: none;
}

.series-toc a:hover {
  color: var(--link-hover);
}

.series-toc .toc-current a {
  color: var(--text);
  font-weight: 600;
  border-left: 2px solid var(--text);
  padding-left: 0.6rem;
}

.series-content {
  max-width: 42rem;
  min-width: 0;
}

/* Responsive: collapse sidebar to disclosure widget */
@media (max-width: 52rem) {
  .series-container {
    max-width: var(--max);
  }

  .series-layout {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .series-toc {
    position: static;
    border-right: none;
    padding-right: 0;
    border-bottom: 1px solid var(--rule);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
  }

  .series-toc summary {
    list-style: revert;
    cursor: pointer;
  }

  .series-toc summary::-webkit-details-marker {
    display: revert;
  }
}

/* ─── Contact form ─── */

.contact-form {
  margin-top: 1.5rem;
}

.contact-form label {
  display: block;
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.25rem;
  margin-top: 1.25rem;
}

.contact-form label:first-child {
  margin-top: 0;
}

.contact-form input,
.contact-form textarea {
  display: block;
  width: 100%;
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--rule);
  padding: 0.4rem 0;
  box-sizing: border-box;
}

.contact-form textarea {
  resize: vertical;
  border: 1px solid var(--rule);
  padding: 0.5rem;
  margin-top: 0.25rem;
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.contact-form button {
  display: inline-block;
  margin-top: 1.5rem;
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 500;
  color: white;
  background: var(--accent);
  border: none;
  padding: 0.5rem 1.75rem;
  cursor: pointer;
  letter-spacing: 0.02em;
}

.contact-form button:hover {
  background: var(--accent-light);
}

/* ─── Sambar page ─── */

.sambar-hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  align-items: start;
  margin-bottom: 2rem;
}

.sambar-hero-text h1 {
  margin-top: 0.5rem;
}

.sambar-tagline {
  color: var(--muted);
  font-style: italic;
  text-align: left;
  margin-top: 0;
}

.sambar-photo {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
}

@media (max-width: 40rem) {
  .sambar-hero {
    grid-template-columns: 1fr;
  }

  .sambar-hero-photo {
    order: -1;
  }
}

/* Stats grid */
.sambar-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 1rem 0 1.5rem;
}

.sambar-stat {
  display: block;
  background: var(--accent-bg);
  border-left: 3px solid var(--accent);
  padding: 0.75rem 0.9rem;
  text-decoration: none;
  transition: border-color 0.15s;
}

.sambar-stat:hover {
  border-left-color: var(--accent-light);
  text-decoration: none;
}

.sambar-stat-value {
  display: block;
  font-family: var(--sans);
  font-size: 1.3rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--text);
}

.sambar-stat-label {
  display: block;
  font-family: var(--sans);
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

@media (max-width: 40rem) {
  .sambar-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Insights */
.sambar-insights {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sambar-insight {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--muted);
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--accent);
  background: var(--accent-bg);
  border-radius: 0 6px 6px 0;
  margin: 0;
}

.sambar-insight strong {
  color: var(--text);
}

/* Tables */
.sambar-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1rem 0 1.5rem;
}

.sambar-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 0.88rem;
  line-height: 1.5;
}

.sambar-table th {
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 0.4rem 0.6rem;
  border-bottom: 2px solid var(--rule);
  white-space: nowrap;
}

.sambar-table td {
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

.sambar-table td:first-child {
  white-space: nowrap;
}

.sambar-table tfoot th {
  border-top: 2px solid var(--rule);
  border-bottom: none;
  padding-top: 0.6rem;
  color: var(--text);
}

.sambar-table tbody tr:last-child td {
  border-bottom: none;
}

/* Maintenance tables: fixed column widths for uniformity across groups */
.sambar-maintenance-table {
  table-layout: fixed;
}

.sambar-maintenance-table th:nth-child(1),
.sambar-maintenance-table td:nth-child(1) {
  width: 18%;
}

.sambar-maintenance-table th:nth-child(2),
.sambar-maintenance-table td:nth-child(2) {
  width: 46%;
}

.sambar-maintenance-table th:nth-child(3),
.sambar-maintenance-table td:nth-child(3) {
  width: 18%;
}

.sambar-maintenance-table th:nth-child(4),
.sambar-maintenance-table td:nth-child(4) {
  width: 18%;
}

/* Schedule table: compact to fit 5 columns without overflow */
.sambar-schedule-table {
  font-size: 0.82rem;
  table-layout: fixed;
}

.sambar-schedule-table td {
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.sambar-schedule-table th:nth-child(1),
.sambar-schedule-table td:nth-child(1) {
  width: 36%;
}

.sambar-schedule-table th:nth-child(2),
.sambar-schedule-table td:nth-child(2) {
  width: 14%;
}

.sambar-schedule-table th:nth-child(3),
.sambar-schedule-table td:nth-child(3) {
  width: 16%;
}

.sambar-schedule-table th:nth-child(4),
.sambar-schedule-table td:nth-child(4) {
  width: 16%;
}

.sambar-schedule-table th:nth-child(5),
.sambar-schedule-table td:nth-child(5) {
  width: 18%;
}

/* ─── Mobile: stacked card layout for tables with 4+ columns ─── */
@media (max-width: 40rem) {
  /* All multi-column sambar tables become stacked cards */
  .sambar-table:not(.sambar-costs-table) {
    display: block;
  }

  .sambar-table:not(.sambar-costs-table) thead {
    display: none;
  }

  .sambar-table:not(.sambar-costs-table) tbody {
    display: block;
  }

  .sambar-table:not(.sambar-costs-table) tbody tr {
    display: block;
    border-bottom: 1px solid var(--rule);
    padding: 0.75rem 0;
  }

  .sambar-table:not(.sambar-costs-table) tbody tr:last-child {
    border-bottom: none;
  }

  .sambar-table:not(.sambar-costs-table) td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.15rem 0;
    border-bottom: none;
    white-space: normal;
  }

  .sambar-table:not(.sambar-costs-table) td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    flex-shrink: 0;
    margin-right: 1rem;
  }

  /* First cell (usually item name or date) is the card header */
  .sambar-table:not(.sambar-costs-table) td:first-child {
    font-weight: 500;
    padding-bottom: 0.25rem;
  }

  /* Reset table-layout and width overrides for mobile */
  .sambar-schedule-table,
  .sambar-maintenance-table {
    table-layout: auto;
  }

  .sambar-schedule-table th,
  .sambar-schedule-table td,
  .sambar-maintenance-table th,
  .sambar-maintenance-table td {
    width: auto !important;
  }

  /* Schedule table: restore readable font size in card mode */
  .sambar-schedule-table {
    font-size: 0.88rem;
  }

  /* Tfoot for costs table stays as-is (2 columns, fine on mobile) */
  .sambar-table.sambar-costs-table tfoot th {
    border-top: 2px solid var(--rule);
  }
}

/* Maintenance group headings */
.sambar-group-heading {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 2rem 0 0.25rem;
}

/* Utility */
.sambar-muted {
  color: var(--muted);
}

.sambar-small {
  font-size: 0.82em;
}

.sambar-empty {
  color: var(--muted);
  font-style: italic;
  font-family: var(--sans);
  font-size: 0.95rem;
}

/* Status badges */
.sambar-badge {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.15em 0.55em;
  border-radius: 3px;
  white-space: nowrap;
}

.sambar-badge--ok {
  background: var(--accent-bg);
  color: var(--accent);
}

.sambar-badge--due-soon {
  background: #fdf5e6;
  color: #8a6200;
}

.sambar-badge--overdue {
  background: #fdecea;
  color: #8b1a1a;
}

/* Charts */
.sambar-chart {
  display: block;
  width: 100%;
  max-width: 600px;
  height: auto;
  margin: 1rem 0 1.5rem;
}

.sambar-chart-empty {
  color: var(--muted);
  font-style: italic;
  font-family: var(--sans);
  font-size: 0.9rem;
}

/* App screenshots */
.app-screenshots {
  overflow-x: auto;
  margin: 1.5rem -1rem 0;
  padding: 0 1rem 1rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.app-screenshots-track {
  display: flex;
  gap: 1.25rem;
  padding: 0.25rem 0;
}

.app-screen {
  flex: 0 0 auto;
  width: 220px;
  margin: 0;
  text-align: center;
}

.app-screen img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.app-screen img:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.app-screen figcaption {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-top: 0.6rem;
}

@media (max-width: 40rem) {
  .app-screen {
    width: 180px;
  }
}

/* ─── Recipes ─── */

.recipe-page {
  padding-left: 1rem;
  border-left: 2px solid var(--accent-light);
}

.recipe-page h1 {
  font-size: 1.8rem;
  font-weight: 300;
  margin-top: 0.25rem;
  margin-bottom: 1.25rem;
}

/* First two paragraphs (Time / Yield) render as metadata */
.recipe-page h1 + p,
.recipe-page h1 + p + p {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--muted);
  text-align: left;
  margin: 0.2rem 0;
}

/* Ingredient tables: borderless two-column layout */
.recipe-page table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0 0.25rem;
  font-size: 0.95em;
  line-height: 1.9;
}

.recipe-page table td {
  padding: 0.1rem 0.75rem 0.1rem 0;
  vertical-align: baseline;
  width: 50%;
  border: none;
  line-height: 1.5;
}

.recipe-page table thead {
  display: none;
}

/* Horizontal rules as section dividers (ingredients → instructions → notes) */
.recipe-page hr {
  border: none;
  margin: 2rem 0;
}

/* Attribution line at end (italic) */
.recipe-page p em:only-child {
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--muted);
}

@media (max-width: 30rem) {
  .recipe-page table td {
    display: block;
    width: 100%;
    padding-right: 0;
  }
}
