/**
 * KK Theme Builder — Frontend Styles
 *
 * Covers universal blocks, offer blocks, recipe action buttons,
 * and archive layouts. Recipe-specific styles live in kk-recipes.css.
 */

/* ─── Design System Tokens ─── */
:root {
    --kk-green: #89a343;
    --kk-green-light: #f4f7ec;
    --kk-green-dark: #6b8232;
    --kk-text: #2d2d2d;
    --kk-text-light: #6b6b6b;
    --kk-text-muted: #999;
    --kk-bg: #fafaf8;
    --kk-white: #ffffff;
    --kk-border: #e8e8e4;
    --kk-radius: 12px;
    --kk-radius-sm: 8px;
    --kk-radius-full: 100px;
    --kk-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    --kk-shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.10);
    --kk-transition: 0.25s ease;
    --kk-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ─── Base / Layout ─── */
.kk-tb {
    font-family: var(--kk-font);
    color: var(--kk-text);
    line-height: 1.6;
}

.kk-section {
    padding: 32px 0;
}

.kk-container {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 24px;
}

/* ─── Post Title ─── */
.kk-post-title {
    margin: 0;
    line-height: 1.2;
}

.kk-post-title h1 {
    font-size: 2.5rem;
    font-weight: 700;
}

.kk-post-title h2 {
    font-size: 2rem;
    font-weight: 600;
}

.kk-post-title h3 {
    font-size: 1.5rem;
    font-weight: 600;
}

/* ─── Post Content (prose) ─── */
.kk-post-content {
    max-width: 720px;
    font-size: 16px;
    line-height: 1.75;
}

.kk-post-content p {
    margin: 0 0 1.25em;
}

.kk-post-content h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 2em 0 0.75em;
}

.kk-post-content h3 {
    font-size: 1.375rem;
    font-weight: 600;
    margin: 1.75em 0 0.5em;
}

.kk-post-content h4 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 1.5em 0 0.5em;
}

.kk-post-content ul,
.kk-post-content ol {
    margin: 0 0 1.25em;
    padding-left: 1.5em;
}

.kk-post-content li {
    margin-bottom: 0.35em;
}

.kk-post-content blockquote {
    margin: 1.5em 0;
    padding: 16px 24px;
    border-left: 4px solid var(--kk-green);
    background: var(--kk-green-light);
    border-radius: 0 var(--kk-radius-sm) var(--kk-radius-sm) 0;
    font-style: italic;
    color: var(--kk-text-light);
}

.kk-post-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--kk-radius-sm);
}

.kk-post-content a {
    color: var(--kk-green);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    transition: color var(--kk-transition);
}

.kk-post-content a:hover {
    color: var(--kk-green-dark);
}

/* ─── Excerpt ─── */
.kk-post-excerpt {
    font-size: 1.125rem;
    color: var(--kk-text-light);
    line-height: 1.7;
    max-width: 720px;
}

/* ─── Featured Image ─── */
.kk-featured-image {
    overflow: hidden;
}

