/* =====================================================================
   Item Catalog — extends the IoA design system defined in style.css
   (Playfair Display / Quattrocento, --ioa-* tokens, .button, .extra-page).
   Nothing here should redefine those tokens, only build on top of them.
   ===================================================================== */

:root {
    --catalog-card-bg: linear-gradient(180deg, #10151d, #0a0d12);
    --catalog-border: rgba(138, 147, 163, 0.25);
}

/* --- Catalog hero / page header (reuses .extra-page .hero-unit sizing) --- */
.catalog-hero {
    text-align: center;
}
.catalog-hero .eyebrow {
    display: block;
    text-transform: uppercase;
    letter-spacing: 3px;
    font-size: 0.75rem;
    color: var(--ioa-text-muted);
    margin-bottom: 6px;
}
.catalog-hero-image {
    width: 100%;
    max-height: 340px;
    object-fit: cover;
    -webkit-mask-image: linear-gradient(180deg, #000 60%, transparent 100%);
    mask-image: linear-gradient(180deg, #000 60%, transparent 100%);
    opacity: 0.85;
    margin-bottom: -60px;
}

/* --- Toolbar: search + filters row --- */
.catalog-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: flex-end;
    padding: 18px 0 28px 0;
    border-bottom: 1px solid var(--catalog-border);
    margin-bottom: 28px;
}
.catalog-filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 160px;
}
.catalog-filter-group label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--ioa-text-muted);
}
.catalog-search {
    flex: 1 1 260px;
    min-width: 220px;
}
.catalog-toolbar input[type="search"],
.catalog-toolbar select {
    background: #0a0d12;
    border: 1px solid var(--catalog-border);
    color: var(--ioa-text);
    padding: 9px 12px;
    font-family: 'Quattrocento', Georgia, serif;
    border-radius: 2px;
    width: 100%;
}
.catalog-toolbar input[type="search"]:focus,
.catalog-toolbar select:focus {
    outline: none;
    border-color: var(--ioa-gold);
}
.catalog-result-count {
    color: var(--ioa-text-muted);
    font-size: 0.85rem;
    margin-bottom: 18px;
}

/* --- Item grid + card --- */
.item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 20px;
}
.item-card {
    position: relative;
    display: block;
    background: var(--catalog-card-bg);
    border: 1px solid var(--catalog-border);
    border-radius: 4px;
    padding: 18px 16px 16px 16px;
    text-align: center;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}
.item-card:hover {
    border-color: var(--ioa-gold);
    box-shadow: 0 0 18px rgba(201, 162, 75, 0.25);
    transform: translateY(-2px);
    text-decoration: none;
}
.item-card.is-disabled:hover { border-color: var(--catalog-border); box-shadow: none; transform: none; }
.item-card-body { margin-top: 12px; }
.item-card-name {
    font-family: 'Playfair Display', 'Priori Serif', Georgia, serif;
    font-size: 1rem;
    color: var(--ioa-text);
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}
.item-card-meta {
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* --- Icon frame (real art or FA-glyph placeholder, rarity-tinted) --- */
.item-icon-frame {
    --rarity-color: #8a93a3;
    width: 84px;
    height: 84px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 50% 40%, rgba(255,255,255,0.04), transparent 70%), #0a0d12;
    border: 2px solid var(--rarity-color);
    border-radius: 6px;
    box-shadow: 0 0 12px -2px var(--rarity-color);
}
.item-icon-frame.large {
    width: 160px;
    height: 160px;
    border-radius: 8px;
}
.item-icon-frame img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.item-icon-placeholder i {
    font-size: 2rem;
    color: var(--rarity-color);
    opacity: 0.9;
}
.item-icon-frame.large .item-icon-placeholder i,
.item-icon-frame.large i {
    font-size: 3.6rem;
}

/* --- Badges --- */
.rarity-pill {
    --rarity-color: #8a93a3;
    display: inline-block;
    font-size: 0.7rem;
    letter-spacing: 1px;
    padding: 2px 8px;
    border: 1px solid var(--rarity-color);
    color: var(--rarity-color);
    border-radius: 20px;
    text-transform: uppercase;
}
.type-pill {
    display: inline-block;
    font-size: 0.7rem;
    letter-spacing: 1px;
    padding: 2px 8px;
    border: 1px solid var(--catalog-border);
    color: var(--ioa-text-muted);
    border-radius: 20px;
    text-transform: uppercase;
}
.coming-soon-ribbon {
    position: absolute;
    top: 10px;
    right: -30px;
    transform: rotate(35deg);
    background: var(--ioa-gold);
    color: #14181f;
    font-size: 0.65rem;
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 3px 34px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    z-index: 2;
}
.coming-soon-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--ioa-gold-bright);
    border: 1px solid var(--ioa-gold);
    padding: 4px 10px;
    border-radius: 20px;
    margin-bottom: 14px;
}

