/* ============================================================
   FIDO — "The Origin Report"
   Ink black · tennis-ball green · Fraunces + Space Grotesk
   ============================================================ */

*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    --ink: #141310;
    --ink-raised: #1d1b17;
    --cream: #f4f1e8;
    --muted: #8c877b;
    --accent: #d9f24b;          /* tennis-ball green — the one color dogs see best */
    --accent-dim: rgba(217, 242, 75, 0.14);
    --line: rgba(244, 241, 232, 0.14);
    --serif: "Fraunces", Georgia, serif;
    --grotesk: "Space Grotesk", -apple-system, sans-serif;
}

::selection {
    background: var(--accent);
    color: var(--ink);
}

html {
    height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--ink);
    color: var(--cream);
    font-family: var(--grotesk);
    font-size: 1rem;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

/* ---------- Masthead ---------- */

.masthead {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 28px clamp(24px, 5vw, 72px);
    border-bottom: 1px solid var(--line);
}

.wordmark {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--serif);
    font-weight: 900;
    font-size: 1.7rem;
    letter-spacing: 0.02em;
}

.ball {
    width: 26px;
    height: 26px;
    fill: none;
    stroke: var(--accent);
    stroke-width: 2.5;
    stroke-linecap: round;
}

.ball-lg {
    width: 56px;
    height: 56px;
}

.masthead-sub {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--muted);
}

/* ---------- Shared type ---------- */

.eyebrow {
    margin: 0 0 18px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--accent);
}

.eyebrow::before {
    content: "";
    display: inline-block;
    width: 28px;
    height: 2px;
    background: var(--accent);
    margin-right: 12px;
    vertical-align: middle;
}

/* ---------- Upload view: asymmetric split ---------- */

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(32px, 6vh, 72px) clamp(24px, 5vw, 72px);
}

.split {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: clamp(40px, 6vw, 96px);
    align-items: center;
}

h1 {
    margin: 0 0 24px;
    font-family: var(--serif);
    font-optical-sizing: auto;
    font-weight: 700;
    font-size: clamp(2.9rem, 6.5vw, 5.4rem);
    line-height: 1.02;
    letter-spacing: -0.015em;
}

h1 em {
    font-style: italic;
    font-weight: 800;
    color: var(--accent);
}

.lede {
    margin: 0;
    max-width: 46ch;
    font-size: 1.05rem;
    color: var(--muted);
}

/* ---------- Dropzone ---------- */

#uploadForm {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

#dropzone {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 4 / 3;
    border: 2px dashed var(--muted);
    border-radius: 4px;
    background: var(--ink-raised);
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

#dropzone:hover,
#dropzone.drag {
    border-color: var(--accent);
    background: var(--accent-dim);
}

#dropzone.has-photo {
    border-style: solid;
    border-color: var(--accent);
}

.dz-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    padding: 24px;
}

.dz-empty .ball-lg {
    margin-bottom: 8px;
    stroke: var(--muted);
    transition: stroke 0.15s ease, transform 0.3s ease;
}

#dropzone:hover .ball-lg,
#dropzone.drag .ball-lg {
    stroke: var(--accent);
    transform: rotate(18deg);
}

.dz-title {
    font-weight: 700;
    font-size: 1.1rem;
}

.dz-sub {
    font-size: 0.85rem;
    color: var(--muted);
}

#dropzone.has-photo .dz-empty {
    display: none;
}

#preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#file {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.filename {
    margin: 0;
    min-height: 1.2em;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    color: var(--muted);
}

/* ---------- Buttons ---------- */

#submitBtn {
    padding: 16px 24px;
    border: none;
    border-radius: 4px;
    background: var(--accent);
    color: var(--ink);
    font-family: var(--grotesk);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: transform 0.1s ease, filter 0.15s ease;
}

#submitBtn:hover {
    filter: brightness(1.08);
}

#submitBtn:active {
    transform: scale(0.98);
}

#submitBtn:disabled {
    filter: saturate(0.4) brightness(0.8);
    cursor: wait;
}

.ghost-btn {
    align-self: flex-start;
    margin-top: 8px;
    padding: 12px 20px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: transparent;
    color: var(--cream);
    font-family: var(--grotesk);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.ghost-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ---------- Result view: the report ---------- */

.report {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(40px, 6vw, 96px);
    align-items: center;
}

.report-photo {
    margin: 0;
    position: relative;
}

.report-photo img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 16px 16px 0 var(--accent);
}

.report-photo figcaption {
    position: absolute;
    top: 16px;
    left: 16px;
    padding: 5px 12px;
    background: var(--ink);
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    border-radius: 2px;
}

.report-body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.breed {
    margin: 0 0 36px;
    font-family: var(--serif);
    font-optical-sizing: auto;
    font-style: italic;
    font-weight: 800;
    font-size: clamp(2.8rem, 6vw, 5rem);
    line-height: 1.02;
    letter-spacing: -0.01em;
    text-transform: capitalize;
}

/* Stat tile: label · hero value · meter (grotesk, per figure spec) */

.stat {
    width: 100%;
    max-width: 420px;
    margin-bottom: 28px;
}

.stat-label {
    margin: 0 0 4px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--muted);
}

.stat-value {
    margin: 0 0 12px;
    font-family: var(--grotesk);
    font-size: clamp(3rem, 5.5vw, 4.2rem);
    font-weight: 700;
    line-height: 1;
    color: var(--accent);
}

.meter {
    width: 100%;
    height: 12px;
    border-radius: 4px;
    background: var(--accent-dim);   /* unfilled track: dim step of same ramp */
    overflow: hidden;
}

.meter-fill {
    width: 0;
    height: 100%;
    border-radius: 4px;
    background: var(--accent);
    transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Top-5 ranked list: thin bars on a dim step of the accent ramp */

.top5 {
    width: 100%;
    max-width: 420px;
    margin-bottom: 28px;
}

.top5-label {
    margin: 0 0 12px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--muted);
}

.top5-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.top5-list li {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
        "name pct"
        "bar  bar";
    gap: 4px 12px;
    align-items: baseline;
}

.t5-name {
    grid-area: name;
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: capitalize;
}

.t5-pct {
    grid-area: pct;
    font-size: 0.85rem;
    color: var(--muted);
}

.t5-bar {
    grid-area: bar;
    display: block;
    height: 6px;
    border-radius: 4px;
    background: var(--accent-dim);
    overflow: hidden;
}

.t5-fill {
    display: block;
    height: 100%;
    border-radius: 4px;
    background: var(--accent);
    transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.note {
    margin: 0 0 8px;
    max-width: 46ch;
    padding: 14px 18px;
    border-left: 3px solid var(--accent);
    background: var(--ink-raised);
    font-size: 0.95rem;
    color: var(--muted);
}

/* ---------- Footer ---------- */

footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 20px clamp(24px, 5vw, 72px);
    border-top: 1px solid var(--line);
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

/* ---------- result.html (server-rendered report) ---------- */

.page-report {
    display: flex;
    flex-direction: column;
}

.page-report .report {
    align-items: start;
}

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
    .split,
    .report {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .report-photo img {
        aspect-ratio: 4 / 3;
        box-shadow: 10px 10px 0 var(--accent);
    }

    .masthead-sub {
        display: none;
    }
}
