/* Lincoln.Life — public Jinja-side stylesheet.
 *
 * Design tokens mirror the SPA homepage so server-rendered pages
 * (Community Chat, News, Sport, Family, Directory, Events, Guidelines)
 * sit visually in the same family as the React homepage at /. The two
 * surfaces should feel like one site, not two.
 *
 * Layout principle: a single source of truth for cross-section navigation
 * is the signpost strip. The header above it carries only the brand and
 * the search bar — no redundant text-link nav, no duplicated section list.
 * The footer below is minimal for the same reason. JAWS users do not
 * scroll past the same six section names three times to reach the page
 * content.
 */

:root {
  --bg:           oklch(0.975 0.007 80);
  --fg:           oklch(0.175 0.025 50);
  --card:         oklch(0.99 0.005 80);
  --card-fg:      oklch(0.175 0.025 50);
  --primary:      oklch(0.52 0.135 55);
  --primary-fg:   oklch(0.99 0.005 80);
  --muted:        oklch(0.94 0.015 75);
  --muted-fg:     oklch(0.48 0.03 55);
  --border:       oklch(0.905 0.015 75);
  --ring:         oklch(0.52 0.135 55);
  --accent:       oklch(0.52 0.135 55);
  --link:         oklch(0.45 0.135 55);
  --link-visited: oklch(0.42 0.13 290);
  --danger:       oklch(0.55 0.22 27);
  --success:      oklch(0.55 0.13 145);

  --radius:       0.625rem;
  --radius-sm:    calc(var(--radius) - 4px);
  --radius-lg:    calc(var(--radius) + 4px);

  --max-width:    72rem;
  --reading-width: 42rem;

  --font-serif:   "Playfair Display", Georgia, "Times New Roman", serif;
  --font-sans:    system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
                  Arial, sans-serif;
}

@import url("https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700&display=swap");

* { box-sizing: border-box; }

html {
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── Typography ─── */

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 1.5rem 0 0.75rem;
  line-height: 1.2;
}

/* Skip-link target gets breathing room from the viewport edge when
 * fragment-scrolled, so the heading doesn't land flush against the
 * top of the screen. */
#page-heading,
[id^="article-"],
[id^="event-"] {
  scroll-margin-top: 1rem;
}

h1 { font-size: 2.4rem; }
h2 { font-size: 1.7rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.05rem; }

p { margin: 0 0 1rem; }

a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}
a:hover, a:focus { text-decoration-thickness: 2px; }
a:visited { color: var(--link-visited); }
a:focus { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 2px; }

::selection { background: oklch(0.85 0.06 60); color: var(--fg); }

/* ─── Skip link ─── */

.skip-link {
  position: absolute;
  left: -999em;
  top: 0;
  background: var(--primary);
  color: var(--primary-fg);
  padding: 0.7rem 1.1rem;
  border-radius: 0 0 var(--radius) 0;
  z-index: 100;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus {
  left: 0;
  outline: 3px solid var(--bg);
  outline-offset: -3px;
}

/* ─── Header strip ─── */

.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 0;
}
.site-header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3rem;
}
.site-header-auth {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.95rem;
}
.site-header-auth a,
.site-header-auth .link-button {
  color: var(--link);
  text-decoration: none;
}
.site-header-auth a:hover,
.site-header-auth .link-button:hover { text-decoration: underline; }
.site-header-auth a:focus,
.site-header-auth .link-button:focus { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 2px; }
.site-header-auth-name {
  color: var(--muted-fg);
  font-weight: 500;
}
.site-header-auth-join {
  background: var(--primary);
  color: var(--primary-fg, #fff) !important;
  padding: 0.35rem 0.75rem;
  border-radius: 0.375rem;
  font-weight: 600;
}
.site-header-auth-join:hover { text-decoration: none; filter: brightness(0.95); }
.site-header-auth-logout { display: inline; margin: 0; }

/* Inline form button styled as a link — used for POST-only actions like
   sign-out where a real <a href> would be wrong (GET shouldn't mutate). */
.link-button {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--link);
  cursor: pointer;
}
.site-brand {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}
.site-brand a {
  color: var(--fg);
  text-decoration: none;
}
.site-brand a:focus { outline: 2px solid var(--ring); outline-offset: 4px; border-radius: 2px; }
.site-brand .brand-accent { color: var(--primary); }

