/* === Reset === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* === Design Tokens === */
:root {
    --black: #000;
    --white: #fff;
    --gray: #888;
    --gray-light: #eee;
    --gray-bg: #f5f5f5;
    --red: #c00;
    --font: system-ui, -apple-system, sans-serif;
    --space-xs: 8px;
    --space-sm: 16px;
    --space-md: 24px;
    --space-lg: 32px;
    --space-xl: 48px;
}

/* === Base === */
html {
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    color: var(--black);
    background: var(--white);
    -webkit-font-smoothing: antialiased;
}

body {
    min-height: 100dvh;
}

a {
    color: var(--black);
}

/* === Layout === */
.container {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 0 var(--space-sm);
}

/* === Screen: Splash === */
.splash {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    text-align: center;
    padding: var(--space-sm);
}

.splash-title {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    font-weight: 300;
    letter-spacing: -0.02em;
    text-transform: lowercase;
}

.splash-subtitle {
    color: var(--gray);
    font-size: 14px;
    margin-top: var(--space-xs);
}

/* === Buttons === */
.btn {
    display: block;
    width: 100%;
    height: 56px;
    border: none;
    background: var(--black);
    color: var(--white);
    font-family: var(--font);
    font-size: 16px;
    cursor: pointer;
    text-align: center;
    line-height: 56px;
    padding: 0;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.btn:disabled {
    background: var(--gray-light);
    color: var(--gray);
    cursor: default;
}

.btn--outline {
    background: var(--white);
    color: var(--black);
    border: 1px solid var(--black);
    height: 48px;
    line-height: 48px;
}

/* === Loading dots === */
.btn--loading .btn-label { display: none; }
.btn--loading .btn-dots { display: inline; }
.btn-dots { display: none; }

.btn-dots::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* === Screen Header === */
.screen-header {
    display: flex;
    align-items: center;
    height: var(--space-xl);
    position: relative;
}

.back-btn {
    position: absolute;
    left: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--black);
    -webkit-tap-highlight-color: transparent;
}

.screen-title {
    width: 100%;
    text-align: center;
    font-size: 16px;
    font-weight: 400;
    text-transform: lowercase;
}

/* === Stepper === */
.stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    margin: var(--space-md) 0;
}

.stepper-btn {
    width: 48px;
    height: 48px;
    border: 1px solid var(--black);
    background: var(--white);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.stepper-value {
    font-size: 32px;
    min-width: 48px;
    text-align: center;
}

/* === Chips === */
.chips {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xs);
    margin: var(--space-md) 0;
}

.chip {
    height: 48px;
    border: 1px solid var(--black);
    background: var(--white);
    color: var(--black);
    font-family: var(--font);
    font-size: 14px;
    cursor: pointer;
    text-transform: lowercase;
    -webkit-tap-highlight-color: transparent;
}

.chip[aria-pressed="true"] {
    background: var(--black);
    color: var(--white);
}

/* === Section Labels === */
.label {
    color: var(--gray);
    font-size: 14px;
    margin-bottom: var(--space-xs);
}

/* === Error === */
.error {
    color: var(--red);
    font-size: 14px;
    margin-top: var(--space-xs);
}

/* === Context Line === */
.context-line {
    color: var(--gray);
    font-size: 14px;
    margin-bottom: var(--space-md);
}

/* === Recipe Cards === */
.card-stack {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.card {
    background: var(--gray-bg);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.card-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.card-img-fallback {
    width: 100%;
    height: 200px;
    background: var(--gray-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--black);
}

.card-body {
    padding: var(--space-sm);
}

.card-title {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: var(--space-xs);
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.tag {
    font-size: 12px;
    padding: 2px 8px;
    border: 1px solid var(--black);
}

/* === Recipe Detail === */
.detail-img {
    width: 100%;
    height: 240px;
    object-fit: cover;
    display: block;
}

.detail-img-fallback {
    width: 100%;
    height: 240px;
    background: var(--gray-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.detail-title {
    font-size: 24px;
    font-weight: 300;
    margin-top: var(--space-md);
}

.detail-meta {
    color: var(--gray);
    font-size: 14px;
    margin-top: var(--space-xs);
    margin-bottom: var(--space-lg);
}

.section-heading {
    font-size: 14px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: var(--space-xs);
}

.section-sub {
    color: var(--gray);
    font-size: 14px;
    margin-bottom: var(--space-sm);
}

.ingredient-list {
    list-style: none;
    margin-bottom: var(--space-lg);
}

.ingredient-list li {
    padding: var(--space-xs) 0;
    border-bottom: 1px solid var(--gray-light);
    font-size: 15px;
}

.step-list {
    list-style: none;
    counter-reset: steps;
    margin-bottom: var(--space-lg);
}

.step-list li {
    counter-increment: steps;
    padding-bottom: var(--space-sm);
    font-size: 15px;
    line-height: 1.6;
}

.step-list li::before {
    content: counter(steps);
    font-weight: 700;
    margin-right: var(--space-xs);
}

/* === Empty State === */
.empty {
    text-align: center;
    color: var(--gray);
    padding: var(--space-xl) 0;
}

/* === Spacing Utilities === */
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }

/* === Fade-in Transition === */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 200ms ease;
}