/* --- Load more / pagination --- */
.catalog-load-more {
    text-align: center;
    margin: 36px 0 8px 0;
}
.catalog-empty-state {
    text-align: center;
    color: var(--ioa-text-muted);
    padding: 60px 0;
}

/* --- Item detail page --- */

/* item.html has no hero section above the breadcrumb, so it needs its own
   clearance under the fixed header: 60px logo + 2x8px navbar padding + 1px
   border ≈ 78px rendered height, plus a little breathing room. */
.item-detail-breadcrumb {
    margin-top: 90px;
}

.item-detail-header {
    display: flex;
    gap: 32px;
    align-items: flex-start;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.item-detail-title h1 {
    margin-bottom: 6px;
}
.item-flavor-text {
    font-style: italic;
    color: var(--ioa-text-muted);
    border-left: 2px solid var(--ioa-gold);
    padding-left: 14px;
    margin: 16px 0;
}

/* Top badge row: rarity (outlined) + primary type (solid gold fill) only. */
.item-detail-tags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 10px 0;
}
.badge-pill {
    display: inline-flex;
    align-items: center;
    font-size: 0.72rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-weight: bold;
    padding: 6px 14px;
    border-radius: 4px;
}
.badge-pill.badge-rarity {
    --rarity-color: #8a93a3;
    border: 1px solid var(--rarity-color);
    color: var(--rarity-color);
    background: transparent;
}
.badge-pill.badge-type {
    background: var(--ioa-gold);
    border: 1px solid var(--ioa-gold);
    color: #14181f;
}

/* Rarity badge doubles as the rarity picker when an item has more than one
   tier: it's a native <select> stripped of its default chrome and styled to
   look exactly like the static badge, with a caret hinting it's clickable.
   Clicking it opens the browser's own dropdown - no custom popover needed. */
select.badge-pill.badge-rarity {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    padding-right: 28px;
    background-image: linear-gradient(45deg, transparent 50%, var(--rarity-color) 50%),
        linear-gradient(135deg, var(--rarity-color) 50%, transparent 50%);
    background-position: calc(100% - 14px) center, calc(100% - 9px) center;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
}
select.badge-pill.badge-rarity:hover,
select.badge-pill.badge-rarity:focus {
    background-color: rgba(255, 255, 255, 0.04);
    outline: none;
}
select.badge-pill.badge-rarity option {
    background: #0a0d12;
    color: var(--ioa-text);
}

/* Secondary tags panel (profession, material, etc.) - rounded button pills. */
.tags-panel h3 {
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(201, 162, 75, 0.35);
    margin-bottom: 16px;
}
.tag-btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.tag-btn {
    display: inline-block;
    padding: 7px 14px;
    font-size: 0.8rem;
    background: #0a0d12;
    border: 1px solid var(--catalog-border);
    border-radius: 4px;
    color: var(--ioa-text);
}

/* Compact variant: de-emphasized, small footer box in the right column. */
.tags-panel.compact {
    padding: 14px 18px;
}
.tags-panel.compact h3 {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--ioa-text-muted);
    border-bottom: 1px solid var(--catalog-border);
    padding-bottom: 8px;
    margin-bottom: 10px;
}
.tags-panel.compact .tag-btn {
    padding: 4px 10px;
    font-size: 0.7rem;
}

.stat-panel {
    background: var(--catalog-card-bg);
    border: 1px solid var(--catalog-border);
    border-radius: 4px;
    padding: 20px 24px;
    margin-bottom: 24px;
}
.stat-panel h3 {
    font-size: 1.1rem;
    color: var(--ioa-gold);
    margin-bottom: 14px;
}
.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(138,147,163,0.15);
}
.stat-row:last-child { border-bottom: none; }
.stat-row .stat-name { color: var(--ioa-text-muted); }
.stat-row .stat-value { color: var(--ioa-text); font-weight: bold; }

.value-panel .base-value-amount {
    font-size: 1.4rem;
    color: var(--ioa-gold-bright);
    font-family: 'Playfair Display', 'Priori Serif', Georgia, serif;
}
.value-panel .base-value-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--ioa-text-muted);
    display: block;
    margin-bottom: 4px;
}
.value-panel .sell-note {
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--ioa-text-muted);
}

