/* Gold & Silver Rates, scoped styles. Self-contained, dark theme matching
   the rest of manikumarjami.com (mapc/labs palette), gold/silver accent. */

:root {
    --bg: #0d0f1a;
    --s1: #131623;
    --s2: #1a1d2e;
    --bd: #2a2f4a;
    --tx: #e2e4f0;
    --mu: #7b82a8;
    --gold: #f5b942;
    --gold2: #ffd76a;
    --silver: #c7ccd9;
    --up: #00e676;
    --down: #ef5350;
}

* { box-sizing: border-box; }

body.gr-page {
    margin: 0;
    background: var(--bg);
    color: var(--tx);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    min-height: 100vh;
}

/* NAV */
.gr-nav {
    background: var(--s1);
    border-bottom: 1px solid var(--bd);
    padding: 13px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.gr-nav-brand { font-size: 14px; font-weight: 800; color: var(--tx); text-decoration: none; }
.gr-nav-brand span { color: var(--gold); }
.gr-nav-back { display: inline-block; padding: 10px 0; font-size: 12px; color: var(--mu); text-decoration: none; }
.gr-nav-back:hover { color: var(--tx); }

/* MAIN WRAP */
.gr-main {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 20px 40px;
}

/* BREADCRUMB */
.gr-breadcrumb {
    font-size: 12px;
    color: var(--mu);
    padding: 16px 0 0;
}
.gr-breadcrumb a { color: var(--mu); text-decoration: none; }
.gr-breadcrumb a:hover { color: var(--gold); }
.gr-breadcrumb span { margin: 0 4px; }

/* HERO */
.gr-hero { padding: 28px 0 8px; }
.gr-eyebrow {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--gold);
    background: rgba(245, 185, 66, .08);
    border: 1px solid rgba(245, 185, 66, .22);
    padding: 3px 12px;
    border-radius: 20px;
    margin-bottom: 14px;
}
.gr-h1 { font-size: 30px; font-weight: 900; line-height: 1.2; margin: 0 0 10px; }
.gr-sub { font-size: 14px; color: var(--mu); max-width: 640px; margin: 0 0 22px; }

/* HERO RATE CARDS */
.gr-hero-cards { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.gr-hero-card {
    flex: 1 1 220px;
    background: var(--s1);
    border: 1px solid var(--bd);
    border-radius: 12px;
    padding: 18px 20px;
}
.gr-hc-label { font-size: 12px; color: var(--mu); font-weight: 600; margin-bottom: 6px; }
.gr-hc-unit { font-weight: 400; color: var(--mu); }
.gr-hc-value { font-size: 28px; font-weight: 900; color: var(--gold2); margin-bottom: 6px; }
.gr-hc-change { font-size: 12.5px; font-weight: 700; }
.gr-hc-change.gr-up { color: var(--up); }
.gr-hc-change.gr-down { color: var(--down); }
.gr-hc-change.gr-flat { color: var(--mu); }

/* SECTIONS */
.gr-section { padding: 28px 0; border-top: 1px solid var(--bd); }
.gr-section:first-of-type { border-top: none; }
.gr-section h2 { font-size: 19px; font-weight: 800; margin: 0 0 14px; }
.gr-section h3 { font-size: 14px; font-weight: 700; color: var(--mu); margin: 18px 0 8px; text-transform: uppercase; letter-spacing: .4px; }
.gr-section h3:first-of-type { margin-top: 0; }
.gr-section p { font-size: 14px; color: var(--tx); margin: 0 0 12px; }
.gr-section p:last-child { margin-bottom: 0; }

/* TABLES */
.gr-table-wrap { margin-bottom: 18px; }
.gr-table-wrap:last-of-type { margin-bottom: 14px; }
.gr-table { width: 100%; border-collapse: collapse; background: var(--s1); border: 1px solid var(--bd); border-radius: 8px; overflow: hidden; font-size: 14px; }
.gr-table th, .gr-table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--bd); }
.gr-table thead th { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--mu); font-weight: 700; background: var(--s2); }
.gr-table tbody tr:last-child td { border-bottom: none; }
.gr-table td:first-child { font-weight: 700; }
.gr-table td:not(:first-child) { font-variant-numeric: tabular-nums; color: var(--gold2); font-weight: 600; }

/* NOTES */
.gr-note { font-size: 12.5px; color: var(--mu); }
.gr-note a { color: var(--gold); text-decoration: none; }
.gr-note a:hover { text-decoration: underline; }
.gr-disclaimer { font-size: 11.5px; color: var(--mu); }

