/*
 * Sankalpa Pets: 3D Packaging Studio (studio.html).
 * Self-contained so the page doesn't depend on the homepage's inline styles.
 * Tokens mirror the homepage redesign; [data-theme="light"] on <html> switches them.
 */

:root {
    --font-display: 'Instrument Serif', 'Times New Roman', serif;
    --font-sans: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

    --bg: #0a0908;
    --bg-raise: #11100e;
    --surface: #161412;
    --surface-2: #1f1c19;
    --line: rgba(255, 238, 214, 0.09);
    --line-strong: rgba(255, 238, 214, 0.17);
    --text: #f5f0e8;
    --text-muted: #a89f93;
    --text-faint: #756c62;
    --accent: #f0b45a;
    --accent-soft: rgba(240, 180, 90, 0.12);
    --accent-glow: rgba(236, 160, 64, 0.24);
    --grad-a: #f8d08a;
    --grad-b: #e39b38;
    --btn-bg: #f0b45a;
    --btn-text: #1a1207;
    --btn-hover: #f7c67c;
    --header-bg: rgba(10, 9, 8, 0.74);
    --viewer-bg: radial-gradient(ellipse at 50% 42%, #4a3714 0%, #1f1808 45%, #0d0d0d 100%);
    --whatsapp: #25d366;
    --danger: #ff6b6b;

    --radius-lg: 22px;
    --radius: 16px;
    --container: 1320px;
    --gutter: clamp(16px, 4vw, 40px);
    --header-h: 72px;
    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
    color-scheme: dark;
}

:root[data-theme="light"] {
    --bg: #f6f1ea;
    --bg-raise: #eee7dd;
    --surface: #fffdf9;
    --surface-2: #f3ece2;
    --line: rgba(48, 32, 14, 0.1);
    --line-strong: rgba(48, 32, 14, 0.19);
    --text: #17120d;
    --text-muted: #655c52;
    --text-faint: #8d8378;
    --accent: #9a5b12;
    --accent-soft: rgba(154, 91, 18, 0.09);
    --accent-glow: rgba(226, 154, 53, 0.28);
    --grad-a: #c0802f;
    --grad-b: #87490b;
    --btn-bg: #17120d;
    --btn-text: #f8f2e9;
    --btn-hover: #31281f;
    --header-bg: rgba(246, 241, 234, 0.8);
    --viewer-bg: radial-gradient(ellipse at 50% 42%, #ffffff 0%, #f1ede4 55%, #d9d4c7 100%);
    --danger: #c4352f;
    color-scheme: light;
}

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 8px;
}

::selection { background: var(--accent); color: var(--btn-text); }

.skip-link {
    position: absolute;
    left: 16px;
    top: -60px;
    z-index: 100;
    padding: 10px 16px;
    border-radius: 999px;
    background: var(--btn-bg);
    color: var(--btn-text);
    font-weight: 700;
}
.skip-link:focus { top: 12px; }

.studio-container {
    width: 100%;
    max-width: calc(var(--container) + var(--gutter) * 2);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

/* ---------- Buttons (same look as the homepage) ---------- */
.btn {
    --h: 54px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: var(--h);
    padding: 0 28px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
    transition: transform 0.3s var(--ease), background-color 0.25s, box-shadow 0.3s, border-color 0.25s, color 0.25s;
}
.btn-primary {
    background: var(--btn-bg);
    color: var(--btn-text);
    box-shadow: 0 12px 32px -12px var(--accent-glow);
}
.btn-primary:hover { background: var(--btn-hover); transform: translateY(-2px); }
.btn-ghost { border-color: var(--line-strong); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }
.btn-sm { --h: 44px; padding: 0 20px; font-size: 0.875rem; }
.btn .fa-arrow-right { font-size: 0.85em; transition: transform 0.3s var(--ease); }
.btn:hover .fa-arrow-right { transform: translateX(3px); }

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent);
}
.eyebrow::before {
    content: '';
    width: 24px;
    height: 1px;
    background: currentColor;
    opacity: 0.6;
}

/* ---------- Header ---------- */
.studio-header {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--header-h);
    background: var(--header-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}
.studio-header-inner {
    height: 100%;
    display: flex;
    align-items: center;
    gap: 24px;
}
.studio-brand { display: flex; align-items: center; gap: 12px; color: var(--accent); }
.studio-brand > span { display: flex; flex-direction: column; line-height: 1.15; }
.studio-brand-name { font-weight: 800; font-size: 1.05rem; color: var(--text); }
.studio-brand-tag { font-size: 0.72rem; color: var(--text-muted); letter-spacing: 0.04em; }
.studio-nav { display: flex; gap: 28px; margin-left: auto; font-weight: 600; font-size: 0.92rem; color: var(--text-muted); }
.studio-nav a:hover { color: var(--text); }
.studio-header-actions { display: flex; align-items: center; gap: 10px; }
.studio-icon-btn {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid var(--line-strong);
    color: var(--text);
}
.studio-icon-btn:hover { border-color: var(--accent); color: var(--accent); }
[data-theme="dark"] .icon-moon,
[data-theme="light"] .icon-sun { display: none; }

