/* crafting.css: Crafting, NPC Requests hub, Site News, Stud Market. */
/* ===== CRAFTING ===== */
.crafting-catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/* Same top-accent-by-rarity convention as .inventory-item (data-rarity set
   from item.rarity), so a recipe card reads at a glance the same way an
   inventory tile does. */
.crafting-recipe-card { position: relative; overflow: hidden; }
.crafting-recipe-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--rarity-accent, transparent);
}
.crafting-recipe-card[data-rarity="uncommon"]  { --rarity-accent: var(--color-success); }
.crafting-recipe-card[data-rarity="rare"]      { --rarity-accent: var(--color-info); }
.crafting-recipe-card[data-rarity="epic"]      { --rarity-accent: var(--color-violet); }
.crafting-recipe-card[data-rarity="legendary"] { --rarity-accent: var(--color-reward); }
.crafting-recipe-card.is-uncraftable { opacity: 0.6; }

.crafting-craft-now {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.crafting-ingredient-list { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.crafting-ingredient-list li { display: flex; align-items: center; gap: 6px; font-size: 0.9em; }
/* Never colour-only: each row also carries a ✓/✗ glyph, not just a tint. */
.crafting-ingredient-list li.is-met { color: var(--text-primary); }
.crafting-ingredient-list li.is-short { color: var(--color-warning-text); }

/* Workbench: NPC portrait beside the recipe picker + panel. Stacks on
   narrow screens the same way .mw-compare does. */
.crafting-workbench {
    display: grid;
    grid-template-columns: minmax(220px, 300px) 1fr;
    gap: 20px;
    align-items: start;
}
.crafting-workbench > * { min-width: 0; }
/* Condensed content mode drops the Thistle persona panel (the grid's first child),
   which would otherwise squeeze the remaining recipe-form panel into the 220-300px
   sidebar column meant for the portrait. Single column instead: same reasoning as
   .handbook__hero--neutral. */
.crafting-workbench--neutral { grid-template-columns: 1fr; }
@media (max-width: 768px) {
    .crafting-workbench { grid-template-columns: 1fr; }
}
.crafting-npc { text-align: center; }
.crafting-npc__portrait {
    width: 100%;
    aspect-ratio: 3 / 4;
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.crafting-npc__portrait img { width: 100%; height: 100%; object-fit: contain; }
.crafting-npc__placeholder { font-size: 3.4em; opacity: 0.6; }
.crafting-npc__name { font-family: var(--font-heading); font-weight: 700; margin: 10px 0 2px; }
.crafting-npc__line { color: var(--text-muted); font-style: italic; min-height: 2.6em; }

/* NPC Requests hub: a single active quest, not a picker over a whole catalog
   like crafting's, so it's one narrow centered column rather than a
   sidebar+content grid. Portrait box shape mirrors .crafting-npc__portrait
   (see prototype/personas-framework.md (in git history): each domain owns its own class family
   until a shared layer is extracted). */
.quest-hub { max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.quest-npc { text-align: center; }
.quest-npc__portrait {
    width: 140px;
    aspect-ratio: 3 / 4;
    margin: 0 auto;
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.quest-npc__portrait img { width: 100%; height: 100%; object-fit: contain; }
.quest-npc__placeholder { font-size: 3em; opacity: 0.6; }
.quest-npc__name { font-family: var(--font-heading); font-weight: 700; margin: 10px 0 2px; }
.quest-npc__line { color: var(--text-muted); font-style: italic; min-height: 2.4em; }
.quest-npc__fact { margin: 6px 0 0; font-size: 0.9rem; }
/* Thank-you strip: the giver of the request just handed in, above the next request. */
.quest-thanks {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    border-color: var(--color-success-border);
    background: var(--color-success-bg);
}
.quest-thanks__portrait {
    flex: 0 0 56px;
    width: 56px;
    aspect-ratio: 3 / 4;
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.quest-thanks__portrait img { width: 100%; height: 100%; object-fit: contain; }
.quest-thanks__placeholder { font-size: 1.6em; opacity: 0.7; }
.quest-thanks__body { min-width: 0; }
.quest-thanks__name { font-family: var(--font-heading); font-weight: 700; margin: 0 0 2px; }
.quest-thanks__line { margin: 0 0 6px; font-style: italic; }
.quest-thanks__reward { margin: 0; color: var(--color-success-text); }
.quest-progress-row { margin: 0 0 12px; }
.quest-progress-row.is-short { color: var(--color-error-text); }
.quest-caps { display: flex; flex-direction: column; gap: 4px; }
.quest-caps__row { margin: 0; font-size: 0.9rem; color: var(--text-muted); }

/* Fixed 100x100 anchor so the panel can't stretch to fit whatever text sits
   beside it: same "displayed at 100x100" contract as mechanics.Item.image,
   reached here via apparel.services.resolve_item_display_image so this
   prefers the pet-compositor art over a manual image upload, same as every
   other apparel surface. */
.crafting-item-summary { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 16px; }
/* Extra breathing room only where this sits right under the recipe <select>
   (the workbench panel); the catalog card has nothing above it to clear. */
#crafting-workbench-panel .crafting-item-summary { margin-top: 20px; }
.crafting-item-summary__header { flex: 1; min-width: 0; margin-bottom: 0; }
.crafting-item-thumb {
    flex: none;
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
}
.crafting-item-thumb--icon {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.6rem;
}

.crafting-ingredients { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.crafting-ingredient { display: flex; align-items: center; gap: 6px; font-size: 0.95em; }
.crafting-ingredient.is-short { color: var(--color-warning-text); }

.crafting-quantity-row { display: flex; align-items: center; gap: 8px; margin: 10px 0; }

/* ---- Site News (/news/, /staff/news/) ---- */
/* --color-danger is not a token in this file: every use of it fell through to a
   hardcoded hex that ignored the palette, and on the light themes that hex measured
   3.2:1 against white. The real token is --color-error-text. */
.field-error { color: var(--color-error-text); font-size: 0.85rem; margin: 4px 0 0; }
.news-post-form { display: flex; flex-direction: column; gap: 16px; max-width: none; }
.news-post-form label { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; color: var(--text-muted); }
.news-post-form input[type="text"], .news-post-form textarea { width: 100%; }
.news-post-form textarea { resize: vertical; font-family: var(--font-mono, monospace); }
.news-post-form__actions { display: flex; gap: 10px; }

.news-card-list { display: flex; flex-direction: column; gap: 14px; }
.news-card { padding: 18px 20px; }
.news-card__date { display: block; color: var(--text-muted); font-size: 0.78rem; margin-bottom: 6px; }
.news-card__title { margin: 0; font-family: var(--font-heading); font-size: 1.15rem; }
.news-card__excerpt { margin: 8px 0 0; color: var(--text-secondary); line-height: 1.5; }

.news-detail { max-width: 760px; margin: 0 auto; }
.news-detail__date { color: var(--text-muted); font-size: 0.85rem; margin: 0 0 18px; }
.news-detail__body { line-height: 1.6; }
.news-detail__body p { margin: 0 0 1em; }
.crafting-quantity-row input[type="number"] { width: 5em; }

/* ---- Stud Market ---- */
.page-intro-card { margin-bottom: 20px; }
.page-intro-card p { margin: 0 0 8px; line-height: 1.5; }
.page-intro-card p:last-child { margin-bottom: 0; }
.card-grid { display: grid; gap: 18px; }
/* Shared by the Stud Market and Manage Studs grids: a fixed two columns, squishing to
   one column under the usual 768px breakpoint. */
.card-grid--stud-two { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.stud-card, .stud-manage-card, .stud-request-card { padding: 16px; }
/* A listing the viewer owns still shows in the market (there's no other fast way to see
   everything currently offered for stud across a roster), just visibly inert: same dimming
   convention as .lineage-card--released / .shop-item-card--out-of-stock. */
.stud-card--own { opacity: 0.7; }
.stud-card--own .btn:disabled { opacity: 1; }
.stud-card__header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.stud-card__header .panel-title { margin: 2px 0 4px; font-size: 1.05rem; }
.stud-card__image { width: 64px; height: 64px; flex: none; object-fit: contain; border-radius: var(--radius-md); background: var(--bg-surface); border: 1px solid var(--border-subtle); }
.stud-card__image--empty { display: flex; align-items: center; justify-content: center; font-size: 1.9rem; }
.stud-card__meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--text-secondary); font-size: 0.85rem; margin-bottom: 12px; }
.stud-card__coat { margin-bottom: 12px; }
.stud-card__coat-summary { font-size: 0.85rem; color: var(--text-secondary); cursor: pointer; }
.stud-card__coat-body { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 0.85rem; color: var(--text-secondary); }
.stud-card__coat-swatch { display: inline-flex; align-items: center; }
.stacked-form { display: flex; flex-direction: column; gap: 12px; }
.stacked-form label, .stacked-form legend { color: var(--text-muted); font-size: 0.85rem; }
.stacked-form label > input, .stacked-form label > select, .stacked-form label > textarea { display: block; width: 100%; margin-top: 5px; }
.stacked-form fieldset { border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: 10px 12px; }
.choice-row { display: flex; flex-direction: row; align-items: center; gap: 8px; color: var(--text-secondary) !important; margin-top: 6px; }
.choice-row input { width: auto !important; margin: 0 !important; }
.form-grid--two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.inline-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.inline-actions form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-actions input[type="text"] { max-width: 240px; }
.stud-request-card { margin-bottom: 16px; }
.stud-request-card .panel-title { margin: 4px 0 8px; }
/* A standing rule about how the Stud Market treats a busy/cooling-down listing, not tied
   to any one card: lives once under the filter bar instead of repeated on every card. */
.stud-manage-notice {
    margin: 0 0 20px;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--color-primary);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
}
.stud-active-studs { margin-bottom: 20px; }
.stud-active-studs > summary { cursor: pointer; }
.stud-active-studs__list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.stud-active-studs__list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 6px 0; border-bottom: 1px solid var(--border-subtle); }
.stud-active-studs__list li:last-child { border-bottom: none; }
.stud-active-studs__list .text-muted { font-size: 0.85rem; }
@media (max-width: 768px) {
    .form-grid--two, .card-grid--stud-two { grid-template-columns: 1fr; }
    .stud-card__header { align-items: flex-start; }
    .inline-actions form { width: 100%; }
}

/* Discrete touch controls share the 44px target floor. Inline prose links are
   intentionally excluded: they are not standalone targets and remain covered by
   the WCAG inline-link exception. This rule is last so component-specific compact
   button classes cannot silently win the cascade on a coarse pointer.

   Text-like inputs/textarea are included here too: the base rule at the top of
   this file (`input[type="text"], ...`) sets padding/font-size but no min-height,
   so every plain text field computed to ~40px, 4px under this same floor, on
   every form in the game. `select` already cleared it via the shared :where()
   above; these five input types plus textarea did not, and nothing guarded the
   gap since TouchTextFieldFloorTests only checks the 16px font floor. */
@media (pointer: coarse) {
    :where(.btn, button, select, summary, input[type="submit"], input[type="button"]) {
        min-height: 44px;
    }
    :where(
        input[type="text"], input[type="password"], input[type="email"],
        input[type="number"], input[type="search"], textarea
    ) {
        min-height: 44px;
    }
    :where(.btn, button, summary, input[type="submit"], input[type="button"]) {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

