/* =============================================================================
   year.css — 12-Week Year tracker design system.
   Vibrant grass-green, light, playful, mobile-first. Separate from the dark
   site.css on purpose: this is a different visual world.
   ========================================================================== */

:root {
    /* palette — grass green + warm accents */
    --y-bg:        #F7FFF7;
    --y-surface:   #FFFFFF;
    --y-surface-2: #F0F9EF;
    --y-ink:       #14361F;
    --y-ink-soft:  #3A5A44;
    --y-muted:     #6B8472;
    --y-line:      #D8EBDB;

    --y-grass:      #3DDC84;
    --y-grass-deep: #1FAE5E;
    --y-grass-dark: #0E7B43;
    --y-sun:        #FFD23F;
    --y-coral:      #FF6B6B;
    --y-mint:       #4ECDC4;
    --y-amber:      #F4A261;

    /* effects */
    --y-shadow:       0 6px 24px rgba(31, 174, 94, 0.10);
    --y-shadow-lg:    0 10px 40px rgba(31, 174, 94, 0.18);
    --y-glow:         0 0 0 3px rgba(61, 220, 132, 0.25), 0 0 24px rgba(61, 220, 132, 0.45);
    --y-glow-sun:     0 0 0 3px rgba(255, 210, 63, 0.30), 0 0 24px rgba(255, 210, 63, 0.45);

    --y-radius:    16px;
    --y-radius-sm: 10px;
    --y-radius-lg: 24px;

    /* type */
    --y-font:      -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI",
                   Roboto, "Helvetica Neue", Arial, sans-serif;
    --y-font-num:  -apple-system, BlinkMacSystemFont, "SF Pro Display",
                   system-ui, sans-serif;

    /* layout */
    --y-gutter:   clamp(1rem, 0.6rem + 2vw, 2rem);
    --y-maxw:     760px;
    --y-tap:      48px; /* min tappable target */
}

/* reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--y-font);
    color: var(--y-ink);
    background:
        radial-gradient(1100px 600px at 85% -10%, rgba(61, 220, 132, 0.18), transparent 60%),
        radial-gradient(900px 500px at -10% 110%, rgba(78, 205, 196, 0.14), transparent 55%),
        var(--y-bg);
    background-attachment: fixed;
    line-height: 1.5;
    min-height: 100dvh;
    -webkit-tap-highlight-color: transparent;
}
img, svg { max-width: 100%; display: block; }
a { color: var(--y-grass-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.15; color: var(--y-ink); }
p { margin: 0 0 1rem; }

/* ---------------------------------------------------------------------------
   layout shell
   ------------------------------------------------------------------------- */
.y-shell {
    max-width: var(--y-maxw);
    margin: 0 auto;
    padding: calc(env(safe-area-inset-top, 0px) + 0.5rem) var(--y-gutter)
             calc(env(safe-area-inset-bottom, 0px) + 5rem);
}

.y-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 0 1.25rem;
}
.y-brand {
    display: flex; align-items: center; gap: 0.55rem;
    font-weight: 800; letter-spacing: -0.01em; color: var(--y-ink);
}
.y-brand__mark {
    width: 34px; height: 34px; flex: none;
    background: linear-gradient(140deg, var(--y-grass), var(--y-grass-deep));
    border-radius: 11px;
    display: grid; place-items: center;
    color: #fff; font-weight: 900; font-size: 1rem;
    box-shadow: var(--y-shadow);
}
.y-brand__name { font-size: 1.05rem; }
.y-brand__sub  { color: var(--y-muted); font-weight: 600; font-size: 0.78rem; }

.y-pill {
    display: inline-flex; align-items: center; gap: 0.35rem;
    background: var(--y-surface);
    border: 1px solid var(--y-line);
    color: var(--y-ink);
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    font-weight: 700; font-size: 0.8rem;
    box-shadow: var(--y-shadow);
}
.y-pill__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--y-grass); box-shadow: 0 0 8px var(--y-grass); }

.y-link-logout {
    font-size: 0.8rem; font-weight: 600; color: var(--y-muted);
    padding: 0.4rem 0.6rem; border-radius: var(--y-radius-sm);
}
.y-link-logout:hover { background: var(--y-surface-2); color: var(--y-coral); }

/* ---------------------------------------------------------------------------
   cards
   ------------------------------------------------------------------------- */
