/* ============================================================
   EatOutDiary /flow — guided capture flow
   BEM block: flow
   Tokens inherited from demo.css :root
   ============================================================ */

/* ── Hidden attribute fix ───────────────────────────────────── */
/* Author stylesheet display rules override UA [hidden] { display:none }.
   Restore correct behaviour for all elements inside the flow container.  */
.flow [hidden] { display: none !important; }

/* ── Root container ─────────────────────────────────────────── */

.flow {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    background: var(--pm-bg);
}

/* ── Screens ────────────────────────────────────────────────── */

.flow__screen {
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 100dvh;
    position: relative;
    animation: flow-slide-in 0.22s ease both;
}

.flow__screen--active {
    display: flex;
}

.flow__screen--exit {
    display: flex;
    animation: flow-slide-out 0.18s ease both;
    pointer-events: none;
    position: absolute;
    inset: 0;
    z-index: 1;
}

@keyframes flow-slide-in {
    from { opacity: 0; transform: translateX(18px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes flow-slide-out {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(-14px); }
}

/* ── Body zones ─────────────────────────────────────────────── */

.flow__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem 1.5rem;
    max-width: var(--pm-max);
    width: 100%;
    margin: 0 auto;
    gap: 1rem;
}

.flow__body--center {
    justify-content: center;
    align-items: center;
    text-align: center;
    padding-top: max(3rem, env(safe-area-inset-top, 0px) + 3rem);
    padding-bottom: max(3rem, env(safe-area-inset-bottom, 0px) + 1.5rem);
}

.flow__body--camera {
    padding-bottom: 0;
    gap: 0.75rem;
    padding-top: max(4.5rem, env(safe-area-inset-top, 0px) + 4rem);
}

/* ── Typography ─────────────────────────────────────────────── */

.flow__heading {
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: clamp(1.75rem, 7vw, 2.3rem);
    font-weight: 400;
    color: var(--pm-text);
    line-height: 1.15;
    letter-spacing: -0.01em;
    margin: 0;
}

.flow__sub {
    font-size: 1rem;
    color: var(--pm-muted);
    margin: 0;
    line-height: 1.5;
}

.flow__sub--camera {
    font-size: 0.875rem;
}

.flow__caption {
    font-size: 0.7rem;
    color: var(--pm-muted);
    margin: 0;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

/* ── Hero (landing) ─────────────────────────────────────────── */

.flow__hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.flow__hero-icon {
    margin-bottom: 0.5rem;
}

/* ── Icon wrappers ──────────────────────────────────────────── */

.flow__icon-wrap {
    margin-bottom: 0.5rem;
}

.flow__icon-wrap--muted svg {
    opacity: 0.55;
}

/* ── Buttons ────────────────────────────────────────────────── */

.flow__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: var(--pm-touch);
    padding: 0 1.5rem;
    border-radius: var(--pm-radius);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.12s, transform 0.1s;
    border: none;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
}

.flow__btn:active:not(:disabled) {
    opacity: 0.8;
    transform: scale(0.97);
}

.flow__btn:disabled {
    opacity: 0.38;
    cursor: not-allowed;
}

.flow__btn--full {
    width: 100%;
    max-width: 360px;
}

.flow__btn--primary {
    background: var(--pm-accent);
    color: #fff;
    width: 100%;
    max-width: 360px;
}

.flow__btn--primary:hover:not(:disabled) {
    background: var(--pm-accent2);
}

.flow__btn--ghost {
    background: transparent;
    color: var(--pm-accent);
    border: 1.5px solid var(--pm-border);
}

.flow__btn--ghost:hover:not(:disabled) {
    background: var(--pm-surface2);
}

.flow__btn--sm {
    min-height: 40px;
    font-size: 0.875rem;
    padding: 0 1.1rem;
}

.flow__btn--capture {
    background: var(--pm-accent);
    color: #fff;
    font-size: 1.05rem;
}

.flow__btn--capture:hover:not(:disabled) {
    background: var(--pm-accent2);
}

/* ── Camera tip ─────────────────────────────────────────────── */

.flow__camera-tip {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    background: rgba(0,0,0,0.04);
    border-left: 3px solid var(--pm-accent);
    border-radius: 0.375rem;
    padding: 0.55rem 0.7rem;
    font-size: 0.74rem;
    line-height: 1.5;
    color: var(--pm-muted, #666);
    margin: 0;
}

.flow__camera-tip__icon {
    font-size: 0.9rem;
    line-height: 1.5;
    flex-shrink: 0;
}

/* ── Venue list (screen 3a) ─────────────────────────────────── */

.flow__venue-list {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    width: 100%;
}

.flow__venue-item {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: var(--pm-touch);
    padding: 0.875rem 1.1rem;
    background: var(--pm-surface);
    border: 1.5px solid var(--pm-border);
    border-radius: var(--pm-radius-sm);
    font-family: var(--font-body);
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--pm-text);
    cursor: pointer;
    text-align: left;
    transition: background 0.12s, border-color 0.12s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
}

.flow__venue-item:active {
    background: var(--pm-surface2);
    transform: scale(0.98);
}

.flow__venue-item__name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.flow__venue-item__distance {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--pm-muted);
    margin-left: 0.75rem;
    flex-shrink: 0;
}

