/* ============================================================
   DOMOPIXA — Combined stylesheet for both pages.

   Both pages share the same 30% / 70% layout and the same pill
   controls. The pages differ only in the right-hand stage
   (#stage + .caption) — the shared base is here once, and the
   two page-specific flavours are scoped under .page-logo and
   .page-waves (set on <body> by universal_header.php).
   ============================================================ */

/* ============================================================
   DESIGN TOKENS — clean, minimal, Google-inspired aesthetic:
   white surfaces, generous spacing, pill controls, soft shadows.
   ============================================================ */
   :root {
    --ink: #17171e;      /* primary text / dark buttons          */
    --muted: #8b8b96;    /* secondary text, labels                */
    --line: #e9e9ef;     /* hairline borders                      */
    --accent: #3b6ef5;   /* light-blue focus accent               */
    --surface: #ffffff;
    --page: #f6f6f9;
    --danger: #e5484d;
    --font: 'Jost', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    font-family: var(--font);
    font-weight: 500; /* Jost Medium is the body weight */
    color: var(--ink);
    background: var(--page);
    -webkit-font-smoothing: antialiased;
}

/* ==================== LAYOUT: 30% panel / 70% stage ==================== */
#app {
    display: flex;
    min-height: 100vh;
}

#panel {
    width: 30%;
    min-width: 330px;
    height: 100vh;
    overflow-y: auto;
    background: var(--surface);
    border-right: 1px solid var(--line);
    padding: 26px 24px 34px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

#stage {
    width: 70%;
}

/* ==================== BRAND HEADER ==================== */
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand h1 {
    margin: 0;
    font-size: 23px;
    font-weight: 700;
    letter-spacing: .02em;
    line-height: 1.1;
}

.brand .sub {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--muted);
    margin-top: 3px;
}

.brandMark {
    flex: none;
}

/* ==================== NAV SWITCH ==================== */
.navSwitch {
    display: flex;
    background: #f0f0f3;
    border-radius: 999px;
    padding: 4px;
    gap: 4px;
}

.navSwitch a {
    flex: 1;
    text-align: center;
    padding: 9px 14px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
    text-decoration: none;
    transition: background .2s ease, color .2s ease, box-shadow .2s ease;
    white-space: nowrap;
}

.navSwitch a:hover {
    color: var(--ink);
}

.navSwitch a.active {
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .12), 0 0 0 1px rgba(0, 0, 0, .03);
}

/* ==================== FIELD LABELS ==================== */
.fieldLabel {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 9px;
}

/* ==================== PILL DROPDOWNS ==================== */
.selectWrap {
    position: relative;
}

.selectWrap::after { /* pure-CSS chevron */
    content: '';
    position: absolute;
    right: 17px;
    top: 50%;
    width: 7px;
    height: 7px;
    pointer-events: none;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: translateY(-70%) rotate(45deg);
}

select {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    font: inherit;
    font-weight: 600;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 11px 38px 11px 16px;
    cursor: pointer;
    transition: border-color .15s;
}

select:hover, select:focus {
    border-color: var(--ink);
    outline: none;
}

/* ==================== HEX COLOR FIELDS ==================== */
.hexField {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    padding: 6px 14px 6px 7px;
    transition: border-color .15s;
}

.hexField:focus-within {
    border-color: var(--ink);
}

.hexField.invalid {
    border-color: var(--danger);
}

.hexField .dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    flex: none;
    border: 1px solid rgba(0, 0, 0, .10);
}

.hexField .dot.checker { /* represents "transparent" */
    background: conic-gradient(#e3e3ea 25%, #fff 0 50%, #e3e3ea 0 75%, #fff 0) 0 0 / 10px 10px;
}

.hexField input {
    border: 0;
    outline: 0;
    background: transparent;
    font: inherit;
    font-weight: 600;
    min-width: 0;
    flex: 1;
    text-transform: lowercase;
}

.hexHint {
    font-size: 11px;
    color: var(--muted);
    margin-top: 6px;
    margin-left: 8px;
    font-weight: 500;
}

/* ==================== HORIZONTALLY SCROLLABLE PALETTES ==================== */
.palette {
    display: flex;
    gap: 10px;
    align-items: center;
    overflow-x: auto;
    padding: 5px 2px 26px;
    scrollbar-width: thin;
    scrollbar-color: #d9d9e2 transparent;
}

.palette::-webkit-scrollbar {
    height: 5px;
}

.palette::-webkit-scrollbar-thumb {
    background: #d9d9e2;
    border-radius: 999px;
}

.palette::-webkit-scrollbar-track {
    background: transparent;
}

.swatch {
    flex: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    padding: 0;
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, .10);
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .15s ease, box-shadow .15s ease;
}

