/* Padelgáva – public shop: front page, card editor, basket, checkout, legal pages.
   Mobile first, like app.css: base rules are for phones; min-width queries add larger layouts. */

/* ---------- Shared bits ---------- */

.hint {
    color: var(--pm-slate);
    font-size: 0.875rem;
    font-weight: 400;
}

.notice {
    margin: 1rem 0;
    padding: 0.875rem 1rem;
    border-left: 4px solid var(--pm-steel);
    background: var(--pm-panel);
    color: var(--pm-ink);
}

.notice h2 {
    margin-top: 0;
    font-size: var(--text-h3);
}

.notice-ok {
    border-left-color: #2e7d4a;
    background: #edf7f0;
}

.notice-error {
    border-left-color: #b42318;
    background: #fdf0ef;
    color: #7a1a12;
}

.validation-message {
    margin: 0.25rem 0 0;
    color: #b42318;
    font-size: 0.875rem;
}

.btn-quiet {
    background: var(--pm-white);
    color: var(--pm-ink);
    border-color: var(--pm-frost);
}

.btn-quiet:hover {
    border-color: var(--pm-steel);
}

/* Inputs use 16px text so iOS Safari does not zoom in (PRD 4.4.1). */
.field input:not([type]),
.field input[type="text"],
.field input[type="email"],
.field input[type="number"],
.field input[type="date"],
.field input[type="time"],
.field textarea {
    width: 100%;
    min-height: var(--tap-min);
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--pm-frost);
    border-radius: 0.375rem;
    background: var(--pm-white);
    color: var(--pm-ink);
    font: inherit;
    font-size: 1rem;
}

.field textarea {
    min-height: 6rem;
    resize: vertical;
}

.field input:focus,
.field textarea:focus {
    border-color: var(--pm-steel);
}

.field input.invalid,
.field textarea.invalid {
    border-color: #b42318;
}

.field {
    margin-bottom: 1rem;
}

.field > label {
    display: block;
    margin-bottom: 0.375rem;
    font-weight: 600;
    color: var(--pm-ink);
}

.field .hint {
    margin: 0.375rem 0 0;
}

.input-short {
    max-width: 8rem;
}

.field-row {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 0.75rem;
}

.field-group {
    min-width: 0;
    margin: 0 0 1.5rem;
    padding: 0;
    border: 0;
}

.field-group > legend {
    margin-bottom: 0.75rem;
    padding: 0;
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--pm-ink);
}

.choice {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    min-height: var(--tap-min);
    padding: 0.5rem 0;
    cursor: pointer;
}

.choice input {
    flex: none;
    width: 1.375rem;
    height: 1.375rem;
    margin-top: 0.125rem;
    accent-color: var(--pm-steel);
}

/* ---------- Front page ---------- */

.amounts h2,
.how h2,
.faq h2 {
    margin-top: 0;
}

.amount-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin: 1.5rem 0 1rem;
    padding: 0;
    list-style: none;
}

.amount-tile {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.5rem;
    /* Fills its grid cell, so every tile in a row is as tall as the tallest. */
    height: 100%;
    min-height: 6.5rem;
    padding: 1.25rem 1.5rem;
    border: 1.5px solid var(--pm-frost);
    border-radius: 0 var(--radius-brand-lg) 0 0;
    background: var(--pm-panel);
    color: var(--pm-ink);
    text-decoration: none;
    transition: transform 0.3s var(--ease-brand), border-color 0.3s;
}

a.amount-tile:hover {
    border-color: var(--pm-steel);
}

@media (hover: hover) {
    a.amount-tile:hover {
        transform: translateY(-2px);
    }
}

.amount-value {
    font-family: var(--font-display);
    font-size: clamp(1.75rem, 1.5rem + 1vw, 2.25rem);
    font-weight: 700;
    font-style: italic;
    line-height: 1.15;
}