/* CITY GRID */
.gr-city-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}
.gr-city-card {
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: var(--s1);
    border: 1px solid var(--bd);
    border-radius: 8px;
    padding: 12px 14px;
    text-decoration: none;
    transition: border-color .15s, background .15s;
}
.gr-city-card:hover { border-color: var(--gold); background: rgba(245, 185, 66, .05); }
.gr-city-name { font-size: 13.5px; font-weight: 700; color: var(--tx); }
.gr-city-state { font-size: 11.5px; color: var(--mu); }

/* SUBSCRIBE */
.gr-subscribe { border-top: 1px solid var(--bd); }
.gr-sub-card {
    background: linear-gradient(135deg, rgba(245, 185, 66, .08), rgba(0, 188, 212, .05));
    border: 1px solid var(--bd);
    border-radius: 12px;
    padding: 24px;
}
.gr-sub-card h2 { margin-bottom: 6px; }
.gr-sub-card > p { font-size: 13px; color: var(--mu); margin-bottom: 16px; }
.gr-sub-row { display: flex; gap: 8px; flex-wrap: wrap; }
.gr-sub-input {
    flex: 1 1 220px;
    background: var(--s2);
    border: 1px solid var(--bd);
    border-radius: 7px;
    padding: 11px 13px;
    color: var(--tx);
    font-size: 13px;
    outline: none;
}
.gr-sub-input:focus { border-color: var(--gold); }
.gr-sub-input::placeholder { color: var(--mu); }
.gr-sub-btn {
    background: linear-gradient(135deg, var(--gold), var(--gold2));
    color: #1a1208;
    font-weight: 800;
    font-size: 13px;
    padding: 15px 22px;
    border-radius: 7px;
    border: none;
    cursor: pointer;
    white-space: nowrap;
}
.gr-sub-btn:disabled { opacity: .5; cursor: not-allowed; }
.gr-sub-note { font-size: 11px; color: var(--mu); margin-top: 8px; margin-bottom: 0 !important; }
.gr-sub-err { display: none; font-size: 12px; color: var(--down); margin-top: 8px; }
.gr-sub-ok { display: none; font-size: 13px; color: var(--up); margin-top: 12px; padding: 12px 14px; background: rgba(0, 230, 118, .08); border: 1px solid rgba(0, 230, 118, .22); border-radius: 8px; }

/* DPDP consent checkbox */
.gr-sub-consent {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 12px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, .02);
    border: 1px solid var(--bd);
    border-radius: 7px;
    cursor: pointer;
}
.gr-sub-consent input[type="checkbox"] {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin-top: 2px;
    accent-color: var(--gold);
    cursor: pointer;
}
.gr-sub-consent span {
    font-size: 12px;
    line-height: 1.55;
    color: var(--mu);
}
.gr-sub-consent a {
    color: var(--gold);
    text-decoration: underline;
}
.gr-sub-consent:hover { border-color: rgba(245, 185, 66, .3); }

/* Above-rates disclaimer banner, sits at the top of every rates section.
   Yellow-edged to read as advisory, not error. */
.gr-disclaimer-banner {
    margin: 0 0 18px;
    padding: 12px 16px;
    border-left: 3px solid var(--gold);
    background: rgba(245, 185, 66, .07);
    border-radius: 0 7px 7px 0;
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--mu);
}
.gr-disclaimer-banner strong { color: var(--tx); }
.gr-disclaimer-banner a { color: var(--gold); text-decoration: underline; }
.gr-methodology code {
    background: var(--s2);
    border: 1px solid var(--bd);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 12px;
    color: var(--tx);
}

/* FAQ */
.gr-faq-item { border-bottom: 1px solid var(--bd); }
.gr-faq-item:last-child { border-bottom: none; }
.gr-faq-item summary { padding: 14px 0; font-size: 14px; font-weight: 700; cursor: pointer; }
.gr-faq-item summary::marker { color: var(--gold); }
.gr-faq-item p { margin: 0 0 14px; font-size: 13px; color: var(--mu); }

/* METHODOLOGY */
.gr-methodology p { font-size: 13px; color: var(--mu); }
.gr-methodology strong { color: var(--tx); }

/* ERROR */
.gr-error { padding: 60px 0; text-align: center; }
.gr-error h1 { font-size: 22px; margin-bottom: 10px; }
.gr-error p { color: var(--mu); margin-bottom: 18px; }
.gr-btn-primary {
    display: inline-block;
    background: linear-gradient(135deg, var(--gold), var(--gold2));
    color: #1a1208;
    font-weight: 800;
    font-size: 13px;
    padding: 11px 22px;
    border-radius: 7px;
    text-decoration: none;
}

