/* ==========================================================
   Picsin v2 — Atelier Print Create Page
   Polymorphic creator: Canvas / Framed / Photo Print
   Source: ported from public/preview/assets/product-page.css
   Port phase: atelier-port-01 (mechanical port + media-query
   responsive replacing the React device-prop trick)
   ========================================================== */

:root {
  --bg:        #f5f1ea;
  --bg-card:   #fbf8f2;
  --bg-sunk:   #efeadf;
  --ink:       #1f1a14;
  --ink-2:     #52483a;
  --ink-3:     #8a7f6c;
  --line:      #e4dccc;
  --line-2:    #d6ccb8;
  --accent:    #7a5a34;       /* warm umber */
  --accent-2:  #3a5a46;       /* forest, "ready" state */
  --danger:    #9a3a2a;
  --serif:     "Instrument Serif", "Cormorant Garamond", Georgia, serif;
  --sans:      "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --radius:    6px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 2px rgba(30,22,10,.04), 0 2px 4px rgba(30,22,10,.03);
  --shadow-md: 0 8px 24px -12px rgba(30,22,10,.18), 0 2px 6px -2px rgba(30,22,10,.08);
}

/* ---------- Page reset ---------- */
.atl-root {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
  letter-spacing: -0.005em;
}
.atl-root *, .atl-root *::before, .atl-root *::after { box-sizing: border-box; }
/* Zero-specificity reset via :where() so per-button class rules
   (.atl-cta, .atl-cta-secondary, .atl-chip, .atl-size-pill etc.) win
   without needing !important or namespace prefixes. */
.atl-root :where(button) { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
.atl-root :where(button):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.atl-root a { color: inherit; text-decoration: none; }

/* ---------- Header ---------- */
.atl-header {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky; top: 0; z-index: 30;
}
.atl-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 28px;
  display: flex; align-items: center; gap: 24px;
}
.atl-logo { display: flex; align-items: center; flex-shrink: 0; }
.atl-logo-img { height: 40px; width: auto; display: block; }
.atl-nav { display: flex; gap: 22px; margin-left: 24px; flex: 1; }
.atl-nav a { color: var(--ink-2); font-size: 14px; font-weight: 500; }
.atl-nav a:hover { color: var(--ink); }
.atl-nav a.is-active { color: var(--ink); }
.atl-header-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.atl-header-actions .atl-track { font-size: 13px; color: var(--ink-2); padding: 6px 10px; }
.atl-header-actions .atl-track:hover { color: var(--ink); }
.atl-header-actions .atl-account-name {
    font-size: 13px; color: var(--ink-2); padding: 6px 10px;
    text-decoration: none; white-space: nowrap;
    transition: color .15s;
}
.atl-header-actions .atl-account-name:hover { color: var(--ink); }

/* ─────────── Account dropdown menu (Phase I 2026-04-27) ─────────── */
.atl-account-menu { position: relative; display: inline-flex; }
.atl-menu-trigger {
    display: inline-flex; align-items: center; gap: 6px;
    font-family: var(--sans); font-size: 13px;
    color: var(--ink-2); background: none; border: none;
    padding: 6px 10px; cursor: pointer;
    transition: color .15s;
}
.atl-menu-trigger:hover { color: var(--ink); }
.atl-menu-trigger[aria-expanded="true"] { color: var(--ink); }
.atl-menu-trigger-name { white-space: nowrap; }
.atl-menu-chevron { transition: transform .2s; flex-shrink: 0; opacity: .8; }
.atl-menu-trigger[aria-expanded="true"] .atl-menu-chevron { transform: rotate(180deg); opacity: 1; }