/* --- Placeholder / reserved sections (crafting, market data) --- */
.placeholder-panel {
    border: 1px dashed var(--catalog-border);
    border-radius: 4px;
    padding: 22px 24px;
    margin-bottom: 24px;
    position: relative;
    opacity: 0.85;
}
.placeholder-panel h3 {
    font-size: 1.05rem;
    color: var(--ioa-text-muted);
    margin-bottom: 8px;
}
.placeholder-panel p {
    color: var(--ioa-text-muted);
    font-size: 0.85rem;
    margin: 0;
}
.placeholder-tag {
    position: absolute;
    top: -11px;
    right: 16px;
    background: var(--ioa-bg);
    padding: 2px 10px;
    font-size: 0.65rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--ioa-gold);
    border: 1px solid var(--ioa-gold);
    border-radius: 20px;
}

/* --- Category hub --- */
.category-hub-header {
    text-align: center;
    margin-bottom: 10px;
}
.category-hub-header p {
    max-width: 640px;
    margin: 10px auto 0 auto;
    color: var(--ioa-text-muted);
}

/* --- Landing index --- */
.category-tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 22px;
    margin: 20px 0 40px 0;
}
.category-tile {
    display: block;
    position: relative;
    height: 160px;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--catalog-border);
    background: var(--catalog-card-bg);
}
.category-tile:hover {
    border-color: var(--ioa-gold);
    text-decoration: none;
}
.category-tile img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.55;
    transition: opacity 0.25s ease;
}
.category-tile:hover img { opacity: 0.75; }
.category-tile-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    padding: 14px 16px;
    background: linear-gradient(180deg, transparent 40%, rgba(10,13,18,0.92) 100%);
    color: var(--ioa-text);
    font-family: 'Playfair Display', 'Priori Serif', Georgia, serif;
    font-size: 1.05rem;
    letter-spacing: 0.5px;
}
.category-tile.generic .category-tile-label {
    background: rgba(10,13,18,0.6);
    align-items: center;
    justify-content: center;
    text-align: center;
}

@media (max-width: 767px) {
    .item-detail-header { flex-direction: column; align-items: center; text-align: center; }
    .catalog-toolbar { flex-direction: column; align-items: stretch; }
}

/* =====================================================================
   Item detail page v2 — mockup-matched, data-driven panel layout.
   Top: hero art (left) + title/badges/description (right).
   Body: two columns of .detail-panel cards, each rendered only when the
   item's payload carries the data for it (see catalog-item.js).
   ===================================================================== */

.item-detail-top {
    display: grid;
    grid-template-columns: minmax(300px, 440px) 1fr;
    gap: 40px;
    align-items: start;
    margin-bottom: 40px;
}

/* --- Hero art frame --- */
.item-hero {
    --rarity-color: #8a93a3;
    position: relative;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--catalog-border);
    border-radius: 6px;
    overflow: hidden;
    background: radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.05), transparent 70%), var(--catalog-card-bg);
    box-shadow: inset 0 0 70px rgba(0, 0, 0, 0.65);
}
/* Thin inset gold frame for the "ornate" feel without needing art assets. */
.item-hero::before {
    content: "";
    position: absolute;
    inset: 12px;
    border: 1px solid rgba(201, 162, 75, 0.35);
    border-radius: 4px;
    pointer-events: none;
    z-index: 2;
}
.item-hero-art {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.item-hero .item-icon-frame {
    width: 62%;
    height: 62%;
    border: none;
    box-shadow: none;
    background: transparent;
}
.item-hero .item-icon-placeholder i {
    font-size: 6rem;
    opacity: 0.5;
}
.item-hero .item-icon-frame img {
    max-width: 82%;
    max-height: 82%;
}
.item-hero-label {
    position: absolute;
    left: 16px;
    bottom: 14px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.7rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--ioa-text-muted);
}
.item-hero-label i { color: var(--ioa-gold); }

/* --- Title block --- */
.item-detail-title h1 {
    font-size: 2.6rem;
    letter-spacing: 1px;
    margin-bottom: 14px;
}
.item-detail-badges {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 18px;
}
.badge-icon {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--catalog-border);
    border-radius: 6px;
    background: var(--catalog-card-bg);
    color: var(--ioa-text-muted);
    font-size: 0.85rem;
}
.badge-pill.badge-craft {
    gap: 7px;
    border: 1px solid var(--catalog-border);
    color: var(--ioa-text);
    background: var(--catalog-card-bg);
}
.badge-pill.badge-craft i { color: var(--ioa-gold); }
.item-lead {
    color: var(--ioa-text);
    font-size: 1.05rem;
    line-height: 1.6;
    max-width: 52ch;
    margin-bottom: 4px;
}

/* --- Two-column panel body --- */
.item-detail-body {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 26px;
    align-items: start;
}
.item-col {
    display: flex;
    flex-direction: column;
    gap: 26px;
}

