/**
 * Saved recipes, recently viewed, diet badges and the ingredient finder.
 *
 * Direction C: square corners, 2px black rules, orange as the single accent.
 */

/* ------------------------------------------------------------ diet badges */

.fmr-card__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 0 0 8px;
}

.fmr-badge {
    display: inline-block;
    padding: 2px 7px;
    border: 1.5px solid var(--fmr-border-strong);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    line-height: 1.5;
    color: var(--fmr-ink-900);
    background: var(--fmr-surface);
}

/* ------------------------------------------------------ recently viewed */

.fmr-recent {
    padding-block: clamp(28px, 4vw, 48px);
    border-bottom: 2px solid var(--fmr-border-strong);
}

/* ------------------------------------------------------------ save button */

.fmr-savebtn[aria-pressed="true"] {
    background: var(--fmr-brand-500);
    border-color: var(--fmr-brand-500);
    color: #fff;
}

/* ------------------------------------------------------------ saved page */

.fmr-savedcard {
    position: relative;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.fmr-savedcard .fmr-card {
    flex: 1 1 auto;
}

.fmr-savedcard__remove {
    min-height: 44px;
    margin-top: -2px;
    border: 2px solid var(--fmr-border-strong);
    border-radius: 0;
    background: var(--fmr-surface);
    color: var(--fmr-ink-700);
    font: inherit;
    font-size: var(--fmr-text-xs);
    font-weight: 700;
    letter-spacing: var(--fmr-track-label);
    text-transform: uppercase;
    cursor: pointer;
}

.fmr-savedcard__remove:hover,
.fmr-savedcard__remove:focus-visible {
    background: var(--fmr-surface-dark);
    color: var(--fmr-on-dark);
}

/* ------------------------------------------------------ ingredient finder */

.fmr-finder {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: var(--fmr-space-4);
    max-width: 640px;
}

.fmr-finder input[type="text"] {
    flex: 1 1 260px;
    min-width: 0;
    min-height: 48px;
    padding: 10px 14px;
    border: 2px solid var(--fmr-border-strong);
    border-radius: 0;
    background: var(--fmr-surface);
    color: var(--fmr-ink-900);
    font: inherit;
}

.fmr-finder input[type="text"]:focus-visible {
    outline: 3px solid var(--fmr-brand-500);
    outline-offset: -1px;
}

.fmr-finder__using,
.fmr-finder__count {
    margin: 0 0 var(--fmr-space-4);
    font-size: var(--fmr-text-sm);
    color: var(--fmr-ink-500);
}

.fmr-chip {
    display: inline-block;
    margin: 0 4px 4px 0;
    padding: 3px 10px;
    background: var(--fmr-surface-dark);
    color: var(--fmr-on-dark);
    font-size: var(--fmr-text-xs);
    font-weight: 700;
}

@media print {

    .fmr-savebtn,
    .fmr-units,
    .fmr-recent {
        display: none !important;
    }
}

/* ------------------------------------------------------------ calculators */

.fmr-calc {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    margin: var(--fmr-space-4) 0;
    padding: 16px;
    border: 2px solid var(--fmr-border-strong);
    background: var(--fmr-brand-50);
}

.fmr-calc[hidden] {
    display: none;
}

.fmr-calc label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: var(--fmr-text-xs);
    font-weight: 700;
    letter-spacing: var(--fmr-track-label);
    text-transform: uppercase;
    color: var(--fmr-ink-700);
}

.fmr-calc input,
.fmr-calc select {
    min-height: 44px;
    padding: 8px 10px;
    border: 2px solid var(--fmr-border-strong);
    border-radius: 0;
    background: var(--fmr-surface);
    color: var(--fmr-ink-900);
    font: inherit;
    font-size: var(--fmr-text-base, 16px);
    text-transform: none;
    letter-spacing: 0;
}

.fmr-calc input[type="number"] {
    width: 7.5em;
}

.fmr-calc output {
    min-height: 44px;
    display: flex;
    align-items: center;
    font-family: var(--font-serif, Georgia, serif);
    font-size: var(--fmr-text-lg);
    font-weight: 700;
    color: var(--fmr-ink-900);
}

.fmr-conv .fmr-content table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
}

@media print {
    .fmr-calc {
        display: none !important;
    }
}

/* ============================================================ kitchen tools */

.fmr-tool .fmr-content table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
}

/* The answer a reader (or a search engine) needs before the calculator. */
.fmr-answer {
    padding: 16px 18px;
    border-left: 4px solid var(--fmr-brand-500);
    background: var(--fmr-surface-muted);
}

.fmr-calc--wide {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    align-items: end;
}

.fmr-calc--wide[hidden] {
    display: none;
}

.fmr-calc__title,
.fmr-calc__out,
.fmr-calc__sides,
.fmr-calc--wide .fmr-print {
    grid-column: 1 / -1;
}

.fmr-calc__title {
    margin: 0 !important;
    font-size: var(--fmr-text-lg);
}

.fmr-calc input[type="datetime-local"],
.fmr-calc input[type="date"],
.fmr-calc input[type="search"] {
    width: 100%;
    box-sizing: border-box;
}