/* FOOTER */
.gr-footer {
    border-top: 1px solid var(--bd);
    padding: 18px 24px;
    text-align: center;
    font-size: 11px;
    color: var(--mu);
}
.gr-footer a { color: var(--mu); text-decoration: none; }
.gr-footer a:hover { color: var(--gold); }

@media (max-width: 600px) {
    .gr-h1 { font-size: 24px; }
    .gr-hero-cards { flex-direction: column; }
    .gr-sub-row { flex-direction: column; }
    .gr-sub-input { flex: 1 1 auto; width: 100%; }
    .gr-sub-btn { width: 100%; }
}

/* ────────────────────────────────────────────────────────────────────
   AUTHOR + SUBSTACK CTA, bottom of gold-rates pages.
   Mirrors labs/css/assess.css .page-author-cta but uses gold-rates'
   variable names (--tx, --mu, --bd, --gold).
   ──────────────────────────────────────────────────────────────────── */
.page-author-cta {
    margin: 48px 0 24px;
    padding: 26px;
    border: 1px solid var(--bd);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(245, 185, 66, 0.04), rgba(167, 139, 250, 0.04));
}
.author-block {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 22px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--bd);
}
.author-avatar {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), var(--gold2));
    color: #1a1208;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    letter-spacing: 0.04em;
}
.author-info { flex: 1 1 auto; min-width: 0; }
.author-name { font-weight: 700; color: var(--tx); font-size: 15px; margin: 0 0 4px; }
.author-bio { color: var(--mu); font-size: 13.5px; line-height: 1.65; margin: 0 0 10px; }
.author-bio a { color: var(--gold); text-decoration: underline; text-decoration-color: rgba(245, 185, 66, 0.4); }
.author-bio a:hover { text-decoration-color: var(--gold); }
.author-links { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; }
.author-links a { color: var(--gold); text-decoration: none; font-weight: 600; }
.author-links a:hover { text-decoration: underline; }
.substack-cta-block h3 { color: var(--tx); font-size: 17px; font-weight: 700; margin: 0 0 8px; }
.substack-cta-block p { color: var(--mu); font-size: 13.5px; line-height: 1.65; margin: 0 0 16px; }
.substack-cta-btn {
    display: inline-block;
    padding: 11px 20px;
    background: linear-gradient(135deg, var(--gold), var(--gold2));
    color: #1a1208 !important;
    border: none;
    border-radius: 8px;
    font-weight: 800;
    font-size: 13px;
    text-decoration: none !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.substack-cta-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(245, 185, 66, 0.25);
}
@media (max-width: 540px) {
    .page-author-cta { padding: 20px 16px; }
    .author-block { flex-direction: column; gap: 12px; padding-bottom: 16px; margin-bottom: 16px; }
    .author-avatar { flex-basis: auto; }
}

/* ────────────────────────────────────────────────────────────────────
   DYNAMIC ICONS — gentle hover only. Earlier version added
   `display: inline-block` to .author-avatar which broke its `display: flex`
   centering and blew out the layout (text overflowed the circle).
   Now: avatar keeps its existing flex layout, transform animates the
   whole element (not its inner text), and only on hover.
   ──────────────────────────────────────────────────────────────────── */
.gr-page .author-avatar {
    transition: transform 0.22s ease-out, box-shadow 0.22s ease-out;
    transform-origin: center;
    will-change: transform;
}
.gr-page .author-avatar:hover {
    transform: scale(1.06);
    box-shadow: 0 4px 14px rgba(245, 185, 66, 0.28);
}
/* Subtle pulse on the gold "jami" word in the nav brand. */
@keyframes mkj-gr-shimmer {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.78; }
}
.gr-page .gr-nav-brand span {
    animation: mkj-gr-shimmer 3.2s ease-in-out infinite;
    transition: transform 0.22s ease-out;
    transform-origin: center;
    display: inline-block;
}
.gr-page .gr-nav-brand:hover span {
    animation-play-state: paused;
    transform: scale(1.06);
}
@media (prefers-reduced-motion: reduce) {
    .gr-page .author-avatar,
    .gr-page .gr-nav-brand span {
        animation: none !important;
        transition: none !important;
    }
}

/* ────────────────────────────────────────────────────────────────────
   CROSS-REFERENCE BANNER, side-by-side compare to a live retail source.
   Green tint when within ±3%, orange when diverged.
   ──────────────────────────────────────────────────────────────────── */
