/**
 * Lunarcat Global Standard
 *
 * The single canonical frontend design system: tokens + the shared `.luna`
 * vocabulary (structure, text, colour, divider, button, link, toggle, table).
 * Local CSS files reference these tokens/classes; they never redefine them.
 *
 * Tokens live on `.luna` (added to <body>), NOT :root — bare :root vars collide
 * with GeneratePress/Elementor. `[data-theme="dark"] .luna` flips the palette.
 */

/* =============================================================================
   TOKENS — LIGHT (default)
   ============================================================================= */
.luna,
body.wp-admin {
    /* Accent — sakura (light) / moon-gold (dark). */
    --accent: #ff9eb5;
    --accent-hover: #ffb3c6;
    --accent-pressed: #e688a1;
    --accent-rgb: 255, 158, 181;
    --accent-glow: rgba(255, 158, 181, 0.3);
    --accent-glow-strong: rgba(255, 158, 181, 0.4);
    /* Neutral in dark: dark-mode gold is never a surface fill. */
    --tint-faint: rgba(255, 158, 181, 0.03);
    --tint: rgba(255, 158, 181, 0.08);
    --tint-strong: rgba(255, 158, 181, 0.16);
    --gold: #ffcd39;
    --sakura: #ff9eb5;

    /* Surfaces — page base, card fill, and the stronger raised/inset fill. */
    --background: #f2f0f0;
    --surface: linear-gradient(135deg, #e8e8e8 0%, #f2f0f0 50%, #faf8f9 100%);
    --surface-strong: linear-gradient(135deg, #faf8f9 0%, #e8e8e8 50%, #d8d8d8 100%);

    /* Body text — slate grey in light, grey in dark. One step softer than the
       black/white headings. Accent + status are the only other text colours. */
    --body-text: #495057;
    --muted: #868e96;

    /* Heading / strong text — black (light) / white (dark). Headings, cat-card
       titles, statistic labels: the max-contrast text one step above body. */
    --heading: #2a2a2a;

    /* Borders — strong (inputs, cards) + soft (dividers, subtle separators). */
    --border: #d5d0d0;
    --border-soft: #e8e8e8;

    /* Cyan — checkout step slashes. */
    --cyan: #18b6d6;

    --item-name: #60a5fa;

    /* Status — solid, plus a faint translucent fill (cf. --tint). */
    --status-success: #20c997;
    --status-danger: #f5365c;
    --status-warning: #fbbf24;
    --status-info: #11cdef;
    --status-success-faint: rgba(32, 201, 151, 0.12);
    --status-danger-faint: rgba(245, 54, 92, 0.12);
    --status-warning-faint: rgba(251, 191, 36, 0.12);
    --status-info-faint: rgba(17, 205, 239, 0.12);
    --status-danger-hover: #ff6b6b;

    /* Text on solid fills: the accent (buttons, pips, badges) and status,
       brand or photo fills. */
    --on-accent: #1a1a1a;
    --on-solid: #fff;
    /* Dark in both themes (theme pill); the dark theme's --surface. */
    --surface-dark: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);

    /* Specials. */
    --trustpilot-green: #00b67a;
    --trustpilot-green-dark: #005128;
    --gradient-header: linear-gradient(90deg, #f7f5f3 0%, #e7e4e1 55%, #d3cfca 100%);
    --gradient-button: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 50%, var(--accent-pressed) 100%);

    --shadow-card: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-card-hover: 0 8px 25px var(--accent-glow);
    --shadow-glow: 0 0 20px var(--accent-glow);

    /* Spacing — one base unit, everything a multiple. In rem so type and rhythm
       scale together when the root font-size changes (account text-size setting). */
    --space: 1rem;
    --space-2xs: calc(0.25 * var(--space));   /*  4px */
    --space-xs:  calc(0.5  * var(--space));    /*  8px */
    --space-sm:  calc(0.75 * var(--space));    /* 12px */
    --space-lg:  calc(1.5  * var(--space));    /* 24px */
    --space-xl:  calc(2    * var(--space));    /* 32px */
    --space-2xl: calc(3    * var(--space));    /* 48px */
    --space-3xl: calc(4    * var(--space));    /* 64px */

    /* Radius — one scale. */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-pill: 999px;

    /* Type scale — rem so the account text-size setting scales all together. */
    --font-primary: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans JP', 'Hiragino Kaku Gothic Pro', 'Meiryo', system-ui, sans-serif;
    --font-mono: 'SF Mono', Monaco, Inconsolata, 'Roboto Mono', 'Source Code Pro', 'Courier New', monospace;
    --font-size-2xs:  0.6875rem;  /* 11px — chips and micro labels only */
    --font-size-xs:   0.75rem;    /* 12px */
    --font-size-sm:   0.875rem;   /* 14px */
    --font-size-base: 1rem;       /* 16px */
    --font-size-md:   1.0625rem;  /* 17px */
    --font-size-lg:   1.125rem;   /* 18px */
    --font-size-xl:   1.25rem;    /* 20px */
    --font-size-2xl:  1.5rem;     /* 24px: close glyphs, small figures */
    --font-size-3xl:  1.75rem;    /* 28px: KPI figures */

    --font-weight-normal:   400;
    --font-weight-medium:   500;
    --font-weight-semibold: 600;
    --font-weight-bold:     700;

    /* Container widths — the only max-width values; rem so layouts widen with text. */
    --width-narrow:  30rem;   /* 480px: forms, auth card */
    --width-content: 45rem;   /* 720px: reading column, settings, checkout */
    --width-page:    65rem;   /* 1040px: full account pages, cart */

    /* Controls. */
    --field-height: 2.375rem;  /* 38px — rem so controls grow with text */
    --tracking-wide: 0.08em;
    --transition-fast: 0.2s ease;
    --opacity-disabled: 0.5;

    /* Row indent that lines content up past a leading 2rem toggle column. */
    --alignment-offset: calc(2rem + var(--space));
}

/* =============================================================================
   TOKENS — DARK
   ============================================================================= */
/* wp-admin never sets data-theme; WP Dark Mode paints it dark, so admin
   takes the dark palette. */
[data-theme="dark"] .luna,
body.wp-admin {
    --accent: #ffcd39;
    --accent-hover: #ffd666;
    --accent-pressed: #e6b800;
    --accent-rgb: 255, 205, 57;
    --accent-glow: rgba(255, 205, 57, 0.3);
    --accent-glow-strong: rgba(255, 205, 57, 0.4);
    --tint-faint: rgba(255, 255, 255, 0.02);
    --tint: rgba(255, 255, 255, 0.05);
    --tint-strong: rgba(255, 255, 255, 0.1);

    --background: #1a1a1a;
    --surface: var(--surface-dark);
    --surface-strong: linear-gradient(135deg, #0f0f0f 0%, #1a1a1a 100%);

    --body-text: #adb5bd;
    --muted: #6c757d;
    --heading: #ffffff;

    --border: #404040;
    --border-soft: #333333;

    --cyan: #3bd6f2;
    --item-name: #ff9eb5;

    --gradient-header: linear-gradient(90deg, #0d0d0d 0%, #161616 55%, #232323 100%);
}

/* =============================================================================
   PAGE BASE — the site shell. <body> carries .luna, so these class-level rules
   beat GeneratePress's element defaults without !important.
   ============================================================================= */
/* Account text size (Settings), printed on <html> by the server. Every size is
   rem, so this one root value scales the whole page. */
html[data-text-size="small"] { font-size: 87.5%; }
html[data-text-size="large"] { font-size: 112.5%; }
html[data-text-size="x-large"] { font-size: 125%; }

html {
    /* Full-bleed 100vw sections include the scrollbar on classic-scrollbar
       browsers; clip that sliver. */
    overflow-x: clip;
    /* Hosted on html because ::view-transition() cannot see a body-level token. */
    --theme-transition-duration: 1s;
}

body.luna,
.luna :is(#page, #main, #content, .site, .site-content, .site-main, .content-area, .hfeed, .entry-content) {
    background: var(--background);
}

body.luna {
    color: var(--body-text);
    font-size: var(--font-size-base);
}

.luna,
.luna :where(button, input, select, textarea) {
    font-family: var(--font-primary);
}

/* Bare buttons shed the WordPress theme button colours. The hover/focus selector
   outranks the theme's `button:hover`. */
.luna :where(button) {
    color: inherit;
    background: none;
}

.luna :where(button):is(:hover, :focus) {
    color: inherit;
    background: none;
}

.luna .site-content {
    padding-top: var(--space-xl);
}

/* GeneratePress lays .site-content out as a row; a template root fills it. */
.luna .site-content > .luna {
    flex: 1;
    min-width: 0;
}

.luna input[type="number"] {
    appearance: textfield;
}

.luna input[type="number"]::-webkit-outer-spin-button,
.luna input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* =============================================================================
   STRUCTURE — bare tags carry the defaults; pages emit no per-element class.
   ============================================================================= */
.luna p,
.luna li {
    font-size: var(--font-size-base);
    line-height: 1.5;
    color: var(--body-text);
}

.luna ul,
.luna ol {
    padding-left: var(--space-lg);
    line-height: 1.8;
}

/* Nested list: indented lines under a lead item, no second marker. */
.luna li > ul {
    margin-top: var(--space-2xs);
    padding-left: var(--space-xs);
    list-style: none;
}

/* Headings — the strong --heading colour (black light / white dark). */
.luna h1,
.luna h2,
.luna h3 {
    font-family: var(--font-primary);
    color: var(--heading);
    line-height: 1.3;
}

.luna h1 {
    font-size: clamp(2.25rem, 3vw, 2.75rem);
    font-weight: var(--font-weight-bold);
    line-height: 1.2;
}

.luna h2 {
    font-size: clamp(1.5rem, 2vw, 1.75rem);
    font-weight: var(--font-weight-semibold);
    text-align: center;
}

/* Anchor jump targets clear the sticky header when linked via #id. */
.luna h2[id] {
    scroll-margin-top: var(--space-xl);
}

.luna h3 {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
}

/* =============================================================================
   TEXT — medium (16px) is the default <p>; large/small opt in. Classes alias
   the type scale so the account text-size setting moves everything at once.
   ============================================================================= */
.luna .text-large { font-size: var(--font-size-lg); }
.luna .text-small { font-size: var(--font-size-sm); }

.luna .highlight {
    display: inline-block;
    background: linear-gradient(100deg, var(--gold), var(--sakura), var(--gold));
    background-size: 200% auto;
    background-clip: text;
    color: transparent;
    font-weight: var(--font-weight-bold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: highlight-shimmer 4s ease-in-out infinite;
}
@keyframes highlight-shimmer {
    0%, 100% { background-position: 0% center; }
    50% { background-position: 100% center; }
}
@media (prefers-reduced-motion: reduce) {
    .luna .highlight { animation: none; }
}

/* Caption — small-print: footnotes, sub-labels, dates, meta. Italic + dim. */
.luna .caption,
.luna .article figcaption {
    font-size: var(--font-size-sm);
    font-style: italic;
    color: var(--body-text);
    opacity: 0.8;
    margin: 0;
}

/* =============================================================================
   COLOUR — body is --body-text, emphasis is <strong>/<h*>, accent is --accent.
   Only status colours need a text class.
   ============================================================================= */
.luna .text-danger  { color: var(--status-danger); }
.luna .text-success { color: var(--status-success); }

/* =============================================================================
   UTILITIES — the only ones no tag/default/token already covers: two layout
   primitives, alignment, tabular figures, hidden state. Weight, font-size, and
   text colour are NOT utilities — they come from tags, --body-text, --heading,
   or a component's own rule.
   ============================================================================= */

/* Vertical rhythm — gap-spaced column; owns its children's spacing. */
.luna .stack {
    display: flex;
    flex-direction: column;
    gap: var(--space);
}

.luna .stack > * {
    margin: 0;
}

/* Row split — label left, value/action right. */
.luna .flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space);
}

.luna .card-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--space);
    margin-top: var(--space);
}

