/*
 * PizzaLogic sub-page layer (redesign A, WP-P)
 *
 * Loaded by includes/header.php after design.css, so it is on every page
 * (including the calculator, which only uses .app-footer and .sr-only from here).
 * Covers the shared sub-page chrome (brand bar, footer, page card, prose,
 * buttons, forms) and the small pages: about, changelog, glossary, feedback,
 * privacy, 404, app page. Blog, bake log, tools and estimator keep their own
 * files. Tokens only: no hex colours.
 */

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

/* ------------------------------------------------------------------ */
/* Brand bar (sub-pages)                                               */
/* ------------------------------------------------------------------ */
a.brand,
a.brand:hover {
    color: var(--header-text);
    text-decoration: none;
}
.brand-page {
    margin: 0 auto 16px;
    padding-top: 18px;
    width: fit-content;
    max-width: 100%;
}
.brand-page:hover .brand-wordmark {
    text-decoration: underline;
    text-underline-offset: 3px;
}
.brand-sub {
    font-size: 1em;
}

/* ------------------------------------------------------------------ */
/* Footer                                                              */
/* ------------------------------------------------------------------ */
.app-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 22px 16px 28px;
    margin-top: 8px;
    font-size: 0.9em;
    color: var(--header-text);
    text-align: center;
}
/* The calculator's fixed quick-reference bar needs room under the footer. */
body:has(.floating-summary-bar) .app-footer {
    /* --dock-clearance is set by ui.js from the bar's live height */
    padding-bottom: calc(var(--dock-clearance, 96px) + 20px);
}
.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2px 0;
    margin: 0;
}
.footer-link {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 10px;
    color: var(--header-text);
    font-weight: 600;
    text-decoration: none;
    opacity: 0.92;
}
.footer-link + .footer-link::before {
    content: '';
    width: 3px;
    height: 3px;
    margin-right: 20px;
    margin-left: -10px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.55;
}
.footer-link:hover {
    opacity: 1;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.footer-links-secondary {
    margin-top: 0;
}
.affiliate-disclosure {
    max-width: 44ch;
    font-size: 0.92em;
    line-height: 1.45;
    opacity: 0.8;
}
.footer-version {
    font-size: 0.85em;
    font-variant-numeric: tabular-nums;
    opacity: 0.7;
}
[data-theme] .app-footer,
[data-theme='dark'] .app-footer,
[data-theme='light'] .app-footer,
[data-theme='cool'] .app-footer,
[data-theme='warm'] .app-footer {
    color: var(--header-text);
}

/* ------------------------------------------------------------------ */
/* Page card + long-form text                                          */
/* ------------------------------------------------------------------ */
.page-wrap {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 12px;
}
.page-card {
    background: var(--card-bg);
    color: var(--card-text);
    border-radius: var(--radius-card);
    box-shadow: var(--card-shadow);
    padding: 24px 22px 28px;
    margin: 0 auto 14px;
}
.page-card.prose {
    max-width: 700px;
}
.page-card h1,
.page-card .page-title {
    display: block;
    margin: 0 0 12px;
    padding: 0;
    border: 0;
    color: var(--card-heading);
    font-size: 1.75em;
    line-height: 1.2;
    letter-spacing: -0.01em;
    text-align: left;
    text-wrap: balance;
}
.page-lede {
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 1.05em;
    line-height: 1.55;
}

.prose {
    font-size: 1.14em; /* about 16px at scale 1 */
    line-height: 1.65;
}
.prose p,
.prose ul,
.prose ol {
    margin: 0 0 14px;
}
.prose h2 {
    margin: 30px 0 10px;
    color: var(--card-heading);
    font-size: 1.3em;
    line-height: 1.25;
    border: 0;
    padding: 0;
    text-wrap: balance;
}
.prose h3 {
    margin: 24px 0 8px;
    color: var(--card-heading);
    font-size: 1.1em;
    line-height: 1.3;
}
.prose h4 {
    margin: 18px 0 6px;
    color: var(--card-heading);
    font-size: 1em;
}
.prose ul,
.prose ol {
    padding-left: 1.3em;
}
.prose li {
    margin-bottom: 6px;
}
.prose a,
.page-card a:not(.pg-btn):not(.back-link) {
    color: var(--accent-ink);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.prose a:hover {
    text-decoration-thickness: 2px;
}
.prose a.pg-btn,
.prose a.back-link,
.prose .link-rows a,
.prose a.glossary-nav-link,
.page-card a.pg-btn,
.page-card a.back-link {
    text-decoration: none;
}
.prose a.pg-btn,
.page-card a.pg-btn {
    color: var(--card-text);
}
.prose a.pg-btn-primary,
.page-card a.pg-btn-primary {
    color: var(--on-accent);
}
.prose a.back-link,
.page-card a.back-link {
    color: var(--accent-ink);
}
.prose strong {
    color: var(--step-title);
}
.prose hr,
.page-rule {
    margin: 28px 0;
    border: 0;
    border-top: 1px solid var(--border-color);
}
.prose table,
.page-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 16px;
    font-size: 0.92em;
    font-variant-numeric: tabular-nums;
}
.prose th,
.prose td,
.page-table th,
.page-table td {
    padding: 9px 10px;
    border: 0;
    border-bottom: 1px solid var(--border-light);
    text-align: left;
}
.prose th,
.page-table th {
    color: var(--muted);
    font-weight: 600;
    border-bottom-color: var(--border-color);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    color: var(--accent-ink);
    font-weight: 600;
    text-decoration: none;
}
.back-link:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}
.back-link .icon {
    width: 16px;
    height: 16px;
}
.page-foot {
    margin-top: 22px;
}