.amount-badge {
    align-self: flex-start;
    padding: 0.125rem 0.625rem;
    border-radius: 999px;
    background: var(--pm-ice);
    color: var(--pm-slate);
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.amount-badge.is-highlight {
    background: var(--pm-blue);
    color: var(--pm-ink);
}

.amount-tile.is-sold-out {
    background: var(--pm-white);
    color: var(--pm-slate);
    border-style: dashed;
}

.how {
    background: var(--pm-panel);
}

.steps-grid {
    display: grid;
    gap: 1.25rem;
    margin: 1.5rem 0 0;
    padding: 0;
    list-style: none;
    counter-reset: step;
}

.steps-grid li {
    counter-increment: step;
    padding: 1.25rem;
    background: var(--pm-white);
    border-radius: 0 var(--radius-brand) 0 0;
}

.steps-grid li::before {
    content: counter(step);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 999px;
    background: var(--pm-blue);
    color: var(--pm-ink);
    font-family: var(--font-display);
    font-weight: 700;
}

.steps-grid h3 {
    margin: 0.75rem 0 0.25rem;
}

.steps-grid p {
    margin: 0;
}

.faq details {
    border-bottom: 1px solid var(--pm-frost);
}

.faq summary {
    display: flex;
    align-items: center;
    min-height: var(--tap-min);
    padding: 0.75rem 0;
    font-weight: 600;
    color: var(--pm-ink);
    cursor: pointer;
}

.faq details p {
    margin: 0 0 1rem;
}

/* ---------- Card editor ---------- */

.editor-layout {
    display: grid;
    gap: 1.5rem;
}

.editor-form {
    min-width: 0;
}

.editor-form h1 {
    margin-top: 0;
}

.amount-choices {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}

.amount-choice {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    min-height: 3.25rem;
    padding: 0.5rem 0.875rem;
    border: 1.5px solid var(--pm-frost);
    border-radius: 0 var(--radius-brand-sm) 0 0;
    cursor: pointer;
}

.amount-choice input {
    width: 1.25rem;
    height: 1.25rem;
    accent-color: var(--pm-steel);
}

.amount-choice:has(input:checked) {
    border-color: var(--pm-steel);
    background: var(--pm-panel);
}

.amount-choice-value {
    font-weight: 700;
    color: var(--pm-ink);
}

.amount-choice.is-sold-out {
    border-style: dashed;
    cursor: not-allowed;
}

.amount-choice.is-sold-out .amount-choice-value {
    color: var(--pm-slate);
    text-decoration: line-through;
}

/* A chosen amount: suggestions that fill in the field, and the field itself. */
.amount-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.amount-suggestions[hidden] {
    display: none;
}

.amount-chip {
    min-height: 3rem;
    min-width: 6.5rem;
    padding: 0.5rem 1rem;
    border: 1.5px solid var(--pm-frost);
    border-radius: 0 var(--radius-brand-sm) 0 0;
    background: var(--pm-white);
    color: var(--pm-ink);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.amount-chip:hover,
.amount-chip[aria-pressed="true"] {
    border-color: var(--pm-steel);
    background: var(--pm-panel);
}

.amount-entry {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
}

/* Recipient details only show when "also send to the recipient" is chosen.
   Browsers without :has() simply always show them. */
.delivery:has(input[value="False"]:checked) .recipient-fields {
    display: none;
}

.recipient-fields {
    margin-top: 0.75rem;
    padding: 1rem;
    background: var(--pm-panel);
}

.recipient-fields .field:last-child {
    margin-bottom: 0;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.form-actions .btn-lg {
    flex: 1 1 16rem;
}

.preview {
    border: 1px solid var(--pm-frost);
    border-radius: 0 var(--radius-brand) 0 0;
    background: var(--pm-white);
}

.preview > summary {
    display: flex;
    align-items: center;
    min-height: var(--tap-min);
    padding: 0.5rem 1rem;
    font-weight: 600;
    color: var(--pm-steel);
    cursor: pointer;
}

.preview > .gc-card,
.preview > .hint {
    margin: 0 1rem 1rem;
}

/* The card as the PDF draws it. Positions, fonts and the artwork come from the active template's
   stylesheet (card-preview/{version}/{language}.css); sizes in cqw scale with the card. */
.gc-card {
    position: relative;
    container-type: inline-size;
    overflow: hidden;
    background-color: var(--pm-frost);
    background-size: 100% 100%;
    box-shadow: 0 0.25rem 1rem rgb(0 0 0 / 0.12);
}

.gc-el {
    position: absolute;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    line-height: normal;
}

.gc-wrap {
    white-space: pre-line;
    overflow-wrap: anywhere;
    text-overflow: clip;
    line-height: 1.3;
}

/* Empty preview lines are hidden by card-preview.js. */
[data-preview-wrap].is-empty,
[data-preview-target="greeting"]:empty {
    display: none;
}

/* ---------- Basket and checkout ---------- */

.basket-layout {
    display: grid;
    gap: 1.5rem;
}

.basket-lines {
    min-width: 0;
}

.basket-lines h1 {
    margin-top: 0;
}

.line-list {
    display: grid;
    gap: 1rem;
    margin: 0 0 1.5rem;
    padding: 0;
    list-style: none;
}

.line-card {
    padding: 1rem;
    border: 1px solid var(--pm-frost);
    border-radius: 0 var(--radius-brand) 0 0;
}

.line-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
}

.line-head h2 {
    margin: 0;
    font-size: 1.25rem;
}

.line-price {
    margin: 0;
    font-weight: 700;
    color: var(--pm-ink);
    white-space: nowrap;
}

.line-quantity {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0.75rem 0;
}

.line-quantity form,
.line-actions form {
    margin: 0;
}

.qty-btn {
    width: var(--tap-min);
    height: var(--tap-min);
    border: 1.5px solid var(--pm-frost);
    border-radius: 0.375rem;
    background: var(--pm-white);
    color: var(--pm-ink);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}

.qty-btn:hover {
    border-color: var(--pm-steel);
}

.line-text p,
.line-delivery {
    margin: 0.25rem 0;
}

.line-greeting {
    font-style: italic;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.line-delivery {
    font-size: 0.9375rem;
    color: var(--pm-steel);
    overflow-wrap: anywhere;
}

.line-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.line-actions .btn {
    min-width: 0;
}

.btn-remove {
    color: #8a1f1f;
}

.basket-summary {
    align-self: start;
    padding: 1.25rem;
    background: var(--pm-panel);
    border-radius: 0 var(--radius-brand) 0 0;
}

.basket-summary h2 {
    margin-top: 0;
    font-size: 1.25rem;
}

.summary-lines {
    margin: 0 0 1rem;
    padding: 0;
    list-style: none;
}

.summary-lines li,
.summary-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.summary-lines li {
    padding: 0.25rem 0;
}

.summary-row {
    align-items: baseline;
    padding-top: 0.5rem;
    border-top: 1px solid var(--pm-frost);
}

.summary-total {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--pm-ink);
    white-space: nowrap;
}

/* Phones: the total and main action stay fixed at the bottom of the screen (PRD 4.4.1). */
.action-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem max(1rem, env(safe-area-inset-right)) calc(0.75rem + env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
    background: var(--pm-white);
    box-shadow: 0 -8px 24px rgb(15 30 53 / 0.12);
}

.action-bar .btn {
    flex: 1;
    min-width: 0;
}

.action-bar-total {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    font-size: 0.8125rem;
}

.action-bar-total strong {
    font-size: 1.125rem;
    color: var(--pm-ink);
    white-space: nowrap;
}

main:has(.action-bar) {
    padding-bottom: calc(5.5rem + env(safe-area-inset-bottom));
}

/* ---------- Header basket link, footer links ---------- */

.basket-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--tap-min);
    height: var(--tap-min);
    color: var(--pm-white);
}

