/*
Theme Name: A1C Calculator Medical
Theme URI: https://a1ccalculator.us
Author: A1C Calculator
Description: Custom WordPress theme matching the A1CCalculator.us Next.js medical blog design.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.6
Requires PHP: 8.0
Text Domain: a1c-medical
*/

:root {
  --primary: #0d9488;
  --primary-dark: #0f766e;
  --primary-light: #99f6e4;
  --primary-50: #f0fdfa;
  --primary-100: #ccfbf1;
  --accent: #f59e0b;
  --bg: #fafaf9;
  --surface: #ffffff;
  --border: #e7e5e4;
  --ink: #1c1917;
  --muted: #57534e;
  --normal: #10b981;
  --prediabetic: #f59e0b;
  --diabetic: #ef4444;
  --shadow-premium: 0 10px 15px -3px rgba(0, 0, 0, .04), 0 4px 6px -4px rgba(0, 0, 0, .02);
  --shadow-glass: 0 8px 32px rgba(15, 118, 110, .08);
  --display: "Fraunces", Georgia, serif;
  --body: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 18px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
img, svg { max-width: 100%; height: auto; }
button, input { font: inherit; }

.container {
  width: min(100% - 32px, 1280px);
  margin-inline: auto;
}

.narrow { width: min(100% - 32px, 880px); margin-inline: auto; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, .94);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-glass);
  backdrop-filter: blur(18px);
}

.header-inner {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  min-width: max-content;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: var(--bg);
  border: 1px solid rgba(231, 229, 228, .85);
  box-shadow: 0 6px 16px rgba(28, 25, 23, .08);
}

.brand-name {
  display: block;
  font-family: var(--display);
  font-size: clamp(22px, 2vw, 28px);
  font-weight: 900;
  line-height: .95;
  letter-spacing: -.03em;
}

.brand-name span,
.text-gradient {
  background: linear-gradient(90deg, #14b8a6, #10b981);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-kicker {
  display: block;
  margin-top: 7px;
  color: rgba(13, 148, 136, .75);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .22em;
  text-transform: uppercase;
}

.main-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  flex: 1;
}

.main-nav ul,
.primary-menu {
  display: flex;
  align-items: center;
  gap: 30px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.main-nav a {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
  transition: color .2s ease;
}

.main-nav a:hover,
.main-nav .current-menu-item > a,
.main-nav .current_page_item > a { color: var(--primary); }

.header-actions { display: flex; align-items: center; gap: 14px; }

.icon-button,
.menu-toggle {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.menu-toggle {
  display: none;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--ink);
}

.button,
.wp-block-button__link,
.form-submit .submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 13px 28px;
  border: 0;
  border-radius: 16px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
  box-shadow: 0 14px 30px rgba(13, 148, 136, .18);
  cursor: pointer;
  transition: transform .2s ease, background .2s ease;
}

.button:hover,
.wp-block-button__link:hover,
.form-submit .submit:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.button.outline {
  background: transparent;
  color: var(--ink);
  border: 2px solid var(--border);
  box-shadow: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--primary-50);
  color: var(--primary-dark);
  padding: 8px 16px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.hero,
.article-header {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 78px 0 90px;
}

.hero::after,
.article-header::after,
.site-footer::after {
  content: "";
  position: absolute;
  top: -220px;
  right: -160px;
  width: 560px;
  height: 560px;
  z-index: 0;
  border-radius: 999px;
  background: var(--primary-50);
  filter: blur(80px);
  opacity: .85;
}

.hero .container,
.article-header .container { position: relative; z-index: 1; }

.hero-content {
  width: min(100%, 880px);
  margin-inline: auto;
  text-align: center;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  color: var(--ink);
  font-family: var(--display);
  letter-spacing: -.03em;
  line-height: 1.08;
}

h1 { font-size: clamp(46px, 7vw, 84px); font-weight: 900; }
h2 { font-size: clamp(34px, 4.2vw, 56px); font-weight: 900; }
h3 { font-size: clamp(24px, 2.6vw, 34px); font-weight: 800; }

.hero p {
  max-width: 780px;
  margin: 28px auto 0;
  color: var(--muted);
  font-size: clamp(19px, 2vw, 25px);
  line-height: 1.65;
}

.search-panel {
  position: relative;
  max-width: 680px;
  margin: 44px auto 0;
}

.search-panel input,
.search-field {
  width: 100%;
  min-height: 68px;
  padding: 0 24px;
  border: 2px solid var(--border);
  border-radius: 30px;
  background: var(--bg);
  color: var(--ink);
  outline: 0;
  box-shadow: var(--shadow-premium);
  transition: border-color .2s ease, box-shadow .2s ease;
}

.search-panel input:focus,
.search-field:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-glass);
}

.archive-wrap {
  position: relative;
  z-index: 2;
  margin-top: -48px;
  padding-bottom: 96px;
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 32px;
}

.post-card {
  display: flex;
  height: 100%;
  min-height: 520px;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(231, 229, 228, .85);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow-premium);
  transition: transform .3s ease, border-color .3s ease, box-shadow .3s ease;
}