.detail-panel {
    background: var(--catalog-card-bg);
    border: 1px solid var(--catalog-border);
    border-radius: 6px;
    padding: 22px 26px;
}
.detail-panel.is-muted { opacity: 0.92; }

.panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid rgba(201, 162, 75, 0.25);
}
.panel-header i { color: var(--ioa-gold); font-size: 1.1rem; }
.panel-header h3 {
    flex: 1;
    margin: 0;
    font-family: 'Playfair Display', 'Priori Serif', Georgia, serif;
    font-size: 1.15rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--ioa-text);
}
.panel-badge {
    border: 1px solid var(--ioa-gold);
    color: var(--ioa-gold);
    font-size: 0.62rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 4px;
    white-space: nowrap;
}
.panel-note { color: var(--ioa-text-muted); font-size: 0.85rem; line-height: 1.6; margin: 0; }

.subsection-label {
    font-size: 0.68rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--ioa-text-muted);
    margin: 8px 0 4px;
}

/* --- Stat / effect rows --- */
.detail-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(138, 147, 163, 0.12);
}
.detail-row:last-child { border-bottom: none; }
.row-icon {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--catalog-border);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.25);
    color: var(--ioa-gold);
}
.row-main { flex: 1; min-width: 0; }
.row-name { color: var(--ioa-text); font-weight: bold; }
.row-desc { color: var(--ioa-text-muted); font-size: 0.8rem; margin-top: 2px; }
.row-sub { color: var(--ioa-text-muted); font-size: 0.78rem; margin-top: 6px; }
.row-sub i { color: var(--ioa-text-muted); margin-right: 4px; }
.row-value { color: var(--ioa-text); font-weight: bold; white-space: nowrap; text-align: right; }
.cooldown-row .row-icon { color: var(--ioa-text-muted); }
.is-positive { color: #6fbf73; }
.is-negative { color: #d9736a; }

/* Variable-stat meter (track + filled portion + diamond marker). */
.row-meter {
    position: relative;
    height: 6px;
    margin-top: 10px;
    background: rgba(138, 147, 163, 0.18);
    border-radius: 3px;
}
.row-meter-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: linear-gradient(90deg, rgba(201, 162, 75, 0.35), var(--ioa-gold));
    border-radius: 3px;
}
.row-meter-mark {
    position: absolute;
    top: 50%;
    width: 10px;
    height: 10px;
    background: var(--ioa-gold-bright);
    border: 1px solid #14181f;
    transform: translate(-50%, -50%) rotate(45deg);
}

/* --- Crafting recipe (populated) --- */
.recipe-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 26px;
}
.recipe-item { display: flex; align-items: center; gap: 12px; padding: 9px 0; }
.recipe-item .row-icon { width: 34px; height: 34px; flex-basis: 34px; }
.recipe-item .item-icon-frame { width: 34px; height: 34px; flex: 0 0 34px; }
.recipe-item .item-icon-frame i { font-size: 1rem; }
.recipe-item-name, .recipe-item-body { flex: 1; color: var(--ioa-text); min-width: 0; }
.recipe-item-count { font-weight: bold; white-space: nowrap; }
a.recipe-item.recipe-item-link {
    border-radius: 6px;
    margin: 0 -8px;
    padding: 9px 8px;
    transition: background 0.15s ease;
}
a.recipe-item.recipe-item-link:hover {
    background: rgba(201, 162, 75, 0.08);
    text-decoration: none;
}
.recipe-footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(138, 147, 163, 0.15);
    color: var(--ioa-text-muted);
    font-size: 0.9rem;
}
.recipe-footer i { color: var(--ioa-gold); margin-right: 5px; }

/* --- Value / acquisition --- */
.value-panel .base-value-amount { font-size: 1.6rem; margin-top: 2px; }
.acq-method {
    color: var(--ioa-gold-bright);
    font-family: 'Playfair Display', 'Priori Serif', Georgia, serif;
    font-size: 1.15rem;
}
.acq-req { color: var(--ioa-text-muted); font-size: 0.85rem; margin-top: 4px; }

/* Tags panel reuses .tag-btn / .tag-btn-row; drop the legacy h3 underline
   since the new .panel-header already provides the rule. */
.detail-panel.tags-panel .panel-header h3 {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

@media (max-width: 991px) {
    .item-detail-body { grid-template-columns: 1fr; }
}
@media (max-width: 767px) {
    .item-detail-top { grid-template-columns: 1fr; }
    .item-hero { aspect-ratio: 4 / 3; }
    .recipe-grid { grid-template-columns: 1fr; }
    .item-detail-title h1 { font-size: 2.1rem; }
}