/* Component library (redesign Phase 2).
   One section per component, in the order of the inventory in
   design/README.md. Every value comes from a semantic or component token,
   so each component looks like today's site now and picks up the new brand
   when Phase 3 repoints the tokens. The live catalog, with every state in
   both themes, is /_styleguide/ (staff only).

   Class names are new on purpose (.button, not .btn): pages move to them
   in Phase 3, and until then the old classes in site.css keep working
   untouched. */

/* --- Icon ------------------------------------------------------------------
   <svg class="icon"><use href=".../icons.svg#name"></use></svg>, or
   {% include "components/icon.html" with name="check" %}. Lucide's stroke
   attributes live on its root <svg>, which a <symbol> does not keep, so they
   are set here. */
.icon {
  width: 1.25em; height: 1.25em; flex: none; vertical-align: -0.25em;
  fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
}
.icon--sm { width: 1rem; height: 1rem; }
.icon--lg { width: 1.5rem; height: 1.5rem; }

/* --- Button ------------------------------------------------------------ */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  padding: 11px 22px; border-radius: var(--radius-control);
  border: 1px solid transparent;
  background: var(--color-action-primary-bg); color: var(--color-action-primary-fg);
  font: 600 15px/1.4 var(--font-body); text-decoration: none; white-space: nowrap;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-standard),
              border-color var(--duration-fast) var(--ease-standard),
              transform var(--duration-instant) var(--ease-standard);
}
.button:hover { background: var(--color-action-primary-bg-hover); text-decoration: none; }
.button:active { transform: translateY(1px); }
.button--secondary {
  background: var(--color-bg-surface); color: var(--color-text-primary);
  border-color: var(--color-border-subtle);
}
.button--secondary:hover { background: var(--color-bg-subtle); }
.button--ghost { background: transparent; color: var(--color-text-link); }
.button--ghost:hover { background: var(--color-bg-subtle); }
/* White button for dark bands; replaces .btn.claro. */
.button--inverse { background: var(--color-action-inverse-bg); color: var(--color-action-inverse-fg); }
.button--inverse:hover { background: var(--color-action-inverse-bg-hover); }
/* Brand CTA: ink on fluorescent pink. Hero and pricing only; everywhere
   else the primary button is the action. */
.button--brand { background: var(--color-action-brand-bg); color: var(--color-action-brand-fg); }
.button--brand:hover { background: var(--color-action-brand-bg-hover); }
.button--sm { padding: 7px 14px; font-size: 14px; }
.button--lg { padding: 14px 30px; font-size: 16px; }
.button--full { display: flex; width: 100%; }
.button:disabled, .button[aria-disabled="true"] {
  opacity: .5; cursor: not-allowed; transform: none;
}
.button:disabled:hover, .button[aria-disabled="true"]:hover {
  background: var(--color-action-primary-bg);
}
.button--secondary:disabled:hover { background: var(--color-bg-surface); }
/* Loading: set aria-busy="true" and disable the button. The label stays in
   the DOM, so the width does not jump and screen readers keep the name. */
