/* Noto IKEA font (files in wwwroot/fonts, see README.txt there); without them the fallback fonts apply */
@font-face {
  font-family: "Noto IKEA";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("/fonts/NotoIKEA-Regular.ttf") format("truetype");
}
@font-face {
  font-family: "Noto IKEA";
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url("/fonts/NotoIKEA-Bold.ttf") format("truetype");
}
:root {
  /* colors based on Skapa tokens (skapa.ikea.net/foundations/colour) */
  --ink: #111111;          /* text-and-icon-1: headings, emphasized text */
  --text: #484848;         /* text-and-icon-2: body text */
  --quiet: #767676;        /* text-and-icon-3: lightest accessible text */
  --line: #929292;         /* interactive-subtle-border-default */
  --line-strong: #111111;  /* interactive-subtle-border-hover, selected */
  --action: #111111;       /* interactive-primary-bg-default (button) */
  --action-hover: #484848;
  --brand: #0058a3;        /* static-ikea-brand-blue: odkazy, fokus */
  --good: #0a8a00;         /* semantic-positive */
  --bad: #e00751;          /* semantic-negative */
  --tint: #f5f5f5;         /* neutral-2 */
  --rule: #dfdfdf;         /* neutral-3 */
  /* spacing throughout the file comes from the Skapa scale: 0.25, 0.5, 0.75, 1, 1.5, 2 rem (space-25 to space-200) */
  color-scheme: light;
}
* { box-sizing: border-box; }

/* the hidden attribute must also apply to elements that have their own display (e.g. label) */
[hidden] { display: none !important; }

html { font-size: 100%; }

body {
  margin: 0;
  padding: 1rem;
  font-family: "Noto IKEA", "Noto Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background: transparent;
}

main { max-width: 28rem; }

h1 { margin: 0 0 0.5rem; font-size: 1.25rem; line-height: 1.3; color: var(--ink); }
p { margin: 0 0 0.75rem; }

label { display: block; margin-bottom: 0.25rem; font-weight: 600; color: var(--ink); }

/* native field outside the Skapa component (e.g. the sample form in docs/examples); inside the component Skapa styles it */
:not(ikea-coupon-input-field) > input[type="text"] {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  font: inherit;
  font-size: 1.125rem;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 0.25rem;                  /* radius-s (4px): fields and selects */
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* on focus both the border color and width change (Skapa Input Field) */
:not(ikea-coupon-input-field) > input[type="text"]:hover { border-color: var(--line-strong); }
:not(ikea-coupon-input-field) > input[type="text"]:focus { border-color: var(--line-strong); box-shadow: 0 0 0 1px var(--line-strong); }
:not(ikea-coupon-input-field) > input[aria-invalid="true"] { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }

.hint { margin: 0.25rem 0 0.75rem; font-size: 0.875rem; color: var(--quiet); }
.error { margin: 0 0 0.75rem; font-size: 0.9375rem; color: var(--bad); font-weight: 600; }
.error::before { content: "\26A0\FE0E\00A0"; }

/* field and button in one row; on a narrow screen (320 px, zoom) the button wraps below the field */
.row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: stretch; }
/* the Skapa field is 48 px tall, the small button 40 px: the row is aligned to the field bottom and the button is centered relative to the field */
.row:has(ikea-coupon-input-field) { align-items: flex-end; }
.row ikea-coupon-button { flex: 0 0 auto; margin-bottom: 4px; }
ikea-coupon-helper-text.hint { display: block; margin: 0.25rem 0 0.75rem; }
.row > input[type="text"], .row ikea-coupon-input-field { flex: 1 1 12rem; min-width: 0; width: auto; }
.row button { flex: 0 0 auto; }

/* the invisible widget takes up no space */
altcha-widget { display: block; margin: 0; }

button {
  min-height: 2.75rem;
  min-width: 7rem;
  padding: 0.5rem 1.5rem;
  font: inherit;
  font-weight: 700;
  color: #ffffff;
  background: var(--action);
  border: 2px solid var(--action);
  border-radius: 4rem;                     /* radius-cap (64px): buttons */
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
button:hover { background: var(--action-hover); border-color: var(--action-hover); }
/* pressing shrinks the button to 97% (Skapa Button) */
button:active { transform: scale(0.97); }
button[aria-disabled="true"] { cursor: progress; opacity: 0.85; }

/* waiting state: spinner before the label */
button.busy::before {
  content: "";
  display: inline-block;
  width: 0.875em;
  height: 0.875em;
  margin-right: 0.5rem;
  vertical-align: -0.1em;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
button:focus-visible { outline-color: var(--ink); }
/* the Skapa field shows focus itself by changing border color and width; our outline would be a second, redundant frame */
ikea-coupon-input-field input:focus-visible { outline: none; }

/* reserved space for the result so the iframe height does not change after the response */
.result {
  min-height: 3.25rem;                     /* exactly one line of text including the border; longer messages wrap and the field grows, nothing is clipped */
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;                   /* radius-m (8px) */
  border: 2px solid transparent;
}
.result:empty { border: 2px dashed var(--rule); }
.result[data-kind="discount"] { background: #ffffff; border-color: var(--good); font-weight: 600; }
.result[data-kind="none"], .result[data-kind="info"] { background: var(--tint); border-color: var(--rule); }
.result[data-kind="error"] { background: #ffffff; border-color: var(--bad); }

.privacy { margin-top: 0.75rem; font-size: 0.875rem; }
.privacy a { color: var(--brand); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