.luna .text-center { text-align: center; }

/* Tabular figures — aligns digits in prices, quantities, ID columns. */
.luna .tabular { font-variant-numeric: tabular-nums; }

.luna .hidden { display: none !important; }

/* =============================================================================
   DIVIDER — soft top rule with matching top rhythm.
   ============================================================================= */
.luna .divider-top {
    border-top: 1px solid var(--border-soft);
    margin-top: var(--space);
    padding-top: var(--space);
}

/* =============================================================================
   BUTTON — four roles: .button (primary CTA), .button-skeleton (secondary),
   .button-red (destructive), .button-green (confirm), plus the one brand
   exception .button-trustpilot (links to Trustpilot only).
   ============================================================================= */
.luna .button,
.luna .button-skeleton,
.luna .button-red,
.luna .button-green,
.luna .button-trustpilot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    height: var(--field-height);
    padding: 0 var(--space);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    box-sizing: border-box;
    transition: background .2s ease, border-color .2s ease, color .2s ease, box-shadow .2s ease, transform .12s ease;
}

.luna .button:active,
.luna .button-skeleton:active,
.luna .button-red:active,
.luna .button-green:active,
.luna .button-trustpilot:active {
    transform: translateY(1px);
}

.luna .button {
    background: var(--gradient-button);
    color: var(--on-accent);
}