/* ---------- Page intro ---------- */
.studio-page { padding: clamp(28px, 5vw, 56px) 0 clamp(48px, 7vw, 88px); }
.studio-intro { margin-bottom: clamp(24px, 4vw, 40px); }
.studio-title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(2.3rem, 5vw, 3.8rem);
    line-height: 1.04;
    letter-spacing: -0.018em;
    margin-top: 14px;
}
.studio-title em {
    font-style: italic;
    padding-right: 0.06em;
    background: linear-gradient(100deg, var(--grad-a), var(--grad-b));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.studio-lead { color: var(--text-muted); max-width: 60ch; margin-top: 14px; font-size: clamp(1rem, 1.2vw, 1.1rem); }

/* ---------- Layout ---------- */
.studio {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
    gap: clamp(20px, 3vw, 36px);
    align-items: start;
}
.studio-stage { position: sticky; top: calc(var(--header-h) + 20px); }

/* ---------- 3D viewer ---------- */
.studio-viewer {
    position: relative;
    width: 100%;
    height: min(72vh, 680px);
    min-height: 420px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--line);
    background: var(--viewer-bg);
    cursor: grab;
}
.studio-viewer:active { cursor: grabbing; }
.studio-viewer canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.studio-status {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 32px;
    text-align: center;
    color: var(--text-muted);
    font-weight: 600;
}
.studio-status[hidden] { display: none; }
.studio-badge,
.studio-hint {
    position: absolute;
    left: 16px;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    background: rgba(10, 9, 8, 0.55);
    color: #f5f0e8;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    pointer-events: none;
}
.studio-badge { top: 16px; }
.studio-hint {
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.4s;
}
.studio-viewer.is-ready .studio-hint { opacity: 0.85; }
.studio-viewer.is-ready:hover .studio-hint { opacity: 0; }
:root[data-theme="light"] .studio-badge,
:root[data-theme="light"] .studio-hint { background: rgba(255, 253, 249, 0.75); color: #17120d; }

/* ---------- Chips (view buttons, sticker shape) ---------- */
.studio-views,
.studio-seg {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.studio-views { justify-content: center; margin: 14px 0; }
.studio-chip,
.studio-seg button {
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: color 0.2s, background-color 0.25s, border-color 0.2s;
}
.studio-chip:hover,
.studio-seg button:hover { color: var(--text); border-color: var(--accent); }
.studio-chip.active,
.studio-seg button[aria-pressed="true"] { background: var(--btn-bg); border-color: var(--btn-bg); color: var(--btn-text); }

/* ---------- Container picker (like a frame strip) ---------- */
.studio-styles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    gap: 10px;
}
.studio-style {
    scroll-snap-align: start;
    padding: 12px 8px 10px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--surface);
    text-align: center;
    transition: border-color 0.2s, transform 0.25s var(--ease), background-color 0.2s;
}
.studio-style:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.studio-style svg { width: 44px; height: 60px; color: var(--text-muted); }
.studio-style span { display: block; margin-top: 6px; font-weight: 700; font-size: 0.85rem; }
.studio-style small { display: block; font-size: 0.72rem; line-height: 1.35; color: var(--text-faint); }
.studio-style[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
.studio-style[aria-checked="true"] svg { color: var(--accent); }

.studio-explore { margin-top: 14px; font-size: 0.9rem; color: var(--text-muted); }
.studio-explore a { color: var(--accent); font-weight: 700; white-space: nowrap; }
.studio-explore a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Control panel ---------- */
.studio-panel {
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    background: var(--surface);
    padding: clamp(18px, 2.4vw, 28px);
}
.studio-tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 4px;
    margin-bottom: 24px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--bg-raise);
}
.studio-tabs [role="tab"] {
    padding: 9px 4px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    transition: color 0.2s, background-color 0.25s;
}
.studio-tabs [role="tab"] span {
    display: inline-grid;
    place-items: center;
    width: 20px;
    height: 20px;
    margin-right: 4px;
    border-radius: 50%;
    font-size: 0.72rem;
    border: 1px solid currentColor;
}
.studio-tabs [role="tab"]:hover { color: var(--text); }
.studio-tabs [role="tab"][aria-selected="true"] { background: var(--btn-bg); color: var(--btn-text); }

.studio-field { margin-bottom: 22px; }
.studio-field > label,
.studio-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.studio-optional { font-weight: 500; color: var(--text-faint); margin-left: 4px; }
.studio-help { margin-top: 8px; font-size: 0.82rem; color: var(--text-faint); }