/* ─── Search band ─── */

.search-band {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0 1.25rem;
}
.search-form {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 1.25rem;
  position: relative;
}
.search-input {
  width: 100%;
  padding: 0.85rem 6.5rem 0.85rem 2.75rem;
  border: 2px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--fg);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px oklch(0.52 0.135 55 / 0.18);
}
.search-input::placeholder { color: var(--muted-fg); }

.search-icon {
  position: absolute;
  left: 2.25rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.1rem;
  height: 1.1rem;
  color: var(--muted-fg);
  pointer-events: none;
}

.search-button {
  position: absolute;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: var(--primary);
  color: var(--primary-fg);
  border: none;
  border-radius: 999px;
  padding: 0.5rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.15s;
}
.search-button:hover, .search-button:focus { opacity: 0.9; }
.search-button:focus { outline: 2px solid var(--ring); outline-offset: 2px; }

/* ─── Hero band (inner pages) ─── */

.hero-band {
  position: relative;
  width: 100%;
  height: 160px;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.hero-band img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 60%;
  display: block;
}

@media (min-width: 768px) {
  .hero-band { height: 200px; }
}

/* ─── Signpost strip ─────────────────────────────────────────────────
 * Inner-page navigation: a single-row strip of section links. Ratified
 * 2026-05-02 — the card grid with blurbs + "Latest" highlights survives
 * on the React homepage at / (its own SignpostStrip component); inner
 * Flask pages use this compressed pattern so above-the-fold belongs
 * to the section's own content, not a navigation hub.
 *
 * Behavioural intent: NO hover-expansion, NO dropdown, NO layout flip.
 * Hovering or focusing a link should not change the strip's height or
 * the position of any other link. This was the lesson from the earlier
 * mock-strip variant that flipped row→column on hover and pushed later
 * sections off-screen.
 */
.signpost-strip {
  background: var(--muted);
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 1.25rem;
}
.signpost-strip > ul {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 1.5rem;
}
.signpost-card {
  padding: 0;
}
.signpost-card h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.4;
}
.signpost-card h3 a {
  color: var(--fg);
  text-decoration: none;
  padding: 0.2rem 0;
  display: inline-block;
}
.signpost-card h3 a:hover, .signpost-card h3 a:focus {
  text-decoration: underline;
  text-decoration-thickness: 2px;
}
.signpost-card h3 a[aria-current="page"] {
  color: var(--primary);
  font-weight: 700;
}
@media (max-width: 640px) {
  .signpost-strip > ul {
    justify-content: flex-start;
    gap: 0.3rem 1rem;
  }
}

/* ─── Main content ─── */

main#main {
  flex: 1 1 auto;
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}
main#main:focus { outline: none; }

main#main > article,
main#main > section,
main#main > nav,
main#main > .post-body {
  max-width: var(--reading-width);
}
main#main > article { width: 100%; }

/* Listing-shaped articles get full width for the section blocks */
main#main > article > section { max-width: 100%; }
main#main > article > header { max-width: var(--reading-width); }

/* Breadcrumb */
.breadcrumb {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted-fg);
}
.breadcrumb li { display: inline; }
.breadcrumb li + li::before {
  content: "›";
  margin-right: 0.4rem;
  color: var(--muted-fg);
}
.breadcrumb li[aria-current="page"] { color: var(--fg); font-weight: 500; }

/* Lead paragraph */
.lede, .lead {
  font-size: 1.1rem;
  color: var(--muted-fg);
  margin-bottom: 1.5rem;
}

/* Meta lines */
.meta {
  font-size: 0.85rem;
  color: var(--muted-fg);
  margin: 0.25rem 0 1rem;
}
.meta strong { color: var(--fg); font-weight: 600; }