.luna .button:hover {
    box-shadow: 0 4px 14px var(--accent-glow);
    color: var(--on-accent);
    text-decoration: none;
}

.luna .button-skeleton {
    background: transparent;
    border-color: var(--accent);
    color: var(--accent);
}

.luna .button-skeleton:hover {
    background: var(--accent);
    color: var(--on-accent);
}

.luna .button-red {
    background: var(--status-danger);
    color: var(--on-solid);
}

.luna .button-red:hover {
    box-shadow: 0 4px 14px rgba(224, 85, 78, .35);
    color: var(--on-solid);
}

.luna .button-green {
    background: var(--status-success);
    color: var(--on-solid);
}

.luna .button-green:hover {
    box-shadow: 0 4px 14px rgba(34, 197, 94, .35);
    color: var(--on-solid);
}

.luna .button-trustpilot {
    background: linear-gradient(135deg, var(--trustpilot-green) 0%, var(--trustpilot-green-dark) 100%);
    box-shadow: 0 4px 15px rgba(0, 182, 122, .3);
    color: var(--on-solid);
}

.luna .button-trustpilot:hover {
    box-shadow: 0 6px 20px rgba(0, 182, 122, .4);
    color: var(--on-solid);
    text-decoration: none;
}

.luna .button:disabled,
.luna .button-skeleton:disabled,
.luna .button-red:disabled,
.luna .button-green:disabled,
.luna .button-trustpilot:disabled,
.luna .button[aria-disabled="true"] {
    opacity: var(--opacity-disabled);
    cursor: not-allowed;
    pointer-events: none;
    transform: none;
}