.swatch:hover {
    transform: translateY(-2px) scale(1.1);
}

.swatch:active {
    transform: scale(.95);
}

.swatch.active {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accent);
}

/* Cute circular "refresh palette" button — always the first swatch.
   Same diameter/height as the color swatches. The arrow spins on hover. */
.swatch.refresh {
    color: var(--ink);
    border: 1px solid var(--line);
}

.swatch.refresh svg {
    transition: transform .45s ease;
}

.swatch.refresh:hover svg {
    transform: rotate(360deg);
}

/* "Transparent" swatch (second slot of the background palette) */
.swatch.transparent {
    background: conic-gradient(#e3e3ea 25%, #fff 0 50%, #e3e3ea 0 75%, #fff 0) 0 0 / 12px 12px;
    border: 1px solid var(--line);
}

/* ==================== COLOR MODE TOGGLE (iOS-style switch) ==================== */
.fieldLabelRow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 9px;
}

.fieldLabelRow .fieldLabel {
    margin-bottom: 0;
}

.toggleWrap {
    display: flex;
    align-items: center;
    gap: 9px;
}

.toggleText {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
}

.colorToggle {
    position: relative;
    width: 44px;
    height: 26px;
    flex: none;
    border: 0;
    border-radius: 999px;
    padding: 0;
    background: #d9d9e2; /* iOS "off" gray */
    cursor: pointer;
    transition: background .25s ease;
}

.colorToggle::after { /* the white knob */
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
    transition: left .25s ease;
}

.colorToggle.on {
    background: #34c759; /* iOS green */
}

.colorToggle.on::after {
    left: 21px;
}

/* second-color dot — only visible in two-color mode */
.hexField .dot.duo {
    display: none;
}

.hexField.duo .dot.duo {
    display: block;
}

/* ==================== PILL BUTTONS ==================== */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font: inherit;
    font-weight: 600;
    border-radius: 999px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: transform .15s, box-shadow .15s, border-color .15s, background .15s;
}

.btn:active {
    transform: scale(.97);
}

.btn.primary {
    background: var(--ink);
    color: #fff;
    padding: 13px 20px;
    width: 100%;
}

.btn.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(20, 20, 40, .22);
}

.btn.outline {
    background: var(--surface);
    color: var(--ink);
    border-color: var(--line);
    padding: 11px 16px;
    flex: 1;
}

.btn.outline:hover {
    border-color: var(--ink);
    transform: translateY(-1px);
}

.btn.full {
    width: 100%;
}

.btnRow {
    display: flex;
    gap: 10px;
}

.panelSection {
    display: flex;
    flex-direction: column;
}

.panelFooter {
    margin-top: auto;
    padding-top: 18px;
    font-size: 11.5px;
    color: var(--muted);
    line-height: 1.5;
    font-weight: 500;
    border-top: 1px solid var(--line);
}

/* ============================================================
   PAGE-SPECIFIC — LOGO PAGE (.page-logo)
   ============================================================ */
.page-logo #stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 36px;
}

/* Square logo canvas (≈700×700) */
.page-logo .card {
    width: min(700px, 100%);
    aspect-ratio: 1 / 1; /* always square */
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid var(--line);
    box-shadow: 0 20px 55px rgba(20, 20, 40, .10);
    background: var(--surface);
}

/* checkerboard visible when background is transparent */
.page-logo .card.transparent {
    background: conic-gradient(#ececf2 25%, #fafafd 0 50%, #ececf2 0 75%, #fafafd 0) 0 0 / 28px 28px;
}

.page-logo .card svg {
    display: block;
    width: 100%;
    height: 100%;
}

.page-logo .caption {
    font-size: 14px;
    font-weight: 500;
    letter-spacing: .05em;
    color: var(--muted);
    text-align: center;
}

/* ============================================================
   PAGE-SPECIFIC — WAVES PAGE (.page-waves)
   ============================================================ */
.page-waves #stage {
    height: 100vh;
    position: relative;
    background: #0d0d13;
    overflow: hidden;
}