.y-card {
    background: var(--y-surface);
    border: 1px solid var(--y-line);
    border-radius: var(--y-radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--y-shadow);
}
.y-card__label {
    font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--y-grass-dark);
    margin: 0 0 0.5rem;
}
.y-row {
    display: grid; gap: 1rem;
}
@media (min-width: 560px) {
    .y-row--2 { grid-template-columns: 1fr 1fr; }
}

/* ---------------------------------------------------------------------------
   hero week banner — the big "Week X / 12"
   ------------------------------------------------------------------------- */
.y-weekhero {
    position: relative;
    background: linear-gradient(150deg, var(--y-grass) 0%, var(--y-grass-deep) 100%);
    color: #fff;
    border-radius: var(--y-radius-lg);
    padding: 1.75rem 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--y-shadow-lg);
    overflow: hidden;
}
.y-weekhero::after {
    content: "";
    position: absolute; inset: auto -30px -50px auto;
    width: 180px; height: 180px;
    background: radial-gradient(circle at 70% 30%, rgba(255,255,255,0.25), transparent 70%);
    pointer-events: none;
}
.y-weekhero__top {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 1rem; margin-bottom: 0.75rem;
}
.y-weekhero__eyebrow {
    font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
    font-size: 0.72rem; opacity: 0.92;
}
.y-weekhero__num {
    font-family: var(--y-font-num);
    font-weight: 900;
    font-size: clamp(3.4rem, 16vw, 5.5rem);
    line-height: 0.9;
    letter-spacing: -0.04em;
    /* "shaped projection" extrusion */
    text-shadow:
        0 1px 0 rgba(14,123,67,0.55),
        0 2px 0 rgba(14,123,67,0.45),
        0 3px 0 rgba(14,123,67,0.35),
        0 4px 8px rgba(0,0,0,0.18);
}
.y-weekhero__num small {
    font-size: 0.42em; font-weight: 800; opacity: 0.9; letter-spacing: 0;
}
.y-weekhero__meta {
    display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; margin-top: 0.75rem;
    font-size: 0.92rem; font-weight: 600; opacity: 0.96;
}
.y-weekhero__meta b { font-weight: 800; }

/* overall progress bar */
.y-progress {
    margin-top: 1.1rem;
    background: rgba(255,255,255,0.25);
    border-radius: 999px;
    height: 12px; overflow: hidden;
}
.y-progress__fill {
    height: 100%;
    background: linear-gradient(90deg, #fff, var(--y-sun));
    border-radius: 999px;
    box-shadow: 0 0 12px rgba(255,255,255,0.6);
    transition: width 0.6s ease;
}
.y-progress__cap {
    margin-top: 0.5rem; font-size: 0.8rem; font-weight: 700; opacity: 0.95;
}

/* ---------------------------------------------------------------------------
   week strip (12 cells)
   ------------------------------------------------------------------------- */
.y-strip {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(58px, 1fr);
    gap: 0.4rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    scroll-snap-type: x proximity;
}
.y-week {
    scroll-snap-align: center;
    background: var(--y-surface-2);
    border: 1px solid var(--y-line);
    border-radius: var(--y-radius-sm);
    padding: 0.6rem 0.4rem;
    text-align: center;
    min-height: 64px;
    display: flex; flex-direction: column; gap: 0.25rem; justify-content: center;
}
.y-week__n { font-weight: 800; font-size: 1rem; color: var(--y-ink); }
.y-week__lab { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--y-muted); }
.y-week--past { opacity: 0.7; }
.y-week--past .y-week__n { color: var(--y-grass-deep); }
.y-week--now {
    background: var(--y-grass);
    border-color: var(--y-grass-deep);
    color: #fff;
    box-shadow: var(--y-glow);
    transform: translateY(-1px);
}
.y-week--now .y-week__n,
.y-week--now .y-week__lab { color: #fff; }

/* ---------------------------------------------------------------------------
   today + check-in CTA
   ------------------------------------------------------------------------- */
.y-today {
    display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.y-today__date { flex: 1 1 160px; }
.y-today__d { font-size: 1.5rem; font-weight: 800; line-height: 1.1; }
.y-today__sub { color: var(--y-muted); font-weight: 600; font-size: 0.88rem; }

.y-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    min-height: var(--y-tap);
    padding: 0.7rem 1.25rem;
    border-radius: 999px;
    border: none; cursor: pointer;
    font-family: var(--y-font); font-weight: 800; font-size: 1rem;
    text-decoration: none;
    transition: transform 0.12s ease, box-shadow 0.2s ease;
}
.y-btn--primary {
    background: linear-gradient(150deg, var(--y-grass), var(--y-grass-deep));
    color: #fff;
    box-shadow: var(--y-shadow);
}
.y-btn--primary:hover { transform: translateY(-1px); box-shadow: var(--y-shadow-lg); text-decoration: none; }
.y-btn--primary.is-pulsing {
    animation: y-pulse 2s ease-in-out infinite;
}
.y-btn--ghost {
    background: var(--y-surface);
    color: var(--y-ink);
    border: 1px solid var(--y-line);
}
.y-btn--ghost:hover { background: var(--y-surface-2); }
.y-btn[disabled] { opacity: 0.6; }

@keyframes y-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(61, 220, 132, 0.45); }
    50%      { box-shadow: 0 0 0 14px rgba(61, 220, 132, 0); }
}