/* Buttons are inline-flex, which would beat the hidden attribute. */
.luna .button[hidden],
.luna .button-skeleton[hidden],
.luna .button-red[hidden],
.luna .button-green[hidden],
.luna .button-trustpilot[hidden] {
    display: none;
}

/* =============================================================================
   FIELDS — the one canonical text input / textarea / select. Every form field
   site-wide uses .field-input / .field-textarea / .field-select; never redeclare
   field geometry per surface.
   ============================================================================= */
.luna .field-input,
.luna .field-select {
    width: 100%;
    height: var(--field-height);
    padding: 0 var(--space);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    font-family: var(--font-primary);
    line-height: var(--field-height);
    background: var(--background);
    color: var(--body-text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.luna .field-select {
    cursor: pointer;
}

.luna .field-textarea {
    width: 100%;
    padding: var(--space);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-base);
    font-family: var(--font-primary);
    background: var(--background);
    color: var(--body-text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    resize: vertical;
    min-height: calc(var(--field-height) * 2);
    box-sizing: border-box;
}

/* Background and text are restated here: the theme's input[type]:focus rule
   (0,2,1) outranks the base field rule and would repaint the field light. */
.luna .field-input:focus,
.luna .field-textarea:focus,
.luna .field-select:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--background);
    color: var(--body-text);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.luna .field-input:hover,
.luna .field-textarea:hover,
.luna .field-select:hover {
    border-color: var(--accent-hover);
}

.luna .field-input:disabled,
.luna .field-textarea:disabled,
.luna .field-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--border-soft);
}

/* Readonly reads as fixed, not editable. */
.luna .field-input[readonly] {
    background: var(--surface-strong);
    color: var(--body-text);
    cursor: not-allowed;
}

.luna .field-input[readonly]:focus {
    border-color: var(--border);
    box-shadow: none;
}

/* Customs entries: one block per declared product, item line then two field rows.
   Shared by the customer PTS modal and the admin storage editors. */
:is(.luna, .wp-admin) .customs-entries {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

:is(.luna, .wp-admin) .customs-entry {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    padding: var(--space-xs);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
}

:is(.luna, .wp-admin) .customs-entry__item {
    font-size: var(--font-size-sm);
}

:is(.luna, .wp-admin) .customs-entry__fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
    gap: var(--space-xs);
    align-items: end;
}

:is(.luna, .wp-admin) .customs-field {
    display: grid;
    gap: var(--space-2xs);
    min-width: 0;
}

:is(.luna, .wp-admin) .customs-field[data-col="description"] {
    grid-column: span 2;
}

:is(.luna, .wp-admin) .customs-field__label {
    font-size: var(--font-size-xs);
    white-space: nowrap;
}

:is(.luna, .wp-admin) .customs-field .field-input {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

:is(.luna, .wp-admin) .customs-entries:not(.is-pid-required) .customs-field:is([data-col="merchant_pid"], [data-col="manufacturer_pid"], [data-col="gtin"]) {
    display: none;
}

/* Every parcel item to the EU keeps its own row; a value change can make identifiers required. */
:is(.luna, .wp-admin) .customs-entries.is-pid-destination .customs-entry[data-item-key] .pts-remove-row {
    display: none;
}

:is(.luna, .wp-admin) .customs-entry__actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: var(--space-2xs);
}

:is(.luna, .wp-admin) .customs-entries__total {
    padding-block: var(--space-xs);
    font-weight: var(--font-weight-semibold);
}

/* Validation states. */
.luna .field-input.error,
.luna .field-textarea.error,
.luna .field-select.error {
    border-color: var(--status-danger);
}

.luna .field-input.success,
.luna .field-textarea.success,
.luna .field-select.success {
    border-color: var(--status-success);
}

.luna .field-input::placeholder,
.luna .field-textarea::placeholder {
    color: var(--body-text);
    opacity: .6;
}

/* 16px on touch viewports stops iOS Safari from zooming into a focused field. */
@media (max-width: 768px) {
    .luna .field-input,
    .luna .field-textarea,
    .luna .field-select {
        font-size: var(--font-size-base);
    }
}

/* Field chrome — label, control, help and messages stacked with one gap. The
   parent form (.stack / grid) owns the spacing between groups. The tooltip is
   ordered after the required marker. */
