/* ==========================================================================
 * Nanolex design system (docs/design-brief.md, step D0)
 *
 * Sizes are in px on purpose: the parent theme scales its rem base with the
 * screen width on phones (≈8.5 px at 375 px), so rem sizes come out too small.
 * Fluid values interpolate between 375 px and 1280 px screens.
 * ========================================================================== */

:root {
  /* Colours: brand */
  --nx-purple: #2c1844;        /* headings, footer, secondary buttons */
  --nx-purple-80: #4a3563;     /* hover on purple */
  --nx-mint: #9ce5c0;          /* primary CTA only */
  --nx-mint-strong: #7cd8a9;   /* primary CTA hover */
  --nx-mint-vivid: #5fdb9c;    /* "Broneeri aeg" (.nx-btn--glow) */
  --nx-mint-vivid-strong: #45cf8a;
  --nx-lilac: #ddaaff;         /* level badges */
  --nx-lilac-soft: #f1e2ff;    /* level badge START, icon tiles */

  /* Colours: neutrals */
  --nx-text: #2b2433;
  --nx-text-muted: #6b6478;
  --nx-bg: #ffffff;
  --nx-bg-alt: #f6f4f9;        /* alternating section background */
  --nx-border: #e7e2ee;
  --nx-placeholder: #e9e6ee;

  /* Typography */
  --nx-font: "Nunito Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --nx-h1: clamp(32px, 25.4px + 1.77vw, 48px);
  --nx-h2: clamp(26px, 21.9px + 1.1vw, 36px);
  --nx-h3: clamp(20px, 18.3px + 0.44vw, 24px);
  --nx-body: 16px;
  --nx-small: 14px;
  --nx-line: 1.5;
  --nx-line-tight: 1.2;

  /* Spacing: 8 px grid */
  --nx-1: 8px;
  --nx-2: 16px;
  --nx-3: 24px;
  --nx-4: 32px;
  --nx-5: 40px;
  --nx-6: 48px;
  --nx-8: 64px;
  --nx-12: 96px;
  --nx-section: clamp(48px, 28.1px + 5.3vw, 96px);  /* 48 → 96 */
  --nx-card-pad: clamp(20px, 18.3px + 0.44vw, 24px); /* 20 → 24 */
  --nx-gutter: 16px;

  /* Shape */
  --nx-radius: 12px;
  --nx-radius-sm: 8px;
  --nx-pill: 999px;
  --nx-shadow: 0 8px 24px rgba(44, 24, 68, 0.08);
  --nx-shadow-strong: 0 12px 32px rgba(44, 24, 68, 0.14);

  /* Controls */
  --nx-tap: 48px;
}

@media (min-width: 1024px) {
  :root {
    --nx-gutter: 32px;
  }
}

/* The site is light-only; set the page background explicitly instead of relying on the browser default. */
:root {
  color-scheme: light;
}

html,
body {
  background-color: var(--nx-bg);
}

/* ---------- Layout ---------- */

.nx-container {
  box-sizing: border-box;
  margin: 0 auto;
  max-width: 1200px;
  padding: 0 var(--nx-gutter);
  width: 100%;
}

.nx-section {
  background: var(--nx-bg);
  padding: var(--nx-section) 0;
}

.nx-section--alt {
  background: var(--nx-bg-alt);
}

.nx-section--dark {
  background: var(--nx-purple);
  color: #fff;
}

.nx-stack > * + * {
  margin-top: var(--nx-2);
}

.nx-grid {
  display: grid;
  gap: var(--nx-3);
  grid-template-columns: 1fr;
}

