/* SZUGAR designer shop — shared styles for every SZUGAR brand-extension site.
   Each site's theme.css sets the tokens below (colours, fonts, the logo fill) and may
   add its own touches. Everything is self-hosted: no external fonts, scripts or images.
   Fonts (SIL Open Font License 1.1, licences in fonts/): Righteous (a free stand-in for
   the SZUGAR display face), Source Code Pro (the SZUGAR body face), Bungee (accents). */

@font-face { font-family: "Righteous"; src: url("fonts/righteous-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Source Code Pro"; src: url("fonts/source-code-pro-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Source Code Pro"; src: url("fonts/source-code-pro-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Source Code Pro"; src: url("fonts/source-code-pro-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Source Code Pro"; src: url("fonts/source-code-pro-latin-600-normal.woff2") format("woff2"); font-weight: 600 700; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url("fonts/newsreader-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Bungee"; src: url("fonts/bungee-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  color-scheme: light;
  /* Defaults; theme.css overrides them. */
  --bg: #efe6d4;
  --bg-2: #e6dbc4;
  --panel: #fbf6ec;
  --ink: #303030;
  --ink-2: #5a4a3e;
  --line: #cdb994;
  --primary: #581213;      /* buttons and links; white text sits on it */
  --primary-hover: #3f0c0d;
  --accent: #bb1735;
  --accent-soft: #f3d9c9;
  --ok: #2f5e3a;
  --bad: #a01530;
  --banner-bg: #303030;
  --banner-ink: #f4ead6;
  --display: "Righteous", "Avenir Next", "Futura", "Trebuchet MS", sans-serif;
  --body: "Source Code Pro", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --accent-font: "Bungee", "Righteous", sans-serif;
  --radius: 8px;
  --radius-lg: 16px;
  --shadow: 0 1px 0 rgba(0, 0, 0, .05), 0 12px 28px -16px rgba(48, 48, 48, .35);
  --mark-fill: #303030;
  --mark-inline: 1;
  --hero-bg: transparent;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.6 var(--body);
  overflow-wrap: break-word;
}
img { max-width: 100%; }
a { color: var(--primary); text-underline-offset: 3px; }
a:hover { color: var(--primary-hover); }
h1, h2, h3 { font-family: var(--display); font-weight: 400; line-height: 1.15; margin: 0 0 .5em; color: var(--heading, var(--ink)); }
h1 { font-size: clamp(2.4rem, 7vw, 4.4rem); }
h2 { font-size: clamp(1.6rem, 4vw, 2.3rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }
code { font-family: var(--body); background: var(--bg-2); padding: 0 4px; border-radius: 4px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--panel); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- the logo: the SZUGAR monogram, filled with this designer's own print ---------- */
.mark {
  display: inline-block;
  position: relative;
  flex: none;
  width: var(--mark-size, 44px);
  aspect-ratio: 1;
  background: var(--mark-fill);
  -webkit-mask: url("brand/szugar-mark.webp") center / contain no-repeat;
  mask: url("brand/szugar-mark.webp") center / contain no-repeat;
}
/* The original gold-glitter inline (cut from the same monogram) over the fill. */
.mark::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("brand/szugar-mark-inline.webp") center / contain no-repeat;
  opacity: var(--mark-inline);
}
.mark--small { --mark-size: 46px; }
.mark--hero { --mark-size: min(60vw, 340px); }

/* ---------- header ---------- */
.masthead { background: var(--panel); border-bottom: 1px solid var(--line); }
.masthead-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-family: var(--display); font-size: 1.3rem; color: var(--heading, var(--ink)); }
.brand-sub { font-size: .75rem; color: var(--ink-2); letter-spacing: .04em; }
.nav { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.nav a { text-decoration: none; font-weight: 500; padding: 4px 0; border-bottom: 2px solid transparent; }
.nav a:hover { border-bottom-color: var(--accent); }
.demo-banner { margin: 0; background: var(--banner-bg); color: var(--banner-ink); text-align: center; font-size: .8rem; padding: 6px 16px; }

/* ---------- hero and story ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 24px 48px; align-items: center; padding-top: 48px; padding-bottom: 32px; }
.hero-mark { display: flex; flex-direction: column; align-items: center; gap: 12px; background: var(--hero-bg); border-radius: var(--radius-lg); padding: 24px 16px; }
.mark-note { font-size: .8rem; color: var(--ink-2); text-align: center; margin: 0; max-width: 32ch; }
.eyebrow { font-family: var(--accent-font); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink, var(--accent)); margin-bottom: .6em; }
.h1-szugar { display: block; font-size: .38em; letter-spacing: .12em; color: var(--ink-2); }
.tagline { font-size: 1.15rem; max-width: 46ch; }
.meaning { color: var(--ink-2); font-style: italic; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.story { padding-top: 24px; padding-bottom: 24px; }
.story-text { columns: 2 320px; column-gap: 40px; max-width: 1000px; }
.story-text p { break-inside: avoid; }
.h2-note { font-family: var(--body); font-size: .5em; color: var(--ink-2); letter-spacing: 0; }
.lede { max-width: 80ch; }
section[id] { scroll-margin-top: 12px; }
.catalogue, .standard, .bag, .assistant { padding-top: 40px; padding-bottom: 24px; }

/* ---------- buttons, forms, panels ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 8px 18px; border-radius: 999px; border: 2px solid var(--primary);
  font: 600 .95rem/1.2 var(--body); cursor: pointer; text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn-quiet { background: transparent; color: var(--primary); }
.btn-quiet:hover { background: var(--accent-soft); color: var(--primary-hover); }
.btn-small { min-height: 36px; padding: 4px 12px; font-size: .85rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
label { display: block; font-weight: 500; font-size: .9rem; }
input, select, textarea {
  display: block; width: 100%; margin-top: 4px; min-height: 40px; padding: 8px 10px;
  font: 400 .95rem/1.3 var(--body); color: var(--ink); background: #fff;
  border: 1px solid var(--ink-2); border-radius: var(--radius);
}
input[type="radio"] { display: inline-block; width: auto; min-height: 0; margin: 0 6px 0 0; accent-color: var(--primary); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px 12px; margin: 0; }
legend { font-weight: 600; padding: 0 4px; }
.radio { display: flex; align-items: baseline; gap: 4px; font-weight: 400; margin-top: 8px; }
.hint { display: block; color: var(--ink-2); font-size: .85rem; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow); }
.note { background: var(--panel); border-left: 4px solid var(--accent); padding: 10px 14px; border-radius: 4px; }
.form-error { color: var(--bad); font-weight: 600; }
.demo-tag { font-size: .85rem; color: var(--ink-2); }
.fine { font-size: .85rem; color: var(--ink-2); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- filters and the piece grid ---------- */
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 12px 16px; margin-bottom: 20px; }
.filters label { flex: 1 1 160px; max-width: 260px; }
.f-count { color: var(--ink-2); font-size: .9rem; padding-bottom: 8px; }
.piece-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 20px; }
.piece-card { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); }
.faces { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; background: var(--line); margin: 0; }
.face { margin: 0; background: var(--panel); }
.face figcaption { font-size: .78rem; padding: 6px 10px; color: var(--ink-2); line-height: 1.3; }
.face-side { font-family: var(--accent-font); font-size: .7rem; color: var(--ink); letter-spacing: .05em; }
.card-body { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px 16px; flex: 1; }
.card-body h3 { margin: 0; }
.card-body p { margin: 0; }
.kind-tag { font-size: .8rem; color: var(--ink-2); }
.kind { font-family: var(--accent-font); font-size: .72rem; letter-spacing: .05em; background: var(--accent-soft); color: var(--ink); padding: 2px 8px; border-radius: 999px; margin-right: 4px; }
.desc { font-size: .9rem; }
.fits { font-size: .85rem; border-left: 3px solid var(--accent); padding-left: 8px; }
.band-chips { list-style: none; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; margin: 2px 0 0; padding: 0; }
.chip { display: flex; flex-direction: column; align-items: center; border: 1px solid var(--line); border-radius: var(--radius); padding: 3px 0; font-size: .7rem; line-height: 1.2; background: #fff; min-width: 0; text-align: center; overflow-wrap: anywhere; }
.chip-band { font-family: var(--accent-font); font-size: .85rem; }
.chip--out { background: transparent; color: var(--ink-2); border-style: dashed; }
.chip--out .chip-band { text-decoration: line-through; }
.chip--on { border: 2px solid var(--primary); }
.price-line { font-size: .88rem; }
.buy { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin-top: auto; padding-top: 6px; }
.buy label { flex: 1 1 140px; }
.buy .qty-label { flex: 0 0 70px; }
.buy .btn { flex: 1 1 120px; }
.buy-status { font-size: .85rem; min-height: 1.4em; }
.buy-status.is-ok { color: var(--ok); }
.buy-status.is-bad { color: var(--bad); }

/* ---------- fabric faces as CSS swatches (colours come from catalogue.js as --c1…--c4) ---------- */
.swatch { height: 120px; background-color: var(--c1); }
.swatch--plain {
  background-image:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .07) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, .06) 0 1px, transparent 1px 4px);
}
.swatch--poppy {
  background-image:
    radial-gradient(circle at 50% 50%, var(--c3) 0 7%, var(--c2) 8% 30%, transparent 31%),
    radial-gradient(ellipse 9% 22% at 50% 82%, var(--c4) 0 95%, transparent 100%),
    radial-gradient(circle at 50% 50%, var(--c3) 0 6%, var(--c2) 7% 26%, transparent 27%),
    radial-gradient(circle at 50% 50%, var(--c4) 0 12%, transparent 13%);
  background-size: 64px 64px, 64px 64px, 44px 44px, 30px 30px;
  background-position: 0 0, 0 30px, 32px 34px, 14px 52px;
}
.swatch--stripe {
  background-image: repeating-linear-gradient(90deg,
    var(--c1) 0 12px, var(--c3) 12px 15px, var(--c2) 15px 24px, var(--c3) 24px 27px,
    var(--c4) 27px 32px, var(--c3) 32px 35px);
}
.swatch--gingham {
  background-color: var(--c2);
  background-image:
    linear-gradient(90deg, color-mix(in srgb, var(--c1) 55%, transparent) 50%, transparent 50%),
    linear-gradient(0deg, color-mix(in srgb, var(--c1) 55%, transparent) 50%, transparent 50%);
  background-size: 18px 18px;
}
.swatch--linen {
  background-image:
    repeating-linear-gradient(0deg, color-mix(in srgb, var(--c2) 70%, transparent) 0 1px, transparent 1px 3px, color-mix(in srgb, var(--c2) 40%, transparent) 3px 4px, transparent 4px 7px),
    repeating-linear-gradient(90deg, color-mix(in srgb, var(--c2) 60%, transparent) 0 1px, transparent 1px 4px, color-mix(in srgb, var(--c2) 35%, transparent) 4px 6px, transparent 6px 9px),
    linear-gradient(90deg, transparent 0 30%, color-mix(in srgb, var(--c2) 45%, transparent) 30% 31.5%, transparent 31.5% 72%, color-mix(in srgb, var(--c2) 45%, transparent) 72% 73%, transparent 73%);
}
.swatch--indigo {
  background-image:
    repeating-radial-gradient(circle at 50% 50%, var(--c2) 0 2px, transparent 2.5px 7px, color-mix(in srgb, var(--c3) 80%, transparent) 7px 9px, transparent 9.5px 14px),
    radial-gradient(circle at 50% 50%, transparent 0 60%, var(--c1) 61%);
  background-size: 44px 44px, 44px 44px;
}

/* ---------- the standard ---------- */
.std-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 20px; }
.std-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px; min-width: 0; }
.std-card h3 + p, .std-card p { font-size: .9rem; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .85rem; }
caption { text-align: left; color: var(--ink-2); font-size: .8rem; padding-bottom: 4px; }
th, td { border-bottom: 1px solid var(--line); padding: 5px 6px; text-align: left; vertical-align: top; }
thead th { font-weight: 600; border-bottom: 2px solid var(--ink-2); }
tbody th { font-family: var(--accent-font); font-weight: 400; }
.joins-table tbody th { font-family: var(--body); font-weight: 600; }
.std-where { font-size: .8rem; margin-top: 10px; }
.std-list { padding-left: 18px; font-size: .9rem; }
.std-list li { margin-bottom: 8px; }

