/*
 * ATLAS DISCOVER — FOUNDER-APPROVED MOBILE RENDER
 * Final measured implementation.
 * Primary acceptance viewport: 390 × 844 CSS pixels.
 *
 * This file intentionally resets inherited Discover and shell geometry.
 * Do not merge it into generic card or layout classes.
 */

:root {
    --d-bg: #fbfaf8;
    --d-card: rgba(255, 255, 255, 0.94);
    --d-text: #101010;
    --d-muted: #555d69;
    --d-line: rgba(18, 18, 18, 0.075);
    --d-green: #3f9738;
    --d-blue: #236cff;
    --d-violet: #7056f5;
    --d-radius: 12px;
    --d-shadow: 0 6px 16px rgba(30, 29, 27, 0.055);
    --d-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
    --d-sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body:has(.main-content--discover) {
    min-width: 0;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 72% 7%, rgba(255,255,255,.98), transparent 23rem),
        linear-gradient(180deg, #fdfcfb 0%, var(--d-bg) 100%);
    color: var(--d-text);
}

body:has(.main-content--discover) .primary-navigation,
body:has(.main-content--discover) .atlas-footer--discover,
body:has(.main-content--discover) .mobile-brand,
body:has(.main-content--discover) .app-header-search,
body:has(.main-content--discover) .header-icon-link {
    display: none;
}

body:has(.main-content--discover) .app-shell,
body:has(.main-content--discover) .app-frame {
    display: block;
    min-width: 0;
    min-height: 100dvh;
}

body:has(.main-content--discover) .app-header {
    position: absolute;
    z-index: 20;
    top: max(12px, env(safe-area-inset-top));
    right: 16px;
    display: block;
    width: 34px;
    min-height: 34px;
    padding: 0;
    border: 0;
    background: transparent;
}

body:has(.main-content--discover) .header-links {
    display: block;
    width: 34px;
    margin: 0;
}

body:has(.main-content--discover) .header-avatar {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: rgba(18,18,18,.055);
    color: var(--d-text);
    font-size: 10px;
    font-weight: 500;
    text-decoration: none;
}

.main-content--discover {
    width: min(100%, 832px);
    min-width: 0;
    margin: 0 auto;
    padding: max(8px, env(safe-area-inset-top)) 16px calc(53px + env(safe-area-inset-bottom));
}

.main-content--discover .discover-page,
.main-content--discover .discover-page * {
    box-sizing: border-box;
}

.main-content--discover .discover-page {
    display: grid;
    min-width: 0;
    gap: 0;
    font-family: var(--d-sans);
}

/* 18–105: hero */
.main-content--discover .discover-hero {
    display: block;
    height: 88px;
    padding: 0 4px;
}

.main-content--discover .discover-hero h1 {
    margin: 0;
    color: var(--d-text);
    font-family: var(--d-serif);
    font-size: 38px;
    font-weight: 500;
    line-height: .92;
    letter-spacing: -2.15px;
}

.main-content--discover .discover-hero__proposition {
    margin: 7px 0 0;
    color: var(--d-muted);
    font-size: 10.5px;
    line-height: 1.3;
}

.main-content--discover .discover-hero__monitoring {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 1px 0 0;
    color: var(--d-muted);
    font-size: 8.8px;
    line-height: 1.2;
}

.main-content--discover .discover-hero__monitoring > span {
    width: 5px;
    height: 5px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--d-green);
}

/* 112–168: search */
.main-content--discover .discover-search {
    position: relative;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) 36px;
    align-items: center;
    gap: 8px;
    height: 57px;
    margin: 0;
    padding: 8px 10px 8px 13px;
    border: 1px solid var(--d-line);
    border-radius: 13px;
    background: var(--d-card);
    box-shadow: var(--d-shadow);
}

.main-content--discover .discover-search__icon {
    display: grid;
    place-items: center;
}

.main-content--discover .discover-search__icon svg {
    width: 31px;
    height: 31px;
    fill: none;
    stroke: #535b66;
    stroke-width: 1.55;
    stroke-linecap: round;
}

