/* =========================================================
   UtilityEra Blog Shared CSS
   Supports:
   1. article > .container + .post-header layout
   2. article.blog-post + .blog-hero + .section layout
   3. Shared navbar, footer, converter, tables, FAQ, cards
   ========================================================= */

/* ---------- Reset & Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

:root {
  --bg: #fafaf7;
  --bg-alt: #f0ede4;
  --bg-elevated: #ffffff;
  --bg-muted: var(--bg-alt);
  --bg-overlay: rgba(20, 18, 16, 0.46);

  --ink: #1a1a1a;
  --ink-soft: #4a4a4a;
  --ink-muted: #7b746c;

  --accent: #c8551e;
  --accent-dark: #9f3e11;
  --accent-soft: #f4e4d6;

  --line: #e0dccf;
  --line-strong: #d2c7b7;
  --highlight: #fff8e7;

  --gold: #b8860b;
  --gold-soft: #f5edd6;
  --diamond: #5a7a8a;
  --diamond-soft: #e8eef2;

  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 2px rgba(20, 18, 16, 0.06);
  --shadow-lg: -18px 0 50px rgba(20, 18, 16, 0.18);

  --radius: 6px;
  --radius-sm: 8px;
  --header-height: 76px;
  --content-max: 1180px;
  --article-max: 920px;

  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "Inter", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "Courier New", monospace;
}

body {
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.nav-open {
  overflow: hidden;
}

img,
svg {
  max-width: 100%;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

/* ---------- Links ---------- */
a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-soft);
}

a:hover {
  border-bottom-color: var(--accent);
}

strong {
  color: var(--ink);
  font-weight: 600;
}

code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--bg-alt);
  padding: 2px 6px;
  border-radius: 3px;
}

/* ---------- Shared Site Header ---------- */
.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 2000;
  transform: translateY(-140%);
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  border-bottom: 0;
  font-size: 0.9rem;
  font-weight: 700;
  transition: transform 0.2s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.masthead-top {
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid transparent;
  background: rgba(250, 250, 247, 0.86);
  backdrop-filter: blur(18px) saturate(1.1);
  -webkit-backdrop-filter: blur(18px) saturate(1.1);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background-color 0.2s ease;
}

.masthead-top.scrolled {
  border-bottom-color: var(--line);
  background: rgba(250, 250, 247, 0.96);
  box-shadow: var(--shadow-sm);
}

