:root {
  --bg: #f8f4ec;
  --bg-card: #ffffff;
  --text: #2a2520;
  --muted: #6b6258;
  --accent: #3d5a3d;
  --accent-dark: #2a3f2a;
  --rule: #d9cfbf;
  --link: #6b3a1f;
  --link-hover: #a04f24;
  --shadow: 0 1px 3px rgba(60, 45, 30, 0.08), 0 4px 12px rgba(60, 45, 30, 0.05);
}

* { box-sizing: border-box; }

html { font-size: 17px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Source Serif 4", Georgia, serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
  padding: 1rem 0;
}
.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: "Source Sans 3", system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--accent-dark);
  text-decoration: none;
  letter-spacing: 0.01em;
}
.brand-mark { color: var(--accent); font-size: 1.25rem; }
.brand:hover { color: var(--accent); }

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.9rem;
  font-family: "Source Sans 3", system-ui, sans-serif;
  font-size: 0.95rem;
}
.site-nav a {
  color: var(--text);
  text-decoration: none;
  padding: 0.25rem 0.1rem;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.site-nav a[aria-current="page"] {
  color: var(--accent-dark);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* Main page */
.page {
  padding: 2.25rem 1.25rem 3rem;
}
.page h1 {
  font-family: "Source Sans 3", system-ui, sans-serif;
  font-size: 2.3rem;
  line-height: 1.15;
  margin: 0 0 1rem;
  color: var(--accent-dark);
  letter-spacing: -0.01em;
}
.page h2 {
  font-family: "Source Sans 3", system-ui, sans-serif;
  font-size: 1.45rem;
  margin: 2rem 0 0.75rem;
  color: var(--accent-dark);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.25rem;
}
.page h3 {
  font-family: "Source Sans 3", system-ui, sans-serif;
  font-size: 1.15rem;
  margin: 1.5rem 0 0.5rem;
  color: var(--accent-dark);
}

.page p { margin: 0 0 1rem; }
.page a { color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.page a:hover { color: var(--link-hover); }

.page ul, .page ol { margin: 0 0 1.25rem; padding-left: 1.5rem; }
.page li { margin-bottom: 0.35rem; }
.page li > p { margin-bottom: 0.4rem; }

.page blockquote {
  margin: 1.25rem 0;
  padding: 0.5rem 1rem;
  border-left: 3px solid var(--accent);
  background: rgba(61, 90, 61, 0.04);
  color: var(--muted);
  font-style: italic;
}

.page hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 2rem 0;
}

.page img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.25rem 0 0.4rem;
  border-radius: 4px;
  box-shadow: var(--shadow);
}
.page img + em,
.page p > em:only-child {
  display: block;
  font-size: 0.93rem;
  color: var(--muted);
  text-align: center;
  margin: 0 0 1.25rem;
  font-style: italic;
}

.page code {
  background: rgba(61, 90, 61, 0.08);
  padding: 0.1em 0.35em;
  border-radius: 3px;
  font-size: 0.92em;
}

.page table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.5rem;
}
.page th, .page td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--rule);
}
.page th { background: rgba(61, 90, 61, 0.06); font-family: "Source Sans 3", system-ui, sans-serif; }

/* Suno embed */
.suno-embed {
  margin: 1.5rem 0;
  padding: 1rem;
  background: var(--bg-card);
  border-radius: 6px;
  box-shadow: var(--shadow);
}
.suno-embed iframe {
  width: 100%;
  border: 0;
  border-radius: 4px;
  display: block;
}
.suno-embed .caption {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0.6rem 0 0;
  text-align: center;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--rule);
  margin-top: 3rem;
  padding: 1.5rem 0 2rem;
  font-family: "Source Sans 3", system-ui, sans-serif;
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
}
.site-footer p { margin: 0.2rem 0; }
.footer-meta { font-size: 0.85rem; }

/* Responsive */
@media (max-width: 600px) {
  .header-inner { flex-direction: column; align-items: flex-start; }
  .site-nav { width: 100%; }
  .page h1 { font-size: 1.85rem; }
  .page h2 { font-size: 1.25rem; }
}

/* Contribute form */
.contribute-form {
  max-width: 580px;
  margin: 1.5rem 0 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  padding: 1.5rem;
  background: var(--bg-card);
  border-radius: 6px;
  box-shadow: var(--shadow);
}
.contribute-form .field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-family: "Source Sans 3", system-ui, sans-serif;
}
.contribute-form .field-label {
  font-weight: 600;
  color: var(--accent-dark);
  font-size: 0.95rem;
}
.contribute-form input[type="text"],
.contribute-form select,
.contribute-form textarea {
  font: inherit;
  font-family: "Source Serif 4", Georgia, serif;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
}
.contribute-form input[type="text"]:focus,
.contribute-form select:focus,
.contribute-form textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
.contribute-form textarea {
  resize: vertical;
  min-height: 7rem;
  line-height: 1.5;
}
.contribute-form input[type="file"] {
  font-family: "Source Sans 3", system-ui, sans-serif;
  font-size: 0.9rem;
}
.contribute-submit {
  align-self: flex-start;
  font-family: "Source Sans 3", system-ui, sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.6rem 1.4rem;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
}
.contribute-submit:hover { background: var(--accent-dark); }
.contribute-submit:disabled { opacity: 0.6; cursor: wait; }

.contribute-status {
  font-family: "Source Sans 3", system-ui, sans-serif;
  font-size: 0.92rem;
  padding: 0.7rem 0.9rem;
  border-radius: 4px;
  display: none;
}
.contribute-status.pending {
  display: block;
  background: rgba(61, 90, 61, 0.08);
  color: var(--accent-dark);
}
.contribute-status.success {
  display: block;
  background: rgba(61, 90, 61, 0.12);
  color: var(--accent-dark);
  border-left: 3px solid var(--accent);
}
.contribute-status.error {
  display: block;
  background: rgba(160, 79, 36, 0.1);
  color: var(--link-hover);
  border-left: 3px solid var(--link-hover);
}

/* Brand icon */
.brand-icon {
  display: inline-block;
  vertical-align: middle;
  width: 32px;
  height: 32px;
  margin-right: 0.4rem;
}

/* Newspaper-style figure floating on desktop */
.page figure {
  margin: 0.5rem 0 1rem;
}
.page figure img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
  box-shadow: var(--shadow);
  margin: 0;
}
.page figure figcaption {
  font-size: 0.88rem;
  color: var(--muted);
  font-style: italic;
  margin-top: 0.4rem;
  line-height: 1.4;
}

@media (min-width: 720px) {
  /* Float figures to alternating sides for a magazine feel */
  .page figure {
    max-width: 48%;
    margin: 0.3rem 0 1rem 1.25rem;
    float: right;
    clear: right;
  }
  .page figure:nth-of-type(even) {
    float: left;
    clear: left;
    margin: 0.3rem 1.25rem 1rem 0;
  }
  /* Headings always clear floats */
  .page h2, .page h3 { clear: both; }
}

/* Bare markdown images: also constrain on desktop, but stay block + centered */
@media (min-width: 720px) {
  .page > p > img[loading="lazy"] {
    max-width: 80%;
    margin-left: auto;
    margin-right: auto;
  }
}

/* "Inline pull" for prominent narrow images on small screens */
.page img {
  max-width: 100%;
}