.atl-menu-panel {
    position: absolute; top: calc(100% + 6px); right: 0;
    min-width: 192px;
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 6px 0;
    opacity: 0; transform: translateY(-4px);
    visibility: hidden;
    transition: opacity .15s, transform .15s, visibility 0s linear .15s;
    z-index: 100;
}
.atl-menu-panel.is-open {
    opacity: 1; transform: translateY(0); visibility: visible;
    transition: opacity .15s, transform .15s, visibility 0s;
}
.atl-menu-item {
    display: block; padding: 10px 18px;
    font-family: var(--sans); font-size: 14px;
    color: var(--ink); text-decoration: none;
    transition: background .12s, color .12s;
}
.atl-menu-item:hover { background: var(--bg-sunk); color: var(--ink); }
.atl-menu-item--signout {
    color: var(--ink-2);
    border-top: 1px solid var(--line);
    margin-top: 6px; padding-top: 12px;
}
.atl-menu-item--signout:hover { color: var(--danger); background: var(--bg-sunk); }
.atl-icon-btn {
  width: 36px; height: 36px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-2);
}
.atl-icon-btn:hover { background: var(--bg-sunk); color: var(--ink); }
.atl-cart-btn { position: relative; }
.atl-cart-count {
  position: absolute; top: 2px; right: 2px;
  background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 600;
  min-width: 16px; height: 16px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 4px;
}

/* ---------- Footer ---------- */
.atl-footer {
  border-top: 1px solid var(--line);
  background: var(--ink);
  color: var(--bg);
  padding: 32px 28px;
  margin-top: 48px;
}
.atl-footer-inner { max-width: 1280px; margin: 0 auto; }
.atl-footer-inner small { font-size: 12px; opacity: 0.7; }

/* ---------- Main grid ---------- */
.atl-main { max-width: 1280px; margin: 0 auto; padding: 32px 28px 60px; }
.atl-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(380px, 1fr);
  gap: 48px;
  align-items: start;
}

/* ---------- Left col : Preview ---------- */
.atl-preview { position: sticky; top: 88px; }
.atl-stage {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 36px;
  display: flex; flex-direction: column; align-items: center; gap: 20px;
  transition: border-color .18s, box-shadow .18s;
}
.atl-stage.is-drag {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(122,90,52,0.12);
}

.atl-artframe {
  /* Width + height computed by JS each render to fit a 500×500 max while
     preserving the active aspect ratio (e.g. portrait 8×30 → 133×500,
     landscape 30×8 → 500×133, square 8×8 → 500×500). On smaller viewports
     the JS clamps to the available stage width. Inline styles win over the
     CSS fallback below. */
  width: 100%;
  max-width: 500px;
  max-height: 500px;
  border-radius: 2px;
  position: relative;
  display: flex; align-items: stretch; justify-content: stretch;
  margin-inline: auto;
}
.atl-artinner {
  flex: 1; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  border-radius: 1px;
  transition: background .2s, padding .2s;
}
.atl-art {
  width: 100%; height: 100%; object-fit: cover; display: block;
}

/* Mockup chrome — Canvas / Framed / Photo Print (driven by data-media on .atl-artframe) */