.flow__venue-other {
    margin-top: 0.5rem;
}

/* ── Add place field (screen 4) ─────────────────────────────── */

.flow__field {
    width: 100%;
}

.flow__input {
    width: 100%;
    min-height: var(--pm-touch);
    padding: 0 1rem;
    border: 1.5px solid var(--pm-border);
    border-radius: var(--pm-radius-sm);
    background: var(--pm-surface);
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--pm-text);
    outline: none;
    transition: border-color 0.15s;
    -webkit-appearance: none;
    appearance: none;
}

.flow__input:focus {
    border-color: var(--pm-accent);
}

.flow__input::placeholder {
    color: var(--pm-muted);
}

/* ── Thumbnails (screen 5) ──────────────────────────────────── */

.flow__thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    width: 100%;
    min-height: 0;
}

.flow__thumb {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: var(--pm-radius-sm);
    overflow: hidden;
    background: var(--pm-surface2);
    flex-shrink: 0;
}

.flow__thumb__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.flow__thumb__del {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-size: 0.75rem;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
}

/* ── Upload bar ─────────────────────────────────────────────── */

.flow__upload-bar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.875rem;
    color: var(--pm-muted);
    padding: 0.25rem 0;
}

/* ── Spinner ────────────────────────────────────────────────── */

.flow__spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--pm-border);
    border-top-color: var(--pm-accent);
    border-radius: 50%;
    animation: flow-spin 0.7s linear infinite;
    flex-shrink: 0;
}

@keyframes flow-spin {
    to { transform: rotate(360deg); }
}

.flow__spinner--lg {
    width: 44px;
    height: 44px;
    border-width: 3px;
    margin-bottom: 1.25rem;
}

/* ── Dock (camera screen fixed bottom) ──────────────────────── */

.flow__dock {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    padding: 1rem 1.5rem max(1.25rem, env(safe-area-inset-bottom, 0px) + 0.75rem);
    background: var(--pm-surface);
    border-top: 1px solid var(--pm-border);
    max-width: var(--pm-max);
    width: 100%;
    margin: 0 auto;
    position: sticky;
    bottom: 0;
}

/* ── Processing state (confirmation screen) ─────────────────── */

.flow__processing-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0;
    animation: flow-fade-in 0.3s ease both;
}

/* ── Confirmation success view ───────────────────────────────── */

.flow__confirm-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.25rem;
    animation: flow-fade-in 0.35s ease both;
}

@keyframes flow-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Confirmation icon ──────────────────────────────────────── */

.flow__confirm-icon {
    margin-bottom: 0.5rem;
}

/* ── Confirmation: thanks + nudge ───────────────────────────── */

.flow__confirm-thanks {
    font-size: 1rem;
    color: var(--pm-accent);
    font-weight: 600;
    line-height: 1.55;
    margin: 0.25rem 0 0.5rem;
    text-align: center;
}

.flow__confirm-thanks--follow {
    font-size: 0.9375rem;
    font-weight: 400;
    margin-top: 0.15rem;
}

.flow__confirm-nudge {
    margin-top: 1.5rem;
    padding: 1.1rem 1.25rem;
    background: var(--pm-surface2);
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius);
    text-align: center;
    width: 100%;
    max-width: 300px;
    animation: flow-slide-in 0.25s ease both;
}

.flow__confirm-nudge__head {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--pm-text);
    margin: 0 0 0.25rem;
}

.flow__confirm-nudge__body {
    font-size: 0.8125rem;
    color: var(--pm-muted);
    margin: 0;
    line-height: 1.5;
}

/* ── Processing state ───────────────────────────────────────── */