/* Buttons (page family) */
.pg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 0 20px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-control);
    background: var(--card-bg);
    color: var(--card-text);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}
.pg-btn .icon {
    width: 18px;
    height: 18px;
}
.pg-btn-primary {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: var(--on-accent);
}
.pg-btn-primary .icon {
    color: inherit;
}
.pg-btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}
.pg-btn:disabled {
    opacity: 0.6;
    cursor: default;
}
.pg-btn-block {
    display: flex;
    width: 100%;
}

/* Tags */
.tag-pro {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 7px;
    border-radius: 6px;
    background: var(--primary-color);
    color: var(--on-accent);
    font-size: 0.7em;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    vertical-align: middle;
}

/* Callouts on pages: .alert already gets the full border from design.css */
.page-card .alert {
    margin: 16px 0;
    font-size: 0.95em;
    line-height: 1.5;
}
.page-card .alert > div {
    min-width: 0;
}

/* ------------------------------------------------------------------ */
/* About                                                               */
/* ------------------------------------------------------------------ */
.about-photo {
    float: right;
    width: 150px;
    margin: 4px 0 12px 20px;
}
.about-photo img,
.about-photo-fallback {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    object-fit: cover;
    background: var(--tint);
}
.about-photo-fallback {
    display: none;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    color: var(--on-accent);
    font-size: 3em;
    font-weight: 700;
}
@media (max-width: 480px) {
    .about-photo {
        width: 92px;
        margin-left: 14px;
    }
}
.link-rows {
    list-style: none;
    margin: 0 0 8px;
    padding: 0;
    border-top: 1px solid var(--border-light);
}
.prose .link-rows {
    padding: 0;
}
.link-rows li {
    margin: 0;
    border-bottom: 1px solid var(--border-light);
}
.link-rows a {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 52px;
    text-decoration: none;
    color: var(--card-text);
}
.prose .link-rows a {
    color: var(--card-text);
    text-decoration: none;
}
.link-rows .row-ic {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: none;
    border-radius: 50%;
    background: var(--tint);
}
.link-rows .row-ic .icon {
    width: 18px;
    height: 18px;
}
.link-rows .row-label {
    font-weight: 600;
    color: var(--accent-ink);
}
.link-rows .row-meta {
    margin-left: auto;
    color: var(--muted);
    font-size: 0.9em;
}

/* ------------------------------------------------------------------ */
/* Changelog                                                           */
/* ------------------------------------------------------------------ */
.changelog-intro {
    color: var(--step-text);
}
.changelog-entry {
    padding: 4px 0 6px;
}
.changelog-entry h3 {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 10px;
    margin: 0 0 6px;
    font-size: 1.25em;
}
.changelog-date {
    color: var(--muted);
    font-size: 0.72em;
    font-weight: 500;
}
.changelog-yeast-flag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--tint);
    color: var(--accent-ink);
    font-size: 0.62em;
    font-weight: 600;
}
.changelog-yeast-flag .icon,
.changelog-entry h4 .icon,
.changelog-intro .icon {
    width: 1.05em;
    height: 1.05em;
    vertical-align: -0.18em;
}
.changelog-entry h4 {
    margin: 16px 0 6px;
    font-size: 0.95em;
    font-weight: 700;
    text-transform: none;
    color: var(--card-heading);
}
.changelog-summary {
    color: var(--step-text);
    font-style: normal;
    font-weight: 500;
}
.changelog-entry ul {
    margin-left: 0;
    padding-left: 1.3em;
}
.changelog-yeast-flag {
    border: 0;
    white-space: nowrap;
}
.changelog-aside {
    margin: 8px 0;
    padding: 8px 12px;
    border: 1px solid var(--alert-info-border);
    border-left-width: 1px;
    border-radius: var(--radius-callout);
    background: var(--alert-info-bg);
    color: var(--alert-info-text);
    font-size: 0.92em;
}

