/* AfterLoss library + content-page chrome.
   Layered on top of seo.css. Loaded by /resources.html and every
   per-state, per-situation, per-task page. Also referenced by
   index.html for the homepage #resources section. */

:root {
  --aw-sage: #7c8a6f;
  --aw-sage-soft: #b8c3a8;
  --aw-cream: #faf6ef;
  --aw-charcoal: #2a2826;
  --aw-rust: #b8755a;
  --aw-hairline: #e0ddd4;
  --aw-ease-soft: cubic-bezier(.2, .8, .2, 1);
}

/* ---------- Library hub ---------- */

.lib-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 3.5rem 1.5rem 5rem;
}

.lib-hero {
  text-align: left;
  max-width: 760px;
  margin: 0 0 3rem;
}
.lib-hero .kicker {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--aw-sage);
  margin: 0 0 0.75rem;
}
.lib-hero h1 {
  font-family: "Source Serif 4", Georgia, "Times New Roman", serif;
  font-weight: 400;
  font-size: clamp(2.25rem, 4vw, 3.5rem);
  line-height: 1.1;
  margin: 0 0 1.25rem;
  color: var(--aw-charcoal);
  letter-spacing: -0.01em;
}
.lib-hero p {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.25rem;
  line-height: 1.55;
  color: #565248;
  margin: 0;
  max-width: 600px;
}

/* Search */
.lib-search {
  position: relative;
  max-width: 560px;
  margin: 0 0 2.5rem;
}
.lib-search input {
  width: 100%;
  font-family: Inter, -apple-system, sans-serif;
  font-size: 1.0625rem;
  padding: 0.875rem 1.125rem 0.875rem 2.75rem;
  border: 1px solid var(--aw-hairline);
  background: #fff;
  color: var(--aw-charcoal);
  border-radius: 6px;
  transition: border-color 220ms var(--aw-ease-soft), box-shadow 220ms var(--aw-ease-soft);
  min-height: 44px;
}
.lib-search input:focus {
  outline: none;
  border-color: var(--aw-sage);
  box-shadow: 0 0 0 4px rgba(124, 138, 111, 0.12);
}
.lib-search::before {
  content: "";
  position: absolute;
  left: 1rem;
  top: 50%;
  width: 18px; height: 18px;
  margin-top: -9px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237c8a6f' stroke-width='2'><circle cx='11' cy='11' r='7'/><path d='m20 20-3.5-3.5'/></svg>");
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0.85;
  pointer-events: none;
}

/* Tabs (pure CSS via radio inputs) */
.lib-tabs { width: 100%; }
.lib-tabs input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.lib-tablist {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--aw-hairline);
  margin: 0 0 2.5rem;
  flex-wrap: wrap;
}
.lib-tablist label {
  font-family: Inter, -apple-system, sans-serif;
  font-size: 1.0625rem;
  font-weight: 500;
  color: #6b6862;
  padding: 0.875rem 1.25rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 200ms var(--aw-ease-soft), border-color 200ms var(--aw-ease-soft);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.lib-tablist label:hover { color: var(--aw-charcoal); }
.lib-tablist label .count {
  font-size: 0.8125rem;
  color: #9a978f;
  margin-left: 0.4rem;
  font-weight: 400;
}

.lib-panel { display: none; }
#lib-tab-state:checked  ~ .lib-panels #lib-panel-state,
#lib-tab-situation:checked ~ .lib-panels #lib-panel-situation,
#lib-tab-task:checked   ~ .lib-panels #lib-panel-task { display: block; }

#lib-tab-state:checked    ~ .lib-tablist label[for="lib-tab-state"],
#lib-tab-situation:checked ~ .lib-tablist label[for="lib-tab-situation"],
#lib-tab-task:checked     ~ .lib-tablist label[for="lib-tab-task"] {
  color: var(--aw-charcoal);
  border-bottom-color: var(--aw-sage);
}

/* Mobile: collapse tabs into stacked pills */
@media (max-width: 640px) {
  .lib-tablist { gap: 0.5rem; border-bottom: none; }
  .lib-tablist label {
    border: 1px solid var(--aw-hairline);
    border-radius: 999px;
    padding: 0.625rem 1rem;
    font-size: 1rem;
  }
  #lib-tab-state:checked    ~ .lib-tablist label[for="lib-tab-state"],
  #lib-tab-situation:checked ~ .lib-tablist label[for="lib-tab-situation"],
  #lib-tab-task:checked     ~ .lib-tablist label[for="lib-tab-task"] {
    background: var(--aw-sage);
    color: #fff;
    border-color: var(--aw-sage);
  }
}

