/*
 * The printed board is set in Proxima Nova. The files are already self-hosted
 * for the old md theme, so they are copied in here rather than approximated —
 * no external request, and the preview matches the product photography.
 */
@font-face {
    font-family: "Proxima Nova Rg";
    src: url("../../fonts/creators/ProximaNova-Regular.woff2") format("woff2"),
         url("../../fonts/creators/ProximaNova-Regular.woff") format("woff");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Proxima Nova Rg";
    src: url("../../fonts/creators/ProximaNova-Bold.woff2") format("woff2"),
         url("../../fonts/creators/ProximaNova-Bold.woff") format("woff");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Proxima Nova Rg";
    src: url("../../fonts/creators/ProximaNova-Light.woff2") format("woff2"),
         url("../../fonts/creators/ProximaNova-Light.woff") format("woff");
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

/*
 * Ögonblick / födelsetavla creator.
 *
 * The preview is a photograph of a printed board with type laid over it, so
 * every preview size is expressed in cqw units against the board container:
 * the whole composition then scales with the board instead of drifting out of
 * register at narrow widths.
 */

.creator {
    max-width: 1180px;
    margin: 0 auto;
    padding: 32px 20px 64px;
}

.creator__head { margin-bottom: 28px; }

.creator__title {
    font-family: var(--font-heading, Georgia, serif);
    font-size: clamp(26px, 4vw, 38px);
    font-weight: 300;
    margin: 0 0 6px;
}

.creator__lead {
    margin: 0;
    color: var(--text-secondary, #6b6259);
    font-size: 15px;
}

.creator__layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
    align-items: start;
}

@media (min-width: 900px) {
    .creator__layout { grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 48px; }
    .creator__preview { position: sticky; top: 89px; }
}

/* ── Tabs ─────────────────────────────────────────────── */
.tabs { border-bottom: 1px solid var(--border, #ebe6de); margin-bottom: 22px; }

.tabs ul {
    display: flex;
    gap: 24px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.tabs li a {
    display: block;
    padding: 0 0 12px;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: .02em;
    color: var(--text-secondary, #6b6259);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.tabs li.active a,
.tabs li a:hover { color: var(--text, #2c2520); }
.tabs li.active a { border-bottom-color: var(--accent-gold-dark, #9a7b4f); }

/* ── Editor panes ─────────────────────────────────────── */
/* The script toggles panes with jQuery show()/hide(), i.e. inline styles.
   Only mirror its initial state here so nothing flashes before it runs —
   setting display on .editor itself would fight those inline styles. */
#editor-design { display: none; }

.editor-block { margin-bottom: 22px; }

.editor-block .title {
    display: block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-secondary, #6b6259);
    margin-bottom: 8px;
}

.editor-field-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.editor-field-row--tight { gap: 8px; }

.editor-text-field {
    font: inherit;
    font-size: 15px;
    padding: 11px 12px;
    border: 1px solid var(--border, #ebe6de);
    border-radius: var(--card-radius, 2px);
    background: var(--bg, #fff);
    color: var(--text, #2c2520);
    min-width: 0;
    width: 100%;
}

.editor-text-field:focus-visible {
    outline: 2px solid var(--accent-gold-dark, #9a7b4f);
    outline-offset: 1px;
}

/* Native selects draw their own OS arrow, which does not match the chevron the
   shop toolbar uses. Strip the appearance and paint the theme's own. */
select.editor-text-field {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a7e6e' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px 12px;
}

/* Number fields: the spinners crowd a two-character field. */
.editor-text-field[type="number"] { appearance: textfield; -moz-appearance: textfield; }
.editor-text-field[type="number"]::-webkit-outer-spin-button,
.editor-text-field[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.editor-text-dropdown { width: auto; flex: 1 1 90px; }
.editor-text-dropdown-longer { flex: 1 1 140px; }
.editor-text-field-short { width: 84px; flex: 0 0 84px; text-align: center; }
.editor-text-field--wide { width: 100%; }

.editor-text-time-sep {
    font-size: 14px;
    color: var(--text-secondary, #6b6259);
    letter-spacing: .04em;
}

/* ── Swatches / size pills ────────────────────────────── */
.editor-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.editor-block:has(.editor-color) .editor-swatches { gap: 14px; }

/* Size: pills, matched to the shop toolbar's controls. */
.editor-size {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 76px;
    padding: 11px 14px;
    border: 1px solid var(--border, #ebe6de);
    border-radius: var(--card-radius, 2px);
    font-size: 14px;
    line-height: 1;
    text-decoration: none;
    color: var(--text, #2c2520);
    background: var(--bg, #fff);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.editor-size:hover { border-color: var(--text-secondary, #6b6259); }

.editor-size.active {
    border-color: var(--text, #2c2520);
    box-shadow: inset 0 0 0 1px var(--text, #2c2520);
    font-weight: 600;
}

/* Colour: the swatch is the control. The board colour is the information, so
   a label beside a dot only repeats what the dot already says. */
.editor-color {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, .16);
    background: var(--swatch, #fff);
    text-indent: -9999px;
    overflow: hidden;
    text-decoration: none;
    transition: box-shadow .15s ease;
}

.editor-color:hover { box-shadow: 0 0 0 3px rgba(0, 0, 0, .06); }

/* Selected state is a ring outside the swatch, so it never tints the colour. */
.editor-color.active { box-shadow: 0 0 0 2px var(--bg, #fff), 0 0 0 4px var(--text, #2c2520); }

.editor-color:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--bg, #fff), 0 0 0 4px var(--accent-gold-dark, #9a7b4f);
}

.editor-color-light { --swatch: #ffffff; }
.editor-color-gray  { --swatch: #dbdbdb; }
.editor-color-dark  { --swatch: #000000; }
.editor-color-blue  { --swatch: #d7eaf1; }
.editor-color-pink  { --swatch: #faf0e7; }
.editor-color-beige { --swatch: #f7f6f1; }

/* ── Add to cart ──────────────────────────────────────── */
.add-to-cart { margin-top: 26px; }

.add-to-cart a {
    display: block;
    text-align: center;
    padding: 15px 20px;
    background: var(--text, #2c2520);
    color: var(--bg, #fff);
    font-size: 15px;
    font-weight: 500;
    letter-spacing: .02em;
    text-decoration: none;
    border-radius: var(--card-radius, 2px);
}

.add-to-cart a:hover { background: var(--accent-gold-dark, #9a7b4f); }

/* Staff-only export link. Deliberately quiet — it is a tool, not a CTA. */
.creator__staff {
    margin: 12px 0 0;
    font-size: 12px;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
}
.creator__staff a { color: var(--text, #2c2520); text-underline-offset: 3px; }
.creator__staff span { color: var(--text-secondary, #6b6259); }
.total-for-product:empty::before { content: "–"; }

/* ── Preview board ────────────────────────────────────── */
/*
 * The board photo already carries the frame and the clock dial; the canvas
 * only draws the hands. So every element is positioned as a percentage of the
 * board and sized in cqw, which registers the type against the artwork at any
 * width — the original did this with pixel values across a dozen breakpoints.
 *
 * Reference geometry, measured off datum-tavla-white-800.jpg (800x1100):
 * Every size and position below is measured off the product photography and
 * the board photo, not estimated: glyph ink heights divided by Proxima Nova's
 * measured cap ratio (0.69 em), and the dial's own pixel bounding box.
 *
 *   board photo 800x1120 (aspect 0.7143)
 *   frame       x 3.5%–96.4%, y 6.5%–72.8%
 *   clock dial  centre 28.06% / 51.38%, diameter 41.25% of board width
 *
 * Positioned by id, not class: the script rebuilds these nodes with the old
 * theme's class list, so the canvas also carries .preview-name and a class
 * selector loses to whichever footer rule happens to come later.
 */

.creator__preview { max-width: 520px; margin-inline: auto; width: 100%; }

.preview {
    container-type: inline-size;
    position: relative;
    aspect-ratio: 800 / 1120;
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #fff;
    box-shadow: 0 2px 6px rgba(20, 18, 15, .12), 0 18px 40px -22px rgba(20, 18, 15, .5);
}

.preview-element {
    position: absolute;
    display: block;
    text-align: center;
    line-height: 1;
    white-space: nowrap;
    font-family: "Proxima Nova Rg", "Century Gothic", "Avenir Next", var(--font-body, system-ui), sans-serif;
    font-weight: 400;
    transform: translate(-50%, -50%);
}

/* Board-colour states, toggled by the editor script. Values from the original. */
.preview-light { color: #000; }
.preview-gray  { color: #383838; }
.preview-dark  { color: #fff; }
.preview-dark.keep-light-if-dark { color: #000; }

/* Beige, pink and blue are pale boards with charcoal dials, but the bundle
   classes them as dark and paints the type white — unreadable. The bridge
   stamps the chosen colour here so the ink can be set per board. */
.preview[data-board-color="Beige"] .preview-element,
.preview[data-board-color="Rosa"] .preview-element,
.preview[data-board-color="Blå"] .preview-element { color: #383838; }

#preview-year {
    left: 49.9%;
    top: 15.36%;
    font-size: 19.9cqw;
    letter-spacing: -0.03em;
    text-indent: -0.03em;
}

#preview-day-name {
    left: 28.55%;
    top: 30.18%;
    font-size: 9.4cqw;
    letter-spacing: 0.02em;
    text-indent: 0.02em;
    text-transform: uppercase;
}

#preview-clock {
    position: absolute;
    left: 28.06%;
    top: 51.38%;
    width: 41.25cqw;
    height: 41.25cqw;
    transform: translate(-50%, -50%);
}

#preview-day {
    left: 72.8%;
    top: 37.93%;
    font-size: 37.8cqw;
    font-weight: 700;
    letter-spacing: -0.045em;
    text-indent: -0.045em;
}

#preview-month-name {
    left: 73.25%;
    top: 60.54%;
    font-size: 14.8cqw;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-transform: uppercase;
}

/* The four lines below the frame. */
#preview-name { left: 49.9%; top: 78.39%; font-size: 4.3cqw; font-weight: 700; letter-spacing: 0.04em; text-indent: 0.04em; text-transform: uppercase; }
#preview-date-long { left: 49.95%; top: 82.14%; font-size: 4.5cqw; letter-spacing: 0.02em; text-indent: 0.02em; text-transform: uppercase; }
#preview-length-weight { left: 50%; top: 85.57%; font-size: 4.5cqw; letter-spacing: 0.02em; text-indent: 0.02em; text-transform: uppercase; }
#preview-place { left: 49.9%; top: 88.79%; font-size: 4.5cqw; letter-spacing: 0.02em; text-indent: 0.02em; text-transform: uppercase; }

/* Wrappers from the markup carry no layout now that children are absolute. */
.preview__row,
.preview__col,
.preview__footer { display: contents; }

/* ── Mobile ───────────────────────────────────────────── */
@media (max-width: 899px) {
    /* Show the poster before the form: on a phone the board otherwise sits
       about a thousand pixels down and you cannot see what you are designing. */
    .creator__preview { order: -1; }
    .creator__layout { display: flex; flex-direction: column; }
    .creator { padding-bottom: 40px; }
}

/* The template has its own add-to-cart in each pane; the theme's floating bar
   duplicates it and covers the last field. */
.single-product.md-creator-page .sticky-cart-bar { display: none !important; }

/* ── The real WooCommerce form ────────────────────────── */
.post-body-hide {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}