.masthead {
  width: min(100% - 2rem, var(--content-max));
  height: var(--header-height);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.logo {
  position: relative;
  z-index: 1101;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 44px;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 0;
  font-family: var(--serif);
  font-size: clamp(1.45rem, 2vw, 1.8rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.logo:hover {
  color: var(--accent);
  border-bottom: 0;
}

.logo-icon,
.footer-logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  background: linear-gradient(135deg, #fff, var(--accent-soft));
  border: 1px solid rgba(200, 85, 30, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.logo-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  transition:
    transform 0.2s ease,
    background 0.2s ease,
    color 0.2s ease;
}

.logo:hover .logo-icon {
  transform: translateY(-1px) rotate(-4deg);
  background: var(--accent);
  color: #fff;
}

.logo-icon svg,
.footer-logo-icon svg {
  width: 20px;
  height: 20px;
}

.main-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
}

.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 0;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition:
    color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.nav-link:hover {
  color: var(--ink);
  background: rgba(242, 238, 230, 0.78);
  border-bottom: 0;
}

.nav-link:active {
  transform: translateY(1px);
}

.nav-link[aria-current="page"] {
  color: var(--accent-dark);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(200, 85, 30, 0.16);
}

.nav-link[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 6px;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: translateX(-50%);
}

.menu-toggle {
  position: relative;
  z-index: 1101;
  display: none;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

.menu-toggle:hover {
  border-color: rgba(200, 85, 30, 0.42);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.menu-toggle:active {
  transform: scale(0.97);
}

.menu-toggle-bars {
  position: relative;
  width: 22px;
  height: 16px;
  display: inline-flex;
  flex-direction: column;
  justify-content: space-between;
}

.menu-toggle-bars::before,
.menu-toggle-bars::after,
.menu-toggle-bars span {
  content: "";
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform-origin: center;
  transition:
    transform 0.24s ease,
    opacity 0.18s ease;
}

.menu-toggle[aria-expanded="true"] {
  border-color: rgba(200, 85, 30, 0.5);
  background: var(--accent);
  color: #fff;
}

.menu-toggle[aria-expanded="true"] .menu-toggle-bars::before {
  transform: translateY(7px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] .menu-toggle-bars span {
  opacity: 0;
  transform: scaleX(0.4);
}

.menu-toggle[aria-expanded="true"] .menu-toggle-bars::after {
  transform: translateY(-7px) rotate(-45deg);
}

.mobile-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: var(--bg-overlay);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.24s ease,
    visibility 0.24s ease;
}

.mobile-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ---------- Layout Families ---------- */
.container {
  max-width: var(--article-max);
  margin: 0 auto;
  padding: 0 24px;
}

article:not(.blog-post) {
  padding: 48px 0 80px;
}

.blog-post {
  max-width: var(--article-max);
  margin: 0 auto;
  padding: 48px 24px 80px;
}

/* ---------- Article Header: container layout ---------- */
.post-header {
  border-bottom: 1px solid var(--line);
  padding-bottom: 32px;
  margin-bottom: 40px;
}

.breadcrumb {
  font-size: 13px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 16px;
}

.breadcrumb a {
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px dotted var(--line);
}

.breadcrumb a:hover {
  color: var(--accent);
}

.post-header h1,
.blog-hero h1,
article h1 {
  font-family: var(--serif);
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.1;
  font-weight: 600;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}

.post-meta,
.blog-meta {
  font-size: 14px;
  color: var(--ink-soft);
}

.lede,
.blog-intro {
  font-family: var(--serif);
  font-size: 1.35rem;
  line-height: 1.5;
  color: var(--ink-soft);
  font-style: italic;
  margin: 24px 0;
}

/* ---------- Article Header: blog-post layout ---------- */
.blog-hero {
  border-bottom: 1px solid var(--line);
  padding-bottom: 32px;
  margin-bottom: 40px;
}

.blog-label {
  display: inline-block;
  font-size: 0.72rem;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 5px 12px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 700;
  margin-bottom: 18px;
}

/* ---------- Typography ---------- */
article h2,
.section h2 {
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 600;
  margin: 56px 0 16px;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.section {
  margin-top: 48px;
}

.section h2 {
  font-size: 1.9rem;
  margin-bottom: 14px;
}

article h2::before,
.section h2::before {
  content: "";
  display: inline-block;
  width: 32px;
  height: 2px;
  background: var(--accent);
  vertical-align: middle;
  margin-right: 14px;
  margin-bottom: 6px;
}

article h3,
.section h3 {
  font-family: var(--sans);
  font-size: 1.25rem;
  font-weight: 600;
  margin: 32px 0 12px;
  color: var(--ink);
}

.section h3 {
  font-size: 1.2rem;
  margin: 28px 0 10px;
}

article p,
.section p {
  margin-bottom: 16px;
}

.section p {
  margin-bottom: 14px;
}

article ul,
article ol,
.section ul,
.section ol {
  margin: 12px 0 18px;
  padding-left: 24px;
}

.section ul,
.section ol {
  margin: 10px 0 16px;
}

article li,
.section li {
  margin-bottom: 6px;
}

/* ---------- TOC ---------- */
.toc {
  background: var(--bg-alt);
  border-left: 3px solid var(--accent);
  padding: 20px 24px;
  margin: 32px 0;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.toc h3 {
  margin-top: 0;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
}

.toc ul {
  list-style: none;
  margin-top: 8px;
  padding: 0;
}

.toc li {
  padding: 4px 0;
  font-size: 0.95rem;
  margin: 0;
}

.toc a {
  border: none;
  color: var(--ink);
}

.toc a:hover {
  color: var(--accent);
}

/* ---------- Converter Widget ---------- */
.converter {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  margin: 32px 0;
  box-shadow: var(--shadow);
}

.converter h3 {
  margin-top: 0;
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 600;
}

.converter-tag {
  display: inline-block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 10px;
  border-radius: 20px;
  margin-bottom: 8px;
  font-weight: 600;
}

.converter-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  align-items: end;
  margin: 20px 0 12px;
}

.converter-field label {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  margin-bottom: 6px;
  font-weight: 600;
}

.converter-field input,
.converter-field select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 1rem;
  background: #fff;
  transition: border-color 0.15s;
}

.converter-field input {
  font-family: var(--mono);
  font-weight: 600;
}

.converter-field input:focus,
.converter-field select:focus {
  outline: none;
  border-color: var(--accent);
}

.swap-btn {
  background: var(--ink);
  color: #fff;
  border: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  transition:
    transform 0.2s,
    background 0.2s;
}

.swap-btn:hover {
  background: var(--accent);
  transform: rotate(180deg);
}

.formula {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--ink-soft);
  background: var(--bg-alt);
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-top: 8px;
}

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
  margin: 24px 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 0.95rem;
}

caption {
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
  background: #fff;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}

th {
  background: var(--ink);
  color: #fafaf7;
  padding: 14px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.92rem;
}

td:first-child {
  font-weight: 600;
  color: var(--ink);
  background: var(--bg-alt);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: var(--highlight);
}

tr:hover td:first-child {
  background: #fff3d6;
}

/* ---------- Formula Cards ---------- */
.formula-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 26px;
  margin: 24px 0;
  box-shadow: var(--shadow);
  text-align: center;
}

.formula-card .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--ink-soft);
  margin-bottom: 8px;
  font-weight: 600;
}

.formula-card .equation {
  font-family: var(--serif);
  font-size: 1.6rem;
  color: var(--ink);
  font-weight: 500;
}

.formula-card .equation .accent {
  color: var(--accent);
  font-weight: 700;
}

/* ---------- Worked Examples ---------- */
.example {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--ink);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 20px 24px;
  margin: 24px 0;
}

