/* Tiny Concepts — kiosk UI, Apple Intelligence aesthetic.
   Scales proportionally on all 16:9 resolutions: 1rem = 16px at 1920px wide,
   everything is sized in rem/vh so 720p, 1080p, 1440p and 4K render identically. */

:root {
    --bg:         #f5f5f7;
    --surface:    #ffffff;
    --border:     rgba(0,0,0,0.08);
    --border-med: rgba(0,0,0,0.14);
    --ink:        #1d1d1f;
    --ink-2:      #48484a;
    --ink-3:      #86868b;
    --accent:     #6e3df3;
    --accent-2:   #5a2fd4;
    --accent-bg:  #f2eefe;
    --green:      #34c759;
    --red:        #ff3b30;
    --radius-sm:  0.75rem;
    --radius:     1.125rem;
    --radius-lg:  1.625rem;
    --shadow-sm:  0 0.125rem 0.5rem rgba(0,0,0,0.07);
    --shadow:     0 0.5rem 2rem rgba(0,0,0,0.10);
    --shadow-lg:  0 1.25rem 3.75rem rgba(0,0,0,0.14);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

/* Vloeiende cross-fade tussen pagina's (Chrome view transitions) */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation-duration: 0.4s; }
::view-transition-new(root) { animation-duration: 0.55s; }

html {
    /* 16px at 1920 wide; scales linearly with viewport width */
    font-size: clamp(8px, 0.83333vw, 36px);
}

html, body {
    height: 100%;
    font-family: -apple-system, "SF Pro Display", "Segoe UI", system-ui, sans-serif;
    background: var(--bg);
    color: var(--ink);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

/* ---- Shell ------------------------------------------------------------ */

.kiosk {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* ---- Top bar ---------------------------------------------------------- */

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 3.75rem;
    height: 5.5rem;
    background: rgba(245,245,247,0.85);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--border);
    position: relative;
    z-index: 10;
    flex-shrink: 0;
}