/* ---------------------------------------------------------------------------
   streak + heatmap
   ------------------------------------------------------------------------- */
.y-streak {
    display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
}
.y-streak__num {
    font-family: var(--y-font-num);
    font-weight: 900; font-size: 2.8rem; line-height: 1;
    color: var(--y-grass-deep);
    text-shadow: 0 2px 0 rgba(31,174,94,0.18);
}
.y-streak__num small { font-size: 0.4em; color: var(--y-muted); font-weight: 700; }
.y-streak__meta { color: var(--y-ink-soft); font-weight: 600; }
.y-streak__meta b { color: var(--y-ink); }

/* heatmap: 12 columns (weeks) × 7 rows (days). */
.y-heat {
    overflow-x: auto;
    padding-bottom: 0.25rem;
}
.y-heat__grid {
    display: grid;
    grid-template-rows: repeat(7, 14px);
    grid-auto-flow: column;
    grid-auto-columns: 14px;
    gap: 4px;
    min-width: max-content;
}
.y-cell {
    width: 14px; height: 14px; border-radius: 4px;
    background: var(--y-surface-2);
    border: 1px solid var(--y-line);
}
.y-cell--1 { background: #CDF3DC; border-color: #B6E8C9; }
.y-cell--2 { background: #8FE3B2; border-color: #74D89E; }
.y-cell--3 { background: var(--y-grass); border-color: var(--y-grass-deep); }
.y-cell--4 { background: var(--y-grass-deep); border-color: var(--y-grass-dark); box-shadow: 0 0 6px rgba(31,174,94,0.5); }
.y-cell--future { opacity: 0.45; background: repeating-linear-gradient(45deg, var(--y-surface-2), var(--y-surface-2) 3px, var(--y-surface) 3px, var(--y-surface) 6px); }
.y-cell--today { outline: 2px solid var(--y-sun); outline-offset: 1px; }
.y-heat__legend {
    display: flex; align-items: center; gap: 0.35rem;
    margin-top: 0.6rem; font-size: 0.72rem; color: var(--y-muted); font-weight: 600;
}
.y-heat__legend .y-cell { width: 11px; height: 11px; }

/* ---------------------------------------------------------------------------
   goals
   ------------------------------------------------------------------------- */
.y-goal { margin-bottom: 1rem; }
.y-goal:last-child { margin-bottom: 0; }
.y-goal__title { font-weight: 800; font-size: 1.02rem; margin-bottom: 0.4rem; display: flex; justify-content: space-between; gap: 0.5rem; }
.y-goal__pct { color: var(--y-grass-dark); font-variant-numeric: tabular-nums; }
.y-goal__bar {
    background: var(--y-surface-2);
    border-radius: 999px; height: 10px; overflow: hidden;
}
.y-goal__fill {
    height: 100%;
    background: linear-gradient(90deg, var(--y-grass), var(--y-grass-deep));
    border-radius: 999px;
    transition: width 0.6s ease;
}
.y-goal__desc { color: var(--y-ink-soft); font-size: 0.85rem; margin: 0.4rem 0 0; }

/* ---------------------------------------------------------------------------
   tabs (bottom bar on mobile)
   ------------------------------------------------------------------------- */
.y-tabs {
    position: fixed; left: 50%; transform: translateX(-50%);
    bottom: calc(env(safe-area-inset-bottom, 0px) + 0.6rem);
    display: flex; gap: 0.4rem;
    background: var(--y-surface);
    border: 1px solid var(--y-line);
    border-radius: 999px;
    padding: 0.4rem;
    box-shadow: var(--y-shadow-lg);
    z-index: 20;
}
.y-tab {
    min-height: 44px;
    padding: 0 1rem;
    border-radius: 999px;
    display: inline-flex; align-items: center; gap: 0.4rem;
    font-weight: 700; font-size: 0.9rem; color: var(--y-ink-soft);
    text-decoration: none;
}
.y-tab:hover { text-decoration: none; background: var(--y-surface-2); }
.y-tab.is-active { background: var(--y-grass); color: #fff; }
.y-tab__ic { font-size: 1.05rem; line-height: 1; }

/* ---------------------------------------------------------------------------
   forms
   ------------------------------------------------------------------------- */
.y-form { display: flex; flex-direction: column; gap: 0.9rem; }
.y-field label {
    display: block; font-weight: 700; font-size: 0.8rem;
    margin-bottom: 0.3rem; color: var(--y-ink-soft);
}
.y-input, .y-textarea {
    width: 100%;
    min-height: var(--y-tap);
    padding: 0.75rem 0.9rem;
    font-family: var(--y-font); font-size: 1rem;
    color: var(--y-ink);
    background: var(--y-surface);
    border: 1px solid var(--y-line);
    border-radius: var(--y-radius-sm);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.y-input:focus, .y-textarea:focus {
    outline: none;
    border-color: var(--y-grass);
    box-shadow: 0 0 0 3px rgba(61,220,132,0.25);
}
.y-textarea { min-height: 88px; resize: vertical; }

.y-mood { display: flex; gap: 0.4rem; }
.y-mood__opt input { position: absolute; opacity: 0; inset-inline-start: -9999px; }
.y-mood__opt span {
    display: grid; place-items: center;
    width: 44px; height: 44px;
    border-radius: 50%;
    background: var(--y-surface-2);
    border: 1px solid var(--y-line);
    font-size: 1.3rem; cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.15s ease;
}
.y-mood__opt input:checked + span {
    background: var(--y-grass); border-color: var(--y-grass-deep);
    box-shadow: var(--y-glow); transform: scale(1.08);
}

.y-alert {
    border-radius: var(--y-radius-sm);
    padding: 0.8rem 1rem; font-weight: 600; font-size: 0.9rem;
    margin-bottom: 1rem;
}
.y-alert--bad  { background: #FFE9E9; color: #9B2C2C; border: 1px solid #FBC8C8; }
.y-alert--good { background: #E7F8EE; color: var(--y-grass-dark); border: 1px solid var(--y-line); }

/* ---------------------------------------------------------------------------
   login page
   ------------------------------------------------------------------------- */
.y-login {
    max-width: 380px; margin: 4vh auto 0;
    text-align: center;
}
.y-login__mark {
    width: 64px; height: 64px; margin: 0 auto 1rem;
    background: linear-gradient(140deg, var(--y-grass), var(--y-grass-deep));
    border-radius: 20px;
    display: grid; place-items: center;
    color: #fff; font-weight: 900; font-size: 1.7rem;
    box-shadow: var(--y-shadow-lg);
}
.y-login h1 { font-size: 1.5rem; }
.y-login__sub { color: var(--y-muted); font-weight: 600; margin-bottom: 1.5rem; }

/* ---------------------------------------------------------------------------
   check-in success confetti (pure CSS, no JS)
   ------------------------------------------------------------------------- */
.y-celebrate {
    position: relative;
    overflow: hidden;
}
.y-confetti { position: absolute; top: -10px; width: 8px; height: 14px; border-radius: 2px; opacity: 0; }
.y-celebrate .y-confetti { animation: y-fall 1.6s ease-in forwards; }
.y-confetti:nth-child(2) { left: 12%; background: var(--y-sun);   animation-delay: 0.05s; }
.y-confetti:nth-child(3) { left: 28%; background: var(--y-coral); animation-delay: 0.15s; }
.y-confetti:nth-child(4) { left: 44%; background: var(--y-mint);  animation-delay: 0.10s; }
.y-confetti:nth-child(5) { left: 60%; background: var(--y-grass); animation-delay: 0.20s; }
.y-confetti:nth-child(6) { left: 76%; background: var(--y-sun);   animation-delay: 0.08s; }
.y-confetti:nth-child(7) { left: 90%; background: var(--y-coral); animation-delay: 0.18s; }
@keyframes y-fall {
    0%   { transform: translateY(-20px) rotate(0); opacity: 0; }
    15%  { opacity: 1; }
    100% { transform: translateY(220px) rotate(540deg); opacity: 0; }
}

/* ---------------------------------------------------------------------------
   tasks view
   ------------------------------------------------------------------------- */
.y-tasks__summary {
    display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.y-tasks__count {
    display: flex; flex-direction: column; line-height: 1;
}
.y-tasks__count-n {
    font-family: var(--y-font-num);
    font-weight: 900; font-size: 2.2rem; color: var(--y-grass-deep);
}
.y-tasks__count-n small { font-size: 0.45em; color: var(--y-muted); font-weight: 700; }
.y-tasks__count-lab {
    font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--y-muted); margin-top: 0.2rem;
}
.y-tasks__bar {
    flex: 1 1 160px;
    background: var(--y-surface-2);
    border-radius: 999px; height: 12px; overflow: hidden;
}
.y-tasks__fill {
    height: 100%;
    background: linear-gradient(90deg, var(--y-grass), var(--y-grass-deep));
    border-radius: 999px;
    transition: width 0.6s ease;
}

.y-tasks { display: flex; flex-direction: column; gap: 1.25rem; }

.y-tasks__group {
    border-left: 3px solid var(--y-line);
    padding-left: 0.85rem;
}
.y-tasks__group--now { border-left-color: var(--y-grass); }
.y-tasks__week {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.95rem; font-weight: 800; letter-spacing: 0.01em;
    color: var(--y-ink);
    margin: 0 0 0.6rem;
}
.y-tasks__group--now .y-tasks__week { color: var(--y-grass-dark); }
.y-tasks__week-cnt {
    font-variant-numeric: tabular-nums;
    font-weight: 700; font-size: 0.8rem; color: var(--y-muted);
}

/* Each task is its own POST form; the button is the row. */
.y-task-form { margin: 0 0 0.5rem; }
.y-task-form:last-child { margin-bottom: 0; }
.y-task {
    width: 100%;
    display: flex; align-items: center; gap: 0.85rem;
    min-height: var(--y-tap);
    padding: 0.6rem 0.75rem;
    background: var(--y-surface);
    border: 1px solid var(--y-line);
    border-radius: var(--y-radius-sm);
    box-shadow: 0 1px 2px rgba(31, 174, 94, 0.04);
    cursor: pointer;
    font-family: var(--y-font);
    text-align: left;
    transition: background 0.12s ease, transform 0.08s ease, border-color 0.12s ease;
}
.y-task:hover { background: var(--y-surface-2); }
.y-task:active { transform: scale(0.997); }

.y-task__check {
    flex: none;
    width: 26px; height: 26px;
    border-radius: 50%;
    border: 2px solid var(--y-line);
    background: var(--y-surface);
    display: grid; place-items: center;
    font-size: 0.9rem; font-weight: 900; color: #fff;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.y-task--done { background: var(--y-surface-2); }
.y-task--done .y-task__check {
    background: linear-gradient(140deg, var(--y-grass), var(--y-grass-deep));
    border-color: var(--y-grass-deep);
}
.y-task--done .y-task__title {
    text-decoration: line-through;
    color: var(--y-muted);
}

.y-task__body {
    flex: 1 1 auto;
    display: flex; flex-direction: column; gap: 0.15rem;
    min-width: 0;
}
.y-task__title {
    font-weight: 700; font-size: 1rem; color: var(--y-ink);
    word-break: break-word;
}
.y-task__goal {
    font-size: 0.76rem; font-weight: 600; color: var(--y-muted);
}

.y-task__next {
    flex: none;
    font-size: 0.95rem; line-height: 1;
    filter: drop-shadow(0 0 6px rgba(255, 210, 63, 0.6));
}
.y-task__state {
    flex: none;
    font-size: 0.66rem; font-weight: 800; text-transform: uppercase;
    letter-spacing: 0.06em; color: var(--y-amber);
    background: rgba(244, 162, 97, 0.14);
    border: 1px solid rgba(244, 162, 97, 0.35);
    padding: 0.2rem 0.45rem; border-radius: 999px;
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