/* ------------------------------------------------------------------ */
/* Glossary                                                            */
/* ------------------------------------------------------------------ */
.glossary-nav {
    padding: 14px 16px;
    margin: 0 0 22px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-callout);
    background: var(--surface-2);
}
.glossary-nav-title {
    margin-bottom: 8px;
    color: var(--card-heading);
    font-weight: 700;
}
.glossary-nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.glossary-nav-link,
.page-card a.glossary-nav-link {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border: 1.5px solid var(--border-color);
    border-radius: 999px;
    background: var(--card-bg);
    color: var(--accent-ink);
    font-size: 0.9em;
    font-weight: 600;
    text-decoration: none;
}
.glossary-nav-link:hover {
    background: var(--tint);
}
.glossary-section {
    margin-bottom: 30px;
}
.glossary-section-title {
    margin: 0 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    color: var(--card-heading);
    font-size: 1.25em;
}
.glossary-term {
    padding: 14px 0;
    border-bottom: 1px solid var(--border-light);
}
.glossary-term:last-child {
    border-bottom: 0;
}
.term-name {
    margin-bottom: 4px;
    color: var(--card-heading);
    font-size: 1.05em;
    font-weight: 700;
}
.term-definition {
    color: var(--step-text);
}
.term-example {
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-callout);
    background: var(--surface-2);
    color: var(--muted);
    font-size: 0.92em;
    line-height: 1.5;
}

/* ------------------------------------------------------------------ */
/* Feedback form                                                       */
/* ------------------------------------------------------------------ */
.pg-field {
    margin-bottom: 16px;
}
.pg-field label {
    display: block;
    margin-bottom: 6px;
    color: var(--label-color);
    font-size: 0.95em;
    font-weight: 600;
}
.pg-input,
.feedback-input,
.feedback-textarea {
    display: block;
    width: 100%;
    min-height: 46px;
    padding: 10px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-control);
    background: var(--input-bg);
    color: var(--card-text);
    font: inherit;
}
.feedback-textarea {
    min-height: 150px;
    line-height: 1.5;
    resize: vertical;
}
.pg-input::placeholder,
.feedback-input::placeholder,
.feedback-textarea::placeholder {
    color: var(--muted);
}
.pg-input:focus,
.feedback-input:focus,
.feedback-textarea:focus {
    outline: 2px solid var(--accent-ink);
    outline-offset: 1px;
    border-color: var(--accent-ink);
}
.feedback-success {
    text-align: center;
    padding: 28px 8px 8px;
}
.feedback-success .empty-state-icon {
    margin-bottom: 14px;
}
.feedback-success h2 {
    margin: 0 0 8px;
}
.feedback-success p {
    margin: 0 0 20px;
    color: var(--step-text);
}
#feedbackResponse .alert,
#feedbackResponse .error,
#feedbackResponse .success {
    margin-top: 14px;
}

/* ------------------------------------------------------------------ */
/* 404                                                                 */
/* ------------------------------------------------------------------ */
.error-card {
    max-width: 520px;
    margin: 0 auto 14px;
    text-align: center;
}
.page-card.error-card {
    padding: 32px 24px 28px;
}
.page-card.error-card h1 {
    background: none;
    -webkit-text-fill-color: currentColor;
    margin: 4px 0 6px;
    font-size: 3.4em;
    line-height: 1;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.error-message {
    margin: 0 0 20px;
    color: var(--step-text);
}
.error-card .empty-state-icon {
    margin-bottom: 10px;
}
.error-sub {
    margin: 14px 0 0;
}
.error-card .error-message {
    margin-bottom: 20px;
    font-size: 1em;
}

/* ------------------------------------------------------------------ */
/* App page (/pizza-app/)                                              */
/* ------------------------------------------------------------------ */
.app-hero {
    text-align: center;
}
.page-card.app-hero h1 {
    text-align: center;
    font-size: 1.7em;
    margin-bottom: 6px;
}
.app-hero-logo {
    width: 88px;
    height: 88px;
    margin-bottom: 14px;
    border-radius: 20px;
    box-shadow: var(--card-shadow);
}
.app-hero .tagline {
    margin: 0 0 14px;
    color: var(--muted);
    font-size: 1.1em;
    font-weight: 600;
}
.app-hero-description {
    max-width: 58ch;
    margin: 0 auto 22px;
    color: var(--step-text);
    line-height: 1.6;
}
.store-label {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 0.95em;
    font-weight: 600;
}
.store-badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
}
.store-badge-link {
    display: inline-block;
}
.store-badge-link:hover {
    opacity: 0.88;
}
.store-badge {
    display: block;
    width: 160px;
    height: auto;
}
.store-badge-google {
    width: 180px;
}
.web-calc-nudge {
    margin: 22px 0 2px;
    color: var(--muted);
    font-size: 0.9em;
}
.web-calc-link {
    color: var(--accent-ink);
    font-weight: 600;
    text-decoration: none;
}
.web-calc-link .icon {
    width: 1.05em;
    height: 1.05em;
    vertical-align: -0.2em;
}
.web-calc-link:hover {
    text-decoration: underline;
}
/* Screenshots: real app captures in a CSS phone frame, inside a page card.
   Four across on desktop; a swipe row on phones (the next phone peeks in).
   Each frame is a button that opens the viewer (.app-lightbox). */