/* The artwork fills the entire right space, edge to edge. */
.page-waves #art {
    position: absolute;
    inset: 0;
}

.page-waves #art svg {
    display: block;
    width: 100%;
    height: 100%;
}

.page-waves #stageControls {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    pointer-events: none;
    z-index: 5;
}

.page-waves .pillRow {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: center;
}

.page-waves .pillBtn {
    pointer-events: auto;
    background: transparent;
    border: 1.5px solid rgba(255, 255, 255, 0.85);
    border-radius: 999px;
    color: #fff;
    opacity: 0.75;
    cursor: pointer;
    padding: 10px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-family: var(--font);
    transition: opacity .2s ease, transform .15s ease, box-shadow .2s ease;
}

.page-waves .pillBtn:hover {
    opacity: 0.99;
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, .25);
    border-width: 2px;
}

.page-waves .pillBtn:active {
    transform: scale(.97);
}

.page-waves .pl1 {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: .04em;
    line-height: 1.2;
}

.page-waves .pl2 {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .08em;
    opacity: .85;
    line-height: 1.2;
}

.page-waves .caption {
    color: rgba(255, 255, 255, .55);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: .05em;
    text-align: center;
    text-shadow: 0 1px 8px rgba(0, 0, 0, .5);
}

/* ==================== SMALL SCREENS ==================== */
@media (max-width: 670px) {
    #app {
        flex-direction: column;
    }

    #panel {
        width: 100%;
        min-width: 0;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .page-logo #stage {
        width: 100%;
        padding: 20px;
    }

    .page-waves #stage {
        width: 100%;
        height: 70vh;
    }
}


/* ============================================================
   PAGE-SPECIFIC - MONEY PORTRAIT PAGE (.page-money)
   The stage layout mirrors the logo page: a rounded square card
   holding the 800x800 engraving canvas, with a caption below.
   New shared-with-this-page widgets: the stage view tab bar
   (same pill style as the nav switch), range sliders, the
   portrait drop zone and the optional settings block.
   ============================================================ */
   .page-money #stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 36px;
}

/* Square art card (800x800 canvas, shown at most 720px wide) */
.page-money .card {
    width: min(720px, 100%);
    aspect-ratio: 1 / 1;
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid var(--line);
    box-shadow: 0 20px 55px rgba(20, 20, 40, .10);
    background: var(--surface);
}

.page-money .card canvas {
    display: block;
    width: 100%;
    height: 100%;
    background: #fff;
}

/* Stage caption doubles as the status line */
.page-money .caption {
    font-size: 14px;
    font-weight: 500;
    letter-spacing: .05em;
    color: var(--muted);
    text-align: center;
    min-height: 20px;
}

.page-money .caption.error {
    color: var(--danger);
    font-weight: 600;
}

/* View tab bar: FINAL ART / PERSON MASK / WAVE PATTERN.
   Same pill style as the nav switch. Hidden by dp.js when fewer
   than two views are enabled in the SHOW config. */
.page-money .viewSwitch {
    display: flex;
    background: #f0f0f3;
    border-radius: 999px;
    padding: 4px;
    gap: 4px;
    width: 100%;
    max-width: 430px;
}

.page-money .viewSwitch button {
    flex: 1;
    text-align: center;
    padding: 9px 10px;
    border: 0;
    border-radius: 999px;
    font: inherit;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: background .2s ease, color .2s ease, box-shadow .2s ease;
}

.page-money .viewSwitch button:hover {
    color: var(--ink);
}

.page-money .viewSwitch button.active {
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .12), 0 0 0 1px rgba(0, 0, 0, .03);
}

/* Range sliders (label row + value on the right) */
.page-money .sliderVal {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .08em;
    color: var(--muted);
}

.page-money input[type="range"] {
    width: 100%;
    accent-color: var(--ink);
    margin: 2px 0 0;
    cursor: pointer;
}

/* Portrait photo drop zone */
.page-money .dropZone {
    border: 1.5px dashed #d5d5d9;
    border-radius: 16px;
    padding: 22px 14px;
    text-align: center;
    font-size: 12.5px;
    color: var(--muted);
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
}

.page-money .dropZone.hover {
    background: #f6f6f9;
    border-color: var(--muted);
}

.page-money .dropZone img {
    max-width: 100%;
    max-height: 150px;
    border-radius: 10px;
    margin-top: 10px;
}

