/* The configurator and the band of actions under it (inc/embed.php, inc/buttons.php) as the Figma Website page draws
   them (278:1593), the Save dialog (src/saveButton.ts) and the structure of the My Designs page (src/myDesignsPage.ts).
   Enqueued by both shortcodes; WordPress prints it in the footer, after the theme. */

/* Full bleed whatever column the theme puts the shortcode in: the viewport width minus the vertical scrollbar that
   embed.js measures into --nordtisch-scrollbar (0 on phones, about 15 px on a Windows desktop, where a bare 100vw would
   scroll the page sideways), pulled left to the viewport edge from the middle of a centred column. :where() keeps it at
   zero specificity, so any theme rule on these classes wins. */
:where(.nordtisch-embed, .nordtisch-actions) {
  box-sizing: border-box;
  width: calc(100vw - var(--nordtisch-scrollbar, 0px));
  max-width: none;
  margin-left: calc(50% - 50vw + var(--nordtisch-scrollbar, 0px) / 2);
}

/* block, or the inline iframe leaves a descender gap above the band; the start height is close to what the app reports
   on a phone (about 1065 to 1100 px from 320 to 412 wide), so the first nordtisch:height barely moves the page;
   embed.js writes the reported height inline from then on. The markup carries the same start (width and height
   attributes, display and border inline) for the moment before this footer stylesheet loads. */
:where(#nordtisch-configurator) {
  display: block;
  width: 100%;
  height: 1080px;
  border: 0;
}

/* The band (Figma 278:1593): brown #70604E with SAVE outlined at the left and FIND RETAILER at the right; on phones
   Order Samples goes into a light #F3F1EF band under it, right aligned. From 1000 px (where the app takes its desktop
   layout) one brown row: SAVE and FIND RETAILER centred, Order Samples at the right. A link without a URL is not in the
   markup, so the band then carries Save alone. */
:where(.nordtisch-actions) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  background: #70604E;
  color: #fff;
}

/* The items set their look at (0,2,0), and the Save button at (0,3,0) for :hover and :focus: the Elementor kit styles
   every button (.elementor-kit-N button, black fill and 11px 30px, and (0,2,1) on hover) and would win over a zero
   specificity rule. A theme overrides them with a selector that starts with body, e.g.
   body .nordtisch-actions .nordtisch-action--save:hover. */
.nordtisch-actions .nordtisch-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: none;
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 400;
  line-height: 18px;
  letter-spacing: 0.76px;
  text-transform: uppercase;
  text-decoration: underline;
  white-space: nowrap;
  cursor: pointer;
}

.nordtisch-actions .nordtisch-action svg { flex: none; }

.nordtisch-actions .nordtisch-action--save,
.nordtisch-actions .nordtisch-action--save:hover,
.nordtisch-actions .nordtisch-action--save:focus {
  border: 1px solid #fff;
  border-radius: 0;
  box-shadow: none;
  background: rgba(124, 124, 124, 0.25);
  color: #fff;
  text-decoration: none;
}

/* phone: SAVE 180 x 50 at 16 px from the left, FIND RETAILER at the right (27 px at 375). SAVE grows from a zero basis
   to at most 180 px: a flex line breaks before it shrinks, so a 180 px basis would push FIND RETAILER (longer in German
   and in our English) onto a line of its own at 375; only when even the narrowest SAVE leaves no room does it wrap,
   still at the right */
.nordtisch-actions .nordtisch-action--save {
  flex: 1 0 0;
  max-width: 180px;
  height: 50px;
  margin: 35px 0 35px 16px;
  padding: 0 8px;
  font-size: 16px;
  line-height: 21px;
}

.nordtisch-actions .nordtisch-action--retailer { margin: 0 7.2% 0 auto; padding-left: 16px; }

.nordtisch-actions .nordtisch-action--samples {
  order: 2;
  flex-basis: 100%;
  justify-content: flex-end;
  gap: 14px;
  padding: 22px 24px;
  background: #F3F1EF;
  color: #000;
  font-size: 16px;
  line-height: 21px;
  letter-spacing: 0;
  text-transform: none;
}

/* the Save status paragraph (src/saveButton.ts puts it right after the button) takes its own line in the brown band
   under the buttons and costs nothing while empty */
.nordtisch-actions .nordtisch-save-status { order: 1; flex-basis: 100%; margin: -19px 16px 16px; }
.nordtisch-actions .nordtisch-save-status:empty { display: none; }