.basket-count {
    position: absolute;
    top: 0.125rem;
    right: 0;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.25rem;
    border-radius: 999px;
    background: var(--pm-blue);
    color: var(--pm-ink);
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.25rem;
    text-align: center;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
}

/* ---------- Legal pages ---------- */

.legal h2 {
    margin-top: 2rem;
    font-size: var(--text-h3);
}

.legal table {
    display: block;
    width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
}

.legal th,
.legal td {
    padding: 0.5rem;
    border-bottom: 1px solid var(--pm-frost);
    text-align: left;
    vertical-align: top;
}

/* Placeholders in the drafts, e.g. [legal company name], are highlighted until filled in. */
.legal code {
    background: #fff4d6;
    font-family: inherit;
}

/* ---------- Order confirmation ---------- */

.order-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 2rem;
    margin: 1.5rem 0;
}

.order-facts dt {
    color: var(--pm-slate);
    font-size: 0.875rem;
}

.order-facts dd {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--pm-ink);
}

.download-list {
    display: grid;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.download-list .btn {
    width: 100%;
    justify-content: flex-start;
    text-transform: none;
    letter-spacing: 0;
}

/* ---------- Larger screens ---------- */

@media (min-width: 40rem) {
    .amount-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .amount-choices {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .steps-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 48rem) {
    .action-bar {
        position: static;
        margin-top: 1.25rem;
        padding: 0;
        background: none;
        box-shadow: none;
    }

    .action-bar-total {
        display: none;
    }

    main:has(.action-bar) {
        padding-bottom: 0;
    }

    .checkout .action-bar .btn {
        flex: 0 1 auto;
    }
}

@media (min-width: 64rem) {
    .amount-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .editor-layout {
        grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
        gap: 3rem;
        align-items: start;
    }

    /* The preview stays in view next to the form. */
    .editor-preview {
        position: sticky;
        top: 1.5rem;
    }

    .basket-layout {
        grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
        gap: 3rem;
    }
}

/* The checkout bot trap: off screen, not display:none, which some bots skip. */
.hp-field {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}
