/* Noria base: typography, the "(…)" heading, the gold dash, the pill button and image placeholders. Linked on every
   storefront page after storefront/tokens.css. */
@layer base {
  body.storefront {
    font-size: var(--noria-text-body);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;

    h1, h2, h3 { font-weight: 700; }
    a { color: inherit; }
    a:hover { color: var(--noria-gold-text); }
    p { max-width: none; }
    em { font-style: italic; font-weight: 600; }
    /* The ring is ink on sand (10.3:1); footer.css and header.css turn it sand on their dark grounds. */
    :focus-visible { outline: 2px solid var(--noria-ink); outline-offset: 3px; }

    /* Inputs are an underline; selects, the "selector" of the design, a 1px square box. */
    input[type="text"], input[type="email"], input[type="password"], input[type="search"],
    input[type="number"], input[type="url"], input[type="tel"], textarea {
      min-height: 2.75rem;
      padding: 0.5rem 0;
      background: transparent;
      border: 0;
      border-bottom: 1px solid var(--noria-ink);
      border-radius: 0;
      font: inherit;
      color: inherit;
    }

    textarea { padding-inline: 0; resize: vertical; }

    select {
      min-height: 2.75rem;
      padding: 0.5rem 0.75rem;
      background: transparent;
      border: 1px solid var(--noria-ink);
      border-radius: 0;
      font: inherit;
      color: inherit;
    }

    input[type="checkbox"], input[type="radio"] { accent-color: var(--noria-green); }

    [aria-invalid="true"] { border-color: var(--color-error-text); border-bottom-width: 2px; }

    :is(input, textarea, select):disabled {
      background: transparent;
      color: var(--noria-ink-muted);
      border-style: dashed;
      cursor: not-allowed;
    }

    table { font-size: var(--noria-text-small); }
    th, td { border-bottom-color: rgb(40 40 40 / 0.25); }

    /* A request under way: the block keeps its place and says so to readers through aria-busy. */
    [aria-busy="true"] { opacity: 0.6; cursor: progress; }

    @media (prefers-reduced-motion: reduce) {
      * { scroll-behavior: auto !important; transition: none !important; }
    }
  }


  body.storefront main { display: block; }
}