/* ─── Article + post lists ─── */

.article-list {
  list-style: none;
  padding: 0;
  margin: 0 0 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.article-list > li {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
}
.article-list > li > article > h3 {
  margin-top: 0;
  font-size: 1.15rem;
}
.article-list > li > article > h3 a {
  color: var(--fg);
  text-decoration: none;
}
.article-list > li > article > h3 a:hover,
.article-list > li > article > h3 a:focus {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  color: var(--primary);
}

/* Pinned + closed badges */
.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  vertical-align: middle;
  margin-left: 0.4rem;
}
.badge-pinned {
  background: oklch(0.92 0.08 75);
  color: oklch(0.35 0.12 60);
  border: 1px solid oklch(0.85 0.1 75);
}
.badge-closed {
  background: var(--muted);
  color: var(--muted-fg);
  border: 1px solid var(--border);
}

/* ─── Conversation thread ─── */

.conversation {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.conversation > li > article {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
}
.report-form {
  margin: 0.4rem 0 0;
}
button.linklike {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.8rem;
  color: var(--muted-fg);
  text-decoration: underline;
  cursor: pointer;
  font-family: inherit;
}
button.linklike:hover, button.linklike:focus {
  color: var(--primary);
}

/* ─── Forms / comment composer ─── */

.comment-form {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin: 1.25rem 0;
}
.comment-form h3 { margin-top: 0; }
.comment-form label {
  display: block;
  font-weight: 600;
  margin: 0.5rem 0 0.3rem;
  font-size: 0.95rem;
}
.comment-form input[type="text"],
.comment-form textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-family: inherit;
  font-size: 1rem;
  color: var(--fg);
}
.comment-form input[type="text"]:focus,
.comment-form textarea:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px oklch(0.52 0.135 55 / 0.15);
}
.comment-form button[type="submit"] {
  margin-top: 0.5rem;
  background: var(--primary);
  color: var(--primary-fg);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.55rem 1.1rem;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.comment-form button[type="submit"]:hover { opacity: 0.9; }

/* ─── Callout / moderation gates ─── */

.callout {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin: 1.25rem 0;
}
.callout.moderation-gate {
  border-left: 4px solid var(--primary);
}
.callout.discussion-prompt {
  background: oklch(0.96 0.025 75);
  border-left: 4px solid oklch(0.65 0.13 80);
}

/* ─── Admin actions ─── */

.admin-actions {
  background: oklch(0.97 0.025 80);
  border: 1px dashed oklch(0.78 0.06 70);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin: 0.5rem 0 1.25rem;
}
.admin-actions::before {
  content: "Admin";
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  margin-right: 0.5rem;
}
.admin-actions-list {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  list-style: none;
  padding: 0;
  margin: 0;
}
.admin-actions button {
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
}
.admin-actions button:hover, .admin-actions button:focus {
  border-color: var(--ring);
  background: var(--card);
}
.admin-actions input[type="text"] {
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-family: inherit;
  font-size: 0.85rem;
  max-width: 18rem;
}

/* ─── Flash messages ─── */

.flash-messages {
  margin: 0 0 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.flash {
  margin: 0;
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--border);
  background: var(--card);
}
.flash-success { border-left-color: var(--success); background: oklch(0.97 0.04 145); }
.flash-error   { border-left-color: var(--danger);  background: oklch(0.97 0.04 27);  }
.flash-info    { border-left-color: var(--primary); background: oklch(0.97 0.025 75); }

/* ─── Pagination ─── */

.pagination {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  margin: 1.5rem 0 0;
}
.pagination span { color: var(--muted-fg); font-size: 0.9rem; }

/* ─── Empty state ─── */

.empty {
  background: var(--muted);
  border-radius: var(--radius);
  padding: 1.25rem;
  color: var(--muted-fg);
  text-align: center;
}

/* ─── Closed thread reason ─── */

.closed-reason {
  background: var(--muted);
  border-left: 3px solid var(--muted-fg);
  padding: 0.5rem 0.8rem;
  border-radius: var(--radius-sm);
  margin: 0.5rem 0;
}

/* ─── Page footer nav (back-links inside main) ─── */

.page-footer-nav {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.page-footer-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

/* ─── Footer ─── */

.site-footer {
  background: var(--muted);
  border-top: 1px solid var(--border);
  padding: 1.5rem 1.25rem;
  color: var(--muted-fg);
  font-size: 0.9rem;
}
.site-footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.site-footer p { margin: 0; }
.site-footer a { color: var(--link); }
.site-footer .small { font-size: 0.8rem; opacity: 0.85; }
.site-footer-brand { font-size: 1rem; }
.site-footer-brand a { color: var(--fg); text-decoration: none; }
.site-footer-brand a:hover { text-decoration: underline; }
.site-footer-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.25rem 2rem;
}
.site-footer-col h3 {
  font-family: var(--font-serif);
  font-size: 1rem;
  margin: 0 0 0.5rem;
  color: var(--fg);
}
.site-footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.site-footer-col form { margin: 0; display: inline; }
.site-footer-legal { font-size: 0.85rem; opacity: 0.85; }

/* ─── Visually hidden (sr-only) helper ─── */

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ─── Article body (post detail, news article) ─── */

.article-body, .post-body {
  font-size: 1.05rem;
}
.article-body img.article-hero {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  border-radius: var(--radius);
  margin: 1rem 0;
}
.source-link a { font-weight: 600; }

.post-removed {
  background: var(--muted);
  border-left: 3px solid var(--danger);
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-sm);
  font-style: italic;
  color: var(--muted-fg);
}