/* Photo Print — bare image, no chrome, fills the box */
.atl-artframe[data-media="print"] {
  padding: 0;
  background: transparent;
  box-shadow: 0 18px 40px -16px rgba(40,32,22,.25);
}
.atl-artframe[data-media="print"] .atl-artinner { background: #efeae0; padding: 0; }

/* Canvas Print — image fills box fully (no cream rim, no inner padding) */
.atl-artframe[data-media="canvas"] {
  padding: 0;
  background: transparent;
  box-shadow: 0 18px 40px -14px rgba(40,32,22,.3),
              inset 0 0 0 1px rgba(0,0,0,.04);
}
.atl-artframe[data-media="canvas"] .atl-artinner { background: #efeae0; padding: 0; }

/* Framed Picture — frame chrome around image. Inner white margin toggles
   based on the user's "Frame Thickness" choice (with-margin / no-margin),
   set via data-frame-margin on the artframe by JS. */
.atl-artframe[data-media="framed"] {
  padding: 28px;
  box-shadow: 0 30px 60px -20px rgba(40,32,22,.35),
              0 10px 20px -8px rgba(40,32,22,.25);
}
.atl-artframe[data-media="framed"][data-frame-margin="with"] .atl-artinner {
  background: #fbfaf6;
  padding: 12px;
}
.atl-artframe[data-media="framed"][data-frame-margin="no"] .atl-artinner {
  background: transparent;
  padding: 0;
}

/* Empty drop state */
.atl-drop {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px;
  background: repeating-linear-gradient(45deg, transparent 0 10px, rgba(0,0,0,.02) 10px 11px);
  border: 1.5px dashed var(--line-2);
  border-radius: 4px;
  padding: 24px;
  transition: border-color .15s, background .15s;
}
.atl-drop:hover { border-color: var(--accent); background: rgba(122,90,52,0.03); }
.atl-drop-icon { color: var(--ink-3); }
.atl-drop-title { font-family: var(--serif); font-size: 26px; color: var(--ink); font-weight: 400; letter-spacing: -0.01em; }
.atl-drop-sub { font-size: 12px; color: var(--ink-3); text-align: center; max-width: 260px; line-height: 1.4; }
.atl-drop-ratio { margin-top: 6px; font-size: 11px; letter-spacing: 0.08em; color: var(--ink-2); text-transform: uppercase; font-weight: 500; }

/* Hover overlay — filled state */
.atl-art-overlay {
  position: absolute; inset: 0;
  display: none;
  align-items: center; justify-content: center;
  gap: 12px;
  background: rgba(20,14,6,.55);
  backdrop-filter: blur(2px);
  border-radius: 2px;
  z-index: 2;
}
.atl-artframe:hover .atl-art-overlay { display: flex; }
.atl-overlay-btn {
  display: inline-flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 18px;
  background: transparent;
  border-radius: var(--radius);
  font-size: 13px; color: #fff; font-weight: 500;
  min-width: 90px;
}
/* No hover state change — icons + text stay white, no background appears */
.atl-overlay-btn:hover,
.atl-overlay-btn:focus-visible { background: transparent; color: #fff; transform: none; }

/* Stage foot */
.atl-stage-foot {
  display: flex; align-items: center; gap: 10px;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--ink-3);
}
.atl-tick { width: 40px; height: 1px; background: var(--line-2); display: inline-block; }

/* Action chip row below preview */
.atl-preview-actions {
  display: flex; gap: 8px; margin-top: 14px; justify-content: center; flex-wrap: wrap;
}
.atl-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px; color: var(--ink-2); font-weight: 500;
  transition: background .12s, border-color .12s, color .12s;
}
.atl-chip:hover { background: var(--bg); border-color: var(--accent); color: var(--ink); }
.atl-chip-ghost { color: var(--ink-3); }
.atl-chip-ghost:hover { color: var(--danger); border-color: var(--danger); }

/* ---------- Right col : Info ---------- */
.atl-info { display: flex; flex-direction: column; gap: 18px; }

.atl-breadcrumbs {
  display: flex; gap: 6px; font-size: 12px; color: var(--ink-3);
  letter-spacing: 0.01em;
}
.atl-breadcrumbs .is-current { color: var(--ink-2); }

.atl-title {
  font-family: var(--serif);
  font-size: 44px; line-height: 1.05; font-weight: 400;
  font-style: normal;
  letter-spacing: -0.015em; margin: 0;
  color: var(--ink);
}

.atl-price-row { display: flex; align-items: baseline; gap: 10px; }
.atl-price-num { font-family: var(--serif); font-size: 28px; color: var(--ink); line-height: 1.1; }
.atl-price-currency { font-family: var(--serif); font-size: 22px; color: var(--ink-2); }

.atl-blurb { font-size: 14px; color: var(--ink-2); line-height: 1.55; margin: 0; max-width: 50ch; }

/* Section block */
.atl-section { display: flex; flex-direction: column; gap: 10px; padding-top: 4px; }
.atl-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.atl-section-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-2); font-weight: 600;
  white-space: nowrap; flex-shrink: 0;
}
.atl-section-help { font-size: 11px; color: var(--ink-3); white-space: nowrap; }

/* Size dropdowns (two side-by-side selects with X between) */
.atl-size-row {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 4px 6px;
}
.atl-size-select {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  border-bottom: 1.5px solid var(--ink);
  padding: 6px 22px 6px 4px;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%231f1a14' stroke-width='2' stroke-linecap='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 4px center;
  min-width: 90px;
}
.atl-size-x { font-size: 14px; color: var(--ink-3); padding: 0 2px; }

