/* ============================================================================
   SOKYO — SoC detail BENTO layer
   Save as static/css/soc-bento.css, link AFTER sokyo-shared.css.
   ============================================================================ */

/* ── HERO: identity tile + quick-spec bento ── */
.md3-hero-card,
.md3-hero-card:hover {
    background: none; background-image: none; border: 0; box-shadow: none;
    padding: 0; overflow: visible; transform: none; margin-bottom: 14px;
}
.md3-hero-card__inner { display: grid; grid-template-columns: 1fr; gap: 14px; align-items: stretch; }
@media (min-width: 1024px) { .md3-hero-card__inner { grid-template-columns: minmax(300px, 380px) 1fr; gap: 16px; } }

.md3-soc-identity {
    position: relative; overflow: hidden;
    display: flex; flex-direction: column; gap: 14px; padding: 24px;
    border-radius: 28px; border: 1px solid var(--sk-line);
    background: linear-gradient(160deg, color-mix(in srgb, var(--md-sys-color-primary) 14%, var(--sk-card)), var(--sk-card) 70%);
}
.md3-soc-identity::after {
    content: 'memory'; font-family: 'Material Symbols Rounded'; font-size: 220px; line-height: 1;
    position: absolute; right: -40px; bottom: -70px; opacity: .06; pointer-events: none;
    color: var(--md-sys-color-primary);
}
.md3-soc-identity > * { position: relative; z-index: 1; }

/* Logo / fallback sits left-aligned at a sensible size */
.md3-soc-showcase { justify-content: flex-start; }
.md3-soc-logo-card { aspect-ratio: auto; height: 76px; max-width: none; justify-content: flex-start; overflow: visible; }
.md3-soc-logo-img { width: auto; height: 64px; max-width: 80%; object-position: left center; }
.md3-soc-logo-fallback { position: static; flex-direction: row; gap: 12px; align-items: center; justify-content: flex-start; }
.md3-soc-logo-fallback .material-symbols-rounded {
    font-size: 30px; opacity: 1; padding: 10px; border-radius: 16px;
    background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container);
}
.md3-soc-logo-fallback span:not(.material-symbols-rounded) {
    font-size: 22px; font-weight: 800; letter-spacing: -.01em; opacity: 1; color: var(--md-sys-color-on-surface);
}
.md3-soc-title { font-size: clamp(28px, 3.4vw, 40px); letter-spacing: -.02em; margin-bottom: 6px; }
.md3-soc-subtitle { margin-bottom: 0; }
.md3-soc-identity .md3-hero-actions { margin-top: auto; padding-top: 8px; }

