/* ccplanning.net — shared styles */
:root {
  /* Brand palette (from logo) */
  --brand-red:   #DC3539;
  --brand-green: #2EAD49;
  --brand-blue:  #2F5DC0;
  --brand-blue-dark: #1F3F8C;

  /* Mapped semantic tokens — variable names retained for backward compat */
  --navy:      var(--brand-blue-dark);
  --navy-dark: #15306A;
  --accent:    var(--brand-blue);
  --bg: #ffffff;
  --bg-soft: #f6f8fc;
  --bg-tint: #ecf1fa;
  --border: #d6dde6;
  --text: #1d2330;
  --muted: #5a6577;
  --good: var(--brand-green);
  --warn: #b9770e;
  --bad:  var(--brand-red);
  --radius: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04);
  --maxw: 1080px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  font-size: 16px;
}
img { max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.site-header {
  background: var(--navy);
  color: #fff;
  position: relative;
}
/* Tri-colour stripe under the header echoing the logo palette */
.site-header::after {
  content: "";
  display: block;
  height: 4px;
  background: linear-gradient(
    to right,
    var(--brand-red) 0%, var(--brand-red) 33.33%,
    var(--brand-green) 33.33%, var(--brand-green) 66.66%,
    var(--brand-blue) 66.66%, var(--brand-blue) 100%
  );
}
.site-header .inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.site-header a { color: #fff; }
.brand {
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand img {
  height: 38px;
  width: auto;
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.15));
}
.brand .brand-text { line-height: 1; }
.brand .brand-text small {
  display: block;
  font-size: 0.7rem;
  font-weight: 400;
  opacity: 0.75;
  margin-top: 2px;
  letter-spacing: 0.5px;
}
nav.primary ul {
  display: flex; gap: 22px; list-style: none; margin: 0; padding: 0;
  flex-wrap: wrap;
}
nav.primary a { font-size: 0.95rem; opacity: 0.92; }
nav.primary a:hover { opacity: 1; text-decoration: none; border-bottom: 2px solid var(--accent); padding-bottom: 2px; }

/* Layout */
main { max-width: var(--maxw); margin: 0 auto; padding: 32px 20px 64px; }
section + section { margin-top: 40px; }

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%);
  color: #fff;
  padding: 56px 20px;
}
.hero .inner { max-width: var(--maxw); margin: 0 auto; }
.hero h1 { font-size: 2.2rem; margin: 0 0 12px; line-height: 1.15; }
.hero p { font-size: 1.1rem; max-width: 720px; opacity: 0.92; margin: 0 0 22px; }
.hero .cta { display: flex; gap: 12px; flex-wrap: wrap; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.05s, background 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #1c5b94; text-decoration: none; }
.btn-ghost {
  background: transparent; color: #fff;
  border: 1px solid rgba(255,255,255,0.6);
}
.btn-ghost:hover { background: rgba(255,255,255,0.12); text-decoration: none; }
.btn-outline {
  background: #fff; color: var(--navy);
  border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--bg-soft); }

/* Cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.card h3 { margin: 0 0 8px; color: var(--navy); }
.card p { margin: 0 0 16px; color: var(--muted); font-size: 0.95rem; }
.card .spacer { flex: 1; }

/* Headings */
h1, h2, h3, h4 { color: var(--navy); }
h2 { border-bottom: 2px solid var(--bg-tint); padding-bottom: 6px; margin-top: 0; }

/* Article pages */
.article {
  max-width: 760px;
  margin: 0 auto;
}
.article h1 { font-size: 2rem; margin-bottom: 6px; }
.article .meta { color: var(--muted); font-size: 0.9rem; margin-bottom: 28px; }
.article p { margin: 0 0 14px; }
.article h2 { font-size: 1.35rem; margin-top: 28px; }