.luna .field-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    margin: 0;
}

.luna .field-label {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin: 0;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--body-text);
}

/* The * follows the control: a label whose field is required (the control
   itself, or a wrapper holding it) gets the marker. Never a class on the label. */
.luna .field-label:has(~ :required, ~ * :required)::after {
    content: '*';
    margin-left: var(--space-2xs);
    color: var(--status-danger);
}

.luna .field-label .field-tooltip {
    order: 1;
}

/* Checkbox / radio — one control everywhere. :where() keeps it at class-level
   specificity so a surface class can still set layout (e.g. margins). */
.luna :where(input[type="checkbox"], input[type="radio"]) {
    flex-shrink: 0;
    width: var(--space);
    height: var(--space);
    margin: 0;
    accent-color: var(--accent);
    cursor: pointer;
}

.luna :where(input[type="checkbox"], input[type="radio"]):disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* Option row — a checkbox or radio followed by its text. */
.luna .check {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: var(--font-size-sm);
    color: var(--body-text);
    cursor: pointer;
}

.luna .check[hidden] {
    display: none;
}

.luna .field-help {
    margin: 0;
    font-size: var(--font-size-xs);
    color: var(--body-text);
}

/* =============================================================================
   CARD — the bordered content card (article body, dashboard sections).
   ============================================================================= */
.luna :is(.basic-container, .dashboard-container) {
    position: relative;
    overflow: hidden;
    margin-bottom: var(--space);
    padding: var(--space);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

/* Phones drop the card chrome; the page gutter frames the content. */
@media (max-width: 480px) {
    .luna :is(.basic-container, .dashboard-container) {
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
    }
}

.luna :is(.address-page, .wallet-page) {
    max-width: var(--width-page);
    margin: 0 auto;
    padding: var(--space-lg) var(--space) var(--space-3xl);
    color: var(--body-text);
}

/* The article card stacks its children with one gap. */
.luna .basic-container {
    display: flex;
    flex-direction: column;
    gap: var(--space);
    text-align: left;
}

.luna .basic-container > * {
    margin: 0;
}

/* A caption belongs to the block above it, so it sits closer than the stack gap. */
.luna .basic-container > .caption {
    margin-top: calc(var(--space-xs) - var(--space));
}

/* The stack gap spaces a table in the card; its own margin would double it. */
.luna .basic-container > .table-scroll > .data-table {
    margin: 0;
}

/* Section headers need breathing room the gap alone does not give. */
.luna .basic-container > h2 {
    margin-top: var(--space);
    margin-bottom: var(--space);
}

.luna .basic-container > h2:first-child {
    margin-top: 0;
}

/* =============================================================================
   REQUIRED MARKER — a hand-placed * where no field sits beside the text
   (cart captions and column headers, table headers). Field labels get their *
   from the control's required attribute (see FIELDS).
   ============================================================================= */
.luna .required {
    margin-left: var(--space-2xs);
    color: var(--status-danger);
}

/* =============================================================================
   FIELD TOOLTIP — (i) icon beside a label. The bubble is position: fixed and
   placed by lunarcat-utils.js from the icon's on-screen position, so no card,
   table, scroll box or modal can clip it. Shown when the trigger has .is-open.
   ============================================================================= */
.luna .field-tooltip {
    display: inline-block;
    vertical-align: middle;
}

.luna .field-tooltip-icon {
    color: var(--body-text);
    cursor: help;
    transition: color var(--transition-fast);
}

.luna .field-tooltip.is-open .field-tooltip-icon {
    color: var(--heading);
}

.luna .field-tooltip-content {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100000; /* above the modal host (99999), below toasts */
    width: max-content;
    min-width: 10rem;
    max-width: min(17.5rem, calc(100vw - var(--space)));
    padding: var(--space-sm);
    overflow-wrap: break-word;
    white-space: normal;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-normal);
    color: var(--body-text);
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--transition-fast), visibility var(--transition-fast);
}

.luna .field-tooltip.is-open .field-tooltip-content {
    opacity: 1;
    visibility: visible;
}

/* =============================================================================
   FIELD SUGGEST — suggestion list under a text field. Appended to <body> and
   positioned by script, so the node is its own token root (`luna field-suggest`)
   and works in wp-admin too.
   ============================================================================= */
.luna.field-suggest {
    position: absolute;
    z-index: 100000; /* above the modal host (99999) */
    min-width: 25ch;
    max-height: calc(var(--field-height) * 5);
    overflow-y: auto;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
}

.luna.field-suggest .field-suggest__item,
.luna.field-suggest .field-suggest__empty {
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-size-sm);
    color: var(--body-text);
}

.luna.field-suggest .field-suggest__item {
    display: flex;
    flex-direction: column;
    cursor: pointer;
    border-bottom: 1px solid var(--border-soft);
}

