/* ================================================================
   Cosmic Companions — Alien Adoption
   styles.css
   ================================================================
   Single stylesheet for alien-adoption/index.html and adopt.html.
   Replaces ../tokens.css + all inline <style> blocks.

   Sections:
     1. Reset
     2. Design Tokens (:root)
     3. Base
     4. Layout
     5. Shared Components
     6. INDEX.HTML — Catalog Page
     7. ADOPT.HTML — Adoption Form
     8. Responsive
   ================================================================ */


/* ================================================================
   1. RESET
   ================================================================ */

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


/* ================================================================
   2. DESIGN TOKENS
   ================================================================ */

:root {
    font-size: 110%;

    /* ─── Backgrounds ─── */
    --bg:             #0a0a0a;
    --bg-deep:        #040408;   /* hero/footer inky black */
    --surface:        #181818;
    --surface-hover:  #242424;

    /* ─── Borders ─── */
    --border:         #494949;
    --border-focus:   #e6e6e6;
    --border-selected: #BDBDBD;
    --border-hover:   #FFF9B2;

    /* ─── Text ─── */
    --text:           #e6e6e6;
    --text-muted:     #a4a4a4;

    /* ─── Accent ─── */
    --accent:         #FFF9B2;
    --accent-soft:    rgba(255, 249, 178, 0.12);
    --accent-glow:    rgba(255, 249, 178, 0.15);

    /* ─── Semantic ─── */
    --success:        #34d399;
    --warning:        #ffb052;
    --danger:         #f87171;
    --pink:           #f472b6;
    --cyan:           #22d3ee;

    /* ─── Tags ─── */
    --tag-bg:         rgba(255, 249, 178, 0.12);
    --tag-text:       #FFF9B2;

    /* ─── Layout ─── */
    --radius:         0;

    /* ─── Fonts ─── */
    --sans:           'Strait', sans-serif;
    --mono:           'DM Mono', monospace;

    /* ─── Derived fill tokens ───────────────────────────────────
       rgba variations of semantic colors used throughout the UI.
       Defined here so changing a base token cascades everywhere.
    ─────────────────────────────────────────────────────────── */

    /* Cyan (size tags) */
    --cyan-border:              rgba(34, 211, 238, 0.3);
    --cyan-fill:                rgba(34, 211, 238, 0.08);

    /* Success / green (temperament tags, agent indicator, success card) */
    --success-border-strong:    rgba(52, 211, 153, 0.3);
    --success-border:           rgba(52, 211, 153, 0.2);
    --success-fill:             rgba(52, 211, 153, 0.08);

    /* Pink (planet tags) */
    --pink-border:              rgba(244, 114, 182, 0.3);
    --pink-fill:                rgba(244, 114, 182, 0.08);

    /* Danger / red (danger tags, warnings block, error card) */
    --danger-border-strong:     rgba(248, 113, 113, 0.3);
    --danger-border:            rgba(248, 113, 113, 0.2);
    --danger-fill:              rgba(248, 113, 113, 0.06);
    --danger-fill-alt:          rgba(248, 113, 113, 0.08);

    /* Warning / amber (ability tags) */
    --warning-border:           rgba(255, 176, 82, 0.3);
    --warning-fill:             rgba(255, 176, 82, 0.08);

    /* ─── Miscellaneous hardcoded values ─── */
    --placeholder:    #666666;   /* input::placeholder — not in global tokens */
    --comment:        #666666;   /* pre .cm code comment color */
}


/* ================================================================
   3. BASE
   ================================================================ */

body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    padding: 40px 20px 100px;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 8px;
}

h1 .emoji { margin-right: 6px; }


/* ================================================================
   4. LAYOUT
   ================================================================ */

.container {
    margin: 0 auto;
    padding-top: 16px;
}

/* index.html — catalog page */
.container--catalog {
    max-width: 900px;
}

/* adopt.html — adoption form page */
.container--form {
    max-width: 900px;
}


/* ================================================================
   5. SHARED COMPONENTS
   Used by both index.html and adopt.html
   ================================================================ */

/* ─── Warnings Block ─── */

.warnings {
    background: var(--danger-fill-alt);
    border: 1px solid var(--danger-border-strong);
    border-radius: 0;
    padding: 12px 14px;
}