/* Calculator panels */
.calc {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
@media (max-width: 760px) { .calc { grid-template-columns: 1fr; } }

.panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.panel h3 { margin-top: 0; }

.field { display: flex; flex-direction: column; margin-bottom: 14px; }
.field label { font-size: 0.9rem; font-weight: 600; margin-bottom: 4px; color: var(--text); }
.field .hint { font-size: 0.8rem; color: var(--muted); margin-top: 3px; }
.field input, .field select, .field textarea {
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

.results { background: var(--bg-tint); border-radius: var(--radius); padding: 16px; }
.result-row {
  display: flex; justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 0.95rem;
}
.result-row:last-child { border-bottom: none; }
.result-row .label { color: var(--muted); }
.result-row .value { font-weight: 700; color: var(--navy); }
.result-row .value.big { font-size: 1.4rem; }

table.staffing {
  width: 100%; border-collapse: collapse; font-size: 0.9rem; margin-top: 10px;
}
table.staffing th, table.staffing td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  text-align: right;
}
table.staffing th:first-child, table.staffing td:first-child { text-align: left; }
table.staffing thead th { background: var(--bg-tint); color: var(--navy); }
table.staffing tr.recommend { background: #eaf6ee; }
table.staffing tr.recommend td { font-weight: 700; }

/* Notice */
.notice {
  background: #fff7e6;
  border-left: 4px solid var(--warn);
  padding: 12px 16px;
  border-radius: 4px;
  font-size: 0.92rem;
  margin: 16px 0;
}
.notice.info { background: #eaf2fa; border-left-color: var(--accent); }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  margin-top: 80px;
  padding: 24px 20px;
  font-size: 0.9rem;
  color: var(--muted);
}
.site-footer .inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
}

/* "Article of the day" panel on the home page */
.aotd-section {
  background: linear-gradient(135deg, #fff 0%, var(--bg-tint) 100%);
  border: 1px solid var(--border);
  border-left: 6px solid var(--brand-blue);
  border-radius: var(--radius);
  padding: 28px 30px;
  box-shadow: var(--shadow);
}
.aotd-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand-blue);
}
.aotd-title {
  font-size: 1.55rem;
  margin: 8px 0 14px;
  border: none;
  padding: 0;
  line-height: 1.25;
}
.aotd-title a {
  color: var(--navy);
  text-decoration: none;
}
.aotd-title a:hover {
  color: var(--brand-blue);
  text-decoration: none;
}
.aotd-synopsis {
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  margin: 0 0 20px;
}
.aotd-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.aotd-readtime {
  color: var(--muted);
  font-size: 0.88rem;
}
.aotd-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 28px;
  align-items: center;
}
@media (max-width: 740px) {
  .aotd-grid { grid-template-columns: 1fr; }
}
.aotd-thumb-link { display: block; border-radius: var(--radius); overflow: hidden; }
.aotd-thumb {
  width: 100%;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
  display: block;
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0,0,0,0.10), 0 4px 14px rgba(0,0,0,0.08);
}
.aotd-content { min-width: 0; }

/* Articles search + sort toolbar */
.articles-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 18px 0 12px;
  flex-wrap: wrap;
}
.search-box {
  flex: 1 1 320px;
  min-width: 260px;
  position: relative;
}
.search-box .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  opacity: 0.55;
  font-size: 0.95rem;
}
.search-box input[type="search"] {
  width: 100%;
  padding: 10px 36px 10px 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  background: #fff;
  -webkit-appearance: none;
  appearance: none;
}
.search-box input[type="search"]::-webkit-search-cancel-button { display: none; }
.search-box input[type="search"]:focus {
  outline: 2px solid var(--brand-blue);
  outline-offset: -1px;
  border-color: var(--brand-blue);
}
.search-box .search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 4px 8px;
  display: none;
}
.search-box .search-clear:hover { color: var(--brand-red); }
.search-box.has-text .search-clear { display: block; }

.sort-control {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.sort-control label {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
}
.sort-control select {
  padding: 9px 30px 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  font-family: inherit;
  font-size: 0.92rem;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M0 0l5 6 5-6z' fill='%235a6577'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.sort-control select:focus {
  outline: 2px solid var(--brand-blue);
  outline-offset: -1px;
  border-color: var(--brand-blue);
}

.results-count {
  margin: 4px 0 14px;
  font-size: 0.9rem;
}

/* Search-hit highlight */
mark.search-hit {
  background: #fff3a6;
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
  font-weight: 600;
}

/* Topic filter pills (articles index) */
.topic-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 24px;
}
.topic-pills .pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  user-select: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.topic-pills .pill:hover { background: var(--bg-tint); }
.topic-pills .pill.active {
  background: var(--brand-blue);
  color: #fff;
  border-color: var(--brand-blue);
}
.topic-pills .pill .count {
  font-size: 0.75rem;
  opacity: 0.7;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(0,0,0,0.06);
}
.topic-pills .pill.active .count { background: rgba(255,255,255,0.18); opacity: 1; }

