/* assets/css/templates/atlas.css — detail-rich, easy scan */
@import url('https://fonts.googleapis.com/css2?family=Literata:ital,opsz,wght@0,7..72,500;0,7..72,600;0,7..72,700;1,7..72,400&family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap');

.tpl-atlas {
    --atlas-bg: #eef6f4;
    --atlas-surface: #ffffff;
    --atlas-ink: #12241f;
    --atlas-muted: #4d635c;
    --atlas-line: #c9ddd6;
    --atlas-teal: #0f766e;
    --atlas-teal-deep: #0a4f4a;
    --atlas-mint: #d8f3eb;
    --atlas-amber: #c27803;
    --accent: var(--atlas-teal);
    --font-display: 'Literata', Georgia, serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;

    background:
        linear-gradient(180deg, #dff0ea 0%, transparent 28%),
        radial-gradient(circle at 90% 8%, rgba(15, 118, 110, 0.1), transparent 40%),
        var(--atlas-bg);
    color: var(--atlas-ink);
    font-family: var(--font-body);
    line-height: 1.55;
    overflow-x: hidden;
    width: 100%;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.tpl-atlas .container {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    padding: 0 1rem;
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
}

@media (min-width: 640px) {
    .tpl-atlas .container {
        padding: 0 1.5rem;
    }
}

.atlas-top-bar {
    padding: 0.85rem 0 0;
    position: relative;
    z-index: 50;
}

.atlas-back {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 44px;
    padding: 0.35rem 0.75rem 0.35rem 0.5rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--atlas-line);
    color: var(--atlas-muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
}

.atlas-back:hover {
    color: var(--atlas-teal);
    border-color: var(--atlas-teal);
}

.atlas-back .icon-back {
    width: 18px;
    height: 18px;
}

/* Header — brand left-aligned for clarity on mobile */
.atlas-header {
    padding: 1.5rem 0 1rem;
}

.atlas-hero {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-align: left;
}

.atlas-logo {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 16px;
    flex-shrink: 0;
    border: 2px solid var(--atlas-surface);
    box-shadow: 0 6px 20px rgba(18, 36, 31, 0.1);
}

.atlas-kicker {
    margin: 0 0 0.2rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--atlas-teal);
}

.atlas-hero-text h1 {
    font-family: var(--font-display);
    font-size: clamp(1.55rem, 5.5vw, 2.25rem);
    font-weight: 600;
    margin: 0 0 0.25rem;
    letter-spacing: -0.02em;
    line-height: 1.2;
    overflow-wrap: break-word;
}

.atlas-tagline {
    margin: 0;
    color: var(--atlas-muted);
    font-size: 0.9rem;
}

/* Sticky chips */
.tpl-atlas .category-nav,
.tpl-atlas .atlas-nav {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0.4rem 0 0.75rem;
    position: sticky;
    top: var(--alvita-sticky-top, 0px);
    z-index: 100;
}

.tpl-atlas .atlas-nav-inner {
    display: flex;
    gap: 0.45rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0.3rem 0;
}

.tpl-atlas .atlas-nav-inner::-webkit-scrollbar {
    display: none;
}

.tpl-atlas .category-nav-link {
    flex: 0 0 auto;
    scroll-snap-align: start;
    min-height: 42px;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    background: var(--atlas-surface);
    border: 1px solid var(--atlas-line);
    color: var(--atlas-ink);
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.tpl-atlas .category-nav-link:hover,
.tpl-atlas .category-nav-link:focus-visible {
    background: var(--atlas-teal);
    color: #fff;
    border-color: var(--atlas-teal);
    outline: none;
}

.tpl-atlas .nav-arrow {
    background: var(--atlas-surface);
    border: 1px solid var(--atlas-line);
    color: var(--atlas-teal-deep);
    box-shadow: 0 2px 8px rgba(18, 36, 31, 0.08);
}

.tpl-atlas .nav-mask-left,
.tpl-atlas .nav-mask-right {
    display: none;
}

@media (max-width: 768px) {
    .tpl-atlas .category-nav,
    .tpl-atlas .atlas-nav {
        background: rgba(238, 246, 244, 0.94);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-bottom: 1px solid var(--atlas-line);
        box-shadow: 0 6px 16px rgba(18, 36, 31, 0.05);
        padding: 0.35rem 0 0.5rem;
    }

    .tpl-atlas .nav-arrow {
        display: none;
    }
}

.atlas-main {
    padding-bottom: calc(5rem + env(safe-area-inset-bottom));
}

.atlas-section {
    scroll-margin-top: calc(var(--alvita-sticky-top, 0px) + 4.5rem);
    padding: 1.35rem 0 0.25rem;
}

.atlas-section-head {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 0.9rem;
}

.atlas-section-head h2 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0;
    flex-shrink: 0;
}

.atlas-rule {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--atlas-line), transparent);
}

