/* =====================================================
   Tasty Recipe Card — frontend styles
   Note: Colors and fonts are injected at runtime as
   CSS variables on .trc-card via the Settings page.
   ===================================================== */

.trc-card {
    /* Fallback values — overridden inline by trc_print_inline_vars() */
    --trc-burgundy: #6b1f2a;
    --trc-burgundy-dark: #4f1620;
    --trc-text: #2b2b2b;
    --trc-muted: #6b6b6b;
    --trc-border: #e5e5e5;
    --trc-star: #f5a623;
    --trc-heading-font: 'Playfair Display', Georgia, serif;
    --trc-body-font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    max-width: 760px;
    margin: 2rem auto;
    font-family: var(--trc-body-font);
    color: var(--trc-text);
    background: #fff;
    border: 1px solid var(--trc-border);
    border-radius: 6px;
    overflow: hidden;
    line-height: 1.6;
}

.trc-card * { box-sizing: border-box; }

.trc-card h2, .trc-card h3, .trc-card h4 {
    font-family: var(--trc-heading-font);
    color: var(--trc-burgundy);
    margin: 0 0 .5rem;
    line-height: 1.2;
}

/* ---------- Logo bar ---------- */
.trc-logo-bar {
    display: flex;
    justify-content: center;
    padding: 1.25rem 1rem .5rem;
    background: #fff;
    border-bottom: 1px solid var(--trc-border);
}

.trc-logo {
    max-height: 70px;
    max-width: 240px;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* ---------- Header ---------- */
.trc-header {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
        "text  image"
        "actions actions";
    gap: 1.25rem;
    padding: 1.75rem 1.75rem 1.25rem;
    border-bottom: 1px solid var(--trc-border);
}

.trc-header-text { grid-area: text; }
.trc-hero-image  { grid-area: image; }
.trc-actions     { grid-area: actions; display: flex; gap: .5rem; flex-wrap: wrap; }

.trc-hero-image img {
    width: 180px;
    height: 180px;
    object-fit: cover;
    border-radius: 4px;
    display: block;
}

.trc-stars-display {
    display: flex;
    align-items: center;
    gap: .35rem;
    margin-bottom: .35rem;
    color: var(--trc-star);
    font-size: 14px;
}

.trc-rating-meta {
    color: var(--trc-muted);
    font-size: 13px;
    margin-left: .25rem;
}

.trc-title {
    font-size: clamp(1.7rem, 4vw, 2.2rem);
    margin-bottom: .35rem;
}

.trc-byline {
    color: var(--trc-muted);
    font-size: 13px;
    margin: 0 0 .75rem;
}

.trc-byline strong { color: var(--trc-burgundy); font-weight: 600; }

.trc-desc {
    font-size: 14px;
    margin: 0 0 1rem;
    color: #444;
}

.trc-meta {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 13px;
}

.trc-meta li strong {
    font-weight: 600;
    color: var(--trc-burgundy);
}

/* ---------- Action buttons ---------- */
.trc-btn {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .55rem 1.25rem;
    background: var(--trc-burgundy);
    color: #fff;
    border: none;
    border-radius: 2px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .03em;
    cursor: pointer;
    text-decoration: none;
    text-transform: capitalize;
    transition: background .15s;
    font-family: inherit;
}

.trc-btn:hover { background: var(--trc-burgundy-dark); color: #fff; }
.trc-btn svg   { flex-shrink: 0; }

/* ---------- Generic section ---------- */
.trc-section {
    padding: 1.5rem 1.75rem;
    border-bottom: 1px solid var(--trc-border);
}

.trc-section h3 {
    font-size: 1.5rem;
    margin: 0 0 1rem;
}

/* ---------- Sub-headers (inside ingredients & instructions) ---------- */
.trc-subheader {
    list-style: none !important;
    counter-increment: none !important;
    padding: 1rem 0 .35rem !important;
    border-bottom: none !important;
}

.trc-subheader::before { display: none !important; content: none !important; }

.trc-subheader h4 {
    font-size: 1.05rem;
    color: var(--trc-burgundy);
    margin: 0;
    padding: 0;
    font-weight: 700;
}

/* First subheader has no top padding */
.trc-ingredient-list > .trc-subheader:first-child,
.trc-instruction-list > .trc-subheader:first-child {
    padding-top: 0 !important;
}

/* ---------- Ingredients ---------- */
.trc-ingredient-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.trc-ingredient-list > li {
    border-bottom: 1px dashed #ececec;
    padding: .65rem 0;
}

.trc-ingredient-list > li:last-child { border-bottom: none; }

.trc-ingredient-list label {
    display: flex;
    gap: .65rem;
    align-items: flex-start;
    cursor: pointer;
    font-size: 14px;
}

.trc-ingredient-list input[type="checkbox"] {
    margin-top: .25rem;
    accent-color: var(--trc-burgundy);
    cursor: pointer;
}

.trc-ingredient-list input:checked + span {
    text-decoration: line-through;
    color: var(--trc-muted);
}

/* ---------- Instructions ---------- */
.trc-instruction-list {
    counter-reset: step;
    list-style: none;
    padding: 0;
    margin: 0;
}

.trc-instruction-list > li.trc-step {
    counter-increment: step;
    position: relative;
    /* Generous left padding so number never touches text */
    padding: .85rem 0 .85rem 3rem;
    border-bottom: 1px dashed #ececec;
    font-size: 14px;
    min-height: 2.6rem;
    display: flex;
    align-items: center;
}

.trc-instruction-list > li.trc-step:last-child { border-bottom: none; }

.trc-instruction-list > li.trc-step::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    background: var(--trc-burgundy);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    font-family: var(--trc-heading-font);
    flex-shrink: 0;
}

.trc-step-text {
    display: block;
    flex: 1;
}

/* ---------- Cook mode toggle ---------- */
.trc-cook-mode {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-top: 1.5rem;
    cursor: pointer;
    font-size: 13px;
}

.trc-cook-mode input { display: none; }

.trc-switch {
    width: 40px;
    height: 22px;
    background: #ccc;
    border-radius: 11px;
    position: relative;
    transition: background .2s;
    flex-shrink: 0;
}

.trc-switch::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s;
}