/* Per-topic colour-coded tags on cards */
.card-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 10px;
}
.topic-tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  background: var(--bg-tint);
  color: var(--brand-blue-dark);
}
.topic-tag.t-forecasting { background: #eaf0fa; color: #1f3f7f; }
.topic-tag.t-scheduling  { background: #eaf6ee; color: #1f6e2d; }
.topic-tag.t-realtime    { background: #fde9eb; color: #8b2230; }
.topic-tag.t-economics   { background: #ecf1fa; color: #2f58a8; }
.topic-tag.t-leadership  { background: #f3eefb; color: #5d4e7b; }

/* Articles index — hide cards filtered out */
.article-grid .card.hidden { display: none; }

/* Article cards with thumbnails */
.article-grid .card.article-card {
  padding: 0;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.12s, box-shadow 0.15s, border-color 0.15s;
}
.article-grid .card.article-card:hover {
  transform: translateY(-2px);
  border-color: var(--brand-blue);
  box-shadow: 0 2px 6px rgba(0,0,0,0.08), 0 8px 20px rgba(0,0,0,0.06);
  text-decoration: none;
}
.article-grid .card-thumb {
  width: 100%;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
  display: block;
  border-bottom: 1px solid var(--border);
}
.article-grid .card-body {
  padding: 18px 22px 22px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.article-grid .card-body .card-cta {
  margin-top: 12px;
  color: var(--brand-blue);
  font-weight: 600;
  font-size: 0.92rem;
}
.article-grid .card-body p { margin: 0 0 8px; }

/* "Next read" panel at the bottom of an article */
.next-read {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.next-read h2 {
  border: none;
  margin-top: 0;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
}
.next-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 14px;
}
.next-card {
  display: block;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  transition: transform 0.1s, box-shadow 0.15s, border-color 0.15s;
}
.next-card:hover {
  text-decoration: none;
  transform: translateY(-2px);
  border-color: var(--brand-blue);
  box-shadow: 0 2px 6px rgba(0,0,0,0.08), 0 8px 20px rgba(0,0,0,0.06);
}
.next-card h3 { color: var(--brand-blue-dark); margin: 0 0 8px; font-size: 1.05rem; }
.next-card p  { margin: 0 0 12px; color: var(--muted); font-size: 0.92rem; }
.next-card .next-card-cta { color: var(--brand-blue); font-weight: 600; font-size: 0.9rem; }

/* No-results message under the filter */
.empty-state {
  padding: 32px;
  text-align: center;
  color: var(--muted);
  background: var(--bg-tint);
  border-radius: var(--radius);
}

/* Comments */
.comments-section { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--border); }
.comments-section h2 { border: none; }

/* Misc utility */
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }

/* Print button (on-screen) */
.print-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  color: var(--brand-blue);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  margin: 0 0 24px;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}
.print-btn:hover {
  background: var(--bg-tint);
  border-color: var(--brand-blue);
}
.print-btn:focus {
  outline: 2px solid var(--brand-blue);
  outline-offset: 2px;
}

/* Print attribution blocks — hidden on screen, shown when printing */
.print-attribution,
.print-footer { display: none; }

/* Print styles */
@media print {
  /* Hide site chrome and screen-only widgets */
  .site-header,
  .site-footer,
  nav.primary,
  .next-read,
  .comments-section,
  .print-btn,
  .topic-pills,
  .aotd-section {
    display: none !important;
  }

  /* Reset page for clean printout */
  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
    line-height: 1.5;
  }
  main {
    padding: 0;
    max-width: none;
  }
  article.article {
    max-width: none;
  }
  a {
    color: #000;
    text-decoration: none;
  }
  h1, h2, h3, h4 {
    color: #000 !important;
    page-break-after: avoid;
  }
  p {
    orphans: 3;
    widows: 3;
  }

  /* Show print attribution at top */
  .print-attribution {
    display: block !important;
    padding: 0 0 14px;
    margin: 0 0 24px;
    border-bottom: 3px solid #1F3F8C;
  }
  .print-brand-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
  }
  .print-brand {
    font-size: 14pt;
    font-weight: 700;
    color: #1F3F8C !important;
    letter-spacing: 0.3px;
  }
  .print-domain {
    font-size: 10pt;
    color: #555 !important;
  }

  /* Print footer attribution */
  .print-footer {
    display: block !important;
    margin-top: 32px;
    padding-top: 12px;
    border-top: 1px solid #999;
    font-size: 9pt;
    color: #555 !important;
  }
  .print-footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
  }
  .print-url {
    font-style: italic;
    word-break: break-all;
  }

  /* Sensible page margins */
  @page {
    margin: 18mm 16mm;
  }
}
