/* =========================================================
   Top 10 Commercial & Flat Roofing Companies in Calgary
   Editorial ranking — presentation only.
   Publisher: Calgary Roofing Rankings (independent editorial resource).
   ========================================================= */

:root {
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1e222b;
  --border: #2a2f3a;
  --text: #e8ebf0;
  --muted: #a3acbd;
  --accent: #e8502e;        /* roofing orange-red */
  --accent-dark: #c43c1d;
  --accent-soft: #2a1a14;
  --gold: #f5b942;
  --green: #4caf7d;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  --maxw: 1080px;
  --font: "Segoe UI", Roboto, Helvetica, Arial, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  z-index: 1000;
  border-radius: 0 0 var(--radius-sm) 0;
  font-weight: 600;
}
.skip-link:focus { left: 0; }

/* ---------- Focus visibility ---------- */
:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ---------- Header / nav ---------- */
.site-header {
  background: rgba(15, 17, 21, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 66px;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--text);
  font-size: 1.05rem;
}
.brand:hover { text-decoration: none; }
.brand img { display: block; }
.main-nav ul {
  list-style: none;
  display: flex;
  gap: 6px;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}
.main-nav a {
  color: var(--muted);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  display: block;
}
.main-nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.main-nav a[aria-current="page"] { color: #fff; background: var(--accent); }

/* ---------- Breadcrumbs ---------- */
.breadcrumbs { padding: 14px 0 0; }
.breadcrumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.breadcrumbs li::after { content: "/"; margin-left: 8px; color: var(--border); }
.breadcrumbs li:last-child::after { content: ""; }
.breadcrumbs a { color: var(--muted); }

/* ---------- Hero ---------- */
.hero {
  padding: 40px 0 24px;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(900px 400px at 80% -10%, rgba(232, 80, 46, 0.12), transparent 70%);
}
.hero h1 {
  font-size: clamp(1.9rem, 4.5vw, 2.9rem);
  line-height: 1.12;
  margin: 10px 0 12px;
  letter-spacing: -0.5px;
}
.hero .subtitle {
  color: var(--muted);
  font-size: 1.1rem;
  margin: 0 0 8px;
}
.updated-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  margin-top: 6px;
}
.updated-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.intro { max-width: 760px; color: var(--text); }

/* ---------- Section ---------- */
section { padding: 34px 0; }
section > .wrap > h2 {
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  margin: 0 0 6px;
  letter-spacing: -0.3px;
}
.section-lead { color: var(--muted); margin: 0 0 22px; max-width: 760px; }

/* ---------- Disclosure box ---------- */
.disclosure {
  background: var(--accent-soft);
  border: 1px solid var(--accent-dark);
  border-left: 5px solid var(--accent);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin: 22px 0;
}
.disclosure h2, .disclosure h3 { margin-top: 0; }
.disclosure p:last-child { margin-bottom: 0; }

