/**
 * 4MG Health Suite — public styles.
 * Mobile-first, theme-inheriting, accessible. No frameworks.
 * Accent colour is injected as --fhs-accent (Settings → Brand).
 *
 * THEME INTEGRATION: every colour used here is a CSS custom property
 * declared on :root, so a theme (or child theme stylesheet, or the
 * Customizer) can restyle the whole suite without touching plugin
 * files — override any of --fhs-accent, --fhs-text, --fhs-muted,
 * --fhs-border, --fhs-bg-soft, --fhs-surface, --fhs-radius, --fhs-font.
 * The medicines archive column width follows the theme's $content_width
 * via the --fhs-archive-width custom property set by the archive shell.
 */

:root {
        --fhs-accent: #0f766e;
        --fhs-accent-contrast: #ffffff;
        --fhs-text: #1f2937;
        --fhs-muted: #4b5563;
        --fhs-border: #d1d5db;
        --fhs-bg-soft: #f5f7f8;
        --fhs-warn: #b45309;
        --fhs-danger: #b32d2e;
        --fhs-ok: #0a7d33;
        --fhs-surface: #ffffff;
        --fhs-radius: 10px;
        --fhs-font: inherit;
}

.fhs-calc,
.fhs-disclaimer,
.fhs-takeaways,
.fhs-toc,
.fhs-related,
.fhs-medicine-directory,
.fhs-newsletter,
.fhs-product-details,
.fhs-medicine-details,
.fhs-product-compare,
.fhs-article-list {
        font-family: var(--fhs-font);
        color: var(--fhs-text);
        line-height: 1.65;
        box-sizing: border-box;
}

.fhs-calc *,
.fhs-medicine-details *,
.fhs-product-details *,
.fhs-newsletter * {
        box-sizing: border-box;
}

/* Images inside plugin blocks never overflow their container. */
.fhs-medicine-details img,
.fhs-medicine-archive img,
.fhs-article-list img,
.fhs-related img,
.fhs-product-details img,
.fhs-takeaways img,
.fhs-toc img {
        max-width: 100%;
        height: auto;
}

/* Long generic / brand names and Malayalam transliterations wrap
   instead of stretching cards or tables. */
.fhs-medicine-name a,
.fhs-medicine-name,
.fhs-medicine-brands,
.fhs-article-card-title a,
.fhs-article-card-title,
.fhs-related-link,
.fhs-medicine-details th,
.fhs-medicine-details td {
        overflow-wrap: break-word;
        word-break: normal;
}

/* ---------------------------------------------------------------- Buttons */
.fhs-btn {
        display: inline-block;
        border: 1px solid var(--fhs-border);
        background: transparent;
        color: var(--fhs-text);
        padding: 0.55em 1.1em;
        border-radius: var(--fhs-radius);
        font-size: 1rem;
        font-weight: 600;
        cursor: pointer;
        transition: background 0.15s ease, color 0.15s ease;
        -webkit-appearance: none;
        appearance: none;
}

.fhs-btn:hover {
        background: var(--fhs-bg-soft);
}

.fhs-btn-primary {
        background: var(--fhs-accent);
        border-color: var(--fhs-accent);
        color: var(--fhs-accent-contrast);
}