.warnings-heading {
    font-size: 0.75rem;
    color: var(--danger);
    font-family: var(--sans);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.warnings ul {
    list-style: none;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.warnings li {
    padding-left: 4px;
}

/* ─── Accordions ─── */

.accordion-item {
    margin-top: 32px;
}

.accordion-header {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: none;
    border: none;
    padding: 16px 0;
    cursor: pointer;
    text-align: left;
    color: var(--text-muted);
    font-family: inherit;
    transition: color 0.15s ease;
}

.accordion-header h3,
.log-section h3,
.annotations h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.accordion-header:hover {
    color: var(--text);
}

.accordion-caret {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--text-muted);
    transition: transform 0.25s ease;
}

.accordion-item.open .accordion-caret {
    transform: rotate(90deg);
}

.accordion-body {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.3s ease;
}

.accordion-item.open .accordion-body {
    grid-template-rows: 1fr;
}

.accordion-inner {
    overflow: hidden;
    padding-bottom: 0;
    transition: padding-bottom 0.3s ease;
}

.accordion-item.open .accordion-inner {
    padding-bottom: 32px;
}

/* ─── Log Panel ─── */

.log-desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.log-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0;
    overflow: hidden;
}

.log-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
}

.log-toolbar span {
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.log-clear {
    font-family: var(--mono);
    font-size: 0.6875rem;
    color: var(--text-muted);
    background: var(--tag-bg);
    border: 1px solid var(--border);
    padding: 3px 10px;
    border-radius: 0;
    cursor: pointer;
}

.log-clear:hover { color: var(--text); }

.log-entries {
    padding: 12px 16px;
    max-height: 400px;
    overflow-y: auto;
    font-family: var(--mono);
    font-size: 0.75rem;
    line-height: 1.8;
}

.log-entry {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.log-entry:last-child { border-bottom: none; }

.log-entry .log-time {
    color: var(--text-muted);
    margin-right: 8px;
}

.log-entry .log-tool {
    color: var(--accent);
    font-weight: 500;
}

.log-entry .log-arrow {
    color: var(--text-muted);
    margin: 0 4px;
}

.log-entry .log-params {
    color: var(--text);
    display: block;
    margin-top: 4px;
    margin-left: 70px;
    white-space: pre-wrap;
    word-break: break-word;
}

.log-entry .log-result {
    color: var(--text-muted);
    display: block;
    margin-top: 4px;
    margin-left: 70px;
    white-space: pre-wrap;
    word-break: break-word;
}

.log-empty {
    color: var(--text-muted);
    padding: 24px;
    text-align: center;
    font-family: var(--mono);
    font-size: 0.75rem;
}

/* ─── Annotations + Code Blocks ─── */

.annotations {
    margin-top: 0;
}

.annotation-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0;
    margin-bottom: 16px;
    overflow: hidden;
}

.annotation-label {
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
}

.annotation-desc {
    padding: 14px 16px;
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.7;
}

.annotation-desc code {
    font-family: var(--mono);
    font-size: 0.75rem;
    background: var(--tag-bg);
    color: var(--tag-text);
    padding: 2px 6px;
    border-radius: 0;
}

.annotation-desc strong {
    color: var(--text);
    font-weight: 500;
}

pre {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0;
    padding: 16px;
    overflow-x: auto;
    white-space: pre-wrap;
    font-family: var(--mono);
    font-size: 0.75rem;
    line-height: 1.8;
    color: var(--text-muted);
    margin-top: 12px;
}

pre::before {
    content: 'tool markup';
    display: block;
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    margin: -16px -16px 16px -16px;
}

pre .hl   { color: var(--accent); }
pre .fn   { color: var(--accent); }
pre .attr { color: var(--accent); }
pre .str  { color: var(--text); }
pre .val  { color: var(--text); }
pre .kw   { color: var(--text-muted); }
pre .tag  { color: var(--text-muted); }
pre .cm   { color: var(--comment); }


/* ================================================================
   6. INDEX.HTML — Catalog Page
   ================================================================ */

/* ─── Hero ─── */

.page-hero {
    position: relative;
    margin: -40px -20px 0;
    overflow: hidden;
    height: 420px;
    background: var(--bg-deep);
    transform: translateZ(0); /* promote to GPU layer so canvas sublayer seam is contained */
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 96px;
}

/* Star glow — inset: 0 removes all element edges from the hero.
   Ellipse size is declared explicitly in the gradient so the visual
   footprint matches the original. Focal point X tracks cursor via
   --glow-x (lerped in JS for smooth easing). */
/* Star glow — radiates from behind the planet, tracks cursor via --glow-x */
.page-hero::before {
    content: '';
    position: absolute;
    left: calc(var(--glow-x, 50%) - 750px);
    bottom: -60px;
    width: 1500px;
    height: 700px;
    background: radial-gradient(ellipse at 50% 100%,
        rgba(255,249,178,0.85) 0%,
        rgba(255,249,178,0.45) 10%,
        rgba(255,249,178,0.2)  22%,
        rgba(255,249,178,0.07) 38%,
        rgba(255,249,178,0)    56%
    );
    z-index: 1;
    pointer-events: none;
}

.hero-stars {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    mix-blend-mode: screen;
}

.hero-content {
    position: relative;
    z-index: 3;
    text-align: center;
    max-width: 660px;
    padding: 0 24px;
}

.hero-content h1 {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text);
    margin-bottom: 14px;
    line-height: 1.05;
}