/* Cards grid */
.lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.lib-card {
  display: block;
  background: #fff;
  border: 1px solid var(--aw-hairline);
  border-radius: 8px;
  padding: 1.25rem 1.25rem 1.125rem;
  color: var(--aw-charcoal);
  text-decoration: none;
  transition: transform 240ms var(--aw-ease-soft),
              box-shadow 240ms var(--aw-ease-soft),
              border-color 240ms var(--aw-ease-soft);
  min-height: 132px;
}
.lib-card:hover, .lib-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px -10px rgba(42, 40, 38, 0.18);
  border-color: var(--aw-sage-soft);
  outline: none;
}
.lib-card h3 {
  font-family: "Source Serif 4", Georgia, serif;
  font-weight: 500;
  font-size: 1.1875rem;
  line-height: 1.3;
  margin: 0 0 0.5rem;
  color: var(--aw-charcoal);
  text-transform: capitalize;
}
.lib-card .meta {
  font-family: Inter, -apple-system, sans-serif;
  font-size: 0.875rem;
  color: #6b6862;
  margin: 0;
  line-height: 1.5;
}
.lib-card .meta span + span::before {
  content: " . ";
  margin: 0 0.35rem;
  color: #c4c0b6;
}
.lib-card .desc {
  font-family: Inter, -apple-system, sans-serif;
  font-size: 0.9375rem;
  color: #565248;
  line-height: 1.55;
  margin: 0.5rem 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lib-empty {
  padding: 2rem 0;
  color: #6b6862;
  font-family: Inter, sans-serif;
  font-size: 1rem;
}

@media (prefers-reduced-motion: reduce) {
  .lib-card, .lib-search input { transition: none; }
  .lib-card:hover, .lib-card:focus-visible { transform: none; }
}

/* ---------- Homepage #resources section ---------- */

#resources {
  padding: 5rem 1.5rem;
  background: var(--aw-cream);
  border-top: 1px solid var(--aw-hairline);
}
#resources .inner {
  max-width: 1180px;
  margin: 0 auto;
}
#resources h2 {
  font-family: "Source Serif 4", Georgia, serif;
  font-weight: 400;
  font-size: clamp(2rem, 3.5vw, 2.75rem);
  line-height: 1.15;
  margin: 0 0 0.75rem;
  color: var(--aw-charcoal);
  letter-spacing: -0.01em;
  max-width: 720px;
}
#resources .lede {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.1875rem;
  color: #565248;
  margin: 0 0 2.5rem;
  max-width: 620px;
}
#resources .lib-grid { margin-bottom: 2rem; }
#resources .browse-all {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: Inter, -apple-system, sans-serif;
  font-size: 1.0625rem;
  font-weight: 500;
  color: #fff;
  background: var(--aw-sage);
  padding: 0.875rem 1.5rem;
  border-radius: 999px;
  text-decoration: none;
  min-height: 44px;
  transition: background-color 220ms var(--aw-ease-soft), transform 220ms var(--aw-ease-soft);
}
#resources .browse-all:hover {
  background: #6a7861;
  transform: translateY(-1px);
}
#resources .browse-all::after {
  content: "->";
  font-family: Inter, sans-serif;
  margin-left: 0.15rem;
}
@media (prefers-reduced-motion: reduce) {
  #resources .browse-all { transition: none; }
  #resources .browse-all:hover { transform: none; }
}

/* ---------- Content-page chrome (state / situation / task) ---------- */

.aw-content-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 4rem;
}

.aw-breadcrumb {
  font-family: Inter, -apple-system, sans-serif;
  font-size: 0.9375rem;
  color: #6b6862;
  margin: 0 0 2rem;
  line-height: 1.5;
}
.aw-breadcrumb a {
  color: var(--aw-sage);
  text-decoration: none;
}
.aw-breadcrumb a:hover { text-decoration: underline; }
.aw-breadcrumb .sep {
  margin: 0 0.5rem;
  color: #c4c0b6;
}

.aw-content-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 3rem;
}
@media (min-width: 900px) {
  .aw-content-layout {
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 4rem;
  }
}

