/* Elder Care Index — Shared Styles */

/* Reset & Base */
*{margin:0;padding:0;box-sizing:border-box}
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;line-height:1.7;color:#1a1a2e;background:#f8f9fa}

/* Header */
header{background:linear-gradient(135deg,#1a365d 0%,#2d5a87 100%);color:white;padding:0.9rem 1.5rem}
.header-inner{max-width:960px;margin:0 auto;display:flex;align-items:center;justify-content:space-between}
.header-inner h1{font-size:1.3rem;font-weight:700;letter-spacing:-0.01em;display:flex;align-items:center;gap:0.5rem}
.header-inner h1 a{color:white;text-decoration:none;display:flex;align-items:center;gap:0.5rem}
.logo-icon{width:28px;height:28px;flex-shrink:0}
.header-nav{display:flex;gap:0.25rem}
.header-nav a{color:rgba(255,255,255,0.8);text-decoration:none;font-size:0.88rem;padding:0.35rem 0.7rem;border-radius:5px;transition:background 0.15s,color 0.15s}
.header-nav a:hover{color:white;background:rgba(255,255,255,0.12)}

/* Breadcrumb */
nav.breadcrumb{padding:0.6rem 1.5rem;background:white;border-bottom:1px solid #e2e8f0;font-size:0.85rem;color:#64748b}
.bc-inner{max-width:960px;margin:0 auto}
nav.breadcrumb a{color:#2d5a87;text-decoration:none}
nav.breadcrumb a:hover{text-decoration:underline}

/* Main container — matches header/breadcrumb width */
.container{max-width:960px;margin:2rem auto;padding:0 1.5rem}

/* Two-column layout (care type pages) */
.layout{max-width:960px;margin:2rem auto;padding:0 1.5rem;display:grid;grid-template-columns:1fr 260px;gap:1.5rem}

/* Content cards */
.card{background:white;border-radius:8px;padding:2rem;box-shadow:0 1px 3px rgba(0,0,0,0.08);margin-bottom:1.5rem}

/* Narrative content (care type pages) */
.narrative{background:white;border-radius:8px;padding:2rem;box-shadow:0 1px 3px rgba(0,0,0,0.08)}
.narrative h3{font-size:1.15rem;color:#1a365d;margin:1.5rem 0 0.5rem 0;padding-bottom:0.3rem;border-bottom:1px solid #e2e8f0}
.narrative h3:first-of-type{margin-top:0}
.narrative p{margin-bottom:1rem;font-size:1.02rem;color:#334155}
.narrative p:last-child{margin-bottom:0}

/* Sidebar */
.sidebar-col{display:flex;flex-direction:column;gap:1rem}
.sidebar{background:white;border-radius:8px;padding:1.25rem;box-shadow:0 1px 3px rgba(0,0,0,0.08)}
.sidebar h3{font-size:0.95rem;color:#1a365d;margin-bottom:0.6rem;border-bottom:2px solid #e2e8f0;padding-bottom:0.4rem}
.sidebar ul{list-style:none}
.sidebar ul li{padding:0.35rem 0}
.sidebar ul li a{color:#2d5a87;text-decoration:none;font-size:0.88rem}
.sidebar ul li a:hover{text-decoration:underline}
.sidebar ul li a.active{color:#1a365d;font-weight:600}

/* Cost badge */
.cost-badge{display:inline-block;background:#f1f5f9;border:1px solid #e2e8f0;border-radius:6px;padding:0.75rem 1rem;margin-bottom:1.5rem;font-size:0.95rem;color:#475569}
.cost-badge strong{color:#1a365d;font-size:1.1rem}

/* Hero (state overview) */
.hero{background:white;border-radius:8px;padding:2rem;margin-bottom:1.5rem;box-shadow:0 1px 3px rgba(0,0,0,0.08)}
.hero h2{font-size:1.6rem;color:#1a365d;margin-bottom:0.5rem}
.hero p{color:#475569;font-size:1.05rem}
.rank-badge{display:inline-block;background:#e0f2fe;color:#0369a1;padding:0.3rem 0.8rem;border-radius:4px;font-size:0.85rem;font-weight:600;margin-top:0.5rem}

/* Quick stats */
.quick-stats{display:grid;grid-template-columns:repeat(3,1fr);gap:1rem;margin-top:1rem}
.stat{text-align:center;padding:0.75rem}
.stat-value{font-size:1.5rem;font-weight:700;color:#1a365d}
.stat-label{font-size:0.8rem;color:#64748b;margin-top:0.2rem}

/* Grade badge */
.grade-row{display:flex;align-items:center;gap:1.25rem}
.grade-badge{flex-shrink:0;width:56px;height:56px;border-radius:10px;display:flex;align-items:center;justify-content:center;font-size:1.75rem;font-weight:800;color:white;line-height:1;letter-spacing:-0.02em}
.grade-a{background:#059669}
.grade-b{background:#0891b2}
.grade-c{background:#d97706}
.grade-d{background:#c2410c}
.grade-f{background:#b91c1c}
.grade-body{flex:1;min-width:0}
.grade-body h2{margin-bottom:0.25rem}

/* Pillar breakdown */
.pillar-breakdown{margin-top:1.25rem;padding-top:1.25rem;border-top:1px solid #e2e8f0;display:flex;flex-direction:column;gap:0.5rem}
.pillar-row{display:flex;align-items:center;gap:0.6rem}
.pillar-label{width:100px;flex-shrink:0;font-size:0.82rem;color:#64748b;text-align:right}
.pillar-bar-wrap{flex:1;height:10px;background:#f1f5f9;border-radius:5px;overflow:hidden}
.pillar-bar{height:100%;border-radius:5px}
.pillar-bar.bar-high{background:#16a34a}
.pillar-bar.bar-mid{background:#ca8a04}
.pillar-bar.bar-low{background:#dc2626}
.pillar-val{width:110px;flex-shrink:0;font-size:0.78rem;font-weight:600;color:#1a365d}
.pillar-val .cms-src{font-weight:400;color:#94a3b8;font-size:0.72rem}

/* Cost grid (state overview) */
.cost-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:1rem;margin-bottom:1.5rem}
.cost-card{display:block;background:white;border-radius:8px;padding:1.25rem;box-shadow:0 1px 3px rgba(0,0,0,0.08);text-decoration:none;color:#1a1a2e;transition:box-shadow 0.2s;position:relative}
.cost-card:hover{box-shadow:0 4px 12px rgba(0,0,0,0.12)}
.cost-label{display:block;font-size:0.85rem;color:#64748b;margin-bottom:0.3rem}
.cost-value{display:block;font-size:1.35rem;font-weight:700;color:#1a365d}
.cost-diff{display:block;font-size:0.78rem;font-weight:600;margin-top:0.35rem}
.cost-below{color:#059669}
.cost-above{color:#dc2626}
.cost-even{color:#94a3b8}
.cost-arrow{position:absolute;right:1rem;bottom:1rem;font-size:1.1rem;color:#cbd5e1;transition:color 0.15s,transform 0.15s}
.cost-card:hover .cost-arrow{color:#2d5a87;transform:translateX(3px)}

/* Section card (state overview) */
.section{background:white;border-radius:8px;padding:1.5rem;margin-bottom:1.5rem;box-shadow:0 1px 3px rgba(0,0,0,0.08)}
.section h3{font-size:1.1rem;color:#1a365d;margin-bottom:0.75rem;padding-bottom:0.4rem;border-bottom:2px solid #e2e8f0}
.section ul{list-style:none}
.section ul li{padding:0.4rem 0}
.section ul li a{color:#2d5a87;text-decoration:none;font-size:0.95rem}
.section ul li a:hover{text-decoration:underline}

/* Hub page nav */
.hub-nav{background:white;border-radius:8px;padding:1.25rem;margin-bottom:1.5rem;box-shadow:0 1px 3px rgba(0,0,0,0.08);display:flex;gap:0.75rem;flex-wrap:wrap}
.hub-nav a{color:#2d5a87;text-decoration:none;padding:0.4rem 0.8rem;border-radius:4px;font-size:0.88rem;background:#f1f5f9}
.hub-nav a:hover{background:#e2e8f0}
.hub-nav a.active{background:#1a365d;color:white}

/* Hub intro */
.intro{background:white;border-radius:8px;padding:2rem;margin-bottom:1.5rem;box-shadow:0 1px 3px rgba(0,0,0,0.08)}
.intro h2{font-size:1.6rem;color:#1a365d;margin-bottom:0.75rem}
.intro p{color:#475569;font-size:1.02rem;margin-bottom:1rem}
.intro p:last-child{margin-bottom:0}
.nat-avg{display:inline-block;background:#e0f2fe;color:#0369a1;padding:0.4rem 1rem;border-radius:6px;font-size:0.95rem;font-weight:600;margin-bottom:1rem}

/* Tables (hub pages) */
.table-wrap{background:white;border-radius:8px;padding:1.5rem;box-shadow:0 1px 3px rgba(0,0,0,0.08);overflow-x:auto}
.table-wrap h3{font-size:1.15rem;color:#1a365d;margin-bottom:1rem}
table{width:100%;border-collapse:collapse;font-size:0.92rem}
th{background:#f8fafc;text-align:left;padding:0.6rem 0.8rem;border-bottom:2px solid #e2e8f0;color:#64748b;font-weight:600;font-size:0.8rem;text-transform:uppercase;letter-spacing:0.03em}
td{padding:0.55rem 0.8rem;border-bottom:1px solid #f1f5f9}
tr:hover{background:#f8fafc}
td a{color:#2d5a87;text-decoration:none}
td a:hover{text-decoration:underline}
td strong{color:#1a365d}
.below{color:#16a34a}
.above{color:#dc2626}

/* Homepage */
.hero-banner{text-align:center;padding:2rem 1.5rem 2.5rem;background:linear-gradient(135deg,#1a365d 0%,#2d5a87 100%);color:white}
.hero-banner h2{font-size:1.8rem;font-weight:700;margin-bottom:0.5rem}
.hero-banner p{font-size:1.05rem;opacity:0.9;max-width:600px;margin:0 auto}
.state-grid{background:white;border-radius:8px;padding:2rem;box-shadow:0 1px 3px rgba(0,0,0,0.08)}
.state-grid h2{font-size:1.3rem;color:#1a365d;margin-bottom:1rem;padding-bottom:0.5rem;border-bottom:2px solid #e2e8f0}
.state-grid ul{list-style:none;column-count:3;column-gap:1.5rem}
.state-grid ul li{padding:0.35rem 0;break-inside:avoid}
.state-grid ul li a{color:#2d5a87;text-decoration:none;font-size:0.95rem}
.state-grid ul li a:hover{text-decoration:underline}
.state-cost{color:#94a3b8;font-size:0.8rem;margin-left:0.3rem}

/* Homepage — extra-small grade badges (inline with state list) */
.grade-badge-xs{display:inline-block;width:22px;height:18px;border-radius:3px;text-align:center;line-height:18px;font-size:0.68rem;font-weight:800;color:white;letter-spacing:-0.01em;vertical-align:middle}

/* Homepage — top states section */
.top-states-section{background:white;border-radius:8px;padding:2rem;margin-bottom:1.5rem;box-shadow:0 1px 3px rgba(0,0,0,0.08)}
.top-states-section h2{font-size:1.3rem;color:#1a365d;margin-bottom:1rem;padding-bottom:0.5rem;border-bottom:2px solid #e2e8f0;display:flex;align-items:center;justify-content:space-between}
.see-all{font-size:0.85rem;font-weight:500;color:#2d5a87;text-decoration:none}
.see-all:hover{text-decoration:underline}
.top-states-grid{display:flex;flex-direction:column;gap:0}
.top-state{display:flex;align-items:center;gap:0.75rem;padding:0.65rem 0.75rem;text-decoration:none;color:#1a1a2e;border-radius:6px;transition:background 0.15s}
.top-state:hover{background:#f1f5f9}
.top-rank{width:32px;font-size:0.88rem;font-weight:700;color:#64748b;text-align:right;flex-shrink:0}
.top-name{flex:1;font-size:0.95rem;font-weight:500;color:#1a365d}
.top-score{font-size:0.85rem;font-weight:600;color:#64748b;flex-shrink:0}
@media(max-width:640px){.top-states-section h2{flex-direction:column;align-items:flex-start;gap:0.3rem}}

/* Ranking page — sort controls */
.sort-controls{display:flex;gap:0.5rem;flex-wrap:wrap;margin-bottom:1rem}
.sort-btn{padding:0.4rem 0.9rem;border:1px solid #e2e8f0;border-radius:6px;background:white;color:#64748b;font-size:0.82rem;font-weight:600;cursor:pointer;transition:all 0.15s}
.sort-btn:hover{background:#f1f5f9;color:#1a365d}
.sort-btn.active{background:#1a365d;color:white;border-color:#1a365d}

/* Ranking page — small grade badges for table cells */
.grade-badge-sm{display:inline-block;width:28px;height:28px;border-radius:6px;text-align:center;line-height:28px;font-size:0.82rem;font-weight:800;color:white;letter-spacing:-0.01em}

/* Ranking page — top 3 row highlight */
tr.top3 td{background:#f0fdf4}
tr.top3 .rank-num{color:#059669;font-weight:700}

/* Ranking page — score cell */
.score-cell{font-weight:700;color:#1a365d}
.rank-num{font-weight:600;color:#64748b;min-width:28px}

/* Active sort column highlight */
td.active-col{background:#f8fafc;font-weight:600}

/* Methodology link */
.methodology-link{font-size:0.88rem;color:#64748b;margin:1.25rem 0;padding:0.75rem 0;border-top:1px solid #e2e8f0}
.methodology-link a{color:#2d5a87;font-weight:600}

/* FAQ section */
.faq-section{background:white;border-radius:8px;padding:2rem;margin:1.5rem 0;box-shadow:0 1px 3px rgba(0,0,0,0.08)}
.faq-section h2{font-size:1.3rem;color:#1a365d;margin-bottom:1.25rem;padding-bottom:0.5rem;border-bottom:2px solid #e2e8f0}
.faq-item{margin-bottom:1.25rem}
.faq-item:last-child{margin-bottom:0}
.faq-item h3{font-size:1rem;color:#1a365d;margin-bottom:0.4rem}
.faq-item p{color:#475569;font-size:0.95rem;line-height:1.7}

/* More Rankings nav */
.more-rankings{margin:1.5rem 0}
.more-rankings h2{font-size:1.1rem;color:#1a365d;margin-bottom:0.75rem}

/* Ranking page — intro h1 */
.intro h1{font-size:1.6rem;color:#1a365d;margin-bottom:0.75rem}

/* Ranking editorial prose */
.ranking-editorial{background:white;border-radius:8px;padding:2rem;margin-bottom:1.5rem;box-shadow:0 1px 3px rgba(0,0,0,0.08)}
.ranking-editorial h3{font-size:1.05rem;color:#1a365d;margin:1.5rem 0 0.4rem 0}
.ranking-editorial h3:first-of-type{margin-top:0}
.ranking-editorial p{font-size:0.92rem;color:#475569;line-height:1.7;margin-bottom:0}
.ranking-editorial a{color:#2d5a87;font-weight:500}

/* Cross-links paragraph */
.cross-links{font-size:0.9rem;color:#64748b;margin-top:0.75rem;padding-top:0.75rem;border-top:1px solid #e2e8f0}
.cross-links a{color:#2d5a87;font-weight:500}

/* Last updated */
.last-updated{font-size:0.8rem;color:#94a3b8;margin-top:1rem;padding-top:0.75rem;border-top:1px solid #f1f5f9}

/* Footer */
footer{text-align:center;padding:2rem 1.5rem;color:#94a3b8;font-size:0.8rem;margin-top:2rem}
footer a{color:#64748b;text-decoration:none}
footer a:hover{text-decoration:underline}

/* Responsive */
@media(max-width:768px){
.layout{grid-template-columns:1fr}
.cost-grid{grid-template-columns:1fr}
.quick-stats{grid-template-columns:1fr}
.grade-row{flex-direction:column;align-items:flex-start;gap:0.75rem}
.state-grid ul{column-count:2}
.sort-controls{gap:0.35rem}
.sort-btn{padding:0.3rem 0.6rem;font-size:0.75rem}
#rankingTable{font-size:0.78rem}
#rankingTable th,#rankingTable td{padding:0.4rem 0.5rem}
}
@media(max-width:640px){
.header-inner{flex-direction:column;gap:0.4rem;text-align:center}
.header-nav{justify-content:center}
.state-grid ul{column-count:1}
}