.hero-content .subtitle {
    color: var(--text-muted);
    font-size: 0.9375rem;
    line-height: 1.65;
    max-width: 520px;
    margin: 0 auto;
}

/* SVG mask fills — match page background so transitions are seamless.
   Only the space inside the curve uses --bg-deep. */
.hero-horizon .horizon-mask,
.footer-horizon .horizon-mask {
    fill: var(--bg);
}

.page-hero--slim {
    height: 329px;
    align-items: center;
    padding-top: 0;
    padding-bottom: 55px;
}

.hero-horizon {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 115px;
    z-index: 2;
    pointer-events: none;
}


/* ─── Footer ─── */

.page-footer {
    position: relative;
    margin: 32px -20px -100px;
    overflow: hidden;
    height: 420px;
    background: var(--bg-deep);
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-footer::before {
    content: '';
    position: absolute;
    left: 50%;
    top: -40px;
    transform: translateX(-50%);
    width: 2800px;
    height: 500px;
    background: radial-gradient(ellipse at 50% 0%,
        rgba(255,249,178,0.18) 0%,
        rgba(255,249,178,0.08) 18%,
        rgba(255,249,178,0.03) 38%,
        rgba(255,249,178,0)    60%
    );
    z-index: 1;
    pointer-events: none;
}

.footer-stars {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    mix-blend-mode: screen;
}

.footer-horizon {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 115px;
    z-index: 2;
    pointer-events: none;
}

.footer-content {
    position: relative;
    z-index: 3;
    text-align: center;
    color: var(--text-muted);
    margin-top: 80px;
    font-size: 0.875rem;
}

.footer-content a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.15s ease;
}

.footer-content a:hover {
    color: var(--text);
}


.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--tag-text);
    background: var(--tag-bg);
    border: 1px solid var(--border);
    padding: 4px 12px;
    border-radius: 0;
    margin-bottom: 20px;
    letter-spacing: 0.02em;
}

.badge::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 0;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.4; }
    50%       { opacity: 1; }
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.9375rem;
    max-width: 600px;
}


/* ─── Section Header + Filter Pills ─── */

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.filter-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.pill {
    font-family: var(--mono);
    font-size: 0.6875rem;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.2s;
}

.pill:hover,
.pill.active {
    color: var(--tag-text);
    border-color: var(--accent);
    background: var(--accent-soft);
}

/* ─── Catalog Grid ─── */

.catalog {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 16px;
    margin-bottom: 48px;
}

/* ─── Alien Cards ─── */

.alien-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.15s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.alien-card:hover {
    transform: translateY(-2px);
    box-shadow: rgba(228, 228, 228, 0.08) 0px 2px 12px 3px;
}

.alien-card.active {
    border-color: var(--border-selected);
    box-shadow: rgba(228, 228, 228, 0.08) 0px 2px 12px 3px;
}

.alien-card-visual {
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.25rem;
    position: relative;
    overflow: hidden;
}

.alien-card-illustration {
    display: block;
    width: 100%;
    height: 120px;
    object-fit: contain;
}

.alien-card-visual::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.15;
}

.alien-card-body {
    padding: 16px;
    flex: 1;
}

.alien-card-body h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.alien-card-body .species {
    font-family: var(--mono);
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.alien-card-body .blurb {
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 12px;
}

.alien-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.alien-tag {
    font-family: var(--mono);
    font-size: 0.625rem;
    padding: 4px 8px;
    border-radius: 0;
}

.alien-tag.size,
.alien-tag.temperament,
.alien-tag.planet,
.alien-tag.danger,
.alien-tag.ability     { color: var(--text); background: rgba(230, 230, 230, 0.149); }

.alien-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    font-size: 0.8125rem;
}