.app-shots-track {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.app-shot figure {
    margin: 0;
}
.app-shot-frame,
.app-lightbox-frame {
    position: relative;
    display: block;
    background: #111217;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}
.app-shot-frame {
    width: 100%;
    padding: 6px;
    border: 0;
    border-radius: 30px;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.08) inset,
        0 10px 26px rgba(10, 6, 40, 0.22);
    cursor: zoom-in;
    transition: transform 0.15s ease;
}
.app-shot-frame:hover {
    transform: translateY(-2px);
}
.app-shot-frame:focus-visible {
    outline: 3px solid var(--accent-ink);
    outline-offset: 3px;
}
/* Dynamic Island */
.app-shot-frame::after,
.app-lightbox-frame::after {
    content: '';
    position: absolute;
    left: 50%;
    width: 30%;
    border-radius: 999px;
    background: #111217;
    transform: translateX(-50%);
}
.app-shot-frame::after {
    top: 13px;
    height: 14px;
}
.app-shot-frame img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 24px;
}
.app-shot figcaption {
    margin-top: 12px;
    color: var(--card-heading);
    font-size: 0.95em;
    font-weight: 600;
    line-height: 1.35;
    text-align: center;
    text-wrap: balance;
}
@media (max-width: 899px) {
    /* bleed the row to the card edges so it scrolls under the card padding */
    .app-shots-track {
        display: flex;
        gap: 16px;
        margin: 0 -22px;
        padding: 4px 22px 8px;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scroll-padding: 0 22px;
        scrollbar-width: none;
    }
    .app-shots-track::-webkit-scrollbar {
        display: none;
    }
    .app-shot {
        flex: 0 0 52vw;
        max-width: 240px;
        scroll-snap-align: start;
    }
}

/* Screenshot viewer */
.app-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 64px;
    background: rgba(10, 8, 30, 0.94);
}
.app-lightbox[hidden] {
    display: none;
}
.app-lightbox-figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
}
.app-lightbox-frame {
    height: min(80vh, calc((100vw - 128px) * 2.172));
    aspect-ratio: 360 / 782;
    padding: 8px;
    border-radius: 44px;
}
.app-lightbox-frame::after {
    top: 18px;
    height: 20px;
}
.app-lightbox-frame img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 36px;
}
.app-lightbox-caption {
    margin-top: 14px;
    color: #fff;
    font-weight: 600;
    text-align: center;
}
.app-lightbox-btn {
    position: absolute;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
}
.app-lightbox-btn:hover {
    background: rgba(255, 255, 255, 0.22);
}
.app-lightbox-btn:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
}
.app-lightbox-btn .icon {
    width: 24px;
    height: 24px;
    color: inherit;
}
.app-lightbox-close {
    top: 14px;
    right: 14px;
}
.app-lightbox-prev,
.app-lightbox-next {
    top: 50%;
    transform: translateY(-50%);
}
.app-lightbox-prev {
    left: 12px;
}
.app-lightbox-next {
    right: 12px;
}
.app-features-card h2,
.app-download h2 {
    margin: 0 0 14px;
    color: var(--card-heading);
    font-size: 1.3em;
    text-align: center;
    text-wrap: balance;
}
.feature-rows {
    list-style: none;
    max-width: 640px;
    margin: 0 auto;
    padding: 0;
}
.feature-row {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-light);
}
.feature-row:last-child {
    border-bottom: 0;
}
.feature-ic {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    flex: none;
    border-radius: 50%;
    background: var(--tint);
}
.feature-ic .icon {
    width: 22px;
    height: 22px;
}
.feature-row h3 {
    margin: 2px 0 3px;
    color: var(--card-heading);
    font-size: 1.05em;
}
.feature-row p {
    margin: 0;
    color: var(--step-text);
    line-height: 1.5;
    font-size: 0.95em;
}
.app-download {
    text-align: center;
}
.signup-subtitle {
    max-width: 52ch;
    margin: 0 auto 18px;
    color: var(--step-text);
}
.app-cta-row {
    margin: 4px 0 8px;
    text-align: center;
}
@media (max-width: 600px) {
    .store-badge {
        width: 140px;
    }
    .store-badge-google {
        width: 158px;
    }
}
