/* ─── Variables ─────────────────────────────────────────────── */
:root {
    --bg:        #141210;
    --bg-card:   #1c1917;
    --border:    #2e2a26;
    --text:      #e8e0d4;
    --muted:     #7a7065;
    --accent:    #c9a84c;
    --accent-dim:#8a6e2f;
    --danger:    #c0614a;
    --font-serif: 'Cormorant Garamond', Georgia, serif;
    --font-mono:  'DM Mono', 'Courier New', monospace;
}

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

/* ─── Base ───────────────────────────────────────────────────── */
html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-serif);
    font-weight: 300;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    cursor: default;
}

/* ─── Grain overlay ──────────────────────────────────────────── */
.grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 100;
    opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-size: 200px 200px;
}

/* ─── Header ─────────────────────────────────────────────────── */
.site-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 40px;
    animation: fadeDown 0.8s ease both;
}

.header-rule {
    flex: 1;
    height: 1px;
    background: var(--border);
}

.header-tag {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    color: var(--muted);
    text-transform: uppercase;
    white-space: nowrap;
}

/* ─── Container ──────────────────────────────────────────────── */
.container {
    flex: 1;
    max-width: 860px;
    margin: 0 auto;
    padding: 0 32px 80px;
    width: 100%;
}

/* ─── Hero ───────────────────────────────────────────────────── */
.hero {
    text-align: center;
    padding: 48px 0 56px;
    animation: fadeUp 0.9s ease 0.1s both;
}

.eyebrow {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    color: var(--accent);
    text-transform: uppercase;
    margin-bottom: 14px;
}

h1 {
    font-family: var(--font-serif);
    font-size: clamp(4rem, 10vw, 7rem);
    font-weight: 300;
    line-height: 0.95;
    letter-spacing: -0.02em;
    color: var(--text);
    margin-bottom: 18px;
    font-style: italic;
}

.subtitle {
    font-size: 1.15rem;
    color: var(--muted);
    font-weight: 300;
    letter-spacing: 0.01em;
}

/* ─── Search section ─────────────────────────────────────────── */
.search-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
    animation: fadeUp 0.9s ease 0.2s both;
}

.search-box {
    border: 1px solid var(--border);
    border-radius: 2px;
    padding: 20px 24px 16px;
    background: var(--bg-card);
    transition: border-color 0.25s ease;
    position: relative;
}

.search-box:focus-within {
    border-color: var(--accent-dim);
}

.field-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    letter-spacing: 0.2em;
    color: var(--accent);
    margin-bottom: 12px;
}

textarea {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    color: var(--text);
    font-family: var(--font-serif);
    font-size: 1.25rem;
    font-weight: 300;
    line-height: 1.6;
    min-height: 80px;
    caret-color: var(--accent);
}

textarea::placeholder {
    color: var(--muted);
    font-style: italic;
    opacity: 0.6;
}

.field-hint {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--muted);
    letter-spacing: 0.05em;
    margin-top: 8px;
    opacity: 0.6;
}

/* ─── Button ─────────────────────────────────────────────────── */
.recommend-btn {
    align-self: flex-end;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--accent);
    color: var(--bg);
    border: none;
    padding: 14px 28px;
    border-radius: 2px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease, gap 0.2s ease;
}

.recommend-btn:hover {
    background: #d9b85c;
    gap: 18px;
    transform: translateY(-1px);
}

.recommend-btn:active {
    transform: translateY(0);
}

.btn-arrow {
    font-size: 1rem;
    transition: transform 0.2s ease;
}

.recommend-btn:hover .btn-arrow {
    transform: translateX(3px);
}

/* ─── Loading ────────────────────────────────────────────────── */
.loading {
    text-align: center;
    padding: 60px 0;
    color: var(--muted);
    font-style: italic;
    font-size: 1rem;
    animation: fadeUp 0.4s ease both;
}

.loading-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 16px;
}

.loading-dots span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent);
    animation: pulse 1.2s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

/* ─── Results ────────────────────────────────────────────────── */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1px;
    background: var(--border);
    margin-top: 48px;
    border: 1px solid var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.meal-card {
    background: var(--bg-card);
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: background 0.2s ease;
    animation: fadeUp 0.5s ease both;
}

.meal-card:hover {
    background: #211e1a;
}

.meal-number {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    letter-spacing: 0.15em;
    color: var(--accent);
}

.meal-name {
    font-size: 1.45rem;
    font-weight: 400;
    line-height: 1.2;
    color: var(--text);
}

.meal-match {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--muted);
    letter-spacing: 0.05em;
}

.match-bar-wrap {
    height: 2px;
    background: var(--border);
    border-radius: 1px;
    overflow: hidden;
    margin-top: 4px;
}

.match-bar {
    height: 100%;
    background: var(--accent);
    border-radius: 1px;
    transition: width 0.8s ease;
}

/* ─── Footer ─────────────────────────────────────────────────── */
.site-footer {
    text-align: center;
    padding: 24px;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    letter-spacing: 0.12em;
    color: var(--muted);
    border-top: 1px solid var(--border);
    opacity: 0.5;
}

.footer-divider { margin: 0 10px; }

.footer-link {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid var(--accent-dim);
    transition: color 0.2s ease, border-color 0.2s ease;
}

.footer-link:hover {
    color: #d9b85c;
    border-color: #d9b85c;
}

/* ─── Utilities ──────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ─── Animations ─────────────────────────────────────────────── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeDown {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40%           { transform: scale(1);   opacity: 1; }
}

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 600px) {
    .site-header { padding: 16px 20px; }
    .container   { padding: 0 20px 60px; }
    .hero        { padding: 32px 0 40px; }
    .recommend-btn { align-self: stretch; justify-content: center; }
    .results-grid  { grid-template-columns: 1fr; }
}