/* ─── Category list (directory) ─── */

.category-list {
  list-style: none;
  padding: 0;
  margin: 0 0 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 0.75rem;
}
.category-list > li {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
}
.category-list > li > h3 { margin-top: 0; }
.category-list > li > h3 a {
  color: var(--fg);
  text-decoration: none;
}
.category-list > li > h3 a:hover, .category-list > li > h3 a:focus {
  color: var(--primary);
  text-decoration: underline;
}

/* ─── CTA link (e.g. "Start a new post") ─── */

.cta-link {
  display: inline-block;
  background: var(--primary);
  color: var(--primary-fg);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  margin: 0.25rem 0 1rem;
}
.cta-link:hover, .cta-link:focus {
  opacity: 0.9;
  color: var(--primary-fg);
  text-decoration: none;
}

/* ─── Cookie consent banner ─────────────────────────────────────────────
 * Sits as the last child of <body>, position:fixed bottom strip. It is a
 * role="region", NOT a modal — it does not trap focus, does not block the
 * page. Visitors can navigate the site without deciding; the analytics
 * tag stays denied until they accept. Equal-prominence Accept and Reject
 * buttons (no dark patterns).
 */
.consent-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  background: var(--card);
  color: var(--card-fg);
  border-top: 2px solid var(--primary);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.12);
}
.consent-banner-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  justify-content: space-between;
}
.consent-banner-text {
  margin: 0;
  flex: 1 1 24rem;
  font-size: 0.95rem;
  line-height: 1.45;
}
.consent-banner-actions {
  display: flex;
  gap: 0.5rem;
  flex: 0 0 auto;
}
.consent-btn {
  font: inherit;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  font-weight: 600;
}
.consent-btn-accept {
  background: var(--primary);
  color: var(--primary-fg);
  border-color: var(--primary);
}
.consent-btn-accept:hover, .consent-btn-accept:focus {
  filter: brightness(0.95);
}
.consent-btn-reject {
  background: var(--bg);
  color: var(--fg);
}
.consent-btn-reject:hover, .consent-btn-reject:focus {
  background: var(--muted);
}
.consent-btn:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .consent-banner-inner {
    flex-direction: column;
    align-items: stretch;
  }
  .consent-banner-actions {
    justify-content: stretch;
  }
  .consent-btn {
    flex: 1;
  }
}