.atlas-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Dense but readable detail rows */
.atlas-item {
    background: var(--atlas-surface);
    border: 1px solid var(--atlas-line);
    border-radius: 16px;
    padding: 0.9rem;
    box-shadow: 0 3px 12px rgba(18, 36, 31, 0.04);
}

.atlas-item-row {
    display: grid;
    grid-template-columns: 88px 1fr;
    gap: 0.85rem;
    align-items: start;
}

.atlas-item.no-image .atlas-item-row {
    grid-template-columns: 1fr;
}

.atlas-item-media {
    width: 88px;
    height: 88px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--atlas-mint);
}

.atlas-item-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.atlas-item-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.atlas-item-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.atlas-item-title-row h3 {
    margin: 0;
    font-size: 1.02rem;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.01em;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.atlas-price {
    flex-shrink: 0;
    font-weight: 700;
    font-size: 0.98rem;
    color: var(--atlas-teal-deep);
    background: var(--atlas-mint);
    padding: 0.28rem 0.55rem;
    border-radius: 8px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.atlas-desc {
    margin: 0;
    font-size: 0.875rem;
    color: var(--atlas-muted);
    line-height: 1.5;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.atlas-meta-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.tpl-atlas .ingredients {
    font-size: 0.8rem;
    color: var(--atlas-muted);
    background: var(--atlas-bg);
    border-radius: 8px;
    padding: 0.45rem 0.6rem;
    margin: 0;
    line-height: 1.4;
    overflow-wrap: anywhere;
    word-break: break-word;
    hyphens: auto;
}

.tpl-atlas .ingredients strong {
    color: var(--atlas-teal-deep);
}

.tpl-atlas .statuses {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.tpl-atlas .status-pill {
    font-size: 0.72rem;
    padding: 0.28rem 0.55rem;
    border-radius: 8px;
    background: var(--atlas-mint);
    border: 1px solid var(--atlas-line);
    color: var(--atlas-teal-deep);
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.tpl-atlas .macros-details {
    border-radius: 10px;
    border: 1px solid var(--atlas-line);
    background: #f7fbfa;
}

.tpl-atlas .macros-summary {
    min-height: 42px;
    padding: 0.5rem 0.7rem;
    font-size: 0.8rem;
}

.tpl-atlas .macro-main-val {
    color: var(--atlas-amber);
    font-weight: 700;
}

.atlas-item-actions {
    padding-top: 0.25rem;
}

.tpl-atlas .alvita-add-btn {
    min-height: 44px;
    width: 100%;
    border-radius: 11px;
    font-weight: 700;
    font-size: 0.9rem;
    background: var(--atlas-teal);
    color: #fff;
    border: none;
    padding: 0.65rem 1rem;
}

.tpl-atlas .alvita-add-btn:hover,
.tpl-atlas .alvita-add-btn:focus-visible {
    background: var(--atlas-teal-deep);
    outline: none;
}

.atlas-footer {
    padding: 2rem 0 calc(2rem + env(safe-area-inset-bottom));
    text-align: center;
    color: var(--atlas-muted);
    font-size: 0.8rem;
}

.atlas-footer p {
    margin: 0;
}

@media (max-width: 380px) {
    .atlas-item {
        padding: 0.75rem;
    }
    .atlas-item-row {
        grid-template-columns: 76px 1fr;
        gap: 0.65rem;
    }
    .atlas-item-media {
        width: 76px;
        height: 76px;
    }
    .atlas-item-title-row h3 {
        font-size: 0.96rem;
    }
    .atlas-price {
        font-size: 0.9rem;
        padding: 0.2rem 0.45rem;
    }
}

@media (min-width: 640px) {
    .atlas-hero {
        gap: 1.25rem;
    }

    .atlas-logo {
        width: 80px;
        height: 80px;
        border-radius: 18px;
    }

    .atlas-item-row {
        grid-template-columns: 110px 1fr;
        gap: 1.1rem;
    }

    .atlas-item-media {
        width: 110px;
        height: 110px;
        border-radius: 14px;
    }

    .atlas-item-actions {
        display: flex;
        justify-content: flex-end;
    }

    .tpl-atlas .alvita-add-btn {
        width: auto;
        min-width: 148px;
    }
}

@media (min-width: 900px) {
    .tpl-atlas .container {
        max-width: 900px;
    }
}

/* A full-width image prevents the fixed left thumbnail from creating a large
   empty column when an item includes detailed dietary and nutrition content. */
@media (max-width: 520px) {
    .atlas-item-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .atlas-item-media {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
        border-radius: 12px;
    }
}