.example .label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--ink-soft);
  font-weight: 700;
  margin-bottom: 8px;
}

.example .question {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-style: italic;
  margin-bottom: 12px;
  color: var(--ink);
}

.example .step {
  font-family: var(--mono);
  font-size: 0.92rem;
  color: var(--ink-soft);
  margin: 4px 0;
}

.example .answer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  font-weight: 600;
  color: var(--accent);
}

/* ---------- Callouts ---------- */
.callout,
.related-note {
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  background: #fff;
  padding: 18px 22px;
  margin: 24px 0;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.related-note {
  background: var(--bg-alt);
  border-left-width: 3px;
  font-size: 0.95rem;
}

.callout-title,
.related-note strong {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 6px;
}

.related-note strong {
  display: block;
  color: var(--ink-soft);
  margin-bottom: 4px;
}

/* ---------- Special Topic Callouts ---------- */
.callout.gold-callout {
  border-left-color: var(--gold);
  background: #fffdf6;
}

.callout.gold-callout .callout-title {
  color: var(--gold);
}

.callout.diamond-callout {
  border-left-color: var(--diamond);
  background: #f8fbfc;
}

.callout.diamond-callout .callout-title {
  color: var(--diamond);
}

/* ---------- Tools and Related Grids ---------- */
.tools-grid,
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin: 24px 0;
}

.related-grid {
  margin: 20px 0;
}

.tool-card,
.related-grid a {
  display: block;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 500;
  transition: all 0.2s;
  text-decoration: none;
  position: relative;
}

.tool-card:hover,
.related-grid a:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(200, 85, 30, 0.12);
  transform: translateY(-2px);
  color: var(--accent);
}

.tool-card::after,
.related-grid a::after {
  content: "→";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  transition: all 0.2s;
}

.tool-card:hover::after,
.related-grid a:hover::after {
  opacity: 1;
  right: 10px;
}

/* ---------- Related Posts Cards ---------- */
.related {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin: 24px 0;
}

.related-card {
  display: block;
  background: #fff;
  border: 1px solid var(--line);
  padding: 18px 20px;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
  transition: all 0.2s;
}

.related-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.related-card .tag {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  font-weight: 700;
}

.related-card h4 {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  margin: 6px 0 0;
  color: var(--ink);
  line-height: 1.3;
}

/* ---------- FAQ ---------- */
.faq-list {
  margin-top: 14px;
}

.faq-item {
  border-bottom: 1px solid var(--line);
  padding: 18px 0;
}

.faq-item:last-child {
  border-bottom: none;
}

.faq-question,
.faq-item summary {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  list-style: none;
  color: var(--ink);
}

.faq-item summary {
  font-size: 1.18rem;
}

.faq-question::-webkit-details-marker,
.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-question::after,
.faq-item summary::after {
  content: "+";
  font-family: var(--sans);
  font-size: 1.4rem;
  color: var(--accent);
  transition: transform 0.2s;
  font-weight: 300;
  flex: 0 0 auto;
}

details[open] .faq-question::after,
.faq-item[open] summary::after {
  transform: rotate(45deg);
}

.faq-answer,
.faq-item .answer {
  padding-top: 10px;
  color: var(--ink-soft);
}

/* ---------- Footer CTA ---------- */
.footer-cta {
  background: var(--ink);
  color: #fafaf7;
  padding: 40px;
  border-radius: var(--radius);
  text-align: center;
  margin: 48px 0 0;
}