/* ---------- bag and checkout ---------- */
.bag-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.bag-main { display: flex; flex-direction: column; gap: 14px; }
.bag-main > p { margin: 0; }
.bag-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.bag-line { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.bag-line-qty { display: flex; align-items: center; gap: 8px; }
.qty { min-width: 1.5em; text-align: center; font-weight: 600; }
.bag-line-total { font-weight: 600; min-width: 5.5em; text-align: right; }
.bag-total { font-size: 1.05rem; text-align: right; }
/* The hidden attribute wins over a display set below (the checkout, the review). */
[hidden] { display: none !important; }
.checkout { display: flex; flex-direction: column; gap: 12px; }
.checkout h3 { margin: 0; }
.review dl, .policies dl { display: grid; grid-template-columns: fit-content(40%) 1fr; gap: 6px 14px; margin: 0 0 12px; font-size: .9rem; }
.review dt, .policies dt { font-weight: 600; }
.review dd, .policies dd { margin: 0; }
.policies { background: var(--bg-2); border-radius: var(--radius-lg); padding: 18px; }
.policies dl { grid-template-columns: 1fr; gap: 2px; }
.policies dd { margin-bottom: 8px; }

/* ---------- footer ---------- */
.footer { margin-top: 48px; background: var(--banner-bg); color: var(--banner-ink); padding: 24px 0; font-size: .85rem; }
.footer a { color: var(--banner-ink); }
/* On the dark banner the accent ring is too faint: use the banner's light ink (>= 3:1). */
.footer :focus-visible, .demo-banner :focus-visible { outline-color: var(--banner-ink); }
.footer code { background: rgba(255, 255, 255, .12); }

/* ---------- assistant (from the agentify-website skill's assistant.css) ---------- */
.assistant { margin-top: 24px; }
.assistant-note { font-size: .85rem; color: var(--ink-2); }
#agent-app {
  --ns-font: var(--body);
  --ns-bg: #ffffff;
  --ns-fg: var(--ink);
  --ns-primary: var(--primary);
  --ns-accent: var(--primary-hover);
  --ns-border: var(--line);
  --ns-panelbg: var(--panel);
  --ns-msgbg: var(--bg-2);
  --ns-muted: var(--ink-2);
}
.assistant-panels { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 16px; margin-top: 16px; }
#agent-app.ns-composed-app [data-ns-slot="chat"] { height: 640px; }
#agent-app .ns-chat { background: var(--ns-bg); }
#agent-app input[type="checkbox"], #agent-app input[type="radio"] { width: auto; }
#agent-app input, #agent-app select, #agent-app textarea { display: revert; width: revert; margin-top: 0; min-height: 0; }
#agent-app .ns-header { flex-wrap: wrap; }
#agent-app .ns-settings-body label { margin: 4px 0; font-weight: 400; }
#agent-app .ns-w-label { font-family: inherit; }
#agent-app .ns-widget label { margin: 0; }
#agent-app .ns-w-radio label, #agent-app .ns-w-multi label, #agent-app .ns-w-toggle { font-weight: 400; }
#agent-app .ns-w-toggle { font-size: 13px; }
#agent-app button { margin: 0; }
#agent-app .ns-w-choice { color: var(--ns-fg); }
#agent-app .ns-devtoggle:not(.on):hover, #agent-app .ns-modal-close:hover { background: transparent; }
#agent-app .ns-w-choice:disabled:hover { background: #fafbfc; }
#agent-app .ns-consent { background: #fffbeb; }
/* The runtime's amber warning hint is 11px at 4.1-4.3:1 here; make it readable (AA). */
#agent-app .ns-hint { font-size: 12.5px; }
#agent-app .ns-hint.warn { color: #7a3a06; }
#agent-app .ns-msgs:has(.ns-consent-actions) > .ns-turn-status { display: none; }
#agent-app .ns-msg { overflow-wrap: break-word; }
#agent-app .ns-consent-actions { flex-wrap: wrap; }
#agent-app .ns-consent-actions button { white-space: nowrap; }
body > dialog h2 { margin: 0 0 12px; font: 400 1.4em/1.2 var(--display); color: var(--heading, var(--ink)); }
body > dialog button { margin-right: 8px; }
.assistant-review { max-width: 640px; width: 85%; max-height: 85vh; overflow: auto; border: 1px solid #888; border-radius: 12px; padding: 24px; font: 15px/1.55 var(--body); color: var(--ink); background: var(--panel); }
.assistant-review dl { display: grid; grid-template-columns: fit-content(40%) 1fr; gap: 4px 16px; margin: 12px 0; }
.assistant-review dt { font-weight: 600; }
.assistant-review dd { margin: 0; overflow-wrap: anywhere; }
.assistant-review details { margin: 12px 0; }
.assistant-review pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.assistant-review button { min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 2px solid var(--primary); background: var(--primary); color: #fff; font: 600 .95rem/1.2 var(--body); cursor: pointer; }
.assistant-review .assistant-decline { background: transparent; color: inherit; border: 1px solid currentColor; }

@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; padding-top: 24px; }
  .bag-grid { grid-template-columns: 1fr; }
  .assistant-panels { grid-template-columns: 1fr; }
  .assistant-review dl { grid-template-columns: 1fr; gap: 0; }
  .assistant-review dd { margin-bottom: 8px; }
  .filters label { max-width: none; }
}
/* Reduced motion: the page and the assistant's runtime (its spinner and pulsing dots,
   whose styles it adds to the page) end each animation at once and do not repeat it. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* The runtime's small controls (the actions summary, the API-key help link): give them
   at least 24 px targets (WCAG 2.2 target size). */
#agent-app summary { min-height: 24px; padding-block: 3px; }
#agent-app .ns-key-help a { display: inline-block; min-height: 24px; padding-block: 3px; }

/* Agent cards: the whole name shows (the runtime cuts it with an ellipsis), and keyboard focus is visible. */
#agent-app .ns-anode .ns-aname { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.3; }
#agent-app .ns-anode:focus-visible { outline: 3px solid currentColor; outline-offset: 2px; }

/* Assistant controls: borders at 3:1 or more against the field and the panel (WCAG 1.4.11). */
#agent-app input:not([type="checkbox"]):not([type="radio"]), #agent-app select, #agent-app textarea,
#agent-app .ns-devtoggle, #agent-app button.ghost, #agent-app .ns-w-btn.ghost { border-color: var(--ink-2); }
#agent-app #ns-newchat { border-color: var(--ink-2) !important; color: var(--ink-2) !important; }