.brand {
    font-size: 1.375rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.brand-icon {
    width: 2.25rem;
    height: 2.25rem;
    background: var(--ink);
    border-radius: 0.625rem;
    display: grid;
    place-items: center;
}
.brand-icon svg { width: 1.375rem; height: 1.375rem; color: #fff; }

.home-btn {
    width: 3.25rem; height: 3.25rem;
    border-radius: 50%;
    background: var(--surface);
    color: var(--ink-2);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: transform 0.15s, background 0.15s;
}
.home-btn svg { width: 1.375rem; height: 1.375rem; }
.home-btn:active { transform: scale(0.9); background: var(--bg); }

.lang-switch { display: flex; gap: 0.5rem; }
.lang-btn {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.625rem 1.125rem;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: var(--ink-2);
    font-size: 0.9375rem;
    font-weight: 500;
    transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.lang-btn .flag { width: 1.625rem; height: 1.0625rem; border-radius: 0.25rem; overflow: hidden; }
.lang-btn.active { border-color: var(--accent); background: var(--accent-bg); color: var(--accent); }
.lang-btn:active { transform: scale(0.95); }

/* ---- Stage ------------------------------------------------------------ */

.stage {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 4.5rem 0;
    min-height: 0;
}

.page-heading {
    font-size: 3.25rem;
    font-weight: 700;
    letter-spacing: -0.028em;
    text-align: center;
    line-height: 1.1;
    margin-bottom: 0.625rem;
}

.page-sub {
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--ink-3);
    text-align: center;
    margin-bottom: 2rem;
    letter-spacing: -0.01em;
}

.page-text {
    font-size: 1.25rem;
    color: var(--ink-3);
    text-align: center;
    line-height: 1.6;
    max-width: 47.5rem;
    letter-spacing: -0.01em;
}

/* ---- Buttons ---------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    border: none;
    border-radius: 999px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    letter-spacing: -0.01em;
    transition: transform 0.15s, opacity 0.15s, background 0.15s;
}

.btn-big {
    font-size: 1.125rem;
    padding: 0 2.25rem;
    height: 3.75rem;
    min-width: 10rem;
}

.btn .icon { width: 1.25rem; height: 1.25rem; flex-shrink: 0; }

.btn-primary {
    background: var(--ink);
    color: #fff;
}
.btn-primary:active { transform: scale(0.96); opacity: 0.9; }

.btn-secondary {
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--border-med);
    box-shadow: var(--shadow-sm);
}
.btn-secondary:active { transform: scale(0.96); }

.btn:disabled { opacity: 0.35; cursor: default; pointer-events: none; }

/* ---- Bottom bar ------------------------------------------------------- */

.bottombar {
    padding: 2.25rem 4.5rem 2.5rem;
    flex-shrink: 0;
}

.nav-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.nav-center { justify-content: center; }

/* ---- Start page ------------------------------------------------------- */

.start-page {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: fade-up 0.5s ease both;
}

.start-page .page-heading { font-size: 4.5rem; letter-spacing: -0.035em; margin-bottom: 1.25rem; }

.start-eyebrow {
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 1rem;
}

.start-text { margin: 0 auto; max-width: 42.5rem; }

@keyframes fade-up {
    from { opacity: 0; transform: translateY(1.25rem); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- Choice cards ----------------------------------------------------- */

#choice-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    flex: 1;
    min-height: 0;
}

.card-grid {
    display: grid;
    gap: 1rem;
    width: 100%;
    flex: 1;
    min-height: 0;
    grid-auto-rows: min-content;
    justify-content: center;
    align-content: center;
    margin-bottom: 1.25rem;
    animation: fade-up 0.4s ease both;
}

/* Square image frames. The cell side is the column width and the image height,
   so the picture area is always a perfect square. It is bounded by viewport
   height (vh) so every row — plus its label — fits on a widescreen kiosk, and
   by rem so the cards never grow absurdly large on tall screens. The grid only
   gets ~62vh of height (heading, sub and nav take the rest), so for the 3-row
   style grid each cell stays ~15vh. */
.grid-4 {
    grid-template-columns: repeat(4, var(--cell));
    --cell: min(18rem, 15vh);
}
.grid-3 {
    grid-template-columns: repeat(3, var(--cell));
    --cell: min(24rem, 32vh);
}

.choice-card {
    position: relative;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    font-family: inherit;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.choice-card img {
    width: var(--cell);
    height: var(--cell);
    object-fit: cover;
    display: block;
    pointer-events: none;
}

.card-label { flex-shrink: 0; }

.card-label {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--ink);
    padding: 0.75rem 0.875rem;
    text-align: center;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.choice-card:active { transform: scale(0.97); }

.choice-card.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 0.1875rem var(--accent-bg), var(--shadow);
    transform: translateY(-0.1875rem);
}

.card-check {
    position: absolute;
    top: 0.75rem; right: 0.75rem;
    width: 2.125rem; height: 2.125rem;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: grid;
    place-items: center;
    opacity: 0;
    transform: scale(0.4);
    transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.card-check svg { width: 1.125rem; height: 1.125rem; }
.choice-card.selected .card-check { opacity: 1; transform: scale(1); }

/* ---- Toast ------------------------------------------------------------ */

.toast {
    position: fixed;
    left: 50%;
    bottom: 8.75rem;
    transform: translate(-50%, 1rem);
    background: var(--ink);
    color: #fff;
    font-size: 1rem;
    font-weight: 500;
    padding: 0.875rem 1.75rem;
    border-radius: 999px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
    z-index: 100;
    white-space: nowrap;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

/* ---- Capture page ----------------------------------------------------- */

.capture-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
}

.camera-frame {
    position: relative;
    width: min(40rem, 60vh);
    aspect-ratio: 1 / 1;
    border-radius: var(--radius-lg);
    background: #0a0a0a;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255,255,255,0.08);
}

.camera-frame video,
.camera-frame img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-message {
    color: rgba(255,255,255,0.6);
    font-size: 1rem;
    font-weight: 400;
    text-align: center;
    padding: 0 3rem;
    line-height: 1.5;
    position: relative;
}

.accepted-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: #fff;
    font-size: 1.25rem;
    font-weight: 600;
}

.accepted-badge {
    width: 5rem; height: 5rem;
    border-radius: 50%;
    background: var(--green);
    color: #fff;
    display: grid;
    place-items: center;
    animation: check-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.accepted-badge svg { width: 2.75rem; height: 2.75rem; }

@keyframes check-pop {
    from { transform: scale(0.3); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.capture-controls {
    display: flex;
    gap: 0.75rem;
}

.upload-label { cursor: pointer; }

/* ---- Generate page ---------------------------------------------------- */

.generate-page { text-align: center; }

/* Huis-loader: een gradiënt-lichtspoor tekent doorlopend de contour van een huis */
.house-loader {
    width: 12rem; height: 12rem;
    margin: 0 auto 2.5rem;
    animation: orb-breathe 3.4s ease-in-out infinite;
}

.house-loader svg { width: 100%; height: 100%; overflow: visible; }

.house-base, .house-door {
    fill: none;
    stroke: rgba(0,0,0,0.09);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.house-door {
    stroke-dasharray: 100;
    stroke-dashoffset: 0;
    animation: door-pulse 4.2s ease-in-out infinite;
}

.house-trace {
    fill: none;
    stroke: url(#house-grad);
    stroke-width: 3.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 32 68;
    animation: house-trace 2.4s linear infinite;
}

.house-trace-glow {
    stroke-width: 7;
    filter: blur(0.4rem);
    opacity: 0.65;
}

@keyframes house-trace {
    from { stroke-dashoffset: 100; }
    to   { stroke-dashoffset: 0; }
}

@keyframes door-pulse {
    0%, 100% { stroke: rgba(0,0,0,0.09); }
    50%      { stroke: rgba(177,109,255,0.45); }
}

@keyframes orb-breathe {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.04); }
}

.generate-text {
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--ink-2);
    letter-spacing: -0.02em;
}

.generate-status {
    margin-top: 0.875rem;
    font-size: 1.0625rem;
    font-weight: 400;
    color: var(--ink-3);
    letter-spacing: -0.01em;
    min-height: 1.6em;
    opacity: 0;
    transform: translateY(0.25rem);
    transition: opacity 0.35s ease, transform 0.35s ease;
}
.generate-status.status-visible {
    opacity: 1;
    transform: translateY(0);
}

.dots span { animation: blink 1.4s infinite both; }
.dots span:nth-child(2) { animation-delay: 0.2s; }
.dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0; } 40% { opacity: 1; } }

.error-badge {
    width: 4.5rem; height: 4.5rem;
    margin: 0 auto 1.25rem;
    border-radius: 50%;
    background: #fff0ef;
    color: var(--red);
    display: grid;
    place-items: center;
}
.error-badge svg { width: 2.25rem; height: 2.25rem; }
#generate-error .page-heading { font-size: 2.25rem; }
#generate-error .page-text { font-size: 1.125rem; }
#generate-error .nav-buttons { margin-top: 1.75rem; }

/* ---- Result page ------------------------------------------------------ */

.result-page {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5rem;
    width: 100%;
    max-width: 87.5rem;
    animation: fade-up 0.45s ease both;
}

.result-text-col {
    flex: 0 0 20rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1.25rem;
}
.result-text-col .page-heading { text-align: left; font-size: 2.75rem; }
.result-text-col .page-sub { text-align: left; margin-bottom: 0; font-size: 1.125rem; }

.result-image-col { flex: 0 0 auto; }

.result-image {
    width: min(43.75rem, 62vh);
    height: min(43.75rem, 62vh);
    object-fit: cover;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: block;
    background: var(--surface);
}

/* ---- Login -------------------------------------------------------------- */

.login-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
}

.login-form {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 26rem;
    margin-top: 2.5rem;
    padding: 2.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    text-align: left;
}

.login-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink-2);
    margin: 0 0 0.5rem 0.25rem;
}

.login-input {
    font: inherit;
    font-size: 1.125rem;
    color: var(--ink);
    background: var(--bg);
    border: 1px solid var(--border-med);
    border-radius: var(--radius-sm);
    padding: 0.875rem 1rem;
    margin-bottom: 1.5rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.login-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 0.25rem var(--accent-bg);
}

.login-error {
    color: var(--red);
    font-size: 1rem;
    font-weight: 600;
    margin: -0.5rem 0 1rem;
    text-align: center;
}

.login-submit {
    justify-content: center;
    margin-top: 0.25rem;
}