/* "Change Size" pill — sits inline at the end of .atl-size-row, only when
   the dropdowns differ from the committed size. Click commits the new size
   and re-opens the cropper at the new aspect (Phase 6, Day 53). */
.atl-size-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  padding: 6px 12px;
  font: 600 12px/1 var(--sans);
  letter-spacing: .01em;
  color: var(--bg);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, transform .12s, box-shadow .15s;
  box-shadow: var(--shadow-sm);
}
.atl-size-pill:hover {
  background: var(--ink);
  border-color: var(--ink);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.atl-size-pill:active { transform: translateY(0); }
.atl-size-pill svg { stroke: currentColor; }
[x-cloak] { display: none !important; }

/* Segmented bar (product toggle, thickness, paper) */
.atl-segbar {
  display: flex; gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 3px;
  background: var(--bg-card);
}
.atl-seg {
  flex: 1; padding: 9px 10px;
  font-size: 13px; color: var(--ink-2);
  border-radius: 4px; font-weight: 500;
  transition: background .12s, color .12s;
}
.atl-seg:hover { color: var(--ink); }
.atl-seg.is-on { background: var(--ink); color: var(--bg); }

/* Type cards (canvas Type block: 3 image cards Rolled / White Border / Gallery Wrap) */
.atl-typegrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.atl-typecard {
  display: flex; flex-direction: column; align-items: stretch;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-card);
  padding: 0; overflow: hidden;
  transition: border-color .12s, box-shadow .12s;
  cursor: pointer;
}
.atl-typecard:hover { border-color: var(--ink-3); }
.atl-typecard.is-on {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}
.atl-typecard-thumb {
  aspect-ratio: 1 / 1;
  background: var(--bg-sunk);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.atl-typecard-thumb svg { width: 60%; height: 60%; opacity: 0.55; }
.atl-typecard-thumb-label {
  position: absolute; bottom: 6px; left: 6px; right: 6px;
  font-size: 9px; color: var(--ink-3);
  text-align: center;
  background: rgba(255,255,255,0.85);
  padding: 2px 4px;
  border-radius: 2px;
  letter-spacing: 0.02em;
}
.atl-typecard-foot {
  padding: 8px 6px;
  font-size: 11px; color: var(--ink-3);
  text-align: center;
  background: var(--bg-card);
}

/* Frame swatches */
.atl-swatches { display: flex; gap: 14px; flex-wrap: wrap; }
.atl-swatch {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 0;
  cursor: pointer;
}
.atl-swatch-ring {
  padding: 3px; border: 1.5px solid transparent; border-radius: 999px;
  transition: border-color .12s;
}
.atl-swatch.is-on .atl-swatch-ring { border-color: var(--ink); }
.atl-swatch-dot {
  width: 28px; height: 28px; border-radius: 999px;
  display: block;
}
.atl-swatch-note {
  font-size: 10px; color: var(--ink-3); white-space: nowrap;
}
.atl-swatch-label {
  font-size: 11px; color: var(--accent); font-weight: 500;
  margin-left: auto; align-self: baseline;
}

/* Action row — Add to Cart + Save Project side by side */
.atl-actions {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 10px;
  margin-top: 10px;
}
.atl-cta {
  display: inline-flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 14px 16px;
  background: var(--accent); color: #fff;
  font-size: 15px; font-weight: 600; letter-spacing: -0.005em;
  border-radius: var(--radius);
  transition: background .15s, transform .08s, opacity .12s;
  text-align: left;
}
.atl-cta:hover { background: #5e4527; }
.atl-cta:active { transform: translateY(1px); }
.atl-cta.is-disabled { background: var(--bg-sunk); color: var(--ink-3); cursor: not-allowed; }
.atl-cta-icon {
  width: 36px; height: 36px; border-radius: 999px;
  background: rgba(255,255,255,0.12);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; flex-shrink: 0;
}
.atl-cta-main { display: flex; flex-direction: column; gap: 2px; }
.atl-cta-main > span:first-child { font-size: 15px; font-weight: 600; line-height: 1.15; }
.atl-cta-sub { font-size: 11px; color: rgba(255,255,255,0.85); font-weight: 400; letter-spacing: 0; line-height: 1.2; }

.atl-cta-secondary {
  display: inline-flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  color: var(--ink);            /* was --ink-2; mock shows near-black "Save Project" */
  font-size: 15px; font-weight: 600;
  border-radius: var(--radius);
  transition: border-color .15s, color .15s, background .15s;
  text-align: left;
}
.atl-cta-secondary:hover { border-color: var(--accent); background: var(--bg); }
.atl-cta-secondary .atl-cta-main > span:first-child { color: var(--ink); font-weight: 600; }
.atl-cta-secondary .atl-cta-icon { background: var(--bg-sunk); color: var(--ink); }
.atl-cta-secondary .atl-cta-sub { color: var(--ink-3); }

/* ---------- Mobile ---------- */
@media (max-width: 820px) {
  .atl-main { padding: 16px 16px 32px; }
  .atl-grid { grid-template-columns: 1fr; gap: 20px; }
  .atl-preview { position: static; }
  .atl-stage { padding: 20px; }
  .atl-title { font-size: 32px; }
  .atl-nav { display: none; }
  .atl-actions { grid-template-columns: 1fr; }
  .atl-typegrid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
}

/* =====================================================================
   atelier-port-01 / vanilla rewrite — additions
   Pill, mode container, product-switch transition, hidden defensive.
   ===================================================================== */

/* Defensive — HTML `hidden` attribute should already work, but ensure
   nothing overrides it via specificity */
[hidden] { display: none !important; }

/* Mode wrapper — server renders all three, JS toggles `hidden` */
.atl-mode {
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: atl-mode-in .22s cubic-bezier(.22,1,.36,1);
}
@keyframes atl-mode-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Change Size pill ---------- */
.atl-size-pill {
  display: inline-flex; align-items: center; gap: 6px;
  margin-left: 6px;
  padding: 7px 14px;
  background: var(--ink);
  color: var(--bg);
  border-radius: 999px;
  font-size: 12px; font-weight: 600; letter-spacing: -0.005em;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  animation: atl-pill-in .22s cubic-bezier(.22,1,.36,1);
  transition: background .12s, transform .08s;
}
.atl-size-pill:hover { background: #000; }
.atl-size-pill:active { transform: translateY(1px); }
@keyframes atl-pill-in {
  from { opacity: 0; transform: translateX(-6px) scale(0.94); }
  to   { opacity: 1; transform: translateX(0)   scale(1); }
}

/* ---------- Product-switch + size-change transition on the artframe ---------- */
.atl-artframe {
  /* Smooth chrome change when switching media (canvas → framed → print)
     and smooth resize when the user commits a new size via the pill. */
  transition:
    padding    .28s cubic-bezier(.22,1,.36,1),
    background .28s cubic-bezier(.22,1,.36,1),
    border     .28s cubic-bezier(.22,1,.36,1),
    box-shadow .28s cubic-bezier(.22,1,.36,1),
    width      .28s cubic-bezier(.22,1,.36,1),
    height     .28s cubic-bezier(.22,1,.36,1),
    transform  .22s cubic-bezier(.22,1,.36,1),
    opacity    .18s linear;
}
.atl-artframe.is-switching {
  transform: scale(0.985);
  opacity: 0.6;
}

/* Ensure size dropdowns sit on a flex row that lets the pill follow inline */
.atl-size-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  padding: 4px 6px;
}
.atl-size-row > .atl-size-select { flex-shrink: 0; }
.atl-size-row > .atl-size-x { flex-shrink: 0; }

/* Active product-toggle button — match the segbar `.is-on` style already
   defined above; this is just an explicit reinforcement for clarity */
#atl-product-bar .atl-seg.is-on { background: var(--ink); color: var(--bg); }

/* Type cards — selected ring */
.atl-typegrid .atl-typecard.is-on {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}

/* Swatch hover bump */
.atl-swatch:hover .atl-swatch-ring { border-color: var(--line-2); }