.studio-panel input[type="text"],
.studio-panel select {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid var(--line-strong);
    background: var(--bg-raise);
    color: var(--text);
    font: inherit;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.studio-panel input[type="text"]:focus,
.studio-panel select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.studio-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }

/* Swatches */
.studio-swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.studio-swatch {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--line-strong);
    background: var(--swatch);
    transition: transform 0.2s var(--ease), box-shadow 0.2s;
}
.studio-swatch:hover { transform: scale(1.08); }
.studio-swatch.is-metal { background: linear-gradient(135deg, rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0) 50%, rgba(0, 0, 0, 0.3)), var(--swatch); }
.studio-swatch.is-none { background: repeating-linear-gradient(45deg, transparent 0 5px, var(--line-strong) 5px 7px); }
.studio-swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--accent); }
#studio-pet .studio-swatch { background: linear-gradient(135deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.1) 60%), var(--swatch); }
#studio-pet [data-value="frosted"] { background: repeating-radial-gradient(circle at 30% 30%, #ffffff 0 1px, #e6e6e6 1px 3px); }

/* Sticker templates */
.studio-templates { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.studio-templates button {
    padding: 6px 6px 8px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--bg-raise);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    transition: border-color 0.2s, color 0.2s;
}
.studio-templates button:hover { border-color: var(--line-strong); color: var(--text); }
.studio-templates button[aria-pressed="true"] { border-color: var(--accent); color: var(--text); box-shadow: 0 0 0 1px var(--accent); }
.studio-templates canvas { display: block; width: 100%; height: auto; margin-bottom: 6px; border-radius: 8px; }

/* Colour pickers */
.studio-colour { display: inline-flex; align-items: center; gap: 8px; font-size: 0.88rem; font-weight: 600; }
.studio-colour input[type="color"] {
    width: 44px;
    height: 36px;
    padding: 3px;
    border-radius: 10px;
    border: 1px solid var(--line-strong);
    background: var(--bg-raise);
    cursor: pointer;
}

/* Uploads and small buttons */
.studio-upload {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 999px;
    border: 1px dashed var(--accent);
    color: var(--accent);
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s;
}
.studio-upload:hover { background: var(--accent-soft); }
.studio-upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.studio-upload:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
.studio-link-btn { color: var(--accent); font-size: 0.85rem; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

.studio-check { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 22px; font-size: 0.92rem; cursor: pointer; }
.studio-check input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--accent); }

.studio-label-preview {
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background:
        repeating-conic-gradient(var(--surface-2) 0 25%, var(--bg-raise) 0 50%) 0 0 / 16px 16px;
}
#studio-label { display: block; width: 100%; height: auto; max-height: 180px; object-fit: contain; }

.studio-next { margin-top: 4px; }

/* Download step */
.studio-summary {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 18px;
    margin-bottom: 22px;
    padding: 16px 18px;
    border-radius: 14px;
    background: var(--bg-raise);
    font-size: 0.9rem;
}
.studio-summary dt { color: var(--text-faint); font-weight: 600; }
.studio-summary dd { font-weight: 700; overflow-wrap: anywhere; }
.studio-actions { display: flex; flex-direction: column; gap: 10px; }
.studio-actions-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.studio-actions-row .btn { padding: 0 12px; white-space: normal; line-height: 1.2; }
.studio-whatsapp { background: var(--whatsapp); color: #062b14; }
.studio-whatsapp:hover { transform: translateY(-2px); filter: brightness(1.05); }

.studio-message { min-height: 1.4em; margin-top: 12px; color: var(--danger); font-weight: 600; font-size: 0.9rem; }

.studio-disclaimer { margin-top: 28px; font-size: 0.82rem; color: var(--text-faint); text-align: center; }

/* ---------- Footer ---------- */
.studio-footer {
    padding: 28px 0 36px;
    border-top: 1px solid var(--line);
    color: var(--text-muted);
    font-size: 0.88rem;
    text-align: center;
    line-height: 1.9;
}
.studio-footer a:hover { color: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
    .studio { grid-template-columns: minmax(0, 1fr); }
    .studio-stage { position: static; }
    .studio-viewer { height: min(62vh, 560px); min-height: 340px; }
    /* On phones the container picker becomes a swipeable strip under the preview. */
    .studio-styles {
        display: flex;
        overflow-x: auto;
        padding: 4px 2px 8px;
        scroll-snap-type: x proximity;
    }
    .studio-style { flex: 0 0 108px; }
    .studio-nav { display: none; }
    .studio-header-actions { margin-left: auto; }
}

@media (max-width: 520px) {
    .studio-header-actions .btn span { display: none; }
    .studio-brand-tag { display: none; }
    .studio-tabs [role="tab"] { font-size: 0.78rem; }
    .studio-tabs [role="tab"] span { display: none; }
    .studio-actions-row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; }
}