.flow__processing-state {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.9rem;
    color: var(--pm-muted);
    margin-top: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.flow__processing-meta {
    width: 100%;
    text-align: center;
    font-size: 0.8rem;
    color: var(--pm-muted);
    margin: 0;
}

/* ── Error text ─────────────────────────────────────────────── */

.flow__error {
    font-size: 0.875rem;
    color: var(--pm-error);
    padding: 0.5rem 0.75rem;
    border-radius: var(--pm-radius-sm);
    background: rgba(196, 68, 68, 0.08);
    margin: 0;
    width: 100%;
    text-align: center;
}

/* ── Back button ────────────────────────────────────────────── */

.flow__back {
    position: fixed;
    top: max(0.875rem, env(safe-area-inset-top, 0px) + 0.5rem);
    left: 1rem;
    z-index: 20;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: transparent;
    border: none;
    color: var(--pm-accent);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.5rem 0.25rem;
    -webkit-tap-highlight-color: transparent;
}

.flow__close {
    position: fixed;
    top: max(0.875rem, env(safe-area-inset-top, 0px) + 0.5rem);
    right: 1rem;
    z-index: 20;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--pm-muted, #888);
    cursor: pointer;
    padding: 0.5rem;
    -webkit-tap-highlight-color: transparent;
}

/* ── Landing body ────────────────────────────────────────────── */

.flow__body--landing {
    justify-content: space-between;
    align-items: center;
    text-align: center;
    gap: 0;
    padding-top: max(3rem, env(safe-area-inset-top, 0px) + 2.5rem);
    padding-bottom: max(2.5rem, env(safe-area-inset-bottom, 0px) + 1.5rem);
}

/* ── Brand mark ──────────────────────────────────────────────── */

.flow__brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--pm-accent);
}

.flow__brand__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #4a2810;
    color: #f0a030;
    font-size: 1rem;
    flex-shrink: 0;
}

.flow__brand__name {
    font-family: var(--font-body);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--pm-text);
    letter-spacing: 0.01em;
    line-height: 1;
}

.flow__brand__snap {
    font-weight: 800;
    color: #f0a030;
}

/* ── Mission (landing hero) ──────────────────────────────────── */

.flow__mission {
    width: 100%;
}

.flow__mission__headline {
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: clamp(2rem, 8.5vw, 2.8rem);
    font-weight: 400;
    font-style: normal;
    color: var(--pm-text);
    line-height: 1.1;
    letter-spacing: -0.01em;
    margin: 0 0 0.9rem;
}

.flow__mission__question {
    font-family: 'DM Serif Display', Georgia, serif;
    font-style: italic;
    font-size: clamp(1.25rem, 5.5vw, 1.6rem);
    font-weight: 400;
    color: var(--pm-accent);
    line-height: 1.3;
    margin: 0 0 1.1rem;
}

.flow__mission__body {
    font-size: clamp(0.875rem, 3.5vw, 1rem);
    color: var(--pm-muted);
    line-height: 1.6;
    margin: 0 auto;
    max-width: 30ch;
}

/* ── Landing CTA group ───────────────────────────────────────── */

.flow__landing-cta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
}

.flow__landing-cta .flow__btn--primary {
    max-width: 100%;
}

/* Mobile: show start button, hide QR */
.flow__landing-cta__desktop { display: none; }
.flow__landing-cta__mobile  { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; width: 100%; }

/* Desktop: show QR, hide start button */
@media (min-width: 700px) {
    .flow__landing-cta__mobile  { display: none; }
    .flow__landing-cta__desktop { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
}

/* ── QR code frame ───────────────────────────────────────────── */

.flow__qr-frame {
    background: #fff;
    border-radius: 14px;
    padding: 14px;
    display: inline-flex;
    box-shadow: 0 4px 24px rgba(0,0,0,0.18);
}

.flow__qr-frame img,
.flow__qr-frame canvas {
    display: block;
    border-radius: 4px;
}

.flow__qr-label {
    font-size: 0.8rem;
    color: var(--pm-muted);
    letter-spacing: 0.02em;
    margin: 0;
    opacity: 0.75;
}

/* ── Landing footer links ────────────────────────────────────── */

.flow__landing-footer {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
    justify-content: center;
}

.flow__landing-footer__link {
    font-size: 0.75rem;
    color: var(--pm-muted);
    text-decoration: none;
    letter-spacing: 0.01em;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.flow__landing-footer__link:hover {
    opacity: 1;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ── Copyright ───────────────────────────────────────────────── */

.flow__copyright {
    font-size: 0.6875rem;
    color: var(--pm-muted);
    opacity: 0.55;
    margin: 0;
    letter-spacing: 0.01em;
}

/* ── Screen-specific tweaks ─────────────────────────────────── */

/* Nearby-found: heading has less bottom gap, list fills space */
[data-screen="nearby-found"] .flow__body {
    padding-top: max(4.5rem, env(safe-area-inset-top, 0px) + 4rem);
}

/* Add-place: extra top padding so back button doesn't overlap */
[data-screen="add-place"] .flow__body {
    padding-top: max(4.5rem, env(safe-area-inset-top, 0px) + 4rem);
}

/* Camera: body fills above the sticky dock */
[data-screen="camera"] {
    padding-bottom: 0;
}