@layer components {
  /* Section heading "(NOVINKY)": the parentheses are drawn, so the text stays clean for readers and translations. */
  .noria-heading {
    margin: 0;
    font-size: var(--noria-text-heading);
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: var(--noria-track-heading);
    text-transform: uppercase;
    text-wrap: balance;

    &::before { content: "(" / ""; }
    &::after { content: ")" / ""; }
  }

  .noria-dash {
    display: block;
    width: 1.25rem;
    height: 2px;
    background: var(--noria-gold);
  }

  .noria-dash--small { width: 1rem; }

  .noria-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 3rem;
    padding: 0.625rem 1.75rem;
    font-family: var(--font-display);
    font-size: var(--noria-text-button);
    font-weight: 500;
    line-height: 1;
    letter-spacing: -0.03em;
    color: var(--noria-brown);
    text-decoration: none;
    background: var(--noria-gold);
    border: 0;
    border-radius: var(--radius-pill);
    cursor: pointer;

    &:hover { color: var(--noria-brown); background: #c29b6c; }
    &:disabled, &[aria-disabled="true"] { color: var(--noria-ink-muted); background: var(--noria-sand-deep); cursor: not-allowed; }
  }

  /* A secondary action next to a pill: the same shape, outlined. */
  .noria-button--outline {
    color: var(--noria-ink);
    background: transparent;
    border: 1px solid var(--noria-ink);

    &:hover { color: var(--noria-ink); background: var(--noria-sand-light); }
  }

  /* The main action of a page, like "Pridať do košíka": a green block, square, the full width of its column. */
  .noria-block-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 3.5rem;
    padding: 0.75rem 1.5rem;
    font-family: var(--font-display);
    font-size: var(--noria-text-button);
    font-weight: 500;
    line-height: 1.2;
    text-align: center;
    color: var(--noria-sand);
    text-decoration: none;
    background: var(--noria-green);
    border: 0;
    border-radius: 0;
    cursor: pointer;

    &:hover { color: var(--noria-sand); background: var(--noria-green-deep); }
    &:disabled, &[aria-disabled="true"] { color: var(--noria-ink-muted); background: var(--noria-sand-deep); cursor: not-allowed; }
  }

  /* One page of the shop: a wide block (1290) or a text column (930), with the heading "(…)" and its dash on top. */
  .noria-page {
    width: min(100% - 2 * var(--noria-gutter), var(--noria-wide-column));
    margin-inline: auto;
    padding-block: 2rem var(--noria-section-gap);
  }

  .noria-page--text { width: min(100% - 2 * var(--noria-gutter), var(--noria-text-column)); }

  .noria-page__head {
    display: grid;
    justify-items: center;
    gap: 1rem;
    margin-block-end: 3rem;
    text-align: center;
  }

  .noria-page > .breadcrumbs { margin-block-end: 2rem; }

  .noria-page__lead { margin: 0; line-height: 1.84; letter-spacing: var(--noria-track-body); }

  /* A sub-heading inside a page: small, uppercase, no parentheses. */
  .noria-subheading {
    margin: 0;
    font-size: var(--noria-text-small);
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: var(--noria-track-heading);
    text-transform: uppercase;
  }

  /* An empty state: one line and a pill. */
  .noria-empty {
    display: grid;
    justify-items: center;
    gap: 1.75rem;
    padding-block: 1rem 2rem;
    text-align: center;

    p { margin: 0; line-height: 1.84; }
  }

  /* Running text from the admin: pages, legal documents, FAQ answers. */
  .noria-prose {
    line-height: 1.84;
    letter-spacing: var(--noria-track-body);
    overflow-wrap: anywhere;

    > * + * { margin-block-start: 1.25rem; }
    :is(h2, h3, h4) { margin-block-start: 2.5rem; line-height: 1.4; letter-spacing: 0.05em; }
    h2 { font-size: var(--noria-text-benefit); }
    h3 { font-size: 1.125rem; }
    h4 { font-size: var(--noria-text-body); }
    :is(ul, ol) { padding-inline-start: 1.5rem; display: grid; gap: 0.5rem; }
    ul { list-style: disc; }
    ol { list-style: decimal; }
    li::marker { color: var(--noria-gold-text); }
    a { text-decoration: underline; text-underline-offset: 0.1875rem; }
    blockquote { margin-inline: 0; padding-inline-start: 1.5rem; border-inline-start: 2px solid var(--noria-gold); font-style: italic; }
    img { display: block; max-width: 100%; height: auto; }
    table { display: block; overflow-x: auto; border-collapse: collapse; }
    :is(th, td) { padding: 0.5rem 1rem 0.5rem 0; }
    hr { border-top: 1px solid var(--noria-gold); }
  }

  /* Empty image box until real photos exist (build-rules, D-005). */
  .noria-placeholder {
    display: block;
    background: var(--noria-sand-deep);
  }

  /* The core's .btn (components/button.css) in the Noria look: primary is the gold pill, secondary its outline. */
  body.storefront .btn {
    min-height: 2.75rem;
    padding: 0.5rem 1.5rem;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 500;
    color: var(--noria-sand);
    background: var(--noria-green);
    border-color: var(--noria-green);
    border-radius: var(--radius-pill);

    &:hover { color: var(--noria-sand); background: var(--noria-green-deep); border-color: var(--noria-green-deep); }
    &:disabled, &[aria-disabled="true"] { color: var(--noria-ink-muted); background: var(--noria-sand-deep); border-color: var(--noria-sand-deep); opacity: 1; }
  }

  body.storefront .btn--primary {
    color: var(--noria-brown);
    background: var(--noria-gold);
    border-color: var(--noria-gold);

    &:hover { color: var(--noria-brown); background: #c29b6c; border-color: #c29b6c; }
  }

  body.storefront .btn--secondary {
    color: var(--noria-ink);
    background: transparent;
    border-color: var(--noria-ink);

    &:hover { color: var(--noria-ink); background: var(--noria-sand-light); }
  }

  body.storefront :is(.btn--link, .btn--text) {
    min-height: 0;
    padding: 0;
    font-family: inherit;
    color: inherit;
    background: none;
    border: 0;
    text-decoration: underline;
  }
}

/* The core's form components (components/form.css) on the account and sign-in pages. */
@layer components {
  body.storefront .field__label {
    font-size: var(--noria-text-form-label);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  body.storefront .field { gap: 0.25rem; }
  body.storefront .field--inline { gap: 0.75rem; }
  body.storefront .field--inline label { font-size: var(--noria-text-small); font-weight: 500; letter-spacing: 0; text-transform: none; }

  body.storefront .form-errors {
    background: var(--noria-sand-light);
    border-width: 0 0 0 0.25rem;
  }

  body.storefront .form-errors h2 { font-size: var(--noria-text-small); font-weight: 700; }
}
