/* ===========================================================================
   Garden design system — the shared "field-journal / seed-catalog" language.
   Tokens live on :root (single source; the variety/species hubs consume these).
   Component classes are prefixed g- and are opt-in, so they never fight Bootstrap.
   =========================================================================== */
:root {
    --forest: #1f4d2e;
    --living: #3a7d44;
    --sage: #8a9a5b;
    --sage-line: #d8e0cf;
    --honey: #d6982f;
    --honey-ink: #8a5a12;
    --honey-wash: #fbf3e3;
    --haze: #f2f5ef;
    --ink: #2b2b27;
    --muted: #6b7568;

    --display: "Fraunces", Georgia, "Times New Roman", serif;
    --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, monospace;
}

/* App-wide display type: content headings become Fraunces (nav/brand untouched). */
main h1, main h2, main h3,
.g-title, .g-h { font-family: var(--display); font-optical-sizing: auto; }
main h1, main h2, main h3 { color: var(--forest); }

/* ---- Page scaffold -------------------------------------------------------- */
.g-back {
    display: inline-block;
    margin-bottom: .75rem;
    color: var(--living);
    text-decoration: none;
    font-size: .9rem;
}
.g-back:hover { text-decoration: underline; }

.g-page-header {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1.25rem 2rem;
    align-items: end;
    padding: 1.5rem 1.75rem;
    background: var(--haze);
    border: 1px solid var(--sage-line);
    border-radius: 14px;
    animation: g-rise .5s ease both;
}
.g-page-header--flat { animation: none; } /* for headers inside htmx-swapped regions */
.g-page-header__bar { /* simpler header: title left, actions right, no band */
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: .75rem 1rem;
    margin-bottom: 1.25rem;
}
.g-eyebrow {
    font-size: .78rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--sage);
    font-weight: 600;
}
.g-title {
    font-weight: 600;
    font-size: clamp(1.9rem, 5vw, 3rem);
    line-height: 1.04;
    color: var(--forest);
    margin: .1rem 0;
}
.g-sci { font-family: var(--display); font-style: italic; color: var(--muted); }
.g-lede { color: var(--muted); margin: 0; }

/* figure cluster (mono data, right-aligned in headers) */
.g-figs { display: flex; gap: 1.5rem; margin: 0; }
.g-figs > div { text-align: right; }
.g-figs dt { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--sage); font-weight: 600; }
.g-figs dd { font-family: var(--mono); font-size: 1.5rem; color: var(--forest); margin: 0; line-height: 1.1; }
.g-fig-honey dd { color: var(--honey); }

/* ---- Sections + headings -------------------------------------------------- */
.g-section { margin-top: 2.2rem; }
.g-h { font-weight: 600; font-size: 1.3rem; color: var(--forest); margin: 0 0 .8rem; }
.g-section__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .8rem; }
.g-section__head .g-h { margin: 0; }
.g-empty { color: var(--muted); font-style: italic; }

/* ---- Card list (the table replacement) ------------------------------------ */
.g-card-list { display: flex; flex-direction: column; gap: .6rem; }
.g-card {
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: .65rem .75rem;
    border: 1px solid var(--sage-line);
    border-radius: 12px;
    background: #fff;
    text-decoration: none;
    color: var(--ink);
    transition: border-color .12s ease, transform .12s ease;
}
a.g-card:hover { border-color: var(--living); transform: translateY(-1px); }
.g-card--idle { opacity: .72; }
.g-card__thumb {
    flex-shrink: 0;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 9px;
    overflow: hidden;
    background: var(--haze);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}
.g-card__thumb img { width: 100%; height: 100%; object-fit: cover; }
.g-card__body { display: flex; flex-direction: column; gap: .12rem; flex: 1 1 auto; min-width: 0; }
.g-card__title { font-family: var(--display); font-weight: 600; font-size: 1.1rem; color: var(--forest); text-decoration: none; }
a.g-card__title:hover, a.g-card:hover .g-card__title { text-decoration: underline; }
.g-card__meta { font-size: .85rem; color: var(--muted); font-family: var(--mono); }
.g-card__meta a { color: inherit; text-decoration: none; }
.g-card__meta a:hover { text-decoration: underline; }
.g-card__tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .15rem; }
.g-card__side { display: flex; flex-direction: column; align-items: flex-end; gap: .3rem; flex-shrink: 0; text-align: right; }
.g-card__chev { font-size: 1.6rem; color: var(--sage); flex-shrink: 0; line-height: 1; }
.g-card__leaf { line-height: 1; }