.fhs-btn-primary:hover {
        background: color-mix(in srgb, var(--fhs-accent) 85%, #000);
        color: var(--fhs-accent-contrast);
}

.fhs-btn[disabled] {
        opacity: 0.6;
        cursor: progress;
}

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

/* ----------------------------------------------------------- Calculator */
.fhs-calc {
        position: relative;
        max-width: 720px;
        background: var(--fhs-surface, #fff);
        border: 1px solid var(--fhs-border);
        border-radius: calc(var(--fhs-radius) + 4px);
        padding: 1.6rem 1.6rem 1.4rem;
        margin: 2rem 0;
        box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 12px 28px -18px rgba(15, 23, 42, 0.25);
        overflow: hidden; /* keeps the accent bar + reveal animation inside the card */
}

.fhs-calc::before {
        content: "";
        position: absolute;
        inset: 0 0 auto 0;
        height: 4px;
        background: var(--fhs-accent);
}

.fhs-calc-head {
        margin-bottom: 1.1rem;
}

.fhs-calc-title {
        margin: 0 0 0.25rem;
        font-size: 1.3rem;
        line-height: 1.3;
}

.fhs-calc-subtitle {
        margin: 0;
        color: var(--fhs-muted);
        font-size: 0.93rem;
}

.fhs-calc-fields {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.95rem 1.1rem;
        margin: 0 0 1.15rem;
}

.fhs-calc-field {
        margin: 0;
        min-width: 0;
}

/* Unit toggles and dropdowns span the full row; number pairs sit side by side. */
.fhs-calc-field-wide {
        grid-column: 1 / -1;
}

.fhs-calc-field > label,
.fhs-segmented legend {
        display: block;
        font-weight: 600;
        font-size: 0.88rem;
        margin-bottom: 0.35rem;
}

.fhs-input,
.fhs-calc-field input[type="number"],
.fhs-calc-field input[type="text"],
.fhs-calc-field select,
.fhs-newsletter-form input[type="email"] {
        width: 100%;
        padding: 0.55em 0.7em;
        border: 1px solid var(--fhs-border);
        border-radius: 8px;
        font-size: 1rem;
        background: var(--fhs-surface, #fff);
        color: var(--fhs-text);
        transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.fhs-calc-field input:focus-visible,
.fhs-calc-field select:focus-visible {
        outline: none;
        border-color: var(--fhs-accent);
        box-shadow: 0 0 0 3px color-mix(in srgb, var(--fhs-accent) 20%, transparent);
}

.fhs-calc-field [aria-invalid="true"] {
        border-color: var(--fhs-danger);
}

/* Number input with a trailing unit selector, kept on one line. */
.fhs-calc-input-group {
        display: flex;
        align-items: stretch;
        gap: 0.45rem;
}

.fhs-calc-input-group .fhs-input {
        flex: 1 1 auto;
        min-width: 0;
}

.fhs-unit-select {
        flex: 0 0 auto;
        width: auto;
        max-width: 110px;
}

/* Segmented pill toggle for unit systems / choices. */
.fhs-segmented {
        border: 0;
        padding: 0;
        margin: 0;
        min-width: 0;
}

.fhs-segmented-options {
        display: inline-flex;
        flex-wrap: wrap;
        width: fit-content;
        max-width: 100%;
        border: 1px solid var(--fhs-border);
        border-radius: 999px;
        padding: 3px;
        background: var(--fhs-bg-soft);
}

.fhs-radio {
        position: relative;
        display: inline-flex;
        align-items: center;
        margin: 0;
}

.fhs-radio input {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        margin: 0;
        opacity: 0;
        cursor: pointer;
}

.fhs-radio span {
        display: inline-block;
        padding: 0.34em 1em;
        border: 1px solid transparent;
        border-radius: 999px;
        font-size: 0.9rem;
        font-weight: 600;
        white-space: nowrap;
        color: var(--fhs-muted);
        transition: background 0.15s ease, color 0.15s ease;
}

.fhs-radio input:hover + span {
        color: var(--fhs-text);
        background: color-mix(in srgb, var(--fhs-accent) 9%, transparent);
}

.fhs-radio input:checked + span {
        background: var(--fhs-accent);
        border-color: var(--fhs-accent);
        color: var(--fhs-accent-contrast);
}

.fhs-radio input:focus-visible + span {
        outline: 3px solid var(--fhs-accent);
        outline-offset: 2px;
}

.fhs-calc-hint {
        display: block;
        font-size: 0.85rem;
        color: var(--fhs-muted);
        margin-top: 0.3rem;
}

.fhs-field-error {
        color: var(--fhs-danger);
        font-size: 0.85rem;
        margin: 0.3rem 0 0;
        min-height: 0;
}

/* Fields hidden by the unit toggle (JS adds/removes this class). */
.fhs-hidden {
        display: none !important;
}

.fhs-field-error:empty {
        display: none;
}

.fhs-calc-actions {
        display: flex;
        align-items: center;
        gap: 0.6rem;
        flex-wrap: wrap;
        margin: 0 0 0.7rem;
}

.fhs-calc-actions .fhs-btn-primary {
        padding: 0.65em 1.5em;
        font-size: 1.02rem;
}

/* Spinner shown while the result is being computed server-side. */
.fhs-btn.is-loading {
        position: relative;
}

.fhs-btn.is-loading::after {
        content: "";
        display: inline-block;
        width: 0.85em;
        height: 0.85em;
        margin-left: 0.55em;
        vertical-align: -0.08em;
        border: 2px solid currentColor;
        border-top-color: transparent;
        border-radius: 50%;
        animation: fhs-spin 0.7s linear infinite;
}

@keyframes fhs-spin {
        to {
                transform: rotate(360deg);
        }
}

.fhs-calc-privacy {
        display: flex;
        align-items: center;
        gap: 0.45rem;
        font-size: 0.82rem;
        color: var(--fhs-muted);
        margin: 0 0 1rem;
}

.fhs-calc-privacy::before {
        content: "";
        flex: 0 0 auto;
        width: 0.7em;
        height: 0.7em;
        border-radius: 50%;
        background: var(--fhs-ok);
        box-shadow: 0 0 0 3px color-mix(in srgb, var(--fhs-ok) 18%, transparent);
}

.fhs-calc-status {
        display: inline-block;
        margin-left: 0.2rem;
        font-size: 0.9rem;
        color: var(--fhs-muted);
}

.fhs-calc-result {
        margin-top: 0.4rem;
        min-height: 1rem;
}

.fhs-calc-result:empty {
        min-height: 0;
        margin: 0;
}

.fhs-calc-result-box {
        position: relative;
        background: var(--fhs-bg-soft);
        border: 1px solid var(--fhs-border);
        border-radius: 12px;
        padding: 1.05rem 1.25rem 1.15rem;
        overflow: hidden;
        animation: fhs-reveal 0.35s ease;
}

.fhs-calc-result-box::before {
        content: "";
        position: absolute;
        inset: 0 0 auto 0;
        height: 4px;
        background: var(--fhs-accent);
}

@keyframes fhs-reveal {
        from {
                opacity: 0;
                transform: translateY(8px);
        }
        to {
                opacity: 1;
                transform: none;
        }
}

.fhs-calc-value {
        font-size: clamp(1.6rem, 3vw, 2.05rem);
        font-weight: 700;
        line-height: 1.25;
        margin: 0.15rem 0 0.45rem;
}

.fhs-calc-value strong {
        font-weight: 700;
}

.fhs-calc-unit {
        font-size: 0.95rem;
        font-weight: 500;
        color: var(--fhs-muted);
}

.fhs-calc-category {
        display: inline-block;
        font-size: 0.88rem;
        font-weight: 700;
        margin: 0 0 0.65rem;
        padding: 0.28em 0.9em;
        border-radius: 999px;
        background: var(--fhs-surface, #fff);
        border: 1px solid var(--fhs-border);
        color: var(--fhs-text);
}

.fhs-cat-healthy,
.fhs-cat-low {
        color: var(--fhs-ok);
        background: #e8f5ec;
        border-color: #b7e0c2;
}

.fhs-cat-underweight,
.fhs-cat-increased {
        color: var(--fhs-warn);
        background: #fff4e5;
        border-color: #e8d9a8;
}

.fhs-cat-overweight,
.fhs-cat-obese,
.fhs-cat-high {
        color: var(--fhs-danger);
        background: #fdecec;
        border-color: #f2b8b5;
}

.fhs-calc-note {
        font-size: 0.88rem;
        color: var(--fhs-muted);
        margin: 0.45rem 0;
}

.fhs-calc-warning {
        font-size: 0.88rem;
        color: var(--fhs-danger);
        background: #fdecec;
        border: 1px solid #f2b8b5;
        border-radius: 8px;
        padding: 0.65rem 0.8rem;
        margin: 0.55rem 0 0.3rem;
}

.fhs-calc-noscript {
        font-size: 0.9rem;
        color: var(--fhs-warn);
        background: #fff4e5;
        border: 1px solid #e8d9a8;
        border-radius: 8px;
        padding: 0.65rem 0.9rem;
        margin: 0.5rem 0 0;
}

.fhs-calc-method {
        margin-top: 1.15rem;
        font-size: 0.9rem;
        color: var(--fhs-muted);
        background: var(--fhs-bg-soft);
        border: 1px solid var(--fhs-border);
        border-radius: 10px;
        padding: 0.85rem 1rem;
}

.fhs-calc-method summary {
        cursor: pointer;
        font-weight: 600;
        color: var(--fhs-text);
}

.fhs-calc-method[open] summary {
        margin-bottom: 0.4rem;
}

.fhs-calc-method p {
        margin: 0.4rem 0;
}

.fhs-calc-method h4 {
        margin: 0.75rem 0 0.3rem;
        font-size: 0.92rem;
}

.fhs-calc-method ul {
        margin: 0.25rem 0 0.35rem;
        padding-left: 1.2rem;
}

.fhs-calc-method li {
        margin: 0.25rem 0;
}

/* Skip link placed at the top of generated calculator pages. */
.fhs-calc-jump {
        display: inline-block;
        font-size: 0.9rem;
        font-weight: 600;
        text-decoration: none;
        color: var(--fhs-accent);
        border: 1px solid color-mix(in srgb, var(--fhs-accent) 35%, transparent);
        border-radius: 999px;
        padding: 0.28em 1em;
        transition: background 0.15s ease;
}

.fhs-calc-jump:hover {
        background: color-mix(in srgb, var(--fhs-accent) 10%, transparent);
        color: var(--fhs-accent);
}

.fhs-calc-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 1rem;
        margin: 1.5rem 0;
}

.fhs-calc-grid-item {
        border: 1px solid var(--fhs-border);
        border-radius: var(--fhs-radius);
        padding: 1rem 1.1rem 1.1rem;
        background: var(--fhs-surface, #fff);
        transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.fhs-calc-grid-item:hover {
        transform: translateY(-2px);
        border-color: color-mix(in srgb, var(--fhs-accent) 45%, var(--fhs-border));
        box-shadow: 0 10px 22px -14px rgba(15, 23, 42, 0.35);
}

.fhs-calc-grid-item h3 {
        margin: 0 0 0.35rem;
        font-size: 1.05rem;
}

.fhs-calc-grid-item p {
        margin: 0 0 0.75rem;
        font-size: 0.9rem;
        color: var(--fhs-muted);
}

.fhs-calc-more {
        color: var(--fhs-accent);
        font-weight: 600;
        text-decoration: none;
}

.fhs-calc-more:hover {
        text-decoration: underline;
}

/* ------------------------------------------------------------- Disclaimer */
.fhs-disclaimer {
        background: #fffaf0;
        border: 1px solid #e8d9a8;
        border-radius: var(--fhs-radius);
        padding: 1rem 1.2rem;
        margin: 1.5rem 0;
        font-size: 0.92rem;
}

.fhs-disclaimer-title {
        margin: 0 0 0.4rem;
        font-size: 1rem;
}

.fhs-disclaimer-emergency {
        margin: 0.6rem 0 0;
        color: var(--fhs-danger);
}

/* ------------------------------------------------------------- Takeaways */
.fhs-takeaways {
        border: 1px solid var(--fhs-border);
        border-radius: var(--fhs-radius);
        background: var(--fhs-bg-soft);
        padding: 1rem 1.2rem;
        margin: 1.5rem 0;
}

.fhs-takeaways-title {
        margin: 0 0 0.5rem;
        font-size: 1.05rem;
}

.fhs-takeaways-list {
        margin: 0;
        padding-left: 1.2rem;
}

/* -------------------------------------------------------------------- TOC */
.fhs-toc {
        border: 1px dashed var(--fhs-border);
        border-radius: var(--fhs-radius);
        padding: 0.9rem 1.2rem;
        margin: 1.5rem 0;
        font-size: 0.95rem;
}

.fhs-toc-title {
        margin: 0 0 0.4rem;
        font-size: 1rem;
}

.fhs-toc-list {
        margin: 0;
        padding-left: 1.2rem;
}

.fhs-toc-h3 {
        padding-left: 0.8rem;
}

/* --------------------------------------------------------------- Tables */
.fhs-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 1rem 0;
}

table.fhs-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 0.95rem;
        background: var(--fhs-surface, #fff);
}

table.fhs-table th,
table.fhs-table td {
        border: 1px solid var(--fhs-border);
        padding: 0.55rem 0.7rem;
        text-align: left;
        vertical-align: top;
}

table.fhs-table th {
        background: var(--fhs-bg-soft);
        font-weight: 600;
        white-space: nowrap;
}

.fhs-detail-group {
        margin: 1.8rem 0;
}

.fhs-detail-group > h2 {
        margin: 0 0 0.6rem;
        font-size: clamp(1.05rem, 1rem + 0.5vw, 1.3rem);
        line-height: 1.35;
        padding-bottom: 0.3rem;
        border-bottom: 1px solid var(--fhs-border);
}

.fhs-detail-warning > h2 {
        color: var(--fhs-danger);
}

.fhs-list {
        margin: 0.3rem 0 0;
        padding-left: 1.2rem;
}

.fhs-emergency-callout {
        background: #fdecec;
        border: 1px solid #f2b8b5;
        border-radius: 8px;
        padding: 0.8rem 1rem;
        margin-top: 0.8rem;
        color: var(--fhs-danger);
        font-weight: 600;
}

.fhs-medicine-meta {
        margin-top: 2rem;
        font-size: 0.9rem;
        color: var(--fhs-muted);
}

.fhs-medicine-notice {
        font-weight: 600;
        color: var(--fhs-text);
}

/* ---------------------------------------------------------- A–Z directory */
.fhs-az-list {
        display: flex;
        flex-wrap: wrap;
        gap: 0.25rem;
        list-style: none;
        margin: 0 0 1.2rem;
        padding: 0;
}

.fhs-az-link {
        display: inline-block;
        min-width: 2.1em;
        padding: 0.15em 0.4em;
        text-align: center;
        border: 1px solid var(--fhs-border);
        border-radius: 6px;
        font-weight: 600;
        text-decoration: none;
        color: var(--fhs-text);
        background: var(--fhs-surface, #fff);
}

.fhs-az-link.is-active {
        background: var(--fhs-accent);
        border-color: var(--fhs-accent);
        color: var(--fhs-accent-contrast);
}

.fhs-medicine-search {
        display: flex;
        gap: 0.5rem;
        margin-bottom: 1.2rem;
        flex-wrap: wrap;
}

.fhs-medicine-search input[type="search"] {
        flex: 1;
        min-width: 220px;
        padding: 0.5em 0.7em;
        border: 1px solid var(--fhs-border);
        border-radius: 6px;
        font-size: 1rem;
}

.fhs-medicine-list,
.fhs-article-list {
        list-style: none;
        margin: 0;
        padding: 0;
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 1rem;
}

.fhs-medicine-item,
.fhs-article-card {
        border: 1px solid var(--fhs-border);
        border-radius: var(--fhs-radius);
        padding: 1rem;
        background: var(--fhs-surface, #fff);
}

.fhs-medicine-name,
.fhs-article-card-title {
        margin: 0 0 0.35rem;
        font-size: 1.02rem;
}

.fhs-medicine-brands,
.fhs-medicine-form,
.fhs-medicine-class,
.fhs-article-card-excerpt {
        font-size: 0.9rem;
        color: var(--fhs-muted);
        margin: 0.25rem 0;
}

.fhs-badge {
        display: inline-block;
        font-size: 0.75rem;
        font-weight: 700;
        padding: 0.15em 0.6em;
        border-radius: 999px;
        vertical-align: middle;
}

.fhs-badge-unverified {
        background: #fff4e5;
        color: var(--fhs-warn);
        border: 1px solid #e8d9a8;
}

/* -------------------------------------------------------------- Related */
.fhs-related-list {
        margin: 0.4rem 0 0;
        padding-left: 1.2rem;
}

/* -------------------------------------------------------------- Products */
.fhs-product-proscons {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        gap: 1rem;
}

.fhs-pros,
.fhs-cons {
        border: 1px solid var(--fhs-border);
        border-radius: 8px;
        padding: 0.8rem 1rem;
}

.fhs-pros {
        border-left: 4px solid var(--fhs-ok);
}

.fhs-cons {
        border-left: 4px solid var(--fhs-warn);
}

.fhs-affiliate-disclosure {
        font-size: 0.85rem;
        color: var(--fhs-muted);
        background: var(--fhs-bg-soft);
        border-radius: 6px;
        padding: 0.6rem 0.8rem;
        margin: 1rem 0;
}

.fhs-affiliate-link {
        font-weight: 600;
        color: var(--fhs-accent);
}

.fhs-product-cta {
        margin-top: 1rem;
}

.fhs-product-cta .fhs-affiliate-link {
        display: inline-block;
        background: var(--fhs-accent);
        color: var(--fhs-accent-contrast);
        padding: 0.6em 1.1em;
        border-radius: var(--fhs-radius);
        text-decoration: none;
}

/* ------------------------------------------------------------ Newsletter */
.fhs-newsletter-form {
        max-width: 560px;
        border: 1px solid var(--fhs-border);
        border-radius: var(--fhs-radius);
        background: var(--fhs-bg-soft);
        padding: 1.2rem;
        margin: 1.5rem 0;
}

.fhs-newsletter-title {
        margin: 0 0 0.8rem;
        font-size: 1.15rem;
}

.fhs-newsletter-label {
        font-weight: 600;
        display: block;
        margin-bottom: 0.3rem;
}

.fhs-newsletter-form input[type="email"] {
        max-width: none;
}

.fhs-newsletter-interests {
        border: 1px solid var(--fhs-border);
        border-radius: 8px;
        padding: 0.6rem 0.9rem;
        margin: 0.8rem 0;
}

.fhs-newsletter-interests legend {
        font-weight: 600;
        padding: 0 0.3rem;
}

.fhs-check-item {
        display: block;
        margin: 0.25rem 0;
}

.fhs-newsletter-consent {
        display: block;
        margin: 0.8rem 0;
        font-size: 0.92rem;
}

.fhs-hp {
        position: absolute;
        left: -9999px;
        height: 0;
        overflow: hidden;
}

.fhs-newsletter-note {
        font-size: 0.85rem;
        color: var(--fhs-muted);
        margin: 0.5rem 0 0;
}

.fhs-newsletter-status {
        font-weight: 600;
        min-height: 1.2em;
        margin: 0.5rem 0 0;
}

.fhs-newsletter-status.is-error {
        color: var(--fhs-danger);
}

.fhs-newsletter-status.is-success {
        color: var(--fhs-ok);
}

/* ------------------------------------------------------------------ Ads */
.fhs-ad {
        margin: 1.5rem 0;
        min-height: 1px;
        overflow: hidden;
        text-align: center;
}

.fhs-ad-empty {
        display: none;
}

.fhs-ad-note {
        font-size: 0.75rem;
        color: var(--fhs-muted);
}

/* -------------------------------------------------------------- Notices */
.fhs-notice {
        border-radius: var(--fhs-radius);
        padding: 0.9rem 1.2rem;
        margin: 1rem 0;
        font-weight: 600;
}

.fhs-notice-success {
        background: #e8f5ec;
        color: var(--fhs-ok);
        border: 1px solid #b7e0c2;
}

.fhs-notice-error {
        background: #fdecec;
        color: var(--fhs-danger);
        border: 1px solid #f2b8b5;
}

/* ------------------------------------------------------------- Utilities */
.fhs-sr-only {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
}

.fhs-error,
.fhs-empty {
        padding: 1rem;
        background: var(--fhs-bg-soft);
        border: 1px dashed var(--fhs-border);
        border-radius: var(--fhs-radius);
        color: var(--fhs-muted);
}

/* --------------------------------------------------------- Small screens */
@media (max-width: 600px) {
        .fhs-calc,
        .fhs-newsletter-form {
                padding: 1.1rem 1rem 1rem;
        }

        .fhs-calc-fields {
                grid-template-columns: 1fr;
                gap: 0.85rem;
        }

        .fhs-calc-input-group {
                flex-direction: column;
        }

        .fhs-calc-input-group .fhs-unit-select {
                width: 100%;
                max-width: none;
        }

        /* Medicine record tables become stacked label+content blocks on
           phones: no horizontal scrolling, no tiny fonts — each row turns
           into a readable pair. The .fhs-table-wrap fallback (horizontal
           scroll) still covers any other table context. */
        .fhs-medicine-details .fhs-table-wrap {
                overflow-x: visible;
        }

        .fhs-medicine-details table.fhs-table,
        .fhs-medicine-details table.fhs-table tbody,
        .fhs-medicine-details table.fhs-table tr,
        .fhs-medicine-details table.fhs-table th,
        .fhs-medicine-details table.fhs-table td {
                display: block;
                width: 100%;
                box-sizing: border-box;
        }

        .fhs-medicine-details table.fhs-table tr {
                border: 1px solid var(--fhs-border);
                border-radius: 8px;
                padding: 0.45rem 0.7rem;
                margin-bottom: 0.55rem;
                background: var(--fhs-surface, #fff);
        }

        .fhs-medicine-details table.fhs-table tr:last-child {
                margin-bottom: 0;
        }

        .fhs-medicine-details table.fhs-table th {
                border: 0;
                background: transparent;
                white-space: normal;
                font-size: 0.82rem;
                text-transform: uppercase;
                letter-spacing: 0.03em;
                color: var(--fhs-muted);
                padding: 0.15rem 0 0.2rem;
        }

        .fhs-medicine-details table.fhs-table td {
                border: 0;
                border-top: 1px dashed var(--fhs-border);
                padding: 0.45rem 0 0.1rem;
                font-size: 0.95rem;
        }

        .fhs-medicine-details table.fhs-table td > ul.fhs-list {
                margin-top: 0.2rem;
        }
}

/* Tablets: two medicine/article cards per row feel right between the
   desktop auto-grid and the single-column phone layout. */
@media (min-width: 601px) and (max-width: 900px) {
        .fhs-medicine-list,
        .fhs-article-list {
                grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        }
}

/* ------------------------------------------------- Reduced motion (a11y) */
@media (prefers-reduced-motion: reduce) {
        .fhs-btn,
        .fhs-az-link,
        .fhs-calc-grid-item,
        .fhs-radio span,
        .fhs-calc-jump {
                transition: none;
        }

        .fhs-calc-result-box {
                animation: none;
        }

        .fhs-btn.is-loading::after {
                animation: none;
                border-top-color: currentColor;
                opacity: 0.6;
        }
}

/* ------------------------------------------- Medicines archive (/medicines/) */
.fhs-medicines-archive {
        max-width: var(--fhs-archive-width, 1080px);
        margin-inline: auto;
        /* Gutters so the archive never touches the viewport edge when the
           active theme wraps main content without its own padding. */
        padding-inline: clamp(0.75rem, 3vw, 1.5rem);
        font-family: var(--fhs-font);
        color: var(--fhs-text);
}

@media (min-width: 901px) {
        .fhs-medicines-archive {
                /* Wider screens: the gutter shrinks away so the archive
                   lines up exactly with the theme's content column. */
                padding-inline: 0;
        }
}

.fhs-archive-header {
        margin: 0 0 1.2rem;
}

.fhs-archive-title {
        margin: 0;
        font-size: clamp(1.65rem, 1.15rem + 2vw, 2.3rem);
        line-height: 1.25;
}

.fhs-archive-intro {
        margin: 0.45rem 0 0;
        max-width: 70ch;
        line-height: 1.6;
        color: var(--fhs-muted);
}

/* Toolbar: search box with a comfortable touch target. */
.fhs-medicines-archive .fhs-medicine-search {
        margin-bottom: 1.2rem;
}

.fhs-medicines-archive .fhs-medicine-search input[type="search"] {
        min-width: min(100%, 220px);
        min-height: 44px;
        padding: 0.55em 0.8em;
}

.fhs-medicines-archive .fhs-medicine-search .fhs-btn {
        min-height: 44px;
}

/* A–Z bar: pill targets that meet the 44px touch minimum. */
.fhs-medicines-archive .fhs-az-list {
        margin-bottom: 1rem;
}

.fhs-medicines-archive .fhs-az-link {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 2.4em;
        min-height: 44px;
        padding: 0.3em 0.45em;
}

.fhs-archive-count {
        margin: 0 0 1.1rem;
        font-size: 0.92rem;
        color: var(--fhs-muted);
}

.fhs-archive-count a,
.fhs-archive-filter-note {
        color: var(--fhs-accent);
        font-weight: 600;
}

.fhs-archive-count a {
        text-decoration: none;
}

.fhs-archive-count a:hover {
        text-decoration: underline;
}

/* Cards: clickable as a whole (stretched link), subtle lift on hover.
   Scoped to the archive so the shortcode list keeps its calmer look. */
.fhs-medicines-archive .fhs-medicine-item {
        position: relative;
        display: flex;
        transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.fhs-medicines-archive .fhs-medicine-item > article {
        display: flex;
        flex-direction: column;
        gap: 0.3rem;
        width: 100%;
}

.fhs-medicines-archive .fhs-medicine-name {
        margin: 0;
}

.fhs-medicines-archive .fhs-medicine-name a {
        color: var(--fhs-accent);
        text-decoration: none;
}

.fhs-medicines-archive .fhs-medicine-name a:hover {
        text-decoration: underline;
}

.fhs-medicines-archive .fhs-medicine-name a::after {
        content: "";
        position: absolute;
        inset: 0;
        border-radius: var(--fhs-radius);
}

.fhs-medicines-archive .fhs-medicine-item:hover,
.fhs-medicines-archive .fhs-medicine-item:focus-within {
        border-color: var(--fhs-accent);
        box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
        transform: translateY(-2px);
}

.fhs-medicine-uses {
        margin: 0;
        font-size: 0.9rem;
        line-height: 1.5;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
}

.fhs-medicine-meta {
        margin: 0;
        font-size: 0.85rem;
        color: var(--fhs-muted);
        display: flex;
        flex-wrap: wrap;
        gap: 0.3rem 0.75rem;
}

.fhs-med-more {
        margin-top: auto;
        font-size: 0.85rem;
        font-weight: 600;
        color: var(--fhs-accent);
}

.fhs-archive-empty {
        text-align: center;
        padding: 2.2rem 1rem;
}

.fhs-archive-empty p {
        margin: 0.4rem 0;
}

/* Numbered pagination: pill page links, current page in the accent. */
.fhs-medicines-archive .pagination {
        margin: 1.4rem 0 0;
}

.fhs-medicines-archive .pagination .nav-links {
        display: flex;
        flex-wrap: wrap;
        gap: 0.35rem;
}

.fhs-medicines-archive .pagination .page-numbers {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 2.4em;
        min-height: 44px;
        padding: 0.25em 0.55em;
        border: 1px solid var(--fhs-border);
        border-radius: 6px;
        background: var(--fhs-surface, #fff);
        color: var(--fhs-text);
        font-weight: 600;
        text-decoration: none;
}

.fhs-medicines-archive .pagination .page-numbers:hover {
        border-color: var(--fhs-accent);
        color: var(--fhs-accent);
}

.fhs-medicines-archive .pagination .page-numbers.current {
        background: var(--fhs-accent);
        border-color: var(--fhs-accent);
        color: var(--fhs-accent-contrast);
}

.fhs-medicines-archive .pagination .page-numbers.dots {
        border: 0;
        background: transparent;
}

/* Small screens: full-width search row, button below. */
@media (max-width: 600px) {
        .fhs-medicines-archive .fhs-medicine-search input[type="search"] {
                min-width: 0;
                flex-basis: 100%;
        }

        .fhs-medicines-archive .fhs-medicine-search .fhs-btn {
                flex: 1;
        }
}

/* Reduced motion: no hover lift, no transitions (a11y). */
@media (prefers-reduced-motion: reduce) {
        .fhs-medicines-archive .fhs-medicine-item,
        .fhs-medicines-archive .fhs-az-link,
        .fhs-medicines-archive .pagination .page-numbers {
                transition: none;
        }

        .fhs-medicines-archive .fhs-medicine-item:hover,
        .fhs-medicines-archive .fhs-medicine-item:focus-within {
                transform: none;
        }
}