.trc-cook-mode input:checked + .trc-switch { background: var(--trc-burgundy); }
.trc-cook-mode input:checked + .trc-switch::after { transform: translateX(18px); }

.trc-cook-label strong { display: inline; margin-right: .25rem; color: var(--trc-burgundy); }
.trc-cook-label        { color: var(--trc-muted); }

/* ---------- Notes ---------- */
.trc-notes ul {
    padding-left: 1.2rem;
    margin: 0;
    font-size: 14px;
}

.trc-notes li {
    margin-bottom: .65rem;
    line-height: 1.55;
}

/* ---------- Nutrition ---------- */
.trc-nutrition-line {
    font-size: 13px;
    line-height: 1.9;
    margin: 0 0 .75rem;
}

.trc-nutrition-line span {
    display: inline-block;
    margin-right: 1rem;
}

.trc-nutrition-line strong { color: var(--trc-burgundy); font-weight: 600; }

.trc-nutrition-disclaimer {
    font-size: 11px;
    color: var(--trc-muted);
    margin: 0;
}

/* ---------- Rate footer ---------- */
.trc-rate-footer {
    background: var(--trc-burgundy);
    color: #fff;
    padding: 1.5rem 1.75rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.trc-rate-icon {
    width: 48px;
    height: 48px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.trc-rate-logo {
    max-height: 48px;
    max-width: 120px;
    width: auto;
    height: auto;
    background: #fff;
    padding: .35rem .55rem;
    border-radius: 4px;
    flex-shrink: 0;
}

.trc-rate-text { flex: 1; min-width: 200px; }

.trc-rate-text h4 {
    color: #fff;
    font-size: 1.15rem;
    margin: 0 0 .15rem;
}

.trc-rate-text p {
    margin: 0;
    font-size: 13px;
    opacity: .9;
}

.trc-rate-stars {
    display: flex;
    gap: .15rem;
}

.trc-star-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,.35);
    cursor: pointer;
    padding: 2px;
    transition: color .15s, transform .15s;
}

.trc-star-btn:hover,
.trc-star-btn.is-hover,
.trc-star-btn.is-selected {
    color: var(--trc-star);
    transform: scale(1.05);
}

.trc-rate-thanks {
    width: 100%;
    font-size: 13px;
    color: #e6ffe1;
}

/* ---------- Static stars (in header) ---------- */
.trc-stars { display: inline-flex; }

.trc-star-static {
    position: relative;
    display: inline-block;
    width: 16px;
    color: #e0e0e0;
    font-size: 16px;
    line-height: 1;
}

.trc-star-fill {
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
    color: var(--trc-star);
    white-space: nowrap;
}

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
    .trc-header {
        grid-template-areas: "image" "text" "actions";
        grid-template-columns: 1fr;
    }
    .trc-hero-image img {
        width: 100%;
        height: 220px;
    }
    .trc-section,
    .trc-header,
    .trc-rate-footer { padding-left: 1.1rem; padding-right: 1.1rem; }
    .trc-rate-stars  { width: 100%; justify-content: center; }
}

/* ---------- Print ---------- */
@media print {
    body * { visibility: hidden; }
    .trc-card.is-printing,
    .trc-card.is-printing * { visibility: visible; }
    .trc-card.is-printing {
        position: absolute;
        left: 0; top: 0;
        max-width: 100%;
        border: none;
        margin: 0;
    }
    .trc-actions,
    .trc-rate-footer,
    .trc-cook-mode { display: none !important; }
    .trc-card.is-printing h2,
    .trc-card.is-printing h3,
    .trc-card.is-printing h4 { color: #000 !important; }
}
