/* The layout sets --ink, --paper, --accent, --on-accent, --heading-font and --body-font. */
:root {
  /* Greys between the text and background colours, so they suit either. */
  --muted: color-mix(in srgb, var(--ink) 70%, var(--paper));
  --rule: color-mix(in srgb, var(--ink) 17%, var(--paper));
  --serif: Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
  /* Shoelace's primary buttons and focus rings take the accent. */
  --sl-color-primary-500: color-mix(in srgb, var(--accent) 85%, white);
  --sl-color-primary-600: var(--accent);
  --sl-color-primary-700: color-mix(in srgb, var(--accent) 80%, black);
  --sl-font-sans: var(--sans);
  /* Shoelace's light theme labels fields in fixed greys; follow the layout's colours instead. */
  --sl-input-label-color: var(--ink);
  --sl-input-help-text-color: var(--muted);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.55 var(--body-font);
  overflow-wrap: break-word;
}

a { color: inherit; }
a:hover { color: var(--accent); }
img { display: block; max-width: 100%; }
/* The layout picks a label colour that reads on the accent. */
sl-button[variant="primary"]::part(base) { color: var(--on-accent); }

.masthead {
  border-bottom: 3px double var(--ink);
  padding: 1.25rem 1rem 0.75rem;
  text-align: center;
}
.site-name {
  font-size: clamp(2rem, 7vw, 3.5rem);
  font-weight: bold;
  letter-spacing: -0.02em;
  text-decoration: none;
}
.tagline { margin: 0.25rem 0 0; color: var(--muted); font-style: italic; }

main { max-width: 72rem; margin: 0 auto; padding: 1.5rem 1rem 2rem; }

h1, h2, h3, .site-name { font-family: var(--heading-font); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5rem; }
h1 a, h2 a, h3 a { text-decoration: none; }

.summary, .dek { color: var(--muted); margin: 0 0 0.5rem; }
.byline { font: 0.85rem var(--sans); color: var(--muted); margin: 0; }

.card-image img, .story figure img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  background: var(--rule);
}
.card-image { display: block; }
.card sl-card { display: block; height: 100%; --border-color: var(--rule); }
.card sl-card::part(base) {
  height: 100%;
  background: color-mix(in srgb, var(--ink) 3%, var(--paper));
  color: var(--ink);
}
.lead .card-image { margin-bottom: 0.6rem; }

.pinned {
  display: grid;
  gap: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 1.5rem;
}
.lead h2 { font-size: clamp(1.6rem, 4.5vw, 2.4rem); }

.latest > h2 {
  font: bold 0.8rem var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 0.3rem;
}
.grid { display: grid; gap: 1.5rem; }
.card h3 { font-size: 1.2rem; }
.older { font-family: var(--sans); text-align: center; margin-top: 2rem; }
.empty { color: var(--muted); }

@media (min-width: 40rem) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 60rem) {
  .pinned { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
  .pinned .lead { grid-row: span 2; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.story, .author, .error { max-width: 42rem; margin: 0 auto; }
.story h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); }
.story .byline { margin-bottom: 1rem; }
.story figure { margin: 0 0 1.5rem; }
.body h2 { font-size: 1.4rem; margin-top: 1.5rem; }
.body h3 { font-size: 1.15rem; margin-top: 1.25rem; }
.body blockquote {
  margin: 1rem 0;
  padding-left: 1rem;
  border-left: 3px solid var(--accent);
  font-style: italic;
}
.bio { color: var(--muted); }

footer {
  border-top: 1px solid var(--rule);
  padding: 1.5rem 1rem 2rem;
  font-family: var(--sans);
}
.signup { max-width: 28rem; margin: 0 auto; }
.signup sl-alert { margin-bottom: 0.75rem; }
.signup-row { display: flex; gap: 0.5rem; align-items: flex-end; }
.signup sl-input { flex: 1; min-width: 0; }
.signup sl-input::part(form-control-label) { font-weight: 600; }
.copyright { text-align: center; color: var(--muted); font-size: 0.8rem; margin: 1.5rem 0 0; }

.editor-bar {
  display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; justify-content: space-between;
  padding: 0.75rem 1rem; border-bottom: 1px solid var(--rule); font-family: var(--sans);
}
.editor-site { font-weight: 600; text-decoration: none; }
.editor-nav { display: flex; flex-wrap: wrap; gap: 1rem; font-size: 0.9rem; }
.editor-who { display: flex; gap: 0.75rem; align-items: center; color: var(--muted); font-size: 0.9rem; }
.editor { max-width: 48rem; font-family: var(--sans); }
.editor > sl-alert, .editor h1 + sl-alert { margin-bottom: 1rem; }
.editor-head { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; justify-content: space-between; }
.editor-list { list-style: none; padding: 0; margin: 1rem 0 0; }
.editor-list > li {
  display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; justify-content: space-between;
  padding: 0.9rem 0; border-top: 1px solid var(--rule);
}
.editor-item { flex: 1 1 16rem; min-width: 0; }
.editor-item a { font-weight: 600; overflow-wrap: anywhere; }
.editor-state { color: var(--muted); font-size: 0.85rem; margin: 0.25rem 0 0; }
.editor-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: flex-end; margin-bottom: 1rem; }
.editor-list .editor-actions { margin-bottom: 0; }
.editor-pin { display: flex; gap: 0.5rem; align-items: flex-end; }
.editor-pin sl-select { width: 10rem; }
.editor-form { display: flex; flex-direction: column; gap: 1rem; }
.editor-form sl-button { align-self: flex-start; }
.theme-file { display: flex; flex-direction: column; gap: 0.25rem; font-family: monospace; }
.theme-file textarea { font: 0.85rem/1.4 monospace; width: 100%; box-sizing: border-box; }
.editor-image img { max-height: 12rem; }
.editor-image { margin: 0; }
.editor-picture { display: flex; flex-direction: column; gap: 0.75rem; border: 1px solid var(--rule, #ddd); border-radius: 0.25rem; padding: 0.75rem 1rem 1rem; margin: 0; min-width: 0; }
.editor-picture input[type="file"] { max-width: 100%; }
.editor-signin { max-width: 26rem; margin: 2rem auto; }

.preview-bar {
  margin: 0; padding: 0.5rem 1rem; text-align: center;
  background: var(--ink); color: var(--paper); font: 600 0.9rem var(--sans);
}
.preview-bar a { color: inherit; }
.no-pictures .card-image { display: none; }
.pinned.no-lead { grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr)); }
.grid.list { grid-template-columns: minmax(0, 1fr); gap: 0.75rem; }
.list .card-image { display: none; }
.signup-section { padding: 1.5rem 0; border-top: 1px solid var(--rule); font-family: var(--sans); }
.layout-form fieldset { border: 1px solid var(--rule); padding: 0.75rem 1rem 1rem; margin: 0; }
.layout-form legend { font-weight: 600; padding: 0 0.25rem; }
.layout-form fieldset > * + * { margin-top: 0.75rem; }
.layout-actions { display: flex; gap: 0.5rem; }