.footer-cta h3 {
  font-family: var(--serif);
  color: #fafaf7;
  font-size: 1.8rem;
  margin-bottom: 10px;
}

.footer-cta p {
  color: #bbb;
  margin-bottom: 20px;
}

.footer-cta a {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 12px 28px;
  border-radius: var(--radius);
  font-weight: 600;
  border: none;
}

.footer-cta a:hover {
  background: #a8451a;
}

/* ---------- Compare Cards ---------- */
.compare {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin: 26px 0;
}

.compare-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.compare-card h4 {
  font-family: var(--serif);
  font-size: 1.35rem;
  margin-bottom: 8px;
}

.compare-card ul {
  margin: 12px 0 0;
  padding-left: 22px;
}

.compare-card li {
  margin-bottom: 5px;
}

.compare-card .big-number {
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.1;
}

.compare-card .ribbon {
  position: absolute;
  top: 14px;
  right: -36px;
  transform: rotate(35deg);
  background: var(--accent);
  color: #fff;
  padding: 4px 42px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.compare-card.gold,
.compare-card.gold-card {
  border-color: rgba(184, 134, 11, 0.35);
  background: #fffdf6;
}

.compare-card.gold .ribbon,
.compare-card.gold-card .ribbon {
  background: var(--gold);
}

.compare-card.diamond {
  border-color: rgba(90, 122, 138, 0.35);
  background: #f8fbfc;
}

.compare-card.diamond .ribbon {
  background: var(--diamond);
}

.compare-card.standard .ribbon {
  background: var(--ink-soft);
}

/* ---------- Gold Bar Reference ---------- */
.bar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 24px 0;
}

.bar-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.bar-card .size {
  display: block;
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}

.bar-card .equiv {
  display: block;
  font-family: var(--mono);
  font-size: 0.86rem;
  color: var(--ink-soft);
}

/* ---------- Diamond Size Chart ---------- */
.diamond-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin: 24px 0;
}

.diamond-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: all 0.2s;
}

.diamond-card:hover {
  border-color: var(--diamond);
  transform: translateY(-2px);
}

.diamond-card .visual {
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.diamond-card .visual .stone {
  display: block;
  border-radius: 50%;
  background: radial-gradient(
    circle at 35% 30%,
    #ffffff 0 12%,
    #dfeef4 13% 35%,
    #9fb8c4 36% 70%,
    #5a7a8a 71% 100%
  );
  border: 1px solid rgba(90, 122, 138, 0.25);
  box-shadow:
    inset -5px -8px 12px rgba(0, 0, 0, 0.08),
    0 8px 16px rgba(90, 122, 138, 0.16);
}

.diamond-card .ct {
  display: block;
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
}

.diamond-card .mm {
  display: block;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* ---------- 4Cs Grid ---------- */
.cs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin: 24px 0;
}

.c-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.c-card .letter {
  display: inline-flex;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--diamond-soft);
  color: var(--diamond);
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.c-card h4 {
  font-family: var(--serif);
  font-size: 1.18rem;
  margin-bottom: 6px;
}

.c-card p {
  margin-bottom: 0;
  font-size: 0.94rem;
  color: var(--ink-soft);
}

/* ---------- Site Footer ---------- */
.site-footer {
  flex-shrink: 0;
  padding: clamp(2.5rem, 5vw, 4rem) 1rem 1.5rem;
  border-top: 1px solid var(--line);
  background: linear-gradient(
    180deg,
    rgba(242, 238, 230, 0.86),
    rgba(238, 232, 220, 0.98)
  );
  color: var(--ink-soft);
}

.site-footer a {
  color: inherit;
  text-decoration: none;
  border-bottom: 0;
}

.footer-top {
  width: min(100%, var(--content-max));
  margin: 0 auto 2.25rem;
  display: grid;
  grid-template-columns: minmax(260px, 1.35fr) repeat(3, minmax(150px, 1fr));
  gap: clamp(1.75rem, 4vw, 3rem);
  align-items: start;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.footer-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  width: fit-content;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  transition: color 0.2s ease;
}

.footer-logo:hover {
  color: var(--accent);
  border-bottom: 0;
}

.footer-logo-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  transition:
    color 0.2s ease,
    background 0.2s ease;
}

.footer-logo:hover .footer-logo-icon {
  color: #fff;
  background: var(--accent);
}

.footer-tagline {
  max-width: 280px;
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.75;
}