.luna.field-suggest .field-suggest__item:hover {
    background: var(--tint);
}

.luna.field-suggest .field-suggest__item strong {
    color: var(--heading);
}

.luna.field-suggest .field-suggest__meta {
    font-size: var(--font-size-xs);
}

/* =============================================================================
   ALERT — inline status box. Status colour on a faint status fill.
   ============================================================================= */
.luna .alert {
    display: block;
    padding: var(--space);
    border: 1px solid var(--alert-color, var(--border));
    border-radius: var(--radius-md);
    background: var(--alert-fill, transparent);
    color: var(--alert-color, var(--body-text));
    font-size: var(--font-size-sm);
    line-height: 1.5;
}

.luna .alert--success { --alert-color: var(--status-success); --alert-fill: var(--status-success-faint); }
.luna .alert--warning { --alert-color: var(--status-warning); --alert-fill: var(--status-warning-faint); }
.luna .alert--danger  { --alert-color: var(--status-danger);  --alert-fill: var(--status-danger-faint); }
.luna .alert--info    { --alert-color: var(--status-info);    --alert-fill: var(--status-info-faint); }

/* Text inside an alert follows the alert, not the page-prose size. */
.luna .alert :is(p, li) {
    font-size: inherit;
    line-height: inherit;
}

.luna .alert--centered {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space);
    text-align: center;
}

.luna .alert--auth-feedback {
    margin-bottom: var(--space);
}

/* =============================================================================
   CHIP / BADGE — small inline labels. A chip is an outlined pill whose colours
   a status class can swap via --chip-*; a badge is a solid accent tag.
   ============================================================================= */
.luna .chip {
    --chip-border-color: var(--border);
    --chip-bg-color: transparent;
    --chip-text-color: var(--heading);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: var(--space-2xs) var(--space-sm);
    border: 1px solid var(--chip-border-color);
    border-radius: var(--radius-pill);
    background: var(--chip-bg-color);
    color: var(--chip-text-color);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    line-height: 1.2;
    transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.luna .chip.clickable {
    cursor: pointer;
    text-decoration: none;
}

.luna .chip.clickable:hover {
    opacity: .85;
}

.luna .badge {
    display: inline-block;
    margin-left: var(--space-xs);
    padding: var(--space-2xs) var(--space-xs);
    border-radius: var(--radius-xs);
    background: var(--accent);
    color: var(--background);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
}

/* =============================================================================
   ICON BUTTON — the shared square icon toggle (image / comment / photo icons on
   cart + mypage rows). Bordered box, cyan on hover, accent when `is-on`. Not a
   text CTA — that is `.button`.
   ============================================================================= */
.luna .icon-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--space-xl);
    height: var(--space-xl);
    padding: 0;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--body-text);
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.luna .icon-button svg { width: var(--space); height: var(--space); }

.luna .icon-button:hover,
.luna .icon-button.is-on {
    border-color: var(--cyan);
    color: var(--cyan);
}

/* Filled accent when active: an image is attached (is-on) or the panel is open. */
.luna .icon-button.is-on[data-cart-img],
.luna .icon-button[data-photo-toggle][aria-expanded="true"] {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--tint);
}

.luna .special-link__label {
    position: absolute;
    top: calc(100% + var(--space-xs));
    left: 0;
    right: 0;
    color: var(--heading);
    font-size: var(--font-size-sm);
    text-align: center;
    visibility: hidden;
}

.luna :is(.special-link, .icon-button):is(:hover, :focus-visible) .special-link__label {
    visibility: visible;
}

.luna .icon-button .special-link__label {
    left: auto;
    white-space: nowrap;
}

/* Count badge — small accent pip in the top-right corner. */
.luna .icon-button__badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: var(--space);
    height: var(--space);
    padding: 0 var(--space-2xs);
    border-radius: var(--radius-pill);
    background: var(--accent);
    color: var(--on-accent);
    font-size: var(--font-size-xs);
    line-height: var(--space);
    text-align: center;
}

/* =============================================================================
   LINK — one global hyperlink style (unscoped so it works on every surface).
   Accent, cyan on hover, red danger variant.
   ============================================================================= */
/* The table selector outranks .data-table td *, which resets cell text color. */
.hyperlink,
.hyperlink:visited,
.luna .data-table td .hyperlink,
.luna .article a,
.luna .article a:visited {
    color: var(--accent);
    font-weight: var(--font-weight-semibold);
    text-decoration: none;
    transition: color 0.2s ease;
}

.hyperlink:hover,
.hyperlink:focus,
.hyperlink:active,
.luna .data-table td .hyperlink:is(:hover, :focus, :active),
.luna .article a:hover,
.luna .article a:focus,
.luna .article a:active {
    color: var(--cyan);
}