@media (min-width: 1000px) {
  /* from here embed.js sets the height, not the app: the window under the frame, 600 to 950 px (README, How the embed
     works). The start guesses the 134 px header of nordtisch.com above the frame, so there the frame does not move
     when embed.js runs; with another header it changes by the difference, at most 350 px. */
  :where(#nordtisch-configurator) { height: min(950px, max(600px, 100vh - 134px)); }

  /* the middle columns hold SAVE and FIND RETAILER, centred whether FIND RETAILER is there or not; the outer ones
     share the rest, Order Samples at the right end (Figma: 167 px from the edge at 1920) */
  :where(.nordtisch-actions) {
    display: grid;
    grid-template-columns: 1fr auto auto 1fr;
    padding: 0 clamp(16px, 8.7vw, 167px);
  }
  .nordtisch-actions .nordtisch-action--save { grid-area: 1 / 2; width: 278px; max-width: none; margin: 35px 0; }
  .nordtisch-actions .nordtisch-action--retailer { grid-area: 1 / 3; margin: 0 0 0 54px; }
  .nordtisch-actions .nordtisch-action--samples { grid-area: 1 / 4; justify-self: end; padding: 0 0 0 24px; background: none; color: #fff; }
  .nordtisch-actions .nordtisch-save-status { grid-area: 2 / 1 / 3 / -1; margin: -19px 0 16px; text-align: center; }
}

/* My Designs (src/myDesignsPage.ts): the cards of Figma 926:14928 (My Favorites, card 927:15402, Stefan 12.11). Four
   385 px columns 19.5 apart in the 1600 content of the 1920 frame and rows 30 apart; a narrower page has fewer columns,
   a phone one. The card: the square render, 20 below it the name in the serif face (30 px) with the heart, then wood and
   size and the designer (16/20, #7E7F7C) and the price (22 px) with Remove (14 px, underlined), 5 apart. The parts are at
   (0,2,0) and more, over the Elementor kit's heading, link and button rules, as the band above. */
.nordtisch-my-designs .nordtisch-designs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
  gap: 30px 19.5px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nordtisch-designs .nordtisch-design {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere; /* long names and engravings wrap instead of widening the card */
}

/* the box keeps its square before the image loads and when there is none; a room render fills it (cover, as Figma's
   photo), a studio cut-out lies on the collection's background, which the script puts on this box */
.nordtisch-designs .nordtisch-design-thumb {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #e8e4df;
  color: #7e7f7c;
  text-decoration: none;
}
/* the box is a link: the kit's a:hover is (0,2,1), so hover and focus keep the box's own look at (0,3,0) */
.nordtisch-designs .nordtisch-design-thumb:hover,
.nordtisch-designs .nordtisch-design-thumb:focus { color: #7e7f7c; text-decoration: none; }
.nordtisch-designs .nordtisch-design-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
}
.nordtisch-designs .nordtisch-design-placeholder { font-family: "DM Sans", sans-serif; font-size: 14px; }

/* the cards of a row are as tall as the tallest (an engraving adds a line): price and Remove sit on one line across it */
.nordtisch-designs .nordtisch-design-body { display: flex; flex: 1 1 auto; flex-direction: column; gap: 5px; min-width: 0; }

.nordtisch-designs .nordtisch-design-head { display: flex; align-items: center; justify-content: space-between; gap: 31px; }
.nordtisch-designs .nordtisch-design-name {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  color: #000;
  font-family: "freight-big-pro", serif;
  font-size: 30px;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: normal;
  text-transform: none;
}
.nordtisch-designs .nordtisch-design-name a,
.nordtisch-designs .nordtisch-design-name a:hover,
.nordtisch-designs .nordtisch-design-name a:focus { color: inherit; font: inherit; text-decoration: none; }
.nordtisch-designs .nordtisch-design-name a:hover { text-decoration: underline; text-decoration-thickness: 1px; }
.nordtisch-designs .nordtisch-design-heart { flex: none; width: 24px; height: 24px; color: #000; }

.nordtisch-designs .nordtisch-design-detail {
  margin: 0;
  padding: 0;
  color: #7e7f7c;
  font-family: "DM Sans", sans-serif;
  font-size: 16px;
  font-weight: 500;
  line-height: 20px;
  letter-spacing: normal;
}
.nordtisch-designs .nordtisch-design-engraving { white-space: pre-line; } /* an engraving has up to three lines */

.nordtisch-designs .nordtisch-design-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 31px;
  min-height: 38px;
  margin-top: auto;
}
.nordtisch-designs .nordtisch-design-price {
  margin: 0;
  padding: 0;
  color: #000;
  font-family: "DM Sans", sans-serif;
  font-size: 22px;
  font-weight: 400;
  line-height: 38px;
  letter-spacing: normal;
}
.nordtisch-designs .nordtisch-design-delete,
.nordtisch-designs .nordtisch-design-delete:hover,
.nordtisch-designs .nordtisch-design-delete:focus {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: none;
  color: #000;
  font-family: "DM Sans", sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  letter-spacing: normal;
  text-transform: none;
  cursor: pointer;
}
.nordtisch-designs .nordtisch-design-delete:disabled { cursor: progress; opacity: 0.5; }
.nordtisch-designs .nordtisch-design-delete-icon { flex: none; width: 24px; height: 24px; }
.nordtisch-designs .nordtisch-design-delete-label { text-decoration: underline; }
.nordtisch-designs .nordtisch-design-delete:focus-visible,
.nordtisch-designs .nordtisch-design-name a:focus-visible { outline: 2px solid #000; outline-offset: 2px; }
/* The row under the cards (Figma 927:15322; Stefan 12.11: Download and Share via Email, as the site's row under its
   wishlist): a line across the list 20 below the cards, the items 16 under it at the right, 38 apart, a 24 px icon 8
   from a 14 px underlined label. Buttons at (0,2,0) and (0,3,0) for :hover and :focus, over the Elementor kit. */
.nordtisch-my-designs .nordtisch-designs-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 16px 38px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #54483a;
}
.nordtisch-designs-actions .nordtisch-designs-action,
.nordtisch-designs-actions .nordtisch-designs-action:hover,
.nordtisch-designs-actions .nordtisch-designs-action:focus {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: none;
  color: #000;
  font-family: "DM Sans", sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 18px;
  letter-spacing: 0.7778px;
  text-transform: none;
  cursor: pointer;
}
.nordtisch-designs-actions .nordtisch-designs-action-icon { flex: none; width: 24px; height: 24px; }
.nordtisch-designs-actions .nordtisch-designs-action-label { text-decoration: underline; }
.nordtisch-designs-actions .nordtisch-designs-action:focus-visible { outline: 2px solid #000; outline-offset: 2px; }

.nordtisch-designs-actions .nordtisch-designs-action:disabled { cursor: progress; opacity: 0.5; }
.nordtisch-designs-actions .nordtisch-designs-error {
  flex-basis: 100%;
  margin: 0;
  color: #b3261e;
  font-family: "DM Sans", sans-serif;
  font-size: 14px;
  text-align: right;
}

/* The page without designs (Stefan 12.11), where the site's wishlist block was and in its look: a line above and below,
   the serif heading, a line of text and the black button to the collections */
.nordtisch-my-designs .nordtisch-designs-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 28px 16px 24px;
  border-top: 1px solid #54483a;
  border-bottom: 1px solid #54483a;
  text-align: center;
}
.nordtisch-designs-empty .nordtisch-designs-empty-title {
  margin: 0;
  padding: 0;
  color: #000;
  font-family: "freight-big-pro", serif;
  font-size: 32px;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: normal;
  text-transform: none;
}
.nordtisch-designs-empty .nordtisch-designs-empty-text {
  max-width: 480px;
  margin: 0;
  color: #7e7f7c;
  font-family: "DM Sans", sans-serif;
  font-size: 16px;
  font-weight: 500;
  line-height: 22px;
}
.nordtisch-designs-empty .nordtisch-designs-empty-link,
.nordtisch-designs-empty .nordtisch-designs-empty-link:hover,
.nordtisch-designs-empty .nordtisch-designs-empty-link:focus {
  display: inline-block;
  margin-top: 4px;
  padding: 12px 30px;
  border: 0;
  border-radius: 0;
  background: #000;
  color: #fff;
  font-family: "DM Sans", sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  text-decoration: none;
}
.nordtisch-designs-empty .nordtisch-designs-empty-link:focus-visible { outline: 2px solid #000; outline-offset: 2px; }

/* Download prints the page: the site's print rules (the HTML widget of its own row) already drop header, footer and
   .mwse-hide-print; here the cards go two to a row, each whole on its page, without Remove and without this row */
@media print {
  /* Download prints the saved designs alone (Stefan 13.11): whatever on the page neither holds the My Designs block
     nor sits inside it (the theme's header, the page title, other sections, the footer, cookie and toast layers) is
     left out, and the blocks around it lose their spacing, so the cards start at the top of the first sheet */
  body:has(.nordtisch-my-designs) :not(:has(.nordtisch-my-designs)):not(.nordtisch-my-designs):not(.nordtisch-my-designs *) {
    display: none !important;
  }
  body:has(.nordtisch-my-designs) :has(.nordtisch-my-designs) {
    margin: 0 !important;
    padding: 0 !important;
    min-height: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    background: none !important;
  }
  /* the site's print rules write each link's address after it; on the cards that is the long deep link after the name
     and a column of letters beside the render, so the cards' links print as plain text */
  .nordtisch-my-designs a[href]::after,
  .nordtisch-my-designs a[href]::before { content: none !important; }
  .nordtisch-my-designs .nordtisch-designs-actions,
  .nordtisch-designs .nordtisch-design-delete,
  .nordtisch-designs .nordtisch-design-error { display: none !important; }
  .nordtisch-my-designs .nordtisch-designs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 30px; }
  .nordtisch-designs .nordtisch-design { break-inside: avoid; page-break-inside: avoid; }
}

.nordtisch-designs .nordtisch-design-error { margin: 0; color: #b3261e; font-family: "DM Sans", sans-serif; font-size: 14px; }

.nordtisch-save-dialog {
  width: min(400px, calc(100vw - 32px));
  box-sizing: border-box;
}

.nordtisch-save-dialog form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.nordtisch-save-dialog h2 {
  margin: 0;
}

.nordtisch-save-dialog input {
  font: inherit;
  width: 100%;
  box-sizing: border-box;
}

.nordtisch-save-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}