.alien-price {
    font-weight: 700;
    color: var(--accent);
}

.compat-score {
    font-family: var(--mono);
    font-size: 0.6875rem;
    color: var(--text-muted);
}

/* ─── Inline Detail Panel ─── */

.inline-detail {
    grid-column: 1 / -1;
    display: flex;
    background: var(--surface);
    border: 1px solid var(--border-selected);
    border-radius: 0;
    overflow: hidden;
    animation: expandIn 0.3s ease;
}

@keyframes expandIn {
    from { opacity: 0; max-height: 0; margin-top: -8px; }
    to   { opacity: 1; max-height: 1200px; margin-top: 0; }
}

@keyframes collapseOut {
    from { opacity: 1; max-height: 1200px; margin-top: 0; }
    to   { opacity: 0; max-height: 0; margin-top: -8px; }
}

.inline-detail.is-closing {
    animation: collapseOut 0.3s ease forwards;
}

/* ─── Left Rail ─── */

.inline-detail-left {
    width: var(--detail-left-width, 289px);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 36px 24px;
    background-image: linear-gradient(145deg, var(--hero-color), var(--bg));
    border-right: 1px solid var(--border);
}

.inline-detail-hero {
    display: flex;
    justify-content: center;
    width: 100%;
}

.inline-detail-illustration {
    display: block;
    width: 100%;
    height: 90px;
    object-fit: contain;
}

.inline-detail-left-identity {
    margin-top: 28px;
    width: 100%;
}

.inline-detail-left-identity h2 {
    font-size: 2.125rem;
    font-weight: 400;
    line-height: 1.2;
    text-align: center;
    color: var(--text);
}

.inline-detail-species {
    font-family: var(--mono);
    font-size: 0.9375rem;
    color: var(--text-muted);
    margin-top: 5px;
    text-align: center;
}

.inline-detail-price-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.inline-detail-price {
    font-family: var(--sans);
    font-size: 1.75rem;
    line-height: 34px;
    color: var(--accent);
}

.inline-detail-match {
    font-family: var(--mono);
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* ─── Right Column ─── */

.inline-detail-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    padding: 28px;
}

.inline-detail-close {
    background: var(--accent-soft);
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 44px;
    height: 44px;
    border-radius: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.inline-detail-close:hover { background: var(--surface-hover); }

.inline-detail-close--right {
    position: absolute;
    top: 20px;
    right: 20px;
}

.inline-detail-close--hero {
    display: none;
}

.inline-detail-bio {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 18px;
    padding-right: 44px;
}

/* ─── Detail Grid ─── */

.detail-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.detail-item {
    flex: 1 1 0%;
    min-width: 190px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 0;
    padding: 10px 12px;
}

.detail-item--full { min-width: 100%; }

.detail-item--fee  { display: none; }

.detail-item .label {
    font-size: 0.6875rem;
    color: var(--text-muted);
    font-family: var(--mono);
    margin-bottom: 3px;
}

.detail-item .value {
    font-size: 0.875rem;
    color: var(--text);
}

/* ─── Warnings (in detail panel) ─── */

.inline-detail-right .warnings {
    margin-bottom: 14px;
}

.inline-detail-right .warnings-heading {
    font-family: var(--sans);
    font-size: 0.8125rem;
}

/* ─── Adopt Bar + Button ─── */

.adopt-bar {
    margin-top: auto;
}

.adopt-btn {
    font-family: var(--sans);
    font-size: 0.9375rem;
    font-weight: 600;
    color: #18181b;
    background: var(--accent);
    border: none;
    border-radius: 0;
    padding: 12px 24px;
    cursor: pointer;
    width: 100%;
    transition: opacity 0.2s;
}

.adopt-btn:hover { opacity: 0.9; }


/* ================================================================
   7. ADOPT.HTML — Adoption Form
   ================================================================ */

/* ─── Back Link ─── */

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
    color: var(--text-muted);
    text-decoration: none;
    margin-bottom: 28px;
    transition: color 0.2s;
}

.back-link:hover { color: var(--text); }

.back-link svg {
    width: 16px;
    height: 16px;
}

/* ─── Recap Card ─── */

.recap-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0;
    margin-bottom: 28px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
    overflow: hidden;
    padding: 0;
}

.recap-card-visual {
    width: 289px;
    min-height: 140px;
    align-self: stretch;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-image: linear-gradient(135deg, var(--hero-color), var(--bg));
}