.kk-featured-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ─── Taxonomy Terms ─── */
.kk-tax-terms {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.kk-term-pill {
    display: inline-flex;
    padding: 4px 14px;
    background: var(--kk-green-light);
    color: var(--kk-green-dark);
    border-radius: var(--kk-radius-full);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: background var(--kk-transition), color var(--kk-transition);
}

.kk-term-pill:hover {
    background: var(--kk-green);
    color: var(--kk-white);
}

.kk-tax-terms--list ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.kk-tax-terms--list li {
    padding: 6px 0;
    border-bottom: 1px solid var(--kk-border);
}

.kk-tax-terms--inline {
    font-size: 14px;
    color: var(--kk-text-light);
}

/* ─── ACF Fields ─── */
.kk-acf-field {
    margin-bottom: 16px;
}

.kk-acf-field__label {
    font-size: 13px;
    font-weight: 600;
    color: var(--kk-text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.kk-acf-field__value {
    font-size: 16px;
}

/* ACF Repeater — Table */
.kk-acf-repeater table {
    width: 100%;
    border-collapse: collapse;
}

.kk-acf-repeater th {
    text-align: left;
    padding: 10px 16px;
    background: #f5f5f3;
    font-size: 13px;
    font-weight: 600;
    color: var(--kk-text-light);
    border-bottom: 2px solid var(--kk-border);
}

.kk-acf-repeater td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--kk-border);
    font-size: 15px;
}

/* ACF Repeater — Definition List */
.kk-acf-repeater dl {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 8px 16px;
}

.kk-acf-repeater dt {
    font-weight: 600;
    color: var(--kk-text-light);
    font-size: 14px;
}

.kk-acf-repeater dd {
    margin: 0;
    font-size: 15px;
}

/* ─── Breadcrumbs ─── */
.kk-breadcrumbs {
    font-size: 14px;
    color: var(--kk-text-muted);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.kk-breadcrumbs a {
    color: var(--kk-text-light);
    text-decoration: none;
    transition: color var(--kk-transition);
}

.kk-breadcrumbs a:hover {
    color: var(--kk-green);
}

.kk-breadcrumbs__sep {
    color: #ccc;
}

.kk-breadcrumbs [aria-current] {
    color: var(--kk-text);
    font-weight: 500;
}

/* ─── Spacer / Custom HTML ─── */
.kk-custom-html {
    font: inherit;
}

/* ─── Two-Column Layout ─── */
.kk-two-col {
    display: grid;
    grid-template-columns: 1fr var(--kk-sidebar-width, 340px);
    gap: 48px;
    align-items: start;
}

.kk-two-col--sidebar-left {
    grid-template-columns: var(--kk-sidebar-width, 340px) 1fr;
}

.kk-two-col--sidebar-left .kk-two-col__sidebar {
    order: -1;
}

/* ─── Recipe Actions ─── */
.kk-ractions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.kk-ractions__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: 1px solid var(--kk-border);
    border-radius: var(--kk-radius-full);
    font-size: 14px;
    font-weight: 500;
    color: var(--kk-text);
    background: var(--kk-white);
    cursor: pointer;
    transition: border-color var(--kk-transition), color var(--kk-transition), background var(--kk-transition);
    text-decoration: none;
}

.kk-ractions__btn:hover {
    border-color: var(--kk-green);
    color: var(--kk-green);
    background: var(--kk-green-light);
}

.kk-ractions__btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ─── Offer Hero ─── */
.kk-ohero {
    position: relative;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    border-radius: var(--kk-radius);
    overflow: hidden;
}

.kk-ohero__img {
    width: 100%;
    display: block;
}

.kk-ohero__badge {
    position: absolute;
    top: 16px;
    left: 16px;
    background: var(--kk-green);
    color: var(--kk-white);
    padding: 4px 14px;
    border-radius: var(--kk-radius-full);
    font-size: 13px;
    font-weight: 600;
}

.kk-ohero__sold-out {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--kk-white);
    font-size: 1.5rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* ─── Offer Details ─── */
.kk-odetails__name {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 12px;
}

.kk-odetails__meta {
    display: flex;
    gap: 16px;
    font-size: 14px;
    color: var(--kk-text-light);
    margin-bottom: 16px;
}

.kk-odetails__meta span {
    display: flex;
    gap: 4px;
}

.kk-odetails__desc {
    font-size: 16px;
    line-height: 1.7;
    margin-bottom: 16px;
}

.kk-odetails__notes {
    font-size: 14px;
    color: var(--kk-text-light);
    font-style: italic;
    padding: 12px 16px;
    background: #f9f9f7;
    border-radius: var(--kk-radius-sm);
}

.kk-odetails__kashrus {
    margin-top: 12px;
    font-size: 14px;
    color: var(--kk-text-light);
}

/* ─── Offer Pricing ─── */
.kk-opricing {
    padding: 24px;
    background: var(--kk-white);
    border: 1px solid var(--kk-border);
    border-radius: var(--kk-radius);
}

.kk-opricing__price {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--kk-green);
}

.kk-opricing__offer-text {
    font-size: 1.125rem;
    color: var(--kk-green-dark);
    font-weight: 600;
    margin-top: 4px;
}

.kk-opricing__rrp {
    font-size: 14px;
    color: var(--kk-text-muted);
    text-decoration: line-through;
    margin-top: 8px;
}