.footer-col-title {
  margin-bottom: 0.85rem;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.16rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.footer-link {
  position: relative;
  width: fit-content;
  padding: 0.1rem 0;
  font-size: 0.92rem;
  transition:
    color 0.2s ease,
    transform 0.2s ease;
}

.footer-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.22s ease;
}

.footer-link:hover {
  color: var(--accent-dark);
  transform: translateX(3px);
  border-bottom: 0;
}

.footer-link:hover::after {
  transform: scaleX(1);
}

.footer-disclaimer,
.footer-bottom {
  width: min(100%, var(--content-max));
  margin-inline: auto;
  border-top: 1px solid rgba(210, 199, 183, 0.72);
}

.footer-disclaimer {
  margin-bottom: 1.25rem;
  padding-top: 1.3rem;
  color: var(--ink-muted);
  font-size: 0.82rem;
  line-height: 1.75;
  font-style: italic;
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding-top: 1.15rem;
  color: var(--ink-muted);
  font-size: 0.83rem;
}

.footer-bottom p {
  margin: 0;
}

/* ---------- Tablet and Mobile Header ---------- */
@media (max-width: 940px) {
  :root {
    --header-height: 68px;
  }

  .masthead {
    width: min(100% - 1.5rem, var(--content-max));
  }

  .menu-toggle {
    display: inline-flex;
  }

  .main-nav {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 1100;
    width: min(86vw, 360px);
    height: 100dvh;
    padding: calc(var(--header-height) + 1rem) 1rem
      max(1rem, env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0.35rem;
    overflow-y: auto;
    background: linear-gradient(
      180deg,
      rgba(251, 250, 246, 0.98),
      rgba(244, 238, 228, 0.98)
    );
    border-left: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
    transform: translateX(105%);
    visibility: hidden;
    transition:
      transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1),
      visibility 0.28s ease;
  }

  .main-nav.open {
    transform: translateX(0);
    visibility: visible;
  }

  .main-nav::before {
    content: "Menu";
    display: block;
    margin: 0 0 0.55rem;
    padding: 0 0.2rem 0.7rem;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    font-family: var(--serif);
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
  }

  .nav-link {
    justify-content: flex-start;
    width: 100%;
    min-height: 50px;
    padding: 0.85rem 0.95rem;
    border-radius: 14px;
    font-size: 1rem;
    color: var(--ink);
  }

  .nav-link:hover {
    background: var(--bg-muted);
  }

  .nav-link[aria-current="page"] {
    background: var(--accent-soft);
    box-shadow:
      inset 4px 0 0 var(--accent),
      inset 0 0 0 1px rgba(200, 85, 30, 0.13);
  }

  .nav-link[aria-current="page"]::after {
    display: none;
  }

  .footer-top {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footer-brand {
    grid-column: 1 / -1;
  }

  .footer-tagline {
    max-width: 620px;
  }
}

/* ---------- Mobile Article Layout ---------- */
@media (max-width: 600px) {
  :root {
    --header-height: 64px;
  }

  body {
    font-size: 16px;
  }

  .masthead {
    width: min(100% - 1rem, var(--content-max));
    gap: 0.75rem;
  }

  .logo {
    font-size: 1.35rem;
    gap: 0.5rem;
  }

  .logo-icon {
    width: 36px;
    height: 36px;
    border-radius: 11px;
  }

  .menu-toggle {
    width: 44px;
    height: 44px;
    border-radius: 13px;
  }

  .main-nav {
    width: 100vw;
    border-left: 0;
  }

  .container {
    padding: 0 20px;
  }

  article:not(.blog-post) {
    padding: 32px 0 60px;
  }

  .blog-post {
    padding: 32px 20px 60px;
  }

  article h2,
  .section h2 {
    font-size: 1.6rem;
    margin-top: 40px;
  }

  .section h2 {
    font-size: 1.55rem;
  }

  .converter-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .swap-btn {
    margin: 0 auto;
    transform: rotate(90deg);
  }

  .swap-btn:hover {
    transform: rotate(270deg);
  }

  td,
  th {
    padding: 10px 12px;
    font-size: 0.86rem;
  }

  .formula-card .equation {
    font-size: 1.25rem;
  }

  .compare {
    grid-template-columns: 1fr;
  }

  .footer-cta {
    padding: 30px 22px;
  }

  .footer-top {
    grid-template-columns: 1fr;
  }

  .footer-bottom {
    align-items: flex-start;
    flex-direction: column;
  }
}

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