.main-content--discover .discover-search__copy {
    display: grid;
    min-width: 0;
    gap: 3px;
    pointer-events: none;
}

.main-content--discover .discover-search__copy label {
    position: static;
    overflow: hidden;
    color: #535b66;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.18;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.main-content--discover .discover-search__copy > span {
    color: var(--d-muted);
    font-size: 8.2px;
    line-height: 1.2;
}

.main-content--discover .discover-search input {
    position: absolute;
    z-index: 1;
    inset: 0 52px 0 52px;
    width: auto;
    border: 0;
    outline: 0;
    background: transparent;
    color: transparent;
    caret-color: var(--d-text);
    font-size: 16px;
}

.main-content--discover .discover-search:focus-within .discover-search__copy {
    opacity: .35;
}

.main-content--discover .discover-search button {
    position: relative;
    z-index: 2;
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    padding: 0;
    border: 1px solid var(--d-line);
    border-radius: 50%;
    background: rgba(255,255,255,.88);
    color: var(--d-text);
}

.main-content--discover .discover-search button svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* 179–214: insight */
.main-content--discover .discover-insight {
    display: grid;
    grid-template-columns: 18px minmax(0,1fr) 18px;
    align-items: center;
    gap: 7px;
    height: 36px;
    margin-top: 8px;
    padding: 6px 11px;
    border: 1px solid var(--d-line);
    border-radius: 10px;
    background: rgba(255,255,255,.84);
    box-shadow: 0 3px 10px rgba(30,29,27,.025);
}