.recap-card-illustration {
    display: block;
    width: 100%;
    height: 110px;
    object-fit: contain;
}

.recap-card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 20px 24px 20px 0;
}


.recap-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 3px;
}

.recap-card-info h2 {
    font-size: 1.375rem;
    font-weight: 400;
    letter-spacing: -0.02em;
    margin: 0;
}

.recap-species {
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}


.recap-price {
    font-family: var(--sans);
    font-size: 1.375rem;
    color: var(--accent);
    flex-shrink: 0;
    text-align: right;
}

/* ─── Form Card ─── */

.form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0;
    overflow: hidden;
    margin-bottom: 48px;
}

.form-card-header {
    padding: 24px 28px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.form-card-header h2 {
    font-size: 1.375rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.form-card-header p {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.agent-indicator {
    font-family: var(--mono);
    font-size: 0.6875rem;
    color: var(--success);
    background: var(--success-fill);
    border: 1px solid var(--success-border);
    padding: 4px 10px;
    border-radius: 0;
    white-space: nowrap;
}

/* ─── Form Fields ─── */

.form-body {
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
}

label .required {
    color: var(--text-muted);
    font-size: 0.6875rem;
}

input,
select,
textarea {
    font-family: var(--sans);
    font-size: 0.875rem;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 0;
    padding: 10px 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

input::placeholder,
textarea::placeholder {
    color: var(--placeholder);
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%238888a4' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

input[type="hidden"] {
    display: none;
}

/* ─── Submit Button ─── */

.submit-btn {
    font-family: var(--sans);
    font-size: 0.875rem;
    font-weight: 600;
    color: #18181b;
    background: var(--accent);
    border: none;
    border-radius: 0;
    padding: 12px 24px;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    align-self: flex-start;
}

.submit-btn:hover  { opacity: 0.9; }
.submit-btn:active { transform: scale(0.98); }

/* ─── Success State ─── */

.success-card {
    display: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0;
    margin-bottom: 48px;
    overflow: hidden;
    padding: 0 32px;
    animation: fadeIn 0.4s ease;
}

.success-card.show { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.success-top {
    padding: 36px 0 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.success-card h2 {
    font-size: 1.75rem;
    font-weight: 400;
    color: var(--text);
    letter-spacing: -0.03em;
    text-align: center;
}

.success-card .success-subtitle {
    font-size: 0.9375rem;
    color: var(--text-muted);
    text-align: center;
}

.success-middle {
    display: flex;
    border: 1px solid var(--border);
}

.success-visual {
    flex: 1;
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: linear-gradient(135deg, var(--hero-color), var(--bg));
    border-right: 1px solid var(--border);
    min-height: 200px;
}

.success-illustration {
    display: block;
    width: 100%;
    height: 140px;
    object-fit: contain;
}

.success-details {
    flex: 1;
    background: var(--bg);
    display: flex;
    flex-direction: column;
}

.success-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    font-size: 0.8125rem;
}

.success-detail-row:not(:last-child) {
    border-bottom: 1px solid var(--border);
}

.success-detail-row .sdl {
    color: var(--text-muted);
    font-family: var(--mono);
    font-size: 0.6875rem;
}

.success-detail-row .sdv {
    font-weight: 400;
}

.success-actions {
    display: flex;
    justify-content: center;
    padding: 24px 0;
}

.btn-primary {
    font-family: var(--sans);
    font-size: 0.875rem;
    font-weight: 600;
    color: #18181b;
    background: var(--accent);
    border: none;
    border-radius: 0;
    padding: 12px 24px;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary:hover { opacity: 0.9; }

/* ─── Error State ─── */

.error-card {
    background: var(--surface);
    border: 1px solid var(--danger-border-strong);
    border-radius: 0;
    padding: 48px 32px;
    text-align: center;
    margin-bottom: 48px;
}

.error-card h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--danger);
}

.error-card p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}


@keyframes slideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

@keyframes slideDown {
    from { transform: translateY(0); }
    to   { transform: translateY(100%); }
}


/* ================================================================
   8. RESPONSIVE
   ================================================================ */

@media (max-width: 600px) {
    /* index.html — hero */
    .page-hero {
        height: 340px;
        align-items: center;
        padding-top: 0;
        padding-bottom: 80px;
        margin-bottom: 0;
    }

    .hero-content {
        margin-top: 30px;
    }

    .hero-content h1 {
        font-size: 2rem;
    }

    .hero-content .subtitle {
        font-size: 0.875rem;
    }

    .hero-horizon {
        height: 80px;
    }

    .footer-horizon {
        height: 80px;
    }

    /* adopt.html — slim hero */
    .page-hero--slim {
        height: 260px;
        padding-bottom: 50px;
    }

    /* Prevent iOS auto-zoom on input focus (triggers when computed
       font-size < 16px), which leaves subpixel rendering artifacts
       after keyboard dismiss. */
    input,
    select,
    textarea {
        font-size: 16px;
    }

    /* adopt.html — recap card */
    .recap-card {
        flex-direction: column;
        align-items: stretch;
        padding: 0;
        gap: 0;
    }

    .recap-card-visual {
        width: 100%;
        height: 150px;
    }

    .recap-card-info {
        padding: 16px;
        gap: 0;
    }

    .recap-title-row { margin-bottom: 2px; }

    .recap-card-info h2 { font-size: 1.25rem; }

    .recap-species { margin-bottom: 10px; }

    .recap-price { font-size: 1.25rem; }

    /* adopt.html — full-width buttons */
    .submit-btn,
    .success-actions .btn-primary {
        width: 100%;
        justify-content: center;
    }

    /* adopt.html — success card */
    .success-middle {
        flex-direction: column;
    }

    .success-visual {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    /* index.html */
.catalog      { grid-template-columns: 1fr; }
    .section-header { flex-direction: column; gap: 10px; align-items: flex-start; }

    /* ─── Mobile Inline Detail ─── */

    .inline-detail {
        position: fixed;
        inset: 0;
        z-index: 100;
        flex-direction: column;
        overflow-y: auto;
        border: none;
        animation: slideUp 0.3s ease;
    }

    .inline-detail.is-closing {
        animation: slideDown 0.3s ease forwards;
    }

    .alien-card.active {
        border-color: var(--border);
        box-shadow: none;
        transform: none;
    }

    .inline-detail-left {
        width: 100% !important;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        padding: 0;
        border-right: none;
        background-image: none;
    }

    .inline-detail-hero {
        position: relative;
        height: 214px;
        flex-shrink: 0;
        overflow: hidden;
        display: flex;
        align-items: center;
        justify-content: center;
        background-image: linear-gradient(145deg, var(--hero-color), var(--bg));
    }

    .inline-detail-illustration {
        position: absolute;
        top: 50%;
        left: 50%;
        translate: -50% -50%;
        width: 280px;
        height: 118px;
    }

    .inline-detail-close--hero {
        display: flex;
        position: absolute;
        top: 16px;
        right: 16px;
    }

    .inline-detail-close--right { display: none; }

    .inline-detail-left-identity {
        margin-top: 0;
        padding: 20px 24px 0;
        width: 100%;
    }

    .inline-detail-left-identity h2 {
        font-size: 1.75rem;
        text-align: left;
    }

    .inline-detail-species {
        font-size: 0.75rem;
        text-align: left;
        margin-top: 0;
        margin-bottom: 10px;
    }

    .inline-detail-price-row {
        padding: 0 24px 18px;
        margin-top: 0;
        border-top: none;
    }

    .inline-detail-price { font-size: 1.375rem; line-height: 28px; }

    .inline-detail-match { font-size: 0.75rem; }

    .inline-detail-right {
        border-top: 1px solid var(--border);
        padding: 20px 24px 28px;
    }

    .inline-detail-bio {
        padding-right: 0;
        margin-bottom: 20px;
    }

    .detail-grid {
        flex-direction: column;
        gap: 12px;
        margin-bottom: 20px;
    }

    .detail-item { min-width: 100%; }

    .detail-item .value { font-size: 0.8125rem; }

    .detail-item--fee { display: block; }

    .inline-detail-right .warnings { margin-bottom: 20px; }

    /* Pad the overlay so content never hides behind the fixed bar */
    .inline-detail { padding-bottom: 80px; }

    .adopt-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 101;
        background: var(--surface);
        border-top: 1px solid var(--border);
        padding: 16px 24px;
        margin-top: 0;
    }

    .adopt-btn { margin-top: 0; }
}

@media (max-width: 600px) {
    .form-card-header {
        padding: 16px;
    }

    .form-body {
        padding: 16px;
    }

    .success-card {
        padding: 0 16px;
    }
}

@media (max-width: 500px) {
    /* adopt.html */
    .field-row { grid-template-columns: 1fr; }
}