.hyperlink-red,
.hyperlink-red:link,
.hyperlink-red:visited {
    color: var(--status-danger);
}

.hyperlink-red:hover,
.hyperlink-red:focus,
.hyperlink-red:active {
    color: var(--status-danger-hover);
}

/* =============================================================================
   EXPAND TOGGLE — expand/collapse control. Base + circle (round icon button)
   and pill variants. `.toggle-icon` is the +/− glyph; `.expanded` is the state.
   ============================================================================= */
.luna .expand-toggle {
    display: inline-flex;
    align-items: center;
    gap: var(--space);
    padding: var(--space);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: var(--font-size-xs);
    color: var(--body-text);
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
    flex-shrink: 0;
}

.luna .expand-toggle .toggle-icon {
    font-weight: var(--font-weight-semibold);
}

.luna .expand-toggle:hover,
.luna .expand-toggle.expanded {
    border-color: var(--accent);
    color: var(--accent);
}

/* Circle — round icon button (order rows, accordions). */
.luna .expand-toggle.circle-expand-toggle {
    width: var(--field-height);
    height: var(--field-height);
    border-radius: 50%;
    justify-content: center;
    border-color: transparent;
    background: var(--tint);
    color: var(--accent);
    box-shadow: var(--shadow-card);
}

.luna .expand-toggle.circle-expand-toggle:hover,
.luna .expand-toggle.circle-expand-toggle.expanded {
    border-color: transparent;
    color: var(--accent);
    box-shadow: var(--shadow-glow);
}

/* Pill — compact rounded chip (storage + shipping rows). */
.luna .expand-toggle.pill-expand-toggle {
    border-radius: var(--radius-pill);
    padding: var(--space-2xs) var(--space-sm);
    font-size: var(--font-size-xs);
    border-color: var(--border-soft);
    color: var(--body-text);
    font-weight: var(--font-weight-medium);
}

.luna .expand-toggle.pill-expand-toggle .toggle-icon {
    font-size: var(--font-size-sm);
}

/* =============================================================================
   TABLE — the one data table. `thead` gets the raised surface; rows separate
   with soft borders.
   ============================================================================= */
/* separate + zero spacing keeps the outer border inside the box (collapse spills
   half of it outside, which shows a scrollbar in .table-scroll) and lets the
   radius apply. Cells only draw a bottom rule, so nothing doubles. */
.luna .data-table {
    box-sizing: border-box;
    width: 100%;
    overflow: hidden;
    margin: var(--space) 0;
    border: 1px solid var(--border);
    border-collapse: separate;
    border-spacing: 0;
    border-radius: var(--radius-md);
    background: var(--background);
}

.luna .data-table thead {
    background: var(--surface-strong);
}

.luna .data-table :is(th, td) {
    padding: var(--space-sm) var(--space);
    border-bottom: 1px solid var(--border);
    font-size: var(--font-size-sm);
    line-height: 1.4;
    text-align: center;
}

.luna .data-table th {
    color: var(--heading);
    font-weight: var(--font-weight-semibold);
}

/* Row headers are labels; the table scrolls instead of wrapping them. */
.luna .data-table th[scope="row"] {
    white-space: nowrap;
}

.luna .data-table td {
    color: var(--body-text);
}

.luna .data-table tr:last-child td {
    border-bottom: none;
}

/* Cell text follows the table (14px/grey), not the page-prose rule, and
   stacked blocks inside a cell get a small gap instead of prose margins. */
.luna .data-table td * {
    font-size: inherit;
    color: inherit;
}

.luna .data-table td > * {
    margin: 0;
}

.luna .data-table td > * + * {
    margin-top: var(--space-xs);
}

/* Scroll wrapper for wide tables. The table sits 1px short of the wrapper on
   purpose: on fractional widths Chromium rounds scrollWidth up and clientWidth
   down, which shows a scrollbar under a table that fits. The table is
   border-box so its border stays inside that width. */
.luna .table-scroll {
    overflow-x: auto;
}

.luna .table-scroll > .data-table {
    width: calc(100% - 1px);
}

/* =============================================================================
   FEE BREAKDOWN — the expandable fee line (checkout payment block, shipping
   service rows, cost simulator). Unscoped like .hyperlink; every surface loads
   global.css.
   ============================================================================= */
/* caret glyph — rotates when its collapsible opens */
.caret-toggle {
    font-size: 1.2rem;
    color: var(--accent);
    transition: transform 0.3s ease;
    display: inline-block;
}

[aria-expanded="true"] > .caret-toggle,
[aria-expanded="true"] .caret-toggle {
    transform: rotate(180deg);
}

/* expandable fee breakdown (shared with the shipping service rows) */
.fee-breakdown {
    margin-top: var(--space-xs);
    padding-top: var(--space-xs);
    border-top: 1px solid var(--border-soft);
}

.fee-breakdown > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space);
    list-style: none;
    cursor: pointer;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
}