.gr-crossref-banner {
    margin: 0 0 18px;
    padding: 14px 16px;
    border-radius: 8px;
    border: 1px solid var(--bd);
    background: var(--s2);
}
.gr-crossref-aligned { border-left: 3px solid var(--up); background: rgba(0, 230, 118, 0.05); }
.gr-crossref-diverged { border-left: 3px solid var(--gold); background: rgba(245, 185, 66, 0.06); }
.gr-crossref-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    margin-bottom: 10px;
}
.gr-crossref-cell {
    text-align: center;
}
.gr-crossref-label {
    font-size: 11px;
    color: var(--mu);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.gr-crossref-value {
    font-size: 17px;
    font-weight: 700;
    color: var(--tx);
}
.gr-crossref-value.gr-crossref-aligned { color: var(--up); }
.gr-crossref-value.gr-crossref-diverged { color: var(--gold); }
.gr-crossref-note {
    font-size: 12px;
    color: var(--mu);
    line-height: 1.55;
    border-top: 1px solid var(--bd);
    padding-top: 8px;
}
@media (max-width: 600px) {
    .gr-crossref-grid { grid-template-columns: 1fr; gap: 8px; }
    .gr-crossref-cell { text-align: left; display: flex; justify-content: space-between; align-items: baseline; }
    .gr-crossref-label { margin-bottom: 0; flex: 0 0 auto; }
    .gr-crossref-value { font-size: 15px; }
}

/* ────────────────────────────────────────────────────────────────────
   CALCULATOR WIDGET
   Purity / Weight / Making% / GST inputs with a live total. Inspired
   by Groww-style calculator pattern. Inputs are clamped by JS but
   we also use HTML5 min/max as a second line of defence.
   ──────────────────────────────────────────────────────────────────── */
.gr-calc {
    background: linear-gradient(135deg, rgba(245, 185, 66, 0.06), rgba(0, 188, 212, 0.03));
    border: 1px solid var(--bd);
    border-radius: 12px;
    padding: 22px 24px 24px;
}
.gr-calc h2 { margin-bottom: 6px; }
.gr-calc-sub { font-size: 13px; color: var(--mu); margin: 0 0 18px; line-height: 1.6; }
.gr-calc-row {
    display: grid;
    grid-template-columns: minmax(180px, 1.4fr) 1fr 1fr minmax(140px, 1fr);
    gap: 12px;
    margin-bottom: 18px;
}
.gr-calc-field { display: flex; flex-direction: column; gap: 6px; }
.gr-calc-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--mu);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.gr-calc-input {
    background: var(--s2);
    border: 1px solid var(--bd);
    border-radius: 7px;
    padding: 10px 12px;
    color: var(--tx);
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    outline: none;
    -moz-appearance: textfield;
}
.gr-calc-input:focus { border-color: var(--gold); }
.gr-calc-input::-webkit-outer-spin-button,
.gr-calc-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.gr-calc-toggle {
    display: inline-flex;
    background: var(--s2);
    border: 1px solid var(--bd);
    border-radius: 7px;
    padding: 3px;
    gap: 2px;
}
.gr-calc-tbtn {
    background: transparent;
    color: var(--mu);
    border: none;
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 5px;
    transition: background 0.15s, color 0.15s;
    flex: 1;
    text-align: center;
}
.gr-calc-tbtn:hover { color: var(--tx); }
.gr-calc-tbtn.is-active {
    background: linear-gradient(135deg, var(--gold), var(--gold2));
    color: #1a1208;
}

/* Results pane: breakdown table on the left, big total on the right */
.gr-calc-results {
    display: grid;
    grid-template-columns: 1fr minmax(180px, 240px);
    gap: 12px;
}
.gr-calc-breakdown {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: var(--s1);
    border: 1px solid var(--bd);
    border-radius: 8px;
    overflow: hidden;
}
.gr-calc-breakdown td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--bd);
}
.gr-calc-breakdown tr:last-child td { border-bottom: none; }
.gr-calc-breakdown td:first-child { color: var(--mu); }
.gr-calc-breakdown td:last-child {
    text-align: right;
    color: var(--tx);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.gr-calc-total {
    background: rgba(245, 185, 66, 0.06);
    border: 1px solid rgba(245, 185, 66, 0.35);
    border-radius: 8px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
}
.gr-calc-total-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--mu);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.gr-calc-total-value {
    font-size: 22px;
    font-weight: 900;
    color: var(--gold2);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    margin-bottom: 4px;
}
.gr-calc-total-note {
    font-size: 11px;
    color: var(--mu);
}

@media (max-width: 640px) {
    .gr-calc { padding: 18px 16px 20px; }
    .gr-calc-row {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .gr-calc-field-purity, .gr-calc-field-gst { grid-column: 1 / -1; }
    .gr-calc-results { grid-template-columns: 1fr; }
    .gr-calc-total-value { font-size: 20px; }
}