.fmr-calc--wide input[type="number"] {
    width: 100%;
    box-sizing: border-box;
}

.fmr-calc__sides {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    margin: 0;
    padding: 10px 12px;
    border: 2px solid var(--fmr-border-strong);
    background: var(--fmr-surface);
}

.fmr-calc__sides legend {
    padding: 0 6px;
    font-size: var(--fmr-text-xs);
    font-weight: 700;
    letter-spacing: var(--fmr-track-label);
    text-transform: uppercase;
}

.fmr-calc .fmr-check {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    font-size: var(--fmr-text-sm);
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    color: var(--fmr-ink-900);
}

.fmr-calc .fmr-check input {
    min-height: 0;
    width: 18px;
    height: 18px;
}

.fmr-calc__out:empty {
    display: none;
}

.fmr-calc__out {
    padding: 14px 16px;
    border: 2px solid var(--fmr-border-strong);
    background: var(--fmr-surface);
}

.fmr-calc__out p {
    margin: 0 0 10px;
}

.fmr-calc__big {
    font-family: var(--font-serif, Georgia, serif);
    font-size: var(--fmr-text-lg);
    font-weight: 700;
}

.fmr-calc__warn {
    font-weight: 700;
    color: #9a3412;
}

.fmr-timeline {
    margin: 0 0 10px;
    padding: 0;
    list-style: none;
    border-left: 2px solid var(--fmr-border-strong);
}

.fmr-timeline li {
    display: grid;
    grid-template-columns: minmax(150px, 11em) 1fr;
    gap: 12px;
    padding: 8px 0 8px 14px;
    border-bottom: 1px solid var(--fmr-border);
}

.fmr-timeline time {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 560px) {
    .fmr-timeline li {
        grid-template-columns: 1fr;
        gap: 2px;
    }
}

.fmr-eatby {
    margin: 0 0 10px;
    padding-left: 18px;
}

.fmr-tables {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--fmr-space-4);
}

.fmr-tables caption {
    font-weight: 700;
    text-align: left;
    padding-bottom: 4px;
}

.fmr-table-group th {
    background: var(--fmr-surface-dark);
    color: var(--fmr-on-dark);
    font-size: var(--fmr-text-xs);
    letter-spacing: var(--fmr-track-label);
    text-transform: uppercase;
}

/* Search box and filter chips above a table or grid. */
.fmr-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 18px;
    margin: var(--fmr-space-4) 0;
}

.fmr-filter[hidden] {
    display: none;
}

.fmr-filter label {
    font-weight: 700;
}

.fmr-filter input[type="search"] {
    flex: 1 1 260px;
    min-height: 44px;
    padding: 8px 10px;
    border: 2px solid var(--fmr-border-strong);
    border-radius: 0;
    font: inherit;
}

.fmr-filter [role="group"] {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.fmr-filter [role="group"] > span {
    font-size: var(--fmr-text-xs);
    font-weight: 700;
    letter-spacing: var(--fmr-track-label);
    text-transform: uppercase;
    margin-right: 4px;
}

.fmr-filter button {
    min-height: 40px;
    padding: 0 14px;
    border: 2px solid var(--fmr-border-strong);
    border-radius: 0;
    background: var(--fmr-surface);
    color: var(--fmr-ink-900);
    font: inherit;
    font-size: var(--fmr-text-sm);
    font-weight: 700;
    cursor: pointer;
}

.fmr-filter button[aria-pressed="true"] {
    background: var(--fmr-surface-dark);
    color: var(--fmr-on-dark);
}

.fmr-filter output {
    font-weight: 700;
    color: var(--fmr-ink-500);
}

/* High-protein grid: the card with a protein label on top. */
.fmr-hp {
    position: relative;
}

.fmr-hp[hidden] {
    display: none;
}

.fmr-hp__badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    padding: 4px 8px;
    background: var(--fmr-brand-500);
    color: #fff;
    font-size: var(--fmr-text-xs);
    font-weight: 700;
    letter-spacing: var(--fmr-track-label);
    text-transform: uppercase;
}

.fmr-sources,
.fmr-moretools {
    margin-top: var(--fmr-space-8);
    padding-top: var(--fmr-space-4);
    border-top: 2px solid var(--fmr-border-strong);
}

.fmr-sources ul,
.fmr-moretools ul {
    padding-left: 18px;
}

.fmr-sources p {
    font-size: var(--fmr-text-sm);
    color: var(--fmr-ink-500);
}

/* A printed plan: the timeline, without the site around it. */
@media print {
    .fmr-tool .fmr-calc__out {
        border: 0;
        padding: 0;
    }

    .fmr-tool .fmr-calc--wide label,
    .fmr-tool .fmr-calc__sides,
    .fmr-tool .fmr-print,
    .fmr-moretools,
    .fmr-filter {
        display: none !important;
    }

    .fmr-tool .fmr-calc--wide:not([hidden]) {
        display: block !important;
        border: 0;
        background: none;
        padding: 0;
    }
}