.kk-opricing__savings {
    display: inline-block;
    background: var(--kk-green-light);
    color: var(--kk-green-dark);
    padding: 4px 12px;
    border-radius: var(--kk-radius-full);
    font-size: 13px;
    font-weight: 600;
    margin-top: 8px;
}

.kk-opricing__validity {
    font-size: 13px;
    color: var(--kk-text-muted);
    margin-top: 12px;
}

/* ─── Offer Variations ─── */
.kk-ovariations__tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--kk-border);
}

.kk-ovariations__tab {
    padding: 10px 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--kk-text-light);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color var(--kk-transition), border-color var(--kk-transition);
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.kk-ovariations__tab--active {
    color: var(--kk-green);
    border-bottom-color: var(--kk-green);
}

.kk-ovariations__panel {
    padding: 24px 0;
    display: none;
}

.kk-ovariations__panel.is-active {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.kk-ovariations__image img {
    width: 100%;
    border-radius: var(--kk-radius-sm);
}

.kk-ovariations__info {
    font-size: 15px;
}

/* ─── Offer Gallery ─── */
.kk-ogallery {
    display: grid;
    gap: 12px;
}

.kk-ogallery--bottom .kk-ogallery__thumbs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
}

.kk-ogallery--side {
    grid-template-columns: 80px 1fr;
}

.kk-ogallery--side .kk-ogallery__thumbs {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kk-ogallery__main img {
    width: 100%;
    border-radius: var(--kk-radius);
    display: block;
}

.kk-ogallery__thumb {
    width: 64px;
    height: 64px;
    border-radius: var(--kk-radius-sm);
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color var(--kk-transition);
    flex-shrink: 0;
    padding: 0;
    background: none;
}

.kk-ogallery__thumb--active {
    border-color: var(--kk-green);
}

.kk-ogallery__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ─── Weight / Details Grid ─── */
.kk-wdetails__grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.kk-wdetails__item {
    display: flex;
    flex-direction: column;
}

.kk-wdetails__label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--kk-text-muted);
    font-weight: 600;
    margin-bottom: 2px;
}

.kk-wdetails__value {
    font-size: 15px;
    font-weight: 500;
}

/* ─── Offer Cards (archive grid) ─── */
.kk-ocard {
    border: 1px solid var(--kk-border);
    border-radius: var(--kk-radius);
    overflow: hidden;
    background: var(--kk-white);
    transition: transform var(--kk-transition), box-shadow var(--kk-transition);
    text-decoration: none;
    display: block;
    color: inherit;
}

.kk-ocard:hover {
    transform: translateY(-4px);
    box-shadow: var(--kk-shadow-hover);
}

.kk-ocard__img-wrap {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background: #f5f5f3;
}

.kk-ocard__img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.kk-ocard__badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--kk-green);
    color: var(--kk-white);
    padding: 4px 12px;
    border-radius: var(--kk-radius-full);
    font-size: 12px;
    font-weight: 600;
}

.kk-ocard__sold-out {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--kk-white);
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
}

.kk-ocard__body {
    padding: 16px;
}

.kk-ocard__title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    margin: 0 0 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.kk-ocard__price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--kk-green);
}

.kk-ocard__offer-text {
    font-size: 13px;
    color: var(--kk-green-dark);
}

/* ─── Archive Header ─── */
.kk-archive-header {
    text-align: center;
    padding: 40px 0 20px;
}

.kk-archive-header__title {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 12px;
}

.kk-archive-header__desc {
    font-size: 1.125rem;
    color: var(--kk-text-light);
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .kk-two-col {
        grid-template-columns: 1fr;
    }

    .kk-post-title h1 {
        font-size: 2rem;
    }

    .kk-odetails__name {
        font-size: 1.5rem;
    }

    .kk-opricing__price {
        font-size: 2rem;
    }

    .kk-ovariations__panel.is-active {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .kk-wdetails__grid {
        grid-template-columns: 1fr;
    }
}

/* ─── Print ─── */
@media print {
    .kk-ractions,
    .kk-rfilters,
    .kk-rpagination,
    header,
    footer,
    nav {
        display: none !important;
    }

    .kk-ringredients {
        position: static !important;
    }
}