.button[aria-busy="true"] { position: relative; color: transparent; pointer-events: none; }
.button[aria-busy="true"]::after {
  content: ""; position: absolute; width: 1.1em; height: 1.1em;
  border: 2px solid var(--color-action-primary-fg); border-right-color: transparent;
  border-radius: 50%; animation: spin .7s linear infinite;
}
.button--secondary[aria-busy="true"]::after { border-color: var(--color-text-primary); border-right-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Link with arrow ----------------------------------------------------- */
.link-arrow { font-weight: 600; }
.link-arrow::after {
  content: "→"; display: inline-block; margin-left: .35em;
  transition: transform var(--duration-fast) var(--ease-standard);
}
.link-arrow:hover { text-decoration: none; }
.link-arrow:hover::after { transform: translateX(3px); }

/* --- Badge ---------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: .35em;
  padding: 3px 10px; border-radius: var(--radius-badge);
  background: var(--color-bg-subtle); color: var(--color-text-secondary);
  font: 600 12px/1.5 var(--font-body); white-space: nowrap;
}
.badge--info    { background: var(--color-feedback-info-bg);    color: var(--color-feedback-info-text); }
.badge--success { background: var(--color-feedback-success-bg); color: var(--color-feedback-success-text); }
.badge--warning { background: var(--color-feedback-warning-bg); color: var(--color-feedback-warning-text); }
.badge--danger  { background: var(--color-feedback-danger-bg);  color: var(--color-feedback-danger-text); }
.badge--outline { background: transparent; border: 1px solid currentColor; }

/* --- Sticker badge ----------------------------------------------------------
   The brand's one hard shadow. Decorative: pages with data-ornament="none"
   get a plain badge instead of the tilted sticker. */
.sticker {
  display: inline-block; padding: 4px 12px; border-radius: var(--radius-pill);
  background: var(--color-bg-surface); color: var(--color-text-primary);
  border: 1.5px solid currentColor; box-shadow: var(--shadow-sticker);
  font: 700 12px/1.4 var(--font-label); letter-spacing: .06em; text-transform: uppercase;
  transform: rotate(-4deg);
  transition: transform var(--duration-base) var(--ease-emphasized);
}
.sticker:hover { transform: rotate(-1deg) translateY(-2px); }
.sticker--pink { background: var(--color-accent-brand-fill); color: var(--color-action-brand-fg); border-color: var(--color-action-brand-fg); }
.sticker--soft { background: var(--color-accent-data-fill); color: var(--color-action-brand-fg); border-color: var(--color-action-brand-fg); }
[data-ornament="none"] .sticker { transform: none; box-shadow: none; }

/* --- Section header ------------------------------------------------------- */
.section-header { max-width: 680px; margin-bottom: 8px; }
.section-header--center { margin-left: auto; margin-right: auto; text-align: center; }
.section-header__eyebrow {
  display: block; margin-bottom: 12px;
  font: 500 12px/1.3 var(--font-label); letter-spacing: .08em; text-transform: uppercase;
  color: var(--color-text-eyebrow);
}
.section-header__title {
  margin: 0 0 16px; font-family: var(--font-display); font-stretch: 88%;
  font-size: clamp(30px, 1.4rem + 2vw, 48px); line-height: 1.05; letter-spacing: -.03em; font-weight: 700;
}
.section-header__lead { margin: 0; font-size: 17px; color: var(--color-text-secondary); }

/* --- Card ------------------------------------------------------------------ */
.card--interactive {
  display: block; color: inherit; text-decoration: none;
  transition: border-color .18s var(--ease-standard), transform .18s var(--ease-standard),
              box-shadow .18s var(--ease-standard);
}
.card--interactive:hover {
  border-color: var(--color-border-hover); transform: translateY(-2px); box-shadow: var(--shadow-raised);
  text-decoration: none;
}
.card--interactive:focus-within { border-color: var(--color-focus-ring); }
.card--media { padding: 0; overflow: hidden; }
.card__media {
  display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover;
  background: var(--color-bg-subtle);
}
/* No image: same box, the item's initial, so a grid of mixed cards stays
   aligned instead of jumping. */
.card__media--empty {
  display: flex; align-items: center; justify-content: center;
  font: 700 44px/1 var(--font-display); color: var(--color-text-secondary);
}
.card__body { padding: 16px 18px; }
.card__title { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.card__meta { margin: 0; font-size: 13px; color: var(--color-text-secondary); }

/* --- Form field -------------------------------------------------------------
   Builds on .field in site.css; adds select/textarea and the states. */
.field select, .field textarea {
  width: 100%; padding: 11px 13px; border-radius: var(--radius-control);
  border: 1px solid var(--color-border-strong); background: var(--color-bg-surface);
  color: var(--color-text-primary); font: 15px/1.5 var(--font-body);
}
.field textarea { min-height: 110px; resize: vertical; }
.field select:focus, .field textarea:focus {
  outline: none; border-color: var(--color-focus-ring); box-shadow: 0 0 0 3px rgba(109,90,230,.16);
}
.field--invalid input, .field--invalid select, .field--invalid textarea {
  border-color: var(--color-feedback-danger-fg);
}
.field input:disabled, .field select:disabled, .field textarea:disabled {
  background: var(--color-bg-subtle); color: var(--color-text-secondary); cursor: not-allowed;
}
.field input[readonly] { background: var(--color-bg-subtle); }
.field__counter { float: right; font-size: 12px; color: var(--color-text-secondary); }

/* Input with a fixed prefix/suffix (the store address). Stacks under 480px
   so the input keeps its width on a phone. */
.input-affix { display: flex; }
.input-affix input { border-radius: var(--radius-control) 0 0 var(--radius-control); }
.input-affix__text {
  display: flex; align-items: center; padding: 0 13px; white-space: nowrap;
  border: 1px solid var(--color-border-subtle); border-left: 0;
  border-radius: 0 var(--radius-control) var(--radius-control) 0;
  background: var(--color-bg-subtle); color: var(--color-text-secondary); font-size: 15px;
}
@media (max-width: 480px) {
  .input-affix { flex-direction: column; }
  .input-affix input { border-radius: var(--radius-control) var(--radius-control) 0 0; }
  .input-affix__text {
    border-left: 1px solid var(--color-border-subtle); border-top: 0;
    border-radius: 0 0 var(--radius-control) var(--radius-control);
    padding: 8px 13px; font-size: 14px;
  }
}

/* --- Segmented control --------------------------------------------------- */
.segmented { display: flex; gap: 8px; }
.segmented button {
  flex: 1; padding: 11px 12px; border-radius: var(--radius-control);
  border: 1px solid var(--color-border-subtle); background: var(--color-bg-surface);
  color: var(--color-text-primary); font: 600 15px/1.4 var(--font-body); cursor: pointer;
}
.segmented button[aria-pressed="true"] {
  border-color: var(--color-action-primary-bg); background: var(--color-action-primary-bg);
  color: var(--color-action-primary-fg);
}
.segmented button:disabled { opacity: .5; cursor: not-allowed; }

/* --- Alert ------------------------------------------------------------------
   role="alert" for errors that appear after a submit; role="status" for
   information that is there on load. */
.alert {
  display: flex; gap: 12px; align-items: flex-start;
  margin: 0 0 18px; padding: 12px 14px; border-radius: var(--radius-control);
  border: 1px solid transparent; font-size: 14px; line-height: 1.5;
}
.alert > .icon { margin-top: 1px; }
.alert__title { display: block; font-weight: 600; }
.alert p { margin: 0; }
.alert ul { margin: 0; padding: 0; list-style: none; }
.alert--danger  { background: var(--color-feedback-danger-bg);  border-color: var(--color-feedback-danger-border);  color: var(--color-feedback-danger-text); }
.alert--warning { background: var(--color-feedback-warning-bg); border-color: var(--color-feedback-warning-border); color: var(--color-feedback-warning-text); }
.alert--success { background: var(--color-feedback-success-bg); color: var(--color-feedback-success-text); }
.alert--info    { background: var(--color-feedback-info-bg);    color: var(--color-feedback-info-text); }

/* --- Empty state ------------------------------------------------------------ */
.empty-state {
  padding: 44px 28px; text-align: center; color: var(--color-text-secondary);
  border: 1px dashed var(--color-border-subtle); border-radius: var(--radius-tile);
}
.empty-state__icon {
  display: inline-flex; width: 48px; height: 48px; margin-bottom: 14px;
  align-items: center; justify-content: center; border-radius: 50%;
  background: var(--color-bg-subtle); color: var(--color-text-primary);
}
.empty-state__title { margin: 0 0 6px; font-size: 17px; font-weight: 600; color: var(--color-text-primary); }
.empty-state__text { margin: 0 auto; max-width: 440px; font-size: 15px; }
.empty-state__actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }

/* --- Filter bar --------------------------------------------------------------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filter-bar select, .filter-bar .filter-bar__check {
  font: 14px/1.4 var(--font-body); padding: 8px 12px; border-radius: var(--radius-chip);
  border: 1px solid var(--color-border-subtle); background: var(--color-bg-surface);
  color: var(--color-text-primary);
}
.filter-bar .filter-bar__check { display: inline-flex; align-items: center; gap: 6px; }
.filter-bar__clear { font-size: 13.5px; }
.filter-bar__count { margin-left: auto; font-size: 13.5px; color: var(--color-text-secondary); }
@media (max-width: 480px) {
  .filter-bar select { flex: 1 1 calc(50% - 10px); }
  .filter-bar__count { margin-left: 0; width: 100%; }
}

/* --- Date block --------------------------------------------------------------- */
.date-block {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 56px; padding: 6px 8px; border-radius: var(--radius-chip);
  border: 1px solid var(--color-border-subtle); background: var(--color-bg-surface);
  line-height: 1;
}
.date-block__month {
  font: 600 11px/1 var(--font-label); letter-spacing: .08em; text-transform: uppercase;
  color: var(--color-text-eyebrow);
}
.date-block__day { margin-top: 4px; font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.date-block--past { opacity: .55; }

/* --- Stepper ------------------------------------------------------------------ */
.stepper { display: flex; gap: 8px; margin: 0 0 24px; padding: 0; list-style: none; counter-reset: step; }
.stepper li {
  flex: 1; display: flex; align-items: center; gap: 8px;
  font-size: 13.5px; color: var(--color-text-secondary); counter-increment: step;
}
.stepper li::before {
  content: counter(step); flex: none; width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--color-border-subtle); font-size: 13px; font-weight: 700;
}
.stepper li + li { position: relative; }
.stepper .is-done { color: var(--color-text-primary); }
.stepper .is-done::before {
  content: "✓"; border-color: var(--color-action-primary-bg);
  background: var(--color-action-primary-bg); color: var(--color-action-primary-fg);
}
.stepper [aria-current="step"] { color: var(--color-text-primary); font-weight: 600; }
.stepper [aria-current="step"]::before { border-color: var(--color-action-primary-bg); color: var(--color-action-primary-bg); }
@media (max-width: 480px) {
  .stepper li:not([aria-current="step"]) { flex: none; font-size: 0; gap: 0; }
}

/* --- Browser and phone frames ------------------------------------------------
   .frame-browser is .marco under its new name. */
.frame-browser {
  margin: 0; border-radius: var(--radius-card); overflow: hidden; background: #fff;
  border: 1px solid var(--color-border-subtle); box-shadow: 0 18px 50px rgba(20,18,26,.13);
}
[data-theme="night"] .frame-browser { background: var(--color-bg-surface); border-color: rgba(255,255,255,.14); box-shadow: 0 30px 80px rgba(0,0,0,.45); }
.frame-browser__bar {
  display: flex; align-items: center; gap: 7px; padding: 10px 14px;
  background: #f2f0f8; border-bottom: 1px solid var(--color-border-subtle);
}
[data-theme="night"] .frame-browser__bar { background: #23202f; border-bottom-color: rgba(255,255,255,.07); }
.frame-browser__dot { width: 10px; height: 10px; border-radius: 50%; background: #cdc8dd; }
[data-theme="night"] .frame-browser__dot { background: #4a4560; }
.frame-browser__url {
  min-width: 0; margin-left: 10px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font: 12px/1.4 var(--font-mono); color: #8d87a8;
}
.frame-browser img, .frame-phone img { display: block; width: 100%; height: auto; }
/* Phone frame for mobile screenshots: the hero and feature pages on a
   phone show the store as a buyer sees it, not a shrunk desktop page. */
.frame-phone {
  width: 100%; max-width: 280px; margin: 0 auto; padding: 10px;
  border-radius: 38px; background: #14121a;
  box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 30px 60px rgba(20,18,26,.28);
}
.frame-phone__screen { position: relative; overflow: hidden; border-radius: 29px; background: #fff; }
.frame-phone__screen::before {
  content: ""; position: absolute; top: 8px; left: 50%; z-index: 1;
  width: 72px; height: 20px; border-radius: 12px; background: #14121a; transform: translateX(-50%);
}

/* --- Accordion (FAQ) ------------------------------------------------------------ */
.accordion { border-top: 1px solid var(--color-border-subtle); }
.accordion details { border-bottom: 1px solid var(--color-border-subtle); }
.accordion summary {
  display: flex; justify-content: space-between; gap: 20px;
  padding: 18px 0; cursor: pointer; list-style: none; font-weight: 600; font-size: 16px;
}
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary::after { content: "+"; color: var(--color-action-primary-bg); font-weight: 700; }
.accordion details[open] summary::after { content: "−"; }
.accordion__body { padding: 0 0 20px; margin: 0; font-size: 15px; color: var(--color-text-secondary); }

/* --- Stat ------------------------------------------------------------------------ */
.stat__value {
  font: 700 clamp(26px, 3.4vw, 36px)/1 var(--font-display); letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}
.stat__label { margin: 8px 0 0; font-size: 13px; color: var(--color-text-secondary); }

/* --- Back link and pagination ----------------------------------------------------- */
.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: 13.5px; }
.back-link:hover { text-decoration: none; }
.pagination { display: flex; gap: 6px; align-items: center; justify-content: center; margin-top: 32px; }
.pagination a, .pagination span {
  min-width: 38px; height: 38px; padding: 0 10px; border-radius: var(--radius-control);
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  border: 1px solid var(--color-border-subtle); font-size: 14px; color: var(--color-text-primary);
}
.pagination a:hover { background: var(--color-bg-subtle); text-decoration: none; }
.pagination [aria-current="page"] {
  background: var(--color-action-primary-bg); border-color: var(--color-action-primary-bg);
  color: var(--color-action-primary-fg); font-weight: 600;
}
.pagination [aria-disabled="true"] { color: var(--color-text-secondary); opacity: .5; }

/* --- Status pill ---------------------------------------------------------------- */
.status-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px;
  border-radius: var(--radius-pill); border: 1px solid var(--color-border-subtle);
  font-size: 13px; color: var(--color-text-secondary);
}
.status-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status-pill--ok::before { background: var(--color-feedback-success-fg); }
.status-pill--degraded::before { background: var(--color-feedback-warning-text); }
.status-pill--incident::before { background: var(--color-feedback-danger-fg); }

/* --- Skeleton ---------------------------------------------------------------------- */
.skeleton {
  display: block; height: 1em; border-radius: var(--radius-chip);
  background: linear-gradient(90deg, var(--color-bg-subtle) 25%, var(--color-border-subtle) 37%, var(--color-bg-subtle) 63%);
  background-size: 400% 100%; animation: shimmer 1.4s ease infinite;
}
@keyframes shimmer { from { background-position: 100% 50%; } to { background-position: 0 50%; } }

/* --- Grain ---------------------------------------------------------------------------
   Riso-style texture for dark marketing bands. A static tile, not a live
   feTurbulence, so it costs nothing to paint on a modest phone. Off
   wherever the page's ornament budget is "none". */
.grain { position: relative; isolation: isolate; }
.grain::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: url("../brand/grain.png") repeat; opacity: .05; mix-blend-mode: overlay;
}
[data-theme="night"].grain::after { opacity: .08; }
[data-ornament="none"] .grain::after { display: none; }

@media (prefers-reduced-motion: reduce) {
  .button[aria-busy="true"]::after, .skeleton { animation: none; }
  .sticker, .sticker:hover { transform: none; }
}