.main-content--discover .discover-insight__icon {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: var(--d-text);
    stroke-width: 1.35;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.main-content--discover .discover-insight p {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    color: var(--d-text);
    font-size: 8.15px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.main-content--discover .discover-insight p strong {
    font-weight: 750;
}

.main-content--discover .discover-insight a {
    display: grid;
    place-items: center;
    color: var(--d-text);
}

.main-content--discover .discover-insight a svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* 235–432: journeys */
.main-content--discover .discover-journeys {
    min-width: 0;
    margin-top: 11px;
}

.main-content--discover .discover-section-heading {
    display: flex;
    height: 21px;
    align-items: baseline;
    justify-content: space-between;
    padding: 0 2px;
}

.main-content--discover .discover-section-heading h2,
.main-content--discover .discover-expand h2 {
    margin: 0;
    color: var(--d-text);
    font-family: var(--d-serif);
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    letter-spacing: -.25px;
}

.main-content--discover .discover-section-heading a {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: var(--d-muted);
    font-size: 7.7px;
    text-decoration: none;
}

.main-content--discover .discover-section-heading a svg {
    width: 11px;
    height: 11px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.65;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.main-content--discover .journey-carousel {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
    min-width: 0;
    margin-top: 3px;
    overflow: visible;
}

.main-content--discover .journey-card {
    position: relative;
    display: block;
    min-width: 0;
    height: 174px;
    overflow: hidden;
    padding: 14px 10px 10px;
    border: 1px solid var(--d-line);
    border-left: 1px solid var(--d-green);
    border-radius: 12px;
    background: rgba(255,255,255,.92);
    box-shadow: var(--d-shadow);
    color: var(--d-text);
    text-decoration: none;
}

.main-content--discover .journey-card[data-tone="information"] {
    border-left-color: var(--d-blue);
}

.main-content--discover .journey-card:nth-child(3) {
    border-left-color: var(--d-violet);
}

.main-content--discover .journey-card h3 {
    position: relative;
    z-index: 3;
    max-width: 92px;
    margin: 0;
    color: var(--d-text);
    font-size: 9.3px;
    font-weight: 700;
    line-height: 1.25;
}

.main-content--discover .journey-card__status {
    position: relative;
    z-index: 3;
    display: flex;
    max-width: 90px;
    align-items: flex-start;
    gap: 5px;
    margin: 7px 0 0;
    color: var(--d-muted);
    font-size: 6.9px;
    line-height: 1.35;
}

.main-content--discover .journey-card:first-child .journey-card__status {
    color: var(--d-green);
}

.main-content--discover .journey-card__status > span {
    width: 5px;
    height: 5px;
    flex: 0 0 auto;
    margin-top: 2px;
    border-radius: 50%;
    background: currentColor;
}

.main-content--discover .journey-card__image {
    position: absolute;
    z-index: 1;
    right: -8px;
    bottom: 23px;
    width: 75%;
    height: 64%;
    object-fit: contain;
    object-position: right bottom;
    filter: drop-shadow(0 5px 5px rgba(0,0,0,.12));
    pointer-events: none;
}

.main-content--discover .journey-card:nth-child(2) .journey-card__image {
    right: -12px;
    width: 84%;
    height: 66%;
}

.main-content--discover .journey-card:nth-child(3) .journey-card__image {
    right: 4px;
    bottom: 34px;
    width: 78%;
    height: 45%;
}

.main-content--discover .journey-card__count {
    position: absolute;
    z-index: 3;
    left: 10px;
    bottom: 46px;
    display: grid;
    width: 40%;
    gap: 2px;
    margin: 0;
}

.main-content--discover .journey-card__count strong {
    color: var(--d-text);
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
}

.main-content--discover .journey-card__count span {
    color: var(--d-muted);
    font-size: 6.4px;
    line-height: 1.35;
}

.main-content--discover .journey-card > small {
    position: absolute;
    z-index: 3;
    left: 10px;
    bottom: 10px;
    color: var(--d-muted);
    font-size: 6.5px;
    line-height: 1;
}

.main-content--discover .journey-dots {
    display: flex;
    height: 14px;
    align-items: end;
    justify-content: center;
    gap: 5px;
}

.main-content--discover .journey-dots span {
    width: 10px;
    height: 2.5px;
    border-radius: 999px;
    background: rgba(18,18,18,.09);
}

.main-content--discover .journey-dots .is-active {
    background: var(--d-text);
}

/* 445–597: goal */
.main-content--discover .discover-goal {
    margin-top: 8px;
}

.main-content--discover .goal-card,
.main-content--discover .update-card {
    border: 1px solid var(--d-line);
    border-radius: 13px;
    background: var(--d-card);
    box-shadow: var(--d-shadow);
}

.main-content--discover .goal-card {
    height: 154px;
    padding: 12px;
}

.main-content--discover .goal-card__heading {
    display: flex;
    height: 20px;
    align-items: center;
    justify-content: space-between;
}

.main-content--discover .goal-card__heading h2 {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0;
    color: var(--d-text);
    font-family: var(--d-serif);
    font-size: 14px;
    font-weight: 500;
}

.main-content--discover .goal-card__target {
    display: grid;
    width: 21px;
    height: 21px;
    place-items: center;
    border-radius: 50%;
    background: rgba(63,151,56,.08);
    color: var(--d-green);
}

.main-content--discover .goal-card__target svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.45;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.main-content--discover .goal-card__heading > a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--d-text);
    font-size: 7.6px;
    text-decoration: none;
}

.main-content--discover .goal-card__heading > a svg {
    width: 11px;
    height: 11px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.55;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.main-content--discover .goal-card__layout {
    display: grid;
    grid-template-columns: minmax(0,1fr) 106px;
    gap: 12px;
    height: 110px;
    margin-top: 9px;
}

.main-content--discover .goal-card__main {
    min-width: 0;
}

.main-content--discover .goal-card__summary {
    display: grid;
    grid-template-columns: minmax(0,1fr) 55px;
    align-items: end;
    gap: 8px;
}

.main-content--discover .goal-card__summary h3 {
    max-width: 150px;
    margin: 0;
    color: var(--d-text);
    font-size: 11px;
    font-weight: 650;
    line-height: 1.3;
}

.main-content--discover .goal-card__percentage {
    margin: 0;
    color: var(--d-muted);
    font-size: 7px;
    line-height: 1.2;
}

.main-content--discover .goal-card__percentage strong {
    display: block;
    color: var(--d-green);
    font-size: 20px;
    font-weight: 500;
    line-height: .95;
}

.main-content--discover .goal-card__percentage span {
    display: block;
    margin-top: 4px;
}

.main-content--discover .goal-progress {
    width: calc(100% - 59px);
    height: 4px;
    margin-top: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(18,18,18,.055);
}

.main-content--discover .goal-progress > span {
    display: block;
    width: var(--goal-progress);
    height: 100%;
    border-radius: inherit;
    background: var(--d-green);
}

.main-content--discover .goal-signals {
    display: grid;
    grid-template-columns: 1.05fr .9fr 1.25fr;
    gap: 7px;
    margin: 14px 0 0;
}

.main-content--discover .goal-signals > div {
    position: relative;
    display: grid;
    min-width: 0;
    grid-template-columns: 17px minmax(0,1fr);
    column-gap: 5px;
    align-items: start;
}

.main-content--discover .goal-signals svg {
    grid-row: 1 / span 2;
    width: 14px;
    height: 14px;
    fill: none;
    stroke: #46505c;
    stroke-width: 1.45;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.main-content--discover .goal-signals dd {
    min-width: 0;
    margin: 0;
    color: var(--d-text);
    font-size: 10px;
    font-weight: 700;
    line-height: 1.1;
}

.main-content--discover .goal-signals dt {
    min-width: 0;
    margin-top: 3px;
    color: var(--d-muted);
    font-size: 6.2px;
    line-height: 1.3;
}

.main-content--discover .goal-signals__market dd {
    color: var(--d-green);
    font-size: 7.6px;
    line-height: 1.25;
}

.main-content--discover .goal-signals__market dt {
    font-size: 6.2px;
}

.main-content--discover .goal-saving {
    display: flex;
    min-width: 0;
    flex-direction: column;
    justify-content: center;
    padding: 12px;
    border-radius: 10px;
    background: #f1f3ee;
}

.main-content--discover .goal-saving > span {
    color: var(--d-text);
    font-size: 7.5px;
    line-height: 1.45;
}

.main-content--discover .goal-saving strong {
    margin: 10px 0 4px;
    color: var(--d-green);
    font-size: 25px;
    font-weight: 500;
    line-height: 1;
}

.main-content--discover .goal-saving small {
    color: var(--d-muted);
    font-size: 6.5px;
}

/* 607–739: update */
.main-content--discover .discover-update {
    margin-top: 9px;
}

.main-content--discover .update-card {
    height: 134px;
    padding: 12px;
}

.main-content--discover .update-card__heading {
    display: flex;
    align-items: center;
    gap: 8px;
}

.main-content--discover .update-card__heading > span {
    display: grid;
    width: 24px;
    height: 24px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    background: rgba(18,18,18,.025);
}

.main-content--discover .update-card__heading > span svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: var(--d-text);
    stroke-width: 1.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.main-content--discover .update-card__heading h2 {
    margin: 0;
    color: var(--d-text);
    font-family: var(--d-serif);
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
}

.main-content--discover .update-card__heading p {
    margin: 3px 0 0;
    color: var(--d-muted);
    font-size: 6.7px;
}

.main-content--discover .update-metrics {
    display: grid;
    grid-template-columns: repeat(4,minmax(0,1fr));
    height: 70px;
    margin: 10px 0 0;
}

.main-content--discover .update-metrics > div {
    display: grid;
    min-width: 0;
    align-content: start;
    justify-items: center;
    padding: 0 5px;
    text-align: center;
}

.main-content--discover .update-metrics > div + div {
    border-left: 1px solid var(--d-line);
}

.main-content--discover .update-metrics__icon {
    display: block;
    height: 19px;
}

.main-content--discover .update-metrics__icon svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: #59616c;
    stroke-width: 1.35;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.main-content--discover .update-metrics [data-index="1"] svg,
.main-content--discover .update-metrics [data-index="2"] svg {
    stroke: var(--d-green);
}

.main-content--discover .update-metrics [data-index="3"] svg {
    stroke: var(--d-blue);
}

.main-content--discover .update-metrics dd {
    margin: 3px 0 0;
    color: var(--d-text);
    font-size: 15px;
    font-weight: 500;
    line-height: 1;
}

.main-content--discover .update-metrics dt {
    max-width: 58px;
    margin-top: 5px;
    color: var(--d-muted);
    font-size: 6.2px;
    line-height: 1.35;
}

.main-content--discover .update-card__message {
    margin: 3px 0 0;
    color: var(--d-muted);
    font-size: 6.8px;
}

/* 748–799: categories */
.main-content--discover .discover-expand {
    min-width: 0;
    margin-top: 10px;
}

.main-content--discover .discover-expand h2 {
    padding-left: 2px;
}

.main-content--discover .discover-categories {
    display: grid;
    grid-template-columns: 1.05fr .9fr 1.15fr 1.05fr .9fr 36px;
    gap: 7px;
    min-width: 0;
    margin-top: 8px;
}

.main-content--discover .discover-categories a {
    display: inline-flex;
    min-width: 0;
    height: 28px;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0 7px;
    border: 1px solid var(--d-line);
    border-radius: 999px;
    background: rgba(255,255,255,.9);
    box-shadow: 0 3px 8px rgba(30,29,27,.045);
    color: var(--d-text);
    text-decoration: none;
}

.main-content--discover .discover-categories a svg {
    width: 13px;
    height: 13px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.main-content--discover .discover-categories a span {
    overflow: hidden;
    font-size: 6.7px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 794–844: fixed navigation */
body:has(.main-content--discover) .mobile-navigation {
    position: fixed;
    z-index: 50;
    right: 0;
    bottom: 0;
    left: 0;
    display: block;
    height: calc(49px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--d-line);
    background: rgba(255,255,255,.965);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

body:has(.main-content--discover) .mobile-navigation ul {
    display: grid;
    width: min(100%, 832px);
    height: 49px;
    grid-template-columns: repeat(6,minmax(0,1fr));
    margin: 0 auto;
    padding: 0 8px;
    list-style: none;
}

body:has(.main-content--discover) .mobile-navigation li {
    min-width: 0;
}

body:has(.main-content--discover) .mobile-navigation a {
    position: relative;
    display: flex;
    min-width: 0;
    height: 49px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 3px 1px 5px;
    color: var(--d-muted);
    font-size: 6.4px;
    font-weight: 500;
    line-height: 1;
    text-decoration: none;
}

body:has(.main-content--discover) .mobile-navigation a svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.35;
    stroke-linecap: round;
    stroke-linejoin: round;
}

body:has(.main-content--discover) .mobile-navigation a[aria-current="page"] {
    color: var(--d-blue);
}

body:has(.main-content--discover) .mobile-navigation a[aria-current="page"]::after {
    position: absolute;
    bottom: 2px;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: currentColor;
    content: "";
}

/* Desktop containment only; the approved artefact remains a phone-first surface. */
@media (min-width: 50rem) {
    body:has(.main-content--discover) .primary-navigation {
        display: none;
    }

    .main-content--discover {
        padding-top: 30px;
        padding-right: 32px;
        padding-left: 32px;
    }

    body:has(.main-content--discover) .app-header {
        right: max(24px, calc((100vw - 832px) / 2 + 32px));
    }
}

/* Narrow safety without changing 390px geometry. */
@media (max-width: 23rem) {
    .main-content--discover {
        padding-right: 12px;
        padding-left: 12px;
    }

    .main-content--discover .journey-carousel {
        gap: 6px;
    }

    .main-content--discover .journey-card {
        padding-right: 7px;
        padding-left: 7px;
    }

    .main-content--discover .journey-card h3 {
        font-size: 8.6px;
    }

    .main-content--discover .goal-card__layout {
        grid-template-columns: minmax(0,1fr) 91px;
        gap: 8px;
    }

    .main-content--discover .discover-categories {
        gap: 4px;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .main-content--discover button,
    .main-content--discover a {
        transition: transform 150ms ease;
    }

    .main-content--discover button:active,
    .main-content--discover a:active {
        transform: scale(.985);
    }
}