/* ── Quick specs → bento tiles ── */
.md3-quick-specs {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: dense; gap: 12px;
    margin: 0; border: 0; border-radius: 0; overflow: visible;
}
@media (min-width: 1024px) { .md3-quick-specs { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.md3-qs-tile {
    position: relative; min-width: 0; display: flex; flex-direction: column; gap: 6px;
    padding: 16px; border-radius: 22px;
    background: var(--sk-card); border: 1px solid var(--sk-line);
    transition: transform .25s ease, box-shadow .25s ease, border-color .15s ease;
}
.md3-qs-tile:hover {
    transform: translateY(-3px); box-shadow: var(--md-sys-elevation-2);
    border-color: color-mix(in srgb, var(--md-sys-color-primary) 45%, transparent);
}
.md3-qs-tile--wide, .md3-qs-tile--full { grid-column: span 2; }
@media (min-width: 1024px) {
    .md3-qs-tile--full { grid-column: span 4; }
    .md3-qs-tile--cores { grid-row: span 2; justify-content: space-between; }
}
.md3-qs-tile__icon {
    width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; font-size: 20px;
    background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container);
}
.md3-qs-tile__label {
    margin-top: 4px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
    color: var(--md-sys-color-on-surface-variant);
}
.md3-qs-tile__value { font-size: 16px; font-weight: 700; line-height: 1.3; color: var(--md-sys-color-on-surface); overflow-wrap: anywhere; }
.md3-qs-tile__big { font-size: clamp(48px, 6vw, 76px); font-weight: 700; letter-spacing: -.04em; line-height: 1; }
.md3-qs-tile__note { font-size: 12px; color: var(--md-sys-color-on-surface-variant); }

/* Accent tile (cores): solid, full-strength text */
.md3-qs-tile--cores {
    background: linear-gradient(145deg, var(--md-sys-color-primary), color-mix(in srgb, var(--md-sys-color-primary) 78%, #000));
    border-color: transparent; color: var(--md-sys-color-on-primary);
}
.md3-qs-tile--cores .md3-qs-tile__label,
.md3-qs-tile--cores .md3-qs-tile__big { color: var(--md-sys-color-on-primary); }
.md3-qs-tile--cores .md3-qs-tile__icon { background: color-mix(in srgb, var(--md-sys-color-on-primary) 18%, transparent); color: var(--md-sys-color-on-primary); }

/* Chips for "2 x 4.35 GHz + 4 x 3.68 GHz" style strings */
.md3-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.md3-chip-tile {
    padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; line-height: 1.3;
    background: var(--sk-tint); border: 1px solid var(--sk-line); color: var(--md-sys-color-on-surface);
}

/* ── Benchmark score tiles ── */
.md3-bench-grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 32px; }
.md3-bench-card { flex-direction: column; align-items: flex-start; gap: 10px; padding: 16px; border-radius: 22px; }
.md3-bench-card__body { width: 100%; }
.md3-bench-card__label { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.md3-bench-card__value { font-size: clamp(22px, 2.4vw, 30px); font-weight: 700; letter-spacing: -.02em; margin-top: 4px; color: var(--md-sys-color-on-surface); }
.md3-bench-card:first-child { background: var(--md-sys-color-primary-container); border-color: transparent; }
.md3-bench-card:first-child .md3-bench-card__label,
.md3-bench-card:first-child .md3-bench-card__value { color: var(--md-sys-color-on-primary-container); }
.md3-bench-card:first-child .md3-bench-card__icon { background: color-mix(in srgb, var(--md-sys-color-on-primary-container) 15%, transparent); }
body.dark .md3-bench-card:first-child { background: var(--md-sys-color-primary-container); }

/* ── Spec cards → tile grids ── */
.md3-all-specs-grid { grid-template-columns: 1fr; grid-auto-flow: dense; gap: 14px; }
@media (min-width: 768px)  { .md3-all-specs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .md3-all-specs-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.md3-spec-card { border-radius: 26px; }

.md3-spec-list {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 12px;
    max-height: none !important; overflow: visible;
}
.md3-spec-list-wrap::after { display: none !important; }
.md3-spec-card__toggle { display: none !important; }
.md3-features-body { max-height: none !important; padding: 16px; }

.md3-spec-row {
    padding: 12px 14px; border-radius: 16px; gap: 4px; justify-content: space-between;
    background: var(--sk-tint);
}
.md3-spec-row:hover, body.dark .md3-spec-row:hover { background: color-mix(in srgb, var(--md-sys-color-primary) 12%, var(--sk-card)); }
.md3-spec-row__label { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.md3-spec-row__value { font-size: 14px; }
.md3-spec-row--wide { grid-column: 1 / -1; }
/* Highlight tile: the row flagged --hi */
.md3-spec-row:has(.md3-spec-row__value--hi) { background: var(--md-sys-color-primary-container); }
.md3-spec-row:has(.md3-spec-row__value--hi) .md3-spec-row__label,
.md3-spec-row:has(.md3-spec-row__value--hi) .md3-spec-row__value { color: var(--md-sys-color-on-primary-container); }

@media (min-width: 1024px) { .md3-spec-card--bench .md3-spec-list { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 640px) {
    .md3-all-specs-grid { grid-template-columns: 1fr; gap: 12px; }
    .md3-spec-card { border-radius: 22px; }
    .md3-spec-row { padding: 11px 12px; }
    .md3-spec-row__value { font-size: 13px; }
    .md3-hero-card { padding: 0; }
    .md3-soc-identity { padding: 20px; border-radius: 24px; }
}

/* ============================================================================
   REFINEMENTS (round 2)
   ============================================================================ */

/* Quieter chip watermark so it doesn't sit under the buttons */
.md3-soc-identity::after { opacity: .04; right: -60px; bottom: -90px; }

/* Dark mode: cores tile lightens instead of darkening, so dark text stays readable */
body.dark .md3-qs-tile--cores {
    background: linear-gradient(145deg, color-mix(in srgb, var(--md-sys-color-primary) 85%, #fff), var(--md-sys-color-primary));
}
.md3-qs-tile--cores .md3-qs-tile__label { font-size: 12px; font-weight: 800; }

/* N/A handling: no empty clutter */
.md3-spec-row.is-na {
    order: 2; background: transparent; border: 1px dashed var(--sk-line);
}
.md3-spec-row.is-na:hover, body.dark .md3-spec-row.is-na:hover { background: transparent; }
.md3-spec-row.is-na .md3-spec-row__value { color: var(--md-sys-color-on-surface-variant); font-weight: 500; }
.md3-spec-card.is-empty { display: none; }
.md3-bench-card.is-na { display: none; }

/* Masonry: cards pack by height, no holes (enabled by JS; harmless without it) */
.md3-all-specs-grid.is-masonry { grid-auto-rows: 1px; row-gap: 0; align-items: start; }
.md3-all-specs-grid.is-masonry > .md3-spec-card { margin-bottom: 14px; align-self: start; }
@media (min-width: 1024px) { .md3-all-specs-grid.is-masonry > .md3-spec-card--bench { grid-column: span 2; } }

/* ============================================================================
   MOBILE (≤ 639px) — boxy square tiles; long content spans full width
   ============================================================================ */
@media (max-width: 639px) {
    .md3-soc-detail-hero { padding: 4px 16px 16px; }
    .md3-breadcrumb { padding: 14px 16px 8px; }
    .md3-specs-section, .md3-related-section { padding-left: 16px; padding-right: 16px; }

    /* Identity tile */
    .md3-soc-identity { padding: 18px; gap: 12px; }
    .md3-soc-logo-card { height: 56px; }
    .md3-soc-logo-img { height: 48px; }
    .md3-soc-title { font-size: 26px; }
    .md3-soc-identity .md3-hero-actions { gap: 8px; }
    .md3-soc-identity .md3-hero-actions .md3-btn { flex: 1; padding: 10px 12px; }

    /* Quick specs: 2-up grid of square tiles */
    .md3-quick-specs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .md3-qs-tile {
        aspect-ratio: 1 / 1; min-width: 0; padding: 16px; gap: 4px;
        border-radius: 24px; justify-content: flex-start;
    }
    .md3-qs-tile__icon { width: 34px; height: 34px; margin-bottom: auto; }
    .md3-qs-tile__label { margin-top: 8px; font-size: 10.5px; }
    .md3-qs-tile__value { font-size: 16px; }
    .md3-qs-tile .md3-chips { gap: 5px; }
    .md3-chip-tile { font-size: 12px; padding: 5px 10px; }

    /* static desktop spans don't apply here; the script decides what is "long" */
    .md3-qs-tile--wide, .md3-qs-tile--full, .md3-qs-tile--cores { grid-column: auto; grid-row: auto; }

    /* Cores: square, big number anchored bottom-left */
    .md3-qs-tile--cores { justify-content: flex-start; }
    .md3-qs-tile--cores > div { margin-top: auto; }
    .md3-qs-tile--cores .md3-qs-tile__big { font-size: 56px; }

    /* Long content (and a lone leftover tile) spans the full width, compact header row */
    .md3-qs-tile--long, .md3-qs-tile--stretch {
        grid-column: span 2; aspect-ratio: auto; padding: 14px;
        display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 10px; row-gap: 10px;
    }
    .md3-qs-tile--long .md3-qs-tile__icon, .md3-qs-tile--stretch .md3-qs-tile__icon { width: 28px; height: 28px; margin: 0; font-size: 18px; }
    .md3-qs-tile--long .md3-qs-tile__label, .md3-qs-tile--stretch .md3-qs-tile__label { margin: 0; }
    .md3-qs-tile--long .md3-qs-tile__value, .md3-qs-tile--stretch .md3-qs-tile__value,
    .md3-qs-tile--long .md3-chips, .md3-qs-tile--long .md3-qs-tile__note { grid-column: 1 / -1; }
    .md3-qs-tile--stretch > div { margin-top: 0; }

    /* Benchmark tiles: 2-up */
    .md3-bench-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 24px; }
    .md3-bench-card { padding: 14px; gap: 8px; border-radius: 20px; }
    .md3-bench-card__value { font-size: 22px; }

    /* Spec cards */
    .md3-spec-list { padding: 10px; gap: 6px; }
    .md3-spec-card__header { padding: 12px 14px; }
}
