/* Whale Song — Matchward Heroes site theme */

:root {
    --page-width: 1024px;
    --rail-width: 108px;
    --purple-deep: #2a1545;
    --purple-mid: #3d2066;
    --purple-light: #9b59d0;
    --orange-sunset: #d97e36;
    --orange-glow: #f2b05e;
    --wood-dark: #5c3a1e;
    --wood-mid: #8b5a2b;
    --wood-light: #c49a6c;
    --green-battle: #3cb371;
    --gold: #f4c430;
    --cream: #fff4e0;
    --text-main: #f8efe3;
    --text-muted: #d8c8b0;
    --shadow: rgba(20, 8, 30, 0.45);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Nunito', sans-serif;
    color: var(--text-main);
    background: #1a0f28;
    line-height: 1.6;
}

.pixel-art {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

a { color: var(--orange-glow); text-decoration: none; }
a:hover { color: var(--gold); }

.site-atmosphere {
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(ellipse 80% 60% at 20% 10%, rgba(242, 176, 94, 0.35), transparent 55%),
        radial-gradient(ellipse 70% 50% at 85% 80%, rgba(60, 179, 113, 0.18), transparent 50%),
        linear-gradient(180deg, #3d2066 0%, #1a0f28 45%, #0d1f2d 100%);
}

body[data-page="home"] .site-atmosphere {
    background:
        radial-gradient(ellipse 90% 55% at 50% 0%, rgba(242, 176, 94, 0.45), transparent 60%),
        linear-gradient(180deg, #5a2d14 0%, #2a1545 40%, #1a0f28 100%);
}

body[data-page="studio"] .site-atmosphere {
    background:
        radial-gradient(ellipse 70% 50% at 30% 20%, rgba(155, 89, 208, 0.35), transparent 55%),
        linear-gradient(180deg, #2a1545 0%, #1a0f28 100%);
}

body[data-page="heroes"] .site-atmosphere {
    background:
        radial-gradient(ellipse 80% 50% at 70% 15%, rgba(217, 126, 54, 0.4), transparent 55%),
        linear-gradient(180deg, #4a2818 0%, #2a1545 55%, #1a0f28 100%);
}

body[data-page="contact"] .site-atmosphere {
    background:
        radial-gradient(ellipse 75% 55% at 50% 90%, rgba(60, 179, 113, 0.25), transparent 50%),
        linear-gradient(180deg, #0d1f2d 0%, #1a3a4a 50%, #0d1f2d 100%);
}

body[data-page="shop"] .site-atmosphere {
    background:
        radial-gradient(ellipse 60% 45% at 50% 30%, rgba(155, 89, 208, 0.4), transparent 55%),
        linear-gradient(180deg, #2a1545 0%, #1a0f28 100%);
}

.site-shell {
    width: min(100%, var(--page-width));
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    border-left: 4px solid var(--wood-dark);
    border-right: 4px solid var(--wood-dark);
    box-shadow: 0 0 60px var(--shadow);
    background: rgba(42, 21, 69, 0.55);
    backdrop-filter: blur(4px);
}

/* Header */
.site-header {
    padding: 18px 24px 14px;
    border-bottom: 3px solid var(--wood-mid);
    background: linear-gradient(180deg, rgba(92, 58, 30, 0.85), rgba(42, 21, 69, 0.9));
    position: relative;
}

.header-accent {
    position: absolute;
    bottom: -3px;
    left: 24px;
    right: 24px;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--gold), var(--purple-light), var(--gold), transparent);
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 14px;
    color: inherit;
}

.brand-logo {
    width: 52px;
    height: 52px;
    object-fit: contain;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-sub {
    font-family: 'Cinzel', serif;
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--gold);
    line-height: 1.35;
    max-width: 520px;
}

.brand-game {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Body layout: main + right rail */
.site-body {
    flex: 1;
    display: flex;
    flex-direction: row-reverse;
    align-items: stretch;
}

.site-main {
    flex: 1;
    min-width: 0;
    padding: 24px 20px 32px;
}

/* Quest Rail */
.quest-rail {
    width: var(--rail-width);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-left: 3px solid var(--wood-mid);
    background: linear-gradient(180deg, rgba(61, 32, 102, 0.95), rgba(26, 15, 40, 0.98));
}

.rail-cap {
    height: 8px;
    background: linear-gradient(90deg, var(--wood-dark), var(--wood-light), var(--wood-dark));
}

.rail-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 10px 0;
    gap: 4px;
}

.rail-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 6px;
    color: var(--text-muted);
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-left: 3px solid transparent;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.rail-link:hover {
    color: var(--cream);
    background: rgba(155, 89, 208, 0.15);
}

.rail-link.is-active {
    color: var(--gold);
    background: rgba(244, 196, 48, 0.12);
    border-left-color: var(--gold);
}

body[data-page="studio"] .rail-link.is-active { border-left-color: var(--purple-light); color: var(--purple-light); }
body[data-page="heroes"] .rail-link.is-active { border-left-color: var(--orange-glow); color: var(--orange-glow); }
body[data-page="contact"] .rail-link.is-active { border-left-color: var(--green-battle); color: var(--green-battle); }
body[data-page="shop"] .rail-link.is-active { border-left-color: var(--purple-light); color: var(--purple-light); }

.rail-icon {
    font-size: 1.15rem;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 2px solid rgba(196, 154, 108, 0.45);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
}

.rail-label {
    text-align: center;
    line-height: 1.2;
}

/* Footer */
.site-footer {
    border-top: 3px solid var(--wood-mid);
    background: rgba(26, 15, 40, 0.95);
    padding: 16px 24px;
}

.footer-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.footer-links a { color: var(--text-muted); font-size: 0.8rem; }
.footer-links a:hover { color: var(--gold); }

/* Common components */
.page-heading {
    font-family: 'Cinzel', serif;
    font-size: 1.75rem;
    color: var(--gold);
    margin: 0 0 8px;
}

.page-lead {
    color: var(--text-muted);
    margin: 0 0 24px;
    font-size: 1rem;
}

.wood-panel {
    background: linear-gradient(145deg, rgba(92, 58, 30, 0.35), rgba(42, 21, 69, 0.65));
    border: 3px solid var(--wood-mid);
    border-radius: 12px;
    padding: 20px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 8px 24px var(--shadow);
}

.text-link {
    font-weight: 700;
    border-bottom: 1px dashed rgba(242, 176, 94, 0.5);
}

.btn-wood {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    font-weight: 700;
    color: #2a1545;
    background: linear-gradient(180deg, var(--orange-glow), var(--orange-sunset));
    border: 3px solid var(--wood-dark);
    border-radius: 10px;
    box-shadow: 0 4px 0 var(--wood-dark);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.btn-wood:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 var(--wood-dark);
    color: #1a0f28;
}

.btn-wood:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 var(--wood-dark);
}

.btn-green {
    background: linear-gradient(180deg, #5fd68a, var(--green-battle));
}

/* Hero banner */
.hero-banner {
    position: relative;
    margin: -24px -20px 20px;
    border-bottom: 4px solid var(--wood-mid);
    overflow: hidden;
}

.hero-banner img {
    width: 100%;
    display: block;
    max-height: 320px;
    object-fit: cover;
    padding: 6px;
    border-radius: 20px;
}

.hero-banner-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(26, 15, 40, 0.15) 0%, rgba(26, 15, 40, 0.75) 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-end;
    text-align: right;
    padding: 24px;
}

.hero-banner-title {
    font-family: 'Cinzel', serif;
    font-size: 2rem;
    color: var(--gold);
    margin: 0;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
    text-align: right;
}

.hero-banner-sub {
    margin: 6px 0 0;
    color: var(--cream);
    font-size: 0.95rem;
    text-align: right;
}

/* Action buttons row */
.action-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
    margin: 20px 0 28px;
}

.action-row a img {
    height: 54px;
    width: auto;
    display: block;
    transition: transform 0.2s;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
}

.action-row a:hover img {
    transform: translateY(-3px) scale(1.03);
}

/* Home adventure panels */
.adventure-panels {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.adventure-panel {
    padding: 18px;
    border-radius: 12px;
    border: 2px solid var(--wood-mid);
    background: rgba(42, 21, 69, 0.6);
    display: flex;
    flex-direction: column;
}

.adventure-panel h3 {
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    color: var(--gold);
    margin: 0 0 10px;
}

.adventure-panel p {
    margin: 0 0 10px;
    font-size: 0.88rem;
    color: var(--text-muted);
    flex: 1;
}

.panel-tag {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--purple-light);
    margin-bottom: 8px;
}

/* Screenshot strip */
.screenshot-strip {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 24px;
}

.screenshot-strip img {
    height: 140px;
    border-radius: 10px;
    border: 3px solid var(--wood-mid);
    flex-shrink: 0;
}

/* Studio page */
.logo-showcase {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.logo-card {
    text-align: center;
    padding: 16px;
    border-radius: 12px;
    border: 2px solid var(--wood-mid);
    background: rgba(0, 0, 0, 0.2);
}

.logo-card img {
    width: 120px;
    height: 120px;
    object-fit: contain;
}

.logo-card span {
    display: block;
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.studio-split {
    display: grid;
    grid-template-columns: 1fr 1.1fr;
    gap: 24px;
    align-items: start;
    margin-bottom: 24px;
}

.studio-visual {
    border-radius: 12px;
    border: 3px solid var(--wood-mid);
    width: 100%;
    display: block;
}

.vision-plaque {
    text-align: center;
    padding: 24px;
    border: 3px double var(--gold);
    border-radius: 12px;
    background: rgba(244, 196, 48, 0.08);
}

.vision-plaque h3 {
    font-family: 'Cinzel', serif;
    color: var(--gold);
    margin: 0 0 12px;
}

.vision-plaque p {
    margin: 0;
    font-style: italic;
    color: var(--cream);
}

/* Heroes page — staggered feature cards */
.feature-stagger {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin: 24px 0;
}

.feature-card {
    padding: 20px;
    border-radius: 12px;
    border: 2px solid var(--wood-mid);
    background: rgba(42, 21, 69, 0.55);
}

.feature-card:nth-child(1) { transform: translateY(0); }
.feature-card:nth-child(2) { transform: translateY(18px); }
.feature-card:nth-child(3) { transform: translateY(-8px); }
.feature-card:nth-child(4) { transform: translateY(10px); }

.feature-card .feature-icon {
    font-size: 1.4rem;
    color: var(--orange-glow);
    margin-bottom: 8px;
}

.feature-card h3 {
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    color: var(--gold);
    margin: 0 0 8px;
}

.feature-card p {
    margin: 0;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.game-logo-hero {
    text-align: center;
    margin-bottom: 20px;
}

.game-logo-hero img {
    max-width: 280px;
    width: 100%;
    border-radius: 12px;
    border: 3px solid var(--wood-mid);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 24px;
}

.gallery-grid img {
    width: 100%;
    border-radius: 10px;
    border: 3px solid var(--orange-sunset);
}

.gallery-grid img:nth-child(4),
.gallery-grid img:nth-child(5) {
    grid-column: span 1;
}

/* Contact page */
.contact-rows {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    overflow: hidden;
}

.contact-row {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 22px 24px;
    border-bottom: 1px solid rgba(196, 154, 108, 0.2);
}

.contact-row:last-child {
    border-bottom: none;
}

.contact-row .contact-icon {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    font-size: 1.3rem;
    color: var(--green-battle);
    border: 2px solid rgba(60, 179, 113, 0.5);
    border-radius: 50%;
    background: rgba(60, 179, 113, 0.1);
}

.contact-row-body h3 {
    font-family: 'Cinzel', serif;
    font-size: 0.95rem;
    color: var(--gold);
    margin: 0 0 6px;
}

.contact-row-body p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
    word-break: break-word;
}

.contact-row-body a {
    color: var(--green-battle);
}

.contact-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 20px;
}

.contact-card {
    text-align: center;
    padding: 28px 16px;
    border-radius: 12px;
    border: 2px solid rgba(60, 179, 113, 0.4);
    background: rgba(13, 31, 45, 0.6);
}

.contact-card .contact-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 14px;
    display: grid;
    place-items: center;
    font-size: 1.3rem;
    color: var(--green-battle);
    border: 2px solid rgba(60, 179, 113, 0.5);
    border-radius: 50%;
    background: rgba(60, 179, 113, 0.1);
}

.contact-card h3 {
    font-family: 'Cinzel', serif;
    font-size: 0.95rem;
    color: var(--gold);
    margin: 0 0 8px;
}

.contact-card p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    word-break: break-word;
}

.contact-card a {
    color: var(--green-battle);
}

/* Shop page */
.shop-error {
    padding: 14px 18px;
    margin-bottom: 20px;
    border-radius: 10px;
    border: 2px solid #e74c3c;
    background: rgba(231, 76, 60, 0.15);
    color: #ffb4a9;
    font-size: 0.9rem;
}

.gem-notes {
    margin: 0 0 24px;
    padding-left: 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.gem-notes li { margin-bottom: 8px; }

.shop-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

.gem-tier-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.gem-tier {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 2px solid var(--wood-mid);
    border-radius: 12px;
    background: rgba(42, 21, 69, 0.5);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.15s;
}

.gem-tier:hover {
    border-color: var(--purple-light);
    transform: translateX(4px);
}

.gem-tier.is-selected {
    border-color: var(--gold);
    background: rgba(244, 196, 48, 0.1);
    box-shadow: 0 0 16px rgba(155, 89, 208, 0.25);
}

.gem-tier img {
    width: 44px;
    height: 44px;
    object-fit: contain;
}

.gem-tier-info {
    flex: 1;
}

.gem-tier-title {
    font-weight: 700;
    color: var(--cream);
    font-size: 0.95rem;
}

.gem-tier-price {
    color: var(--gold);
    font-family: 'Cinzel', serif;
    font-size: 1.05rem;
}

.gem-tier-pick {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.gem-empty {
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    border: 2px dashed var(--wood-mid);
    border-radius: 12px;
}

.gem-loading {
    padding: 40px 24px;
    text-align: center;
    color: var(--text-muted);
    border: 2px dashed var(--wood-mid);
    border-radius: 12px;
}

.gem-loading p {
    margin: 14px 0 0;
    font-size: 0.9rem;
}

.gem-loading-spinner {
    width: 36px;
    height: 36px;
    margin: 0 auto;
    border: 3px solid rgba(155, 89, 208, 0.25);
    border-top-color: var(--purple-light);
    border-radius: 50%;
    animation: gem-spin 0.8s linear infinite;
}

@keyframes gem-spin {
    to { transform: rotate(360deg); }
}

.btn-retry {
    display: inline-block;
    margin-top: 12px;
    padding: 8px 18px;
    font-family: 'Nunito', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--cream);
    background: rgba(155, 89, 208, 0.35);
    border: 2px solid var(--purple-light);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-retry:hover {
    background: rgba(155, 89, 208, 0.55);
}

.checkout-panel {
    position: sticky;
    top: 16px;
}

.checkout-panel h3 {
    font-family: 'Cinzel', serif;
    color: var(--gold);
    margin: 0 0 16px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.form-group input[type="text"],
.form-group input[type="email"] {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--wood-mid);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.25);
    color: var(--cream);
    font-family: inherit;
    font-size: 0.95rem;
}

.form-group input[readonly] {
    opacity: 0.8;
    cursor: not-allowed;
}

.payment-segments {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.payment-segment {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 2px solid var(--wood-mid);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.payment-segment input { accent-color: var(--purple-light); }

.payment-segment.is-selected {
    border-color: var(--purple-light);
    background: rgba(155, 89, 208, 0.15);
}

.agree-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 16px 0;
}

.agree-row input { margin-top: 3px; accent-color: var(--gold); }

.agree-row a { color: var(--orange-glow); }

.selected-package-display {
    padding: 10px 12px;
    border: 2px dashed var(--wood-mid);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
    min-height: 42px;
}

.selected-package-display.has-value {
    border-style: solid;
    border-color: var(--gold);
    color: var(--cream);
}

/* Transaction pages (confirm, payfinish, error) */
body.transaction-page .site-shell {
    border: none;
    background: transparent;
    box-shadow: none;
}

body.transaction-page .quest-rail,
body.transaction-page .site-header {
    display: none;
}

body.transaction-page .site-main {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
}

.portal-card {
    width: min(100%, 520px);
    padding: 32px;
    border-radius: 16px;
    border: 3px solid var(--wood-mid);
    background: linear-gradient(160deg, rgba(61, 32, 102, 0.9), rgba(26, 15, 40, 0.95));
    box-shadow: 0 16px 48px var(--shadow);
    text-align: center;
}

.portal-card h1 {
    font-family: 'Cinzel', serif;
    color: var(--gold);
    margin: 0 0 16px;
    font-size: 1.6rem;
}

.portal-card.success h1 { color: var(--green-battle); }
.portal-card.fail h1 { color: #e74c3c; }

.order-details {
    text-align: left;
    margin: 20px 0;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(196, 154, 108, 0.2);
    font-size: 0.9rem;
}

.detail-row .label { color: var(--text-muted); }
.detail-row .value { color: var(--cream); font-weight: 600; }
.detail-row .value.total { color: var(--gold); font-family: 'Cinzel', serif; }

.payment-redirect {
    margin: 20px 0;
    padding: 16px;
    border-radius: 10px;
    background: rgba(60, 179, 113, 0.12);
    border: 2px solid rgba(60, 179, 113, 0.35);
}

.countdown {
    font-family: 'Press Start 2P', cursive;
    font-size: 1.2rem;
    color: var(--green-battle);
    margin: 10px 0;
}

.portal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
}

/* Responsive */
@media (max-width: 900px) {
    .adventure-panels,
    .studio-split,
    .shop-layout,
    .logo-showcase {
        grid-template-columns: 1fr;
    }

    .feature-card { transform: none !important; }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 720px) {
    .site-body {
        flex-direction: column;
    }

    .quest-rail {
        width: 100%;
        border-left: none;
        border-top: 3px solid var(--wood-mid);
    }

    .rail-nav {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        padding: 8px;
    }

    .rail-link {
        flex: 1 1 30%;
        min-width: 80px;
        border-left: none;
        border-bottom: 3px solid transparent;
        padding: 8px 4px;
    }

    .rail-link.is-active {
        border-left: none;
        border-bottom-color: var(--gold);
    }

    .rail-label { font-size: 0.55rem; }

    .hero-banner-title { font-size: 1.4rem; }

    .gallery-grid { grid-template-columns: 1fr; }
}