/* ---------- Methodology ---------- */
.method-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 18px;
}
.method-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.method-card h3 { margin: 0 0 6px; font-size: 1.05rem; }
.method-card p { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* ---------- Expert card ---------- */
.expert-card {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin: 18px 0 0;
}
.expert-card img {
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid var(--accent);
  object-fit: cover;
}
.expert-card figcaption { margin: 0; }
.expert-name { font-weight: 700; font-size: 1.15rem; margin: 0; }
.expert-role { color: var(--muted); margin: 2px 0 10px; font-size: 0.92rem; }
.expert-verdict {
  margin: 0;
  border-left: 4px solid var(--accent);
  padding: 4px 0 4px 16px;
  font-style: italic;
  color: var(--text);
}
.expert-verdict p { margin: 0; }

/* ---------- Comparison table ---------- */
.table-scroll { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table.compare {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
  background: var(--surface);
}
table.compare caption {
  text-align: left;
  padding: 14px 16px;
  color: var(--muted);
  font-size: 0.88rem;
  caption-side: bottom;
}
table.compare th, table.compare td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  font-size: 0.93rem;
}
table.compare thead th {
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
table.compare tbody th[scope="row"] { font-weight: 700; color: var(--text); }
table.compare tbody tr:first-child { background: rgba(232, 80, 46, 0.07); }
.rank-pill {
  display: inline-block;
  min-width: 24px;
  text-align: center;
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  font-weight: 700;
  padding: 1px 7px;
  margin-right: 8px;
  font-size: 0.82rem;
}

/* ---------- Company cards ---------- */
.company-list { display: flex; flex-direction: column; gap: 22px; }
.company {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.company.featured { border-color: var(--accent); border-width: 2px; }
.company-top {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
}
.company-head { flex: 1 1 280px; }
.company-position {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
  text-transform: uppercase;
}
.company-head h3 { margin: 2px 0 4px; font-size: 1.4rem; }
.best-for { margin: 0; color: var(--muted); font-size: 0.92rem; }
.best-for strong { color: var(--text); }

.scores { display: flex; gap: 12px; flex-wrap: wrap; }
.editorial-score, .google-snapshot {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  min-width: 150px;
  text-align: center;
}
.editorial-score {
  background: var(--accent-soft);
  border: 1px solid var(--accent-dark);
}
.editorial-score .num { font-size: 1.7rem; font-weight: 800; color: var(--accent); line-height: 1; }
.editorial-score .label { display: block; font-size: 0.68rem; color: var(--muted); margin-top: 6px; line-height: 1.3; }
.google-snapshot {
  background: var(--surface-2);
  border: 1px dashed var(--border);
}
.google-snapshot .stars { font-size: 1.15rem; font-weight: 700; color: var(--gold); line-height: 1; }
.google-snapshot .label { display: block; font-size: 0.68rem; color: var(--muted); margin-top: 6px; line-height: 1.3; }
.google-snapshot.unconfirmed .stars { color: var(--muted); font-size: 0.95rem; font-weight: 600; }

.company-body { padding-top: 16px; }
.company-body h4 {
  margin: 18px 0 6px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.company-body h4:first-child { margin-top: 0; }
.company-body p { margin: 0 0 4px; }

.meta-line { color: var(--muted); font-size: 0.9rem; margin: 2px 0; }
.meta-line strong { color: var(--text); }

/* chips & lists */
.trust-chips, .services-row { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.trust-chips li {
  background: rgba(76, 175, 125, 0.12);
  border: 1px solid rgba(76, 175, 125, 0.4);
  color: #9fe3c2;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.82rem;
  font-weight: 600;
}
.services-row li {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.82rem;
}
.facts { margin: 6px 0 0; padding-left: 20px; }
.facts li { margin-bottom: 6px; }
.facts a { font-size: 0.85rem; }

.stated-tag {
  display: inline-block;
  background: var(--surface-2);
  border: 1px solid var(--gold);
  color: var(--gold);
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1px 7px;
  border-radius: 5px;
  margin-left: 4px;
  vertical-align: middle;
}

.highlight-strip {
  background: var(--surface-2);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin: 14px 0 0 !important;
  font-size: 0.92rem;
  color: var(--text);
}

.thin-note {
  background: rgba(245, 185, 66, 0.08);
  border: 1px dashed var(--gold);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin: 12px 0 0;
  font-size: 0.88rem;
  color: #f3d79a;
}

/* CTA buttons */
.card-cta { margin: 18px 0 0 !important; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.95rem;
  transition: transform 0.12s ease, background 0.12s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary-cta { background: var(--accent); color: #fff; }
.btn-primary-cta:hover { background: var(--accent-dark); }
.btn-outline-cta {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
}
.btn-outline-cta:hover { background: var(--accent-soft); }
.cta-arrow { transition: transform 0.12s ease; }
.btn:hover .cta-arrow { transform: translateX(3px); }

/* sources details */
.sources { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 10px; }
.sources summary {
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  list-style: none;
}
.sources summary::before { content: "▸ "; color: var(--accent); }
.sources[open] summary::before { content: "▾ "; }
.sources ul { margin: 10px 0 0; padding-left: 20px; }
.sources li { font-size: 0.82rem; margin-bottom: 5px; word-break: break-word; }
.sources .note { color: var(--muted); font-style: italic; }

/* ---------- FAQ (progressive enhancement) ---------- */
.faq-list { display: flex; flex-direction: column; gap: 12px; }
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.faq-item h3 { margin: 0; font-size: 1rem; }
.faq-trigger {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  padding: 16px 20px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.faq-trigger .chev { color: var(--accent); transition: transform 0.2s ease; flex-shrink: 0; }
.faq-trigger[aria-expanded="true"] .chev { transform: rotate(180deg); }

/* collapse via grid-rows, NOT display:none */
.faq-answer {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.25s ease;
}
.faq-answer .inner {
  overflow: hidden;
  padding: 0 20px;
  opacity: 0;
  transition: opacity 0.25s ease, padding 0.25s ease;
}
.faq-answer.open { grid-template-rows: 1fr; }
.faq-answer.open .inner { opacity: 1; padding: 0 20px 18px; }
.faq-answer .inner p:first-child { margin-top: 0; }

/* no-js: everything expanded and readable */
.no-js .faq-answer { grid-template-rows: 1fr; }
.no-js .faq-answer .inner { opacity: 1; padding: 0 20px 18px; }
.no-js .faq-trigger { cursor: default; }
.no-js .faq-trigger .chev { display: none; }

/* ---------- Content pages ---------- */
.prose { max-width: 760px; }
.prose h2 { margin-top: 32px; }
.prose h3 { margin-top: 22px; }
.prose ul { padding-left: 22px; }
.prose li { margin-bottom: 8px; }

/* ---------- 404 ---------- */
.notfound { text-align: center; padding: 80px 0; }
.notfound h1 { font-size: clamp(3rem, 12vw, 7rem); margin: 0; color: var(--accent); }
.notfound p { color: var(--muted); font-size: 1.15rem; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 34px 0;
  margin-top: 20px;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
}
.site-footer h3 { font-size: 0.95rem; margin: 0 0 10px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 6px; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--text); }
.footer-disclosure {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}
.footer-disclosure p { margin: 0 0 8px; }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  body { font-size: 16px; }
  .site-header .wrap { min-height: auto; padding-top: 10px; padding-bottom: 10px; }
  .expert-card { flex-direction: column; align-items: center; text-align: center; }
  .expert-verdict { text-align: left; }
  .scores { width: 100%; }
  .editorial-score, .google-snapshot { flex: 1 1 140px; min-width: 0; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