/* ---- Tags + status pills -------------------------------------------------- */
.g-tag {
    font-size: .72rem;
    padding: .08rem .55rem;
    border: 1px solid var(--sage-line);
    border-radius: 999px;
    color: var(--forest);
    background: #fff;
    line-height: 1.6;
    text-decoration: none;
    white-space: nowrap;
}
.g-tag--harvest { border-color: var(--honey); color: var(--honey-ink); background: var(--honey-wash); }
.g-status { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.g-pill-status {
    font-size: .72rem; padding: .08rem .55rem; border-radius: 999px; font-weight: 600; white-space: nowrap;
}
.g-pill-status--in { background: #e6f0e3; color: var(--forest); }
.g-pill-status--out { background: #f0ece1; color: #8a7a52; }
.g-pill-status--alert { background: var(--honey-wash); color: var(--honey-ink); }

/* mono data figure inline */
.g-data { font-family: var(--mono); }

/* ---- Buttons / actions ---------------------------------------------------- */
.g-pill {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    border: 1px solid var(--living);
    background: #fff;
    color: var(--living);
    border-radius: 999px;
    font-size: .85rem;
    padding: .25rem .8rem;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
}
.g-pill:hover { background: var(--living); color: #fff; }
.g-pill--ghost { border-color: var(--sage-line); color: var(--muted); }
.g-pill--ghost:hover { background: var(--haze); color: var(--forest); }

/* ---- Soft form section (grouped fields) ----------------------------------- */
.g-addbox {
    border: 1px solid var(--sage-line);
    background: var(--haze);
    border-radius: 12px;
    padding: 1rem 1.1rem;
}
.g-form-section { margin-bottom: 1.4rem; }
.g-form-section > .g-h { font-size: 1.05rem; margin-bottom: .6rem; }
.g-label { font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; color: var(--sage); font-weight: 600; }

/* Full create/edit form pages: a contained panel with chunked sections. */
.g-form-panel {
    max-width: 42rem;
    background: #fff;
    border: 1px solid var(--sage-line);
    border-radius: 14px;
    padding: 1.5rem 1.5rem 1.75rem;
}
.g-form-panel fieldset { border: 0; padding: 0; margin: 0; }
.g-subhead { font-size: 1.05rem; font-weight: 600; color: var(--forest); margin: 1.5rem 0 .7rem; }
.g-subhead:first-child, .g-form-panel > .g-subhead:first-of-type { margin-top: 0; }
.g-form-actions { display: flex; align-items: center; gap: .5rem; margin-top: 1.5rem; padding-top: 1.1rem; border-top: 1px solid var(--sage-line); }

/* ---- Upload feedback + toasts --------------------------------------------- */
/* Shown only while the owning htmx form is mid-request (htmx adds .htmx-request). */
.g-uploading { display: none; align-items: center; gap: .5rem; color: var(--forest); font-size: .9rem; margin-top: .6rem; }
.htmx-request .g-uploading { display: inline-flex; }
.g-toasts {
    position: fixed; left: 50%; bottom: 5.5rem; transform: translateX(-50%);
    z-index: 1090; display: flex; flex-direction: column; gap: .5rem;
    width: min(92vw, 26rem); pointer-events: none;
}
.g-toast {
    background: var(--forest); color: #fff; padding: .7rem 1rem; border-radius: 10px;
    box-shadow: 0 6px 18px rgba(31, 77, 46, .25); font-size: .9rem; animation: g-rise .25s ease both;
}
.g-toast--error { background: #8a2d2d; }

/* ---- Dashboard stats + photo strip ---------------------------------------- */
.g-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: .8rem; }
.g-stat { background: var(--haze); border: 1px solid var(--sage-line); border-radius: 12px; padding: 1rem 1.1rem; }
.g-stat__num { font-family: var(--mono); font-size: 1.9rem; color: var(--forest); line-height: 1.05; }
.g-stat__num--honey { color: var(--honey); }
.g-stat__label { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--sage); font-weight: 600; margin-top: .35rem; }
.g-photostrip { display: grid; grid-template-columns: repeat(auto-fill, minmax(5rem, 1fr)); gap: .5rem; }
.g-photostrip a { aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--haze); }
.g-photostrip img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---- Auth pages ----------------------------------------------------------- */
.g-auth { max-width: 27rem; margin: 1.5rem auto; }
.g-auth__brand { text-align: center; margin-bottom: 1.4rem; }
.g-auth__leaf { font-size: 2.4rem; line-height: 1; }
.g-auth__name { font-family: var(--display); font-weight: 600; color: var(--forest); font-size: 1.9rem; margin: .3rem 0 .1rem; }
.g-auth__tagline { color: var(--muted); font-size: .92rem; }
.g-auth__card {
    background: #fff;
    border: 1px solid var(--sage-line);
    border-radius: 14px;
    padding: 1.5rem 1.5rem 1.75rem;
    box-shadow: 0 2px 14px rgba(31, 77, 46, .06);
    animation: g-rise .5s ease both;
}
.g-auth__card h1 { font-size: 1.4rem; margin-bottom: 1.1rem; }

@keyframes g-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---- Responsive + quality floor ------------------------------------------ */
@media (max-width: 640px) {
    .g-page-header { grid-template-columns: 1fr; align-items: start; padding: 1.25rem; }
    .g-figs > div { text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
    .g-page-header { animation: none; }
}