.aw-article {
  font-family: "Source Serif 4", Georgia, "Times New Roman", serif;
  color: var(--aw-charcoal);
  font-size: 1.1875rem;
  line-height: 1.7;
  max-width: 720px;
}
.aw-article .hero { padding: 0; margin: 0 0 2.5rem; }
.aw-article .hero .kicker {
  font-family: Inter, sans-serif;
  font-size: 0.875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--aw-sage);
  margin: 0 0 0.875rem;
}
.aw-article .hero h1 {
  font-family: "Source Serif 4", Georgia, serif;
  font-weight: 400;
  font-size: clamp(2.125rem, 4vw, 3rem);
  line-height: 1.15;
  margin: 0 0 1.25rem;
  letter-spacing: -0.01em;
}
.aw-article .lede {
  font-size: 1.3125rem;
  line-height: 1.55;
  color: #3f3d39;
  margin: 0 0 1.5rem;
}
.aw-article h2 {
  font-family: "Source Serif 4", Georgia, serif;
  font-weight: 500;
  font-size: 1.625rem;
  line-height: 1.25;
  margin: 3rem 0 1rem;
  color: var(--aw-charcoal);
  letter-spacing: -0.005em;
}
.aw-article h3 {
  font-family: "Source Serif 4", Georgia, serif;
  font-weight: 500;
  font-size: 1.25rem;
  margin: 2rem 0 0.75rem;
}
.aw-article p { margin: 0 0 1.125rem; }
.aw-article ul, .aw-article ol { padding-left: 1.5rem; margin: 0 0 1.5rem; }
.aw-article li { margin: 0 0 0.5rem; }
.aw-article a { color: var(--aw-rust); text-decoration: underline; text-underline-offset: 2px; }
.aw-article a:hover { color: #9a5d44; }

.aw-article .quick-facts {
  background: #fff;
  border: 1px solid var(--aw-hairline);
  border-left: 3px solid var(--aw-sage);
  padding: 1.25rem 1.5rem;
  margin: 0 0 2rem;
  border-radius: 0 6px 6px 0;
}
.aw-article .quick-facts h2 { margin-top: 0; font-size: 1.125rem; font-family: Inter, sans-serif; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; color: #6b6862; }
.aw-article .quick-facts dl { display: grid; grid-template-columns: 1fr; gap: 0.5rem; margin: 0; font-family: Inter, sans-serif; font-size: 1rem; }
.aw-article .quick-facts dt { color: #6b6862; font-weight: 500; }
.aw-article .quick-facts dd { margin: 0 0 0.5rem; color: var(--aw-charcoal); }
@media (min-width: 540px) {
  .aw-article .quick-facts dl { grid-template-columns: 200px 1fr; align-items: baseline; }
  .aw-article .quick-facts dd { margin: 0; }
}

.aw-article table {
  width: 100%;
  border-collapse: collapse;
  font-family: Inter, sans-serif;
  font-size: 1rem;
  margin: 0 0 2rem;
}
.aw-article th, .aw-article td {
  text-align: left;
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid var(--aw-hairline);
}
.aw-article th { color: #6b6862; font-weight: 600; }

.aw-article .calc {
  background: #fff;
  border: 1px solid var(--aw-hairline);
  padding: 1.25rem;
  border-radius: 6px;
  margin: 0 0 2rem;
  font-family: Inter, sans-serif;
}
.aw-article .calc input {
  width: 100%;
  font-size: 1.0625rem;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--aw-hairline);
  border-radius: 4px;
  margin: 0.5rem 0;
  min-height: 44px;
}
.aw-article .calc button {
  background: var(--aw-sage);
  color: #fff;
  border: none;
  font-size: 1rem;
  padding: 0.625rem 1.25rem;
  border-radius: 4px;
  cursor: pointer;
  min-height: 44px;
}
.aw-article .calc-result { margin: 0.75rem 0 0; font-size: 1rem; }

.aw-article details {
  border: 1px solid var(--aw-hairline);
  border-radius: 6px;
  padding: 0.875rem 1.125rem;
  margin: 0 0 0.625rem;
  background: #fff;
}
.aw-article details summary {
  font-family: Inter, sans-serif;
  font-weight: 500;
  font-size: 1.0625rem;
  cursor: pointer;
  list-style: none;
}
.aw-article details summary::-webkit-details-marker { display: none; }
.aw-article details[open] summary { margin-bottom: 0.5rem; }

.aw-article aside.cta-box {
  background: var(--aw-cream);
  border: 1px solid var(--aw-hairline);
  border-left: 3px solid var(--aw-rust);
  padding: 1.5rem 1.75rem;
  margin: 3rem 0;
  border-radius: 0 8px 8px 0;
}
.aw-article aside.cta-box h2 { margin: 0 0 0.5rem; font-size: 1.375rem; }
.aw-article aside.cta-box .cta-button,
.aw-article aside.cta-box a.cta-button {
  display: inline-block;
  background: var(--aw-rust);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
  text-decoration: none;
  font-family: Inter, sans-serif;
  font-weight: 500;
  font-size: 1.0625rem;
  margin-top: 0.5rem;
  min-height: 44px;
}
.aw-article aside.cta-box a.cta-button:hover { background: #9a5d44; color: #fff; }

/* Sidebar */
.aw-sidebar {
  font-family: Inter, -apple-system, sans-serif;
  font-size: 0.9375rem;
  position: sticky;
  top: 1.5rem;
  align-self: start;
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
}
@media (max-width: 899px) {
  .aw-sidebar { position: static; max-height: none; }
}
.aw-sidebar h2 {
  font-family: Inter, sans-serif;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6b6862;
  margin: 0 0 0.75rem;
}
.aw-sidebar nav ul {
  list-style: none;
  padding: 0;
  margin: 0 0 2rem;
}
.aw-sidebar nav li { margin: 0 0 0.5rem; line-height: 1.45; }
.aw-sidebar nav a {
  color: #565248;
  text-decoration: none;
  display: block;
  padding: 0.25rem 0;
  border-left: 2px solid transparent;
  padding-left: 0.75rem;
  margin-left: -0.75rem;
  transition: color 180ms var(--aw-ease-soft), border-color 180ms var(--aw-ease-soft);
}
.aw-sidebar nav a:hover {
  color: var(--aw-sage);
  border-left-color: var(--aw-sage-soft);
}
.aw-sidebar nav a.active {
  color: var(--aw-charcoal);
  border-left-color: var(--aw-sage);
  font-weight: 500;
}
.aw-sidebar .related a { color: var(--aw-rust); }
.aw-sidebar .related a:hover { color: #9a5d44; text-decoration: underline; }

/* Footer related grid */
.aw-related-footer {
  background: #fff;
  border-top: 1px solid var(--aw-hairline);
  padding: 3rem 1.5rem;
  margin-top: 4rem;
}
.aw-related-footer .inner {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
}
.aw-related-footer h3 {
  font-family: Inter, sans-serif;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6b6862;
  margin: 0 0 1rem;
}
.aw-related-footer ul { list-style: none; padding: 0; margin: 0; }
.aw-related-footer li { margin: 0 0 0.5rem; }
.aw-related-footer a {
  color: var(--aw-charcoal);
  text-decoration: none;
  font-family: Inter, sans-serif;
  font-size: 0.9375rem;
  line-height: 1.5;
}
.aw-related-footer a:hover { color: var(--aw-sage); text-decoration: underline; }

.aw-final-cta {
  background: var(--aw-cream);
  padding: 3rem 1.5rem;
  text-align: center;
  border-top: 1px solid var(--aw-hairline);
}
.aw-final-cta p {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.375rem;
  color: var(--aw-charcoal);
  margin: 0 0 1.25rem;
  line-height: 1.4;
}
.aw-final-cta a {
  display: inline-block;
  background: var(--aw-rust);
  color: #fff;
  padding: 0.875rem 1.75rem;
  border-radius: 999px;
  text-decoration: none;
  font-family: Inter, sans-serif;
  font-weight: 500;
  font-size: 1.0625rem;
  min-height: 44px;
}
.aw-final-cta a:hover { background: #9a5d44; }

/* Slim chrome header (matches the upgraded shell) */
.aw-chrome-header {
  background: var(--aw-cream);
  border-bottom: 1px solid var(--aw-hairline);
  padding: 1rem 0;
  font-family: Inter, -apple-system, sans-serif;
}
.aw-chrome-header .wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.aw-chrome-header .brand {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.375rem;
  font-weight: 500;
  color: var(--aw-sage);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.aw-chrome-header nav {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  flex-wrap: wrap;
}
.aw-chrome-header nav a {
  color: var(--aw-charcoal);
  text-decoration: none;
  font-size: 1rem;
  padding: 0.5rem 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.aw-chrome-header nav a:hover { color: var(--aw-sage); }
.aw-chrome-header nav a.cta {
  background: var(--aw-rust);
  color: #fff;
  padding: 0.625rem 1.125rem;
  border-radius: 999px;
  font-weight: 500;
}
.aw-chrome-header nav a.cta:hover { background: #9a5d44; color: #fff; }

/* Drop cap (subtle, only on .aw-article > .lede first letter) */
.aw-article.has-dropcap .lede::first-letter {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 3.25rem;
  font-weight: 500;
  float: left;
  line-height: 0.95;
  padding: 0.25rem 0.5rem 0 0;
  color: var(--aw-sage);
}