.page-money .dropZone .fileName {
    font-weight: 600;
    color: var(--ink);
}

/* Optional settings block (SHOW.settingsPanel in dp.js) */
.page-money .mono {
    font-family: 'SF Mono', Consolas, Menlo, monospace;
    font-size: 10.5px;
    line-height: 1.5;
    background: #fafafd;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px;
    max-height: 170px;
    overflow: auto;
    white-space: pre;
    color: #555;
    margin: 0;
}

/* Disabled Regenerate button */
.page-money .btn.primary:disabled {
    opacity: .4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Small screens: match the other pages */
@media (max-width: 670px) {
    .page-money #stage {
        width: 100%;
        padding: 20px;
    }
}


/* ============================================================
   PAGE-SPECIFIC - MONEY PORTRAIT PAGE, round 2 additions
   (append at the end of styles.css)
   ============================================================ */

/* Small subtle pill for the Clear button next to "Portrait Photo" */
.page-money .btn.small {
    padding: 6px 14px;
    font-size: 11px;
    letter-spacing: .08em;
    flex: none;
}

/* Stage action row: sits below the canvas, above the caption */
.page-money .stageBtns {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

/* Subtle pill outline buttons for the stage actions */
.page-money .stageBtn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font: inherit;
    font-weight: 600;
    font-size: 12.5px;
    border-radius: 999px;
    cursor: pointer;
    padding: 10px 20px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    transition: transform .15s, border-color .15s, box-shadow .15s;
}

.page-money .stageBtn:hover {
    border-color: var(--ink);
    transform: translateY(-1px);
}

.page-money .stageBtn:active {
    transform: scale(.97);
}

/* The Create Portrait pill: black background, white text */
.page-money .stageBtn.create {
    background: var(--ink);
    color: #fff;
    border-color: var(--ink);
}

.page-money .stageBtn.create:hover {
    box-shadow: 0 8px 22px rgba(20, 20, 40, .22);
}

.page-money .stageBtn:disabled {
    opacity: .4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Checkerboard behind the preview canvas when the chosen
   background is transparent (same look as the logo card) */
.page-money .card.transparent {
    background: conic-gradient(#ececf2 25%, #fafafd 0 50%, #ececf2 0 75%, #fafafd 0) 0 0 / 28px 28px;
}

/* The canvas element itself carries a white CSS background from the
   round-1 block (.page-money .card canvas { background: #fff; }).
   That white would cover the checkerboard above, so it must also
   drop away when the card switches to its transparent state. */
.page-money .card.transparent canvas {
    background: transparent;
}


/* ============================================================
   PAGE-SPECIFIC - MONEY PORTRAIT PAGE, round 2 additions
   (append at the end of styles.css)
   ============================================================ */

/* Small subtle pill for the Clear button next to "Portrait Photo" */
.page-money .btn.small {
    padding: 6px 14px;
    font-size: 11px;
    letter-spacing: .08em;
    flex: none;
}

/* Stage action row: sits below the canvas, above the caption */
.page-money .stageBtns {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

/* Subtle pill outline buttons for the stage actions */
.page-money .stageBtn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font: inherit;
    font-weight: 600;
    font-size: 12.5px;
    border-radius: 999px;
    cursor: pointer;
    padding: 10px 20px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    transition: transform .15s, border-color .15s, box-shadow .15s;
}

.page-money .stageBtn:hover {
    border-color: var(--ink);
    transform: translateY(-1px);
}

.page-money .stageBtn:active {
    transform: scale(.97);
}

/* The Create Portrait pill: black background, white text */
.page-money .stageBtn.create {
    background: var(--ink);
    color: #fff;
    border-color: var(--ink);
}

.page-money .stageBtn.create:hover {
    box-shadow: 0 8px 22px rgba(20, 20, 40, .22);
}

.page-money .stageBtn:disabled {
    opacity: .4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Checkerboard behind the preview canvas when the chosen
   background is transparent (same look as the logo card) */
.page-money .card.transparent {
    background: conic-gradient(#ececf2 25%, #fafafd 0 50%, #ececf2 0 75%, #fafafd 0) 0 0 / 28px 28px;
}

/* The canvas element itself carries a white CSS background from the
   round-1 block (.page-money .card canvas { background: #fff; }).
   That white would cover the checkerboard above, so it must also
   drop away when the card switches to its transparent state. */
.page-money .card.transparent canvas {
    background: transparent;
}