@media (min-width: 700px) {
  .nx-grid--2 { grid-template-columns: repeat(2, 1fr); }
  .nx-grid--3 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .nx-grid--3 { grid-template-columns: repeat(3, 1fr); }
  .nx-grid--4 { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- Typography ---------- */

.nx-scope,
.nx-text {
  color: var(--nx-text);
  font-family: var(--nx-font);
  font-size: var(--nx-body);
  line-height: var(--nx-line);
}

/* The parent theme sizes p/li/a in its scaled rem; inside the system they follow the scope.
   Specificity (0,1,0) beats the theme's element selectors; the classes below are declared later and win. */
.nx-scope :where(p, li, a, span, strong, dd, dt, label) {
  font-size: inherit;
  line-height: inherit;
}

.nx-h1,
.nx-h2,
.nx-h3 {
  color: var(--nx-purple);
  font-family: var(--nx-font);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: var(--nx-line-tight);
  margin: 0;
}

.nx-h1 { font-size: var(--nx-h1); }
.nx-h2 { font-size: var(--nx-h2); }
.nx-h3 { font-size: var(--nx-h3); font-weight: 700; }

.nx-lead {
  font-size: clamp(18px, 16.3px + 0.44vw, 22px);
  line-height: 1.45;
}

.nx-small {
  font-size: var(--nx-small);
  line-height: 1.45;
}

.nx-muted {
  color: var(--nx-text-muted);
}

.nx-eyebrow {
  color: var(--nx-purple);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- Buttons ---------- */

.nx-btn {
  align-items: center;
  border: 2px solid transparent;
  border-radius: var(--nx-pill);
  box-sizing: border-box;
  cursor: pointer;
  display: inline-flex;
  font-family: var(--nx-font);
  font-size: 16px;          /* one size for the whole label */
  font-weight: 700;
  gap: var(--nx-1);
  justify-content: center;
  line-height: 1;
  min-height: var(--nx-tap);
  padding: 0 var(--nx-3);
  text-decoration: none !important;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}

.nx-btn .nx-icon {
  height: 20px;
  width: 20px;
}

.nx-btn--primary {
  background: var(--nx-mint);
  border-color: var(--nx-mint);
  color: var(--nx-purple);
}

.nx-btn--primary:hover,
.nx-btn--primary.is-hover {
  background: var(--nx-mint-strong);
  border-color: var(--nx-mint-strong);
  color: var(--nx-purple);
}

.nx-btn--secondary {
  background: transparent;
  border-color: var(--nx-purple);
  color: var(--nx-purple);
}

.nx-btn--secondary:hover,
.nx-btn--secondary.is-hover {
  background: var(--nx-purple);
  color: #fff;
}

.nx-btn--on-dark.nx-btn--secondary {
  border-color: #fff;
  color: #fff;
}

.nx-btn--small {
  font-size: 14px;
  min-height: 40px;
  padding: 0 var(--nx-2);
}

.nx-btn--block {
  width: 100%;
}

.nx-btn--icon {
  min-width: var(--nx-tap);
  padding: 0;
}

.nx-btn:focus-visible,
.nx-link:focus-visible,
.nx-accordion summary:focus-visible {
  outline: 3px solid var(--nx-purple);
  outline-offset: 3px;
}

.nx-btn[disabled],
.nx-btn.is-disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.nx-link {
  align-items: center;
  color: var(--nx-purple);
  display: inline-flex;
  font-weight: 700;
  gap: 6px;
  text-decoration: none;
}

.nx-link .nx-icon {
  height: 18px;
  transition: transform 0.2s ease;
  width: 18px;
}

.nx-link:hover .nx-icon,
.nx-link.is-hover .nx-icon {
  transform: translateX(3px);
}

.nx-link:hover {
  text-decoration: underline;
}

/* ---------- Badges and chips ---------- */

.nx-badge {
  border-radius: var(--nx-pill);
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1;
  padding: 6px 10px;
  text-transform: uppercase;
}

.nx-badge--start { background: var(--nx-lilac-soft); color: var(--nx-purple); }
.nx-badge--entusiast { background: var(--nx-lilac); color: var(--nx-purple); }
.nx-badge--pro { background: var(--nx-purple); color: #fff; }
.nx-badge--highlight { background: var(--nx-purple); color: #fff; }

.nx-chip {
  align-items: center;
  background: #fff;
  border: 1px solid var(--nx-border);
  border-radius: var(--nx-pill);
  color: var(--nx-purple);
  display: inline-flex;
  font-size: var(--nx-small);
  font-weight: 700;
  gap: 6px;
  min-height: 40px;
  padding: 0 var(--nx-2);
}

.nx-chip[aria-pressed="true"],
.nx-chip.is-active {
  background: var(--nx-purple);
  border-color: var(--nx-purple);
  color: #fff;
}

/* ---------- Icons ---------- */

.nx-icon {
  display: inline-block;
  flex-shrink: 0;
  vertical-align: middle;
}

.nx-icon-tile {
  align-items: center;
  background: var(--nx-lilac-soft);
  border-radius: var(--nx-radius);
  color: var(--nx-purple);
  display: inline-flex;
  height: 56px;
  justify-content: center;
  width: 56px;
}

.nx-icon-tile .nx-icon {
  height: 28px;
  width: 28px;
}

/* ---------- Photo placeholder (until the content day, see docs/shot-list.md) ---------- */

.nx-photo {
  align-items: center;
  aspect-ratio: 16 / 10;
  background: repeating-linear-gradient(135deg, var(--nx-placeholder) 0 12px, #efedf3 12px 24px);
  border-radius: var(--nx-radius);
  box-sizing: border-box;
  color: var(--nx-text-muted);
  display: flex;
  font-size: 13px;
  font-weight: 700;
  justify-content: center;
  line-height: 1.35;
  padding: var(--nx-2);
  text-align: center;
  width: 100%;
}

.nx-photo--square { aspect-ratio: 1 / 1; }
.nx-photo--wide { aspect-ratio: 16 / 9; }

/* ---------- Cards ---------- */

.nx-card {
  background: #fff;
  border: 1px solid var(--nx-border);
  border-radius: var(--nx-radius);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.nx-card__body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: var(--nx-2);
  padding: var(--nx-card-pad);
}

.nx-card__media {
  position: relative;
}

.nx-card__media .nx-photo {
  border-radius: 0;
}

.nx-card--highlight {
  border: 2px solid var(--nx-purple);
  box-shadow: var(--nx-shadow-strong);
}

/* Badge sits inside the card, never cut off by the edge */
.nx-card__badge {
  left: var(--nx-2);
  position: absolute;
  top: var(--nx-2);
  z-index: 1;
}

/* Service card */
.nx-service__list {
  display: grid;
  gap: var(--nx-1);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nx-service__list li {
  align-items: flex-start;
  display: flex;
  gap: var(--nx-1);
  margin: 0;
}

.nx-service__list li::before {
  display: none; /* parent theme adds bullets to list items */
}

.nx-service__list .nx-icon {
  color: var(--nx-purple);
  height: 20px;
  margin-top: 2px;
  width: 20px;
}

.nx-service__meta {
  align-items: center;
  color: var(--nx-text-muted);
  display: flex;
  font-size: var(--nx-small);
  gap: 6px;
}

.nx-service__meta .nx-icon {
  height: 18px;
  width: 18px;
}

.nx-service__footer {
  align-items: flex-end;
  border-top: 1px solid var(--nx-border);
  display: flex;
  flex-wrap: wrap;
  gap: var(--nx-2);
  justify-content: space-between;
  margin-top: auto;
  padding-top: var(--nx-2);
}

.nx-price {
  color: var(--nx-purple);
  display: flex;
  flex-direction: column;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.1;
}

.nx-price__size {
  color: var(--nx-text-muted);
  font-size: 13px;
  font-weight: 600;
}

/* Product card */
.nx-product__image {
  align-items: center;
  aspect-ratio: 1 / 1;
  background: var(--nx-bg-alt);
  display: flex;
  justify-content: center;
  padding: var(--nx-2);
}

.nx-product__image img {
  height: 100%;
  object-fit: contain;
  width: 100%;
}

.nx-product__name {
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: var(--nx-purple);
  display: -webkit-box;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  margin: 0;
  overflow: hidden;
}

.nx-product__subtitle {
  color: var(--nx-text-muted);
  font-size: var(--nx-small);
  margin: 4px 0 0;
}

.nx-product__footer {
  align-items: center;
  display: flex;
  gap: var(--nx-2);
  justify-content: space-between;
  margin-top: auto;
}

.nx-product__price {
  color: var(--nx-purple);
  font-size: 20px;
  font-weight: 800;
}

.nx-product__cart-mobile { display: flex; }
.nx-product__cart-desktop { display: none; }

@media (min-width: 700px) {
  .nx-product__cart-mobile { display: none; }
  .nx-product__cart-desktop { display: inline-flex; }
}

/* Info card */
.nx-info {
  gap: var(--nx-2);
}

.nx-info__text {
  margin: 0;
}

/* ---------- Accordion ---------- */

.nx-accordion {
  border-top: 1px solid var(--nx-border);
}

.nx-accordion__item {
  border-bottom: 1px solid var(--nx-border);
}

.nx-accordion__item > summary {
  align-items: center;
  color: var(--nx-purple);
  cursor: pointer;
  display: flex;
  font-size: 18px;
  font-weight: 700;
  gap: var(--nx-2);
  justify-content: space-between;
  line-height: 1.35;
  list-style: none;
  min-height: var(--nx-tap);
  padding: var(--nx-2) var(--nx-1);
}

.nx-accordion__item > summary::-webkit-details-marker {
  display: none;
}

.nx-accordion__item > summary::marker {
  content: "";
}

.nx-accordion__item > summary .nx-icon {
  transition: transform 0.2s ease;
}

.nx-accordion__item[open] > summary .nx-icon {
  transform: rotate(180deg);
}

.nx-accordion__panel {
  padding: 0 var(--nx-1) var(--nx-3);
}

/* ---------- Placeholder text (owner fills in) ---------- */

.nx-placeholder-text {
  background: #fff3cd;
  border: 1px dashed #b38600;
  border-radius: 4px;
  color: #6b5000;
  display: inline-block;
  font-size: var(--nx-small);
  padding: 2px 8px;
}

/* ---------- Segmented control (car-size toggle) ---------- */

.nx-segmented {
  background: var(--nx-bg-alt);
  border: 1px solid var(--nx-border);
  border-radius: var(--nx-pill);
  display: inline-flex;
  gap: 4px;
  max-width: 100%;
  padding: 4px;
}

.nx-segmented__option {
  background: transparent;
  border: 0;
  border-radius: var(--nx-pill);
  color: var(--nx-purple);
  cursor: pointer;
  flex: 1 1 0;
  font-family: var(--nx-font);
  font-size: 15px;
  font-weight: 700;
  min-height: 40px;
  padding: 0 var(--nx-2);
  white-space: nowrap;
}

.nx-segmented__option[aria-pressed="true"] {
  background: var(--nx-purple);
  color: #fff;
}

/* "Broneeri aeg": the one action that matters most, a more saturated mint with a soft glow */
.nx-btn--glow {
  background: var(--nx-mint-vivid);
  border-color: var(--nx-mint-vivid);
  box-shadow: 0 0 0 0 rgba(78, 214, 147, 0), 0 6px 18px rgba(78, 214, 147, 0.45);
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.25s ease, transform 0.2s ease;
}

.nx-btn--glow:hover,
.nx-btn--glow:focus-visible {
  background: var(--nx-mint-vivid-strong);
  border-color: var(--nx-mint-vivid-strong);
  box-shadow: 0 0 0 4px rgba(78, 214, 147, 0.25), 0 10px 26px rgba(78, 214, 147, 0.6);
  transform: translateY(-1px);
}

/* Small "Broneeri" buttons inside cards: same colour, a lighter glow */
.nx-btn--glow.nx-btn--small {
  box-shadow: 0 4px 12px rgba(78, 214, 147, 0.4);
}

.nx-btn--glow.nx-btn--small:hover,
.nx-btn--glow.nx-btn--small:focus-visible {
  box-shadow: 0 0 0 3px rgba(78, 214, 147, 0.25), 0 6px 16px rgba(78, 214, 147, 0.55);
}

/* Outline buttons on a photo: a clear hover, the button fills white */
.nx-btn--on-dark.nx-btn--secondary {
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.25s ease, transform 0.2s ease;
}

.nx-btn--on-dark.nx-btn--secondary:hover,
.nx-btn--on-dark.nx-btn--secondary:focus-visible {
  background: #fff;
  border-color: #fff;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.25);
  color: var(--nx-purple);
  transform: translateY(-1px);
}

@media (prefers-reduced-motion: reduce) {
  .nx-btn--glow,
  .nx-btn--on-dark.nx-btn--secondary {
    transition: none;
  }

  .nx-btn--glow:hover,
  .nx-btn--on-dark.nx-btn--secondary:hover {
    transform: none;
  }
}

/* Sliding highlight (assets/js/services.js): the purple pill moves to the chosen option */
.nx-segmented.has-thumb {
  position: relative;
}

.nx-segmented__thumb {
  background: var(--nx-purple);
  border-radius: var(--nx-pill);
  bottom: 4px;
  box-shadow: 0 2px 8px rgba(44, 24, 68, 0.25);
  left: 0;
  position: absolute;
  top: 4px;
}

.nx-segmented.is-ready .nx-segmented__thumb {
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.nx-segmented.has-thumb .nx-segmented__option {
  position: relative;
  transition: color 0.25s ease;
  z-index: 1;
}

.nx-segmented.has-thumb .nx-segmented__option[aria-pressed="true"] {
  background: transparent;
}

@media (prefers-reduced-motion: reduce) {
  .nx-segmented.is-ready .nx-segmented__thumb,
  .nx-segmented.has-thumb .nx-segmented__option {
    transition: none;
  }
}

.nx-segmented__option:focus-visible {
  outline: 3px solid var(--nx-purple);
  outline-offset: 2px;
}

.nx-product__name a {
  color: inherit;
  text-decoration: none;
}

.nx-product__name a:hover {
  text-decoration: underline;
}

/* ==========================================================================
 * Style-guide page only (/stiilijuhend/): layout helpers, not components
 * ========================================================================== */

.nx-styleguide p {
  margin: 0;
}

.nx-sg-label {
  color: var(--nx-text-muted);
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.nx-sg-type {
  display: grid;
  gap: var(--nx-3);
}

.nx-sg-swatches {
  display: grid;
  gap: var(--nx-2);
  grid-template-columns: 1fr;
}

@media (min-width: 700px) {
  .nx-sg-swatches { grid-template-columns: repeat(3, 1fr); }
}

.nx-sg-swatch {
  align-items: flex-start;
  background: #fff;
  border: 1px solid var(--nx-border);
  border-radius: var(--nx-radius);
  display: flex;
  gap: var(--nx-2);
  padding: var(--nx-2);
}

.nx-sg-swatch strong,
.nx-sg-swatch .nx-small {
  display: block;
}

.nx-sg-swatch__chip {
  border: 1px solid var(--nx-border);
  border-radius: var(--nx-radius-sm);
  flex-shrink: 0;
  height: 48px;
  width: 48px;
}

.nx-sg-spacing {
  display: grid;
  gap: var(--nx-1);
}

.nx-sg-spacing__row {
  align-items: center;
  display: grid;
  gap: var(--nx-2);
  grid-template-columns: 56px 1fr;
}

.nx-sg-spacing__bar {
  background: var(--nx-lilac);
  border-radius: 4px;
  display: block;
  height: 16px;
}

.nx-sg-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--nx-2);
}

.nx-sg-row--mobile {
  display: grid;
  max-width: 343px;
}

.nx-sg-dark {
  align-items: center;
  background: var(--nx-purple);
  border-radius: var(--nx-radius);
  color: #fff;
  display: flex;
  flex-wrap: wrap;
  gap: var(--nx-2);
  padding: var(--nx-3);
}

.nx-sg-icons {
  display: grid;
  gap: var(--nx-2);
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
}

.nx-sg-icon {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: center;
}

/* Product grid: 2 columns already on phones */
.nx-grid--products {
  gap: var(--nx-2);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 700px) {
  .nx-grid--products { gap: var(--nx-3); grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .nx-grid--products { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 699px) {
  .nx-grid--products .nx-card__body { gap: var(--nx-1); padding: 12px; }
  .nx-grid--products .nx-product__name { font-size: 16px; }
  .nx-grid--products .nx-product__price { font-size: 17px; }
  .nx-grid--products .nx-product__image { padding: var(--nx-1); }
  .nx-grid--products .nx-card__badge { left: var(--nx-1); top: var(--nx-1); }
}

.nx-price-from {
  color: var(--nx-text-muted);
  font-size: 13px;
  font-weight: 600;
}

/* Product card: square image box regardless of the image's own proportions */
.nx-product__image {
  display: block;
  position: relative;
}

/* The image fills the whole square (most product photos have their own background; a frame around them looked odd) */
.nx-product__image img {
  height: 100%;
  left: 0;
  position: absolute;
  top: 0;
  width: 100%;
}