.post-card:hover {
  transform: translateY(-8px);
  border-color: var(--primary-100);
  box-shadow: var(--shadow-glass);
}

.cover {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #0f172a;
}

.cover svg {
  display: block;
  width: 100%;
  height: 100%;
}

.cover-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 28px;
  color: #fff;
  background: linear-gradient(to top, rgba(2, 6, 23, .88), rgba(2, 6, 23, .08), transparent);
}

.cover-overlay .cover-kicker {
  margin-bottom: 10px;
  color: var(--primary-light);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .25em;
  text-transform: uppercase;
}

.cover-overlay h2 {
  color: #fff;
  font-family: var(--display);
  font-size: clamp(20px, 2.2vw, 30px);
  font-weight: 900;
  line-height: 1.1;
}

.post-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 30px;
}

.post-card h2 {
  margin: 22px 0 16px;
  font-size: 25px;
  line-height: 1.16;
}

.post-card:hover h2 { color: var(--primary); }

.excerpt {
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: auto;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.author-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.avatar-letter {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  border-radius: 12px;
  background: var(--primary-100);
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
}

.meta-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.arrow-box {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  border-radius: 13px;
  background: var(--primary-50);
  color: var(--primary);
  transition: background .2s ease, color .2s ease;
}

.post-card:hover .arrow-box { background: var(--primary); color: #fff; }

.article-header {
  padding-top: 94px;
  padding-bottom: 76px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 46px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.article-title {
  max-width: 980px;
  margin: 28px 0 38px;
  font-size: clamp(44px, 6vw, 76px);
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 28px;
  padding-top: 34px;
  border-top: 1px solid var(--border);
  color: var(--muted);
}

.reviewed-badge {
  background: var(--ink);
  color: #fff;
}

.article-layout {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 320px;
  gap: 54px;
  padding: 72px 0 112px;
}

.sticky-tools,
.right-rail {
  position: sticky;
  top: 116px;
  align-self: start;
}

.sticky-tools {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.round-action {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .4);
  border-radius: 18px;
  background: rgba(255, 255, 255, .78);
  color: var(--muted);
  box-shadow: var(--shadow-glass);
}

.article-cover { margin-bottom: 58px; border-radius: 36px; box-shadow: 0 20px 50px rgba(15, 23, 42, .14); }

.content {
  color: rgba(87, 83, 78, .92);
  font-size: 20px;
  line-height: 1.8;
}

.content a {
  color: var(--primary);
  font-weight: 800;
}

.content a:hover { text-decoration: underline; }

.content p { margin: 0 0 36px; }

.content h2 {
  margin: 88px 0 34px;
  padding-left: 28px;
  border-left: 12px solid var(--primary-100);
  font-size: clamp(34px, 4vw, 48px);
}

.content h3 {
  margin: 58px 0 28px;
  font-size: clamp(26px, 3vw, 34px);
}

.content ul,
.content ol {
  margin: 0 0 44px;
  padding-left: 0;
}

.content ul { list-style: none; }
.content ol { padding-left: 28px; }

.content li {
  margin: 0 0 18px;
  color: rgba(87, 83, 78, .95);
}

.content ul li {
  position: relative;
  padding-left: 40px;
}

.content ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .75em;
  width: 24px;
  height: 4px;
  border-radius: 999px;
  background: var(--primary);
}

.content blockquote {
  margin: 56px 0;
  padding: 42px;
  border: 0;
  border-left: 12px solid var(--primary);
  border-radius: 0 44px 44px 0;
  background: var(--primary-50);
  color: var(--primary-dark);
  font-family: var(--display);
  font-size: 26px;
  font-style: italic;
  font-weight: 650;
  line-height: 1.55;
}

.content pre {
  overflow-x: auto;
  margin: 34px 0;
  padding: 26px;
  border: 1px solid var(--primary-100);
  border-radius: 22px;
  background: rgba(240, 253, 250, .7);
  color: var(--primary-dark);
  font-size: 15px;
}

.content code {
  padding: 3px 8px;
  border-radius: 8px;
  background: var(--primary-100);
  color: var(--primary-dark);
  font-size: .86em;
  font-weight: 800;
}

.content pre code { padding: 0; background: transparent; }

.content hr {
  width: 130px;
  margin: 70px auto;
  border: 0;
  border-top: 4px dotted var(--border);
}

.wp-block-table {
  overflow-x: auto;
  margin: 54px 0;
  border-radius: 30px;
  box-shadow: var(--shadow-premium);
}

.wp-block-table table,
.content table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  background: #fff;
}

.wp-block-table thead,
.content thead {
  background: var(--ink);
  color: #fff;
}

.wp-block-table th,
.wp-block-table td,
.content th,
.content td {
  padding: 22px 28px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.wp-block-table th,
.content th {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.wp-block-table td,
.content td {
  color: rgba(87, 83, 78, .88);
  font-size: 15px;
  font-weight: 650;
}

.wp-block-table tr:hover td,
.content tr:hover td {
  background: rgba(240, 253, 250, .65);
  color: var(--primary-dark);
}

.a1c-callout {
  position: relative;
  overflow: hidden;
  margin: 44px 0;
  padding: 32px;
  border-left: 8px solid var(--primary);
  border-radius: 22px;
  background: var(--primary-50);
  color: var(--primary-dark);
}

.a1c-callout-warning {
  border-left-color: var(--accent);
  background: #fffbeb;
  color: #92400e;
}

.a1c-callout > p:first-child {
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .18em;
  text-transform: uppercase;
  opacity: .75;
}

.medical-quality-assurance {
  margin-top: 86px;
  padding: 38px;
  border: 2px solid var(--border);
  border-radius: 32px;
  background: var(--bg);
}

.medical-quality-assurance h2 {
  margin: 0 0 14px;
  padding: 0;
  border: 0;
  font-size: 25px;
}

.rail-section { margin-bottom: 46px; }

.rail-title {
  margin-bottom: 20px;
  color: var(--muted);
  font-family: var(--body);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .2em;
  text-transform: uppercase;
}

.rail-card,
.newsletter-card {
  display: block;
  margin-bottom: 14px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-premium);
  transition: border-color .2s ease, transform .2s ease;
}

.rail-card:hover {
  transform: translateX(3px);
  border-color: var(--primary);
}

.rail-card small {
  display: block;
  margin-bottom: 8px;
  color: var(--primary);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.rail-card strong {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
}

.newsletter-card {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.newsletter-card h3 { color: #fff; font-size: 24px; }
.newsletter-card p { color: rgba(153, 246, 228, .7); font-size: 13px; }

.newsletter-card input {
  width: 100%;
  min-height: 46px;
  margin: 16px 0 12px;
  padding: 0 14px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 12px;
  background: rgba(255,255,255,.1);
  color: #fff;
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 70px;
}

.pagination .page-numbers {
  min-width: 48px;
  height: 48px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
  font-weight: 900;
}

.pagination .current {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 14px 24px rgba(13, 148, 136, .24);
}

.trust-section {
  padding: 86px 0;
  background: var(--surface);
  border-block: 1px solid var(--border);
}

.trust-grid {
  display: grid;
  grid-template-columns: .95fr 1fr;
  gap: 70px;
  align-items: center;
}

.trust-panel {
  padding: 44px;
  border: 2px solid var(--primary-100);
  border-radius: 32px;
  background: var(--primary-50);
}

.trust-list {
  display: grid;
  gap: 30px;
}

.trust-item {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 22px;
}

.trust-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: var(--primary-50);
  color: var(--primary);
}

.site-footer {
  position: relative;
  overflow: hidden;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.trust-bar {
  position: relative;
  z-index: 2;
  padding: 14px 0;
  background: var(--ink);
  color: #fff;
}

.trust-bar .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px 42px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .24em;
  text-transform: uppercase;
}

.footer-main {
  position: relative;
  z-index: 2;
  padding: 80px 0 46px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.1fr 2fr;
  gap: 80px;
  margin-bottom: 76px;
}

.footer-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 36px;
}

.footer-col h3 {
  margin-bottom: 28px;
  color: rgba(28, 25, 23, .42);
  font-family: var(--body);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.footer-col ul { margin: 0; padding: 0; list-style: none; }
.footer-col li + li { margin-top: 18px; }
.footer-col a {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}
.footer-col a:hover { color: var(--primary); }

.footer-disclaimer {
  padding-top: 36px;
  border-top: 1px solid var(--border);
  color: rgba(87, 83, 78, .65);
  font-size: 12px;
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 34px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.not-found {
  padding: 120px 0;
  text-align: center;
}

.screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
}

@media (max-width: 1100px) {
  .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .article-layout { grid-template-columns: minmax(0, 1fr); }
  .sticky-tools, .right-rail { position: static; }
  .sticky-tools { display: none; }
  .right-rail { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; }
  .main-nav { display: none; }
  .menu-toggle { display: grid; }
}

@media (max-width: 760px) {
  body { font-size: 16px; }
  .header-inner { min-height: 72px; }
  .brand-kicker, .header-actions .button { display: none; }
  .mobile-open .main-nav {
    position: fixed;
    inset: 72px 0 auto 0;
    display: grid;
    gap: 0;
    padding: 14px 16px 22px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-glass);
  }
  .mobile-open .main-nav ul,
  .mobile-open .primary-menu {
    display: grid;
    gap: 0;
  }
  .mobile-open .main-nav a { padding: 15px 4px; border-bottom: 1px solid var(--border); }
  .hero, .article-header { padding: 54px 0 70px; }
  .post-grid, .trust-grid, .footer-grid, .footer-links, .right-rail { grid-template-columns: 1fr; }
  .archive-wrap { margin-top: -34px; }
  .post-card { min-height: auto; }
  .post-card-body { padding: 24px; }
  .article-layout { padding-top: 48px; }
  .content { font-size: 18px; }
  .content h2 { margin-top: 66px; padding-left: 18px; border-left-width: 8px; }
  .cover-overlay { padding: 22px; }
  .footer-main { padding-top: 58px; }
}
