/* Base, shell and shared components */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--hdr-h) + 16px); }
body { margin: 0; background: var(--c-bg); color: var(--c-ink); font: 400 var(--text-base)/var(--lh-body) var(--f-body); overflow-x: hidden; }
body::after { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 100; opacity: .1; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .2 0 0 0 0 .15 0 0 0 0 .1 0 0 0 .55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"); }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 3px; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 400; line-height: var(--lh-head); margin: 0; text-wrap: balance; }
:root[lang="ar"] h1, :root[lang="ar"] h2 { font-weight: 500; }
p { margin: 0; text-wrap: pretty; }
.sr-only { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; inset-inline-start: 12px; inset-block-start: -60px; z-index: 200; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 6px; }
.skip:focus { inset-block-start: 12px; }
.wrapx { inline-size: min(1280px, 100% - 2 * clamp(16px, 4vw, 48px)); margin-inline: auto; }
.ico { inline-size: 20px; block-size: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[dir="rtl"] .ico-dir { transform: scaleX(-1); }
.lead { font-size: 1.1rem; color: var(--c-muted); max-inline-size: 56ch; }

/* header */
.hdr { position: sticky; inset-block-start: 0; z-index: 50; background: color-mix(in srgb, var(--c-bg) 88%, transparent); backdrop-filter: blur(12px); border-block-end: 1.5px solid var(--ink); }
.hdr-in { display: flex; align-items: center; gap: 16px; min-block-size: var(--hdr-h); }
.logo { display: inline-flex; align-items: center; gap: 10px; font-family: var(--f-display); font-size: 1.3rem; text-decoration: none; white-space: nowrap; }
.logo img { inline-size: 34px; block-size: 34px; filter: drop-shadow(1.5px 0 0 #fff) drop-shadow(-1.5px 0 0 #fff) drop-shadow(0 1.5px 0 #fff) drop-shadow(0 -1.5px 0 #fff); }
.hdr nav { margin-inline-start: auto; }
.hdr nav ul { display: flex; gap: 24px; list-style: none; margin: 0; padding: 0; }
.hdr nav a { text-decoration: none; padding-block: 12px; display: inline-block; }
.hdr nav a:hover, .hdr nav a[aria-current] { text-decoration: underline; text-underline-offset: .35em; }
/* progress steps: the list may shrink, but only the step names give way (ellipsis), never the pills overlapping their neighbours */
.steps { margin: 0 auto; padding: 0; list-style: none; display: flex; gap: 6px; min-inline-size: 0; }
.steps li { display: flex; min-inline-size: 0; }
.steps li > a, .steps li > span { display: inline-flex; align-items: center; gap: 8px; min-block-size: 40px; min-inline-size: 0; padding: 0 12px; border-radius: 999px; text-decoration: none; color: var(--c-muted); font-size: .9rem; white-space: nowrap; }
.steps .sp-name { min-inline-size: 0; overflow: hidden; text-overflow: ellipsis; line-height: 1.7; }
.steps i { flex: none; display: inline-grid; place-items: center; inline-size: 24px; block-size: 24px; border-radius: 50%; border: 1.5px solid currentColor; font: 600 .75rem var(--f-body); }
.steps i .ico { inline-size: 14px; block-size: 14px; stroke-width: 2.4; }
.steps li.now a { background: var(--ink); color: var(--c-bg); }
.steps li.done a { color: var(--ink); }
.steps li.done i { background: var(--mint); border-color: var(--ink); }
.steps li > span { opacity: .55; }
.hdr-tools { display: flex; gap: 6px; margin-inline-start: auto; }
.steps + .hdr-tools, nav + .hdr-tools { margin-inline-start: 0; }
.tool { display: inline-flex; align-items: center; gap: 8px; min-block-size: 44px; min-inline-size: 44px; justify-content: center; padding: 0 12px; border: 1.5px solid var(--line); border-radius: 999px; background: var(--paper); font-size: .85rem; font-weight: 500; }
.tool:hover { border-color: var(--ink); }
@media (max-width: 900px) {
  .hdr nav { display: none; }
  .hdr-tools { margin-inline-start: auto !important; }
  .logo span { display: none; }
  .steps { margin: 0; }
  .steps li > a, .steps li > span { padding: 0 8px; font-size: .8rem; gap: 5px; }
}

/* buttons */
.btn { --bg: var(--c-primary); --fg: var(--c-on-primary); --bd: var(--c-primary); --sh: var(--btn-shadow);
  display: inline-flex; align-items: center; justify-content: center; gap: .6em; min-block-size: 44px; padding: 12px 22px;
  border-radius: var(--r-btn); border: 1.5px solid var(--bd); background: var(--bg); color: var(--fg);
  font: 600 .95rem/1.1 var(--f-body); text-decoration: none; white-space: nowrap; box-shadow: var(--sh); -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-pop) var(--ease), background-color var(--dur-fast), box-shadow var(--dur-fast); }
:root[lang="ar"] .btn { font-size: 1rem; }
.btn .ico { inline-size: 18px; block-size: 18px; transition: transform var(--dur-pop) var(--ease); }
.btn:hover { --bg: color-mix(in srgb, var(--c-primary) 88%, #000); transform: translateY(-2px); }
.btn:hover .ico-dir { transform: translateX(4px); }
[dir="rtl"] .btn:hover .ico-dir { transform: scaleX(-1) translateX(4px); }
.btn:active { transform: translateY(3px) scale(.96); box-shadow: none; transition-duration: 90ms; }
.btn:disabled { opacity: .5; cursor: progress; transform: none; }
.btn-lg { min-block-size: 52px; padding: 14px 28px; font-size: 1.02rem; }
.btn-secondary { --bg: var(--paper); --fg: var(--ink); --bd: var(--ink); --sh: var(--btn-shadow-2); }
.btn-secondary:hover { --bg: var(--paper-2); }
.btn-ghost { --bg: transparent; --fg: var(--ink); --bd: transparent; --sh: none; padding-inline: 8px; text-decoration: underline; text-underline-offset: .3em; }
.btn-ghost:hover { --bg: transparent; }
.is-later { opacity: .7; }
.later-note { font-size: .8rem; color: var(--c-muted); }

/* chips, segmented, swatches */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; min-block-size: 40px; padding: 4px 16px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--paper); font-size: .9rem; transition: transform var(--dur-pop) var(--ease), border-color var(--dur-fast); }
.chip:hover { border-color: var(--ink); }
.chip:active { transform: scale(.93); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--c-bg); border-color: var(--ink); }
.chip-lg { min-block-size: 48px; padding: 6px 20px; font-size: 1rem; }
.seg { display: inline-flex; flex-wrap: wrap; padding: 3px; gap: 2px; background: var(--paper-2); border-radius: 999px; }
.seg button { min-block-size: 40px; padding: 4px 14px; border: 0; border-radius: 999px; background: transparent; font-size: .86rem; font-weight: 500; white-space: nowrap; transition: transform var(--dur-pop) var(--ease); }
.seg button[aria-pressed="true"] { background: var(--paper); box-shadow: 0 1px 2px rgb(0 0 0 / .14); font-weight: 600; }
.seg button:active { transform: scale(.92); }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.sw { position: relative; inline-size: 36px; block-size: 36px; border-radius: 50%; border: 3px solid var(--paper); background: var(--v); box-shadow: 0 0 0 1px var(--line); transition: transform var(--dur-pop) var(--ease); }
.sw::before { content: ""; position: absolute; inset: -6px; }
.sw[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--ink); transform: scale(1.08); }
.sw.none { background: linear-gradient(135deg, transparent 46%, var(--poppy) 46% 54%, transparent 54%), var(--paper); }

/* toast */
.toast { position: fixed; z-index: 300; inset-block-end: 24px; left: 50%; translate: -50% 0; padding: 12px 18px; border-radius: 10px; background: var(--ink); color: #fff; font-size: .92rem; box-shadow: 0 10px 30px -10px rgb(0 0 0 / .4); opacity: 0; transform: translateY(12px); transition: opacity .2s, transform var(--dur-pop) var(--ease); pointer-events: none; max-inline-size: calc(100vw - 32px); text-align: center; }
.toast.show { opacity: 1; transform: none; }

/* screen transitions (View Transitions API, quick & springy) */
::view-transition-old(root) { animation: 160ms ease both vt-out; }
::view-transition-new(root) { animation: 420ms var(--ease) both vt-in; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-8px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(18px) scale(.99); } }

/* screen headers */
.screen { padding-block: clamp(24px, 4vw, 48px) clamp(56px, 8vw, 96px); }
.screen-head { display: grid; gap: 8px; margin-block-end: clamp(20px, 3vw, 32px); }
.screen-head h1 { font-size: clamp(2.4rem, 1.5rem + 3.4vw, 4.4rem); }
.step { font: 600 .78rem var(--f-body); letter-spacing: .12em; text-transform: uppercase; color: var(--poppy); }
:root[lang="ar"] .step { letter-spacing: 0; font-size: .9rem; }

/* flower art */
.fart { display: block; inline-size: 100%; block-size: 100%; }
.fart img { inline-size: 100%; block-size: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none;
  filter: drop-shadow(1.6px 0 0 #fff) drop-shadow(-1.6px 0 0 #fff) drop-shadow(0 1.6px 0 #fff) drop-shadow(0 -1.6px 0 #fff) drop-shadow(0 5px 5px rgb(60 40 30 / .22)); }
.fart.is-sketch svg { inline-size: 100%; block-size: 100%; opacity: .5; filter: grayscale(1); }

/* reduced motion */
html[data-motion="reduced"] *, html[data-motion="reduced"] *::before, html[data-motion="reduced"] *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 100ms !important; transition-delay: 0ms !important; }

[tabindex="-1"]:focus:not(:focus-visible), h1[tabindex="-1"]:focus { outline: none; }
@media (min-width: 760px) { .tb { inline-size: 40px; block-size: 40px; } .counter { padding-inline: 8px; } }

.hdr-in { min-inline-size: 0; }
.logo { flex: none; }
@media (max-width: 640px) {
  .hdr-in { gap: 8px; }
  /* compact steps: only the current step keeps its name; the others are number/check circles (name kept for screen readers) */
  .steps { flex: 1; justify-content: center; gap: 4px; }
  .steps li:not(.now) { flex: none; }
  .steps li:not(.now) > a, .steps li:not(.now) > span { padding: 0 6px; gap: 0; }
  .steps li:not(.now) .sp-name { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .tool { padding: 0 10px; }
  .tool[data-lang] span { font-size: .8rem; }
}
/* in the studio flow, small phones give the steps room: the wordmark yields to the poppy icon (the link keeps its aria-label) */
@media (max-width: 440px) { .hdr-in:has(.steps) .logo .logo-name { display: none; } }