.fee-breakdown > summary::-webkit-details-marker {
    display: none;
}

.fee-breakdown[open] > summary .caret-toggle {
    transform: rotate(180deg);
}

/* Fee row that is itself the expand toggle — the fee line folds its own
   breakdown, so the summary keeps the normal row look. */
.fee-breakdown--row {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.fee-breakdown--row > summary {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-normal);
    color: inherit;
}

.fee-breakdown--row > summary .caret-toggle {
    margin-left: var(--space-2xs);
    font-size: 0.7em;
}

.fee-breakdown__content {
    display: grid;
    gap: var(--space-2xs);
    margin-top: var(--space-xs);
    padding-left: var(--space-2xs);
}

.fee-breakdown__group {
    display: flex;
    justify-content: space-between;
    gap: var(--space);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    font-variant-numeric: tabular-nums;
}

.fee-breakdown__group:not(:first-child) {
    margin-top: var(--space-2xs);
}

.fee-breakdown__row {
    font-size: var(--font-size-xs);
    line-height: 1.45;
    word-break: break-word;
}

/* =============================================================================
   STEPPER — the numbered step accordion (shipment checkout, cost simulator).
   JS opens one step at a time (.is-active), marks finished ones (.is-complete),
   may lock unreached ones (.is-locked), sets the body max-height and fills
   .stepper__slashes with one .stepper__slash per step.
   ============================================================================= */
.luna .stepper {
    --slash-glow: color-mix(in srgb, var(--cyan) 55%, transparent);
    --slash-dim: color-mix(in srgb, var(--heading) 16%, transparent);
    --glow-strength: 1;
    --bar-radius: 14px;
    --bar-stripe: 2px;
    --slash-width: var(--space-xs);
    --slash-height: calc(var(--space) * 1.375);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}
[data-theme="dark"] .luna .stepper {
    --slash-glow: color-mix(in srgb, var(--cyan) 60%, transparent);
    --slash-dim: color-mix(in srgb, var(--heading) 14%, transparent);
}

.luna .stepper__bar {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space);
    width: 100%;
    padding: var(--space-sm) var(--space);
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-left: var(--bar-stripe) solid var(--border);
    border-radius: var(--bar-radius);
    color: var(--heading);
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    transition: border-color 0.25s ease, box-shadow 0.3s ease, background 0.3s ease, transform 0.2s ease, opacity 0.25s ease;
}
.luna .stepper__bar:hover { transform: translateY(-1px); }

.luna .stepper__num {
    flex-shrink: 0;
    width: var(--space-xl);
    height: var(--space-xl);
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: var(--font-size-xs);
    font-weight: 700;
    color: var(--body-text);
    background: var(--tint);
    border: 1px solid var(--border-soft);
    transition: color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
.luna .stepper__label {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-2xs);
}
.luna .stepper__name {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    line-height: 1.25;
    transition: color 0.25s ease;
}
.luna .stepper__summary {
    font-size: var(--font-size-xs);
    color: var(--body-text);
    line-height: 1.3;
    font-variant-numeric: tabular-nums;
    display: none;
}

.luna .stepper__slashes {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: var(--space-2xs);
    padding-left: var(--space);
}
.luna .stepper__slash {
    width: var(--slash-width);
    height: var(--slash-height);
    border-radius: var(--radius-xs);
    background: var(--slash-dim);
    transform: skewX(-20deg);
    transition: background 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease;
}
.luna .stepper__slash.is-lit { background: var(--cyan); opacity: 0.5; }
.luna .stepper__step.is-active .stepper__slash.is-lit {
    opacity: 1;
    box-shadow: 0 0 calc(var(--space-xs) * var(--glow-strength)) var(--slash-glow);
}

.luna .stepper__step.is-active > .stepper__bar {
    border-color: var(--accent);
    border-left-color: var(--accent);
    background: var(--tint);
    box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.25), var(--shadow-card-hover);
}
.luna .stepper__step.is-active .stepper__num {
    color: var(--background);
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 calc(var(--space-sm) * var(--glow-strength)) var(--accent-glow);
}
.luna .stepper__step.is-complete > .stepper__bar { border-left-color: var(--accent); }
.luna .stepper__step.is-complete .stepper__num {
    color: var(--accent);
    border-color: rgba(var(--accent-rgb), 0.4);
    background: var(--tint);
}
.luna .stepper__step.is-complete .stepper__summary { display: block; }
.luna .stepper__step.is-locked > .stepper__bar { opacity: var(--opacity-disabled); cursor: not-allowed; }
.luna .stepper__step.is-locked > .stepper__bar:hover { transform: none; }

.luna .stepper__body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.luna .stepper__panel {
    padding: var(--space) var(--space-xs) var(--space);
}
@media (prefers-reduced-motion: reduce) { .luna .stepper__body { transition: none; } }
