/* Base */
:root {
  --green: #a8fd3e;
  --placeholder: #000;
  --font: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  /* Every page, the home page included, has the same edge padding and the
     same logo in its top left corner. */
  --pad: clamp(16px, 1.45vw, 28px);
  --logo-w: clamp(140px, 15.5vw, 300px);
  --logo-h: calc(var(--logo-w) * 857 / 1921); /* logo.png is 1921 x 857 */
  /* Green cursors to match the site (numbers are each one's hotspot) */
  --cursor-default: url('/images/cursors/default.svg') 3 2, default;
  --cursor-pointer: url('/images/cursors/pointer.svg') 12 2, pointer;
  --cursor-text: url('/images/cursors/text.svg') 16 16, text;
}

html {
  height: 100%;
}

/* The public site's look applies under body.msft-site (set by the public pages),
   so the admin panel (/admin) keeps its own. */
body {
  margin: 0;
}

body.msft-site {
  cursor: var(--cursor-default);
  min-height: 100%;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.3;
  color: var(--green);
  background-color: #000;
}

img {
  max-width: 100%;
  vertical-align: middle;
  display: inline-block;
  border: 0;
}

.msft-site a {
  color: var(--green);
  background-color: transparent;
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

.msft-site a,
.msft-site button {
  cursor: var(--cursor-pointer);
}

.msft-site input,
.msft-site textarea {
  cursor: var(--cursor-text);
}

/* Selected text: black on the site's green */
.msft-site ::selection {
  background: var(--green);
  color: #000;
}

/* Phones: a swipe across a picture or the logo can't select it (and show it
   with the green selection backdrop), or hold to bring up the image menu */
@media (max-width: 800px) {
  .msft-site img,
  .msft-site .page-logo,
  .msft-site .link {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
  }
}

.msft-site :focus-visible {
  outline: 2px dashed var(--green);
  outline-offset: 4px;
}

/* Landing page: the shared header, then the photo collage filling the rest
   of the window. The collage is drawn at a fixed size (about 1320 x 875px).
   --s scales it to fit the space under the header: sizes below are in design
   pixels multiplied by --s. */
.landing {
  --vh: 100vh;
  --avail-w: calc(100vw - 2 * var(--pad));
  --avail-h: calc(var(--vh) - 3 * var(--pad) - var(--logo-h));
  --s: min(calc(var(--avail-w) / 1340), calc(var(--avail-h) / 900));
  position: relative;
  height: var(--vh);
  padding: var(--pad);
  box-sizing: border-box;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* On phones, 100dvh follows the address bar showing and hiding */
@supports (height: 100dvh) {
  .landing {
    --vh: 100dvh;
  }
}

.collage {
  flex: 1;
  min-height: 0;
  margin-top: var(--pad);
  display: flex;
  flex-direction: column;
  justify-content: center;
  /* Hidden until all three photos are decoded (LandingPage), so they appear
     together; the first visit fades them in. */
  opacity: 0;
}

/* Wide windows (computers): the photos a little above the middle of the space
   under the logo, since the pins and torn top edges already leave room above
   them. In step with the window's height, so every screen size looks alike. */
@media (min-aspect-ratio: 6/7) {
  .collage {
    translate: 0 -4vh;
  }
}

.collage.is-ready {
  opacity: 1;
}

.collage.fades-in {
  transition: opacity 0.3s ease;
}

.links-top {
  display: flex;
  justify-content: center;
}

.links-bottom {
  display: flex;
  justify-content: center;
  margin-top: calc(-200 * var(--s));
}

/* The footer (as on the FAQ) pinned in the bottom right corner, so it adds no
   height and the collage still fills the window. Phones, where the page
   scrolls, put it under the collage instead (below). */
.landing .site-footer {
  position: absolute;
  right: var(--pad);
  bottom: var(--pad);
  z-index: 400; /* above the photos */
  margin: 0;
}

.link {
  position: relative;
  display: block;
  flex: none;
  /* A slow, small lift: just enough to show it's a link */
  transition: scale 0.35s cubic-bezier(0.25, 0.1, 0.25, 1);
  /* Kept on its own layer, so growing on hover doesn't repaint the photo (and
     flicker) when the animation starts and ends */
  will-change: scale;
}

.link:hover {
  scale: 1.008;
}

.link img {
  display: block;
  width: 100%;
  height: auto; /* with the img's width/height attributes: its space is kept before it loads */
}

.link-left {
  z-index: 100;
  width: calc(735 * var(--s));
  margin-right: calc(-68 * var(--s));
}

.link-right {
  z-index: 300;
  width: calc(700 * var(--s));
  margin-left: calc(-50 * var(--s));
}

.link-bottom {
  z-index: 200;
  width: calc(685 * var(--s));
}

/* Tall, narrow windows (phones held upright, portrait tablets): the photos
   stack in a staggered column instead of sitting side by side, so they stay
   large. The column is about 840 x 1400 design pixels. */
@media (max-aspect-ratio: 6/7) {
  .landing {
    --s: min(calc(var(--avail-w) / 840), calc(var(--avail-h) / 1420));
  }

  .links-top {
    flex-direction: column;
    align-items: center;
  }

  .links-bottom {
    margin-top: calc(-110 * var(--s));
  }

  .link-left {
    margin-right: 0;
    margin-bottom: calc(-110 * var(--s));
    translate: calc(-45 * var(--s)) 0;
  }

  .link-right {
    margin-left: 0;
    translate: calc(55 * var(--s)) 0;
  }

  .link-bottom {
    translate: calc(-40 * var(--s)) 0;
  }
}

/* Phones: the photos as wide as the screen allows, not shrunk until all three
   fit between Safari's bars; the page scrolls a little instead. */
@media (max-aspect-ratio: 6/7) and (max-width: 600px) {
  .landing {
    --s: calc(var(--avail-w) / 840);
    height: auto;
    min-height: var(--vh);
    /* Still trims the photos' sideways nudges, so the page can't scroll sideways */
    overflow: visible;
    overflow-x: clip;
    padding-bottom: calc(var(--pad) + var(--phone-bottom-room, 0px));
  }

  .collage {
    flex: none;
  }

  .landing .site-footer {
    position: static;
    margin-top: calc(var(--pad) * 3);
  }
}

/* Other pages: the logo in the top left, then the page.
   Sizes follow the window width so the pages keep the same proportions on any
   screen, with minimums so text stays readable on phones. */
.page {
  min-height: 100vh;
  /* On phones, the height that shows between the browser's bars: 100vh is the
     height with them hidden, so the page (and its footer) would end behind them */
  min-height: 100svh;
  padding: var(--pad);
  /* On a phone, room under the footer so Safari's toolbar doesn't cover it
     (--phone-bottom-room, core/page.js; 0 on a computer) */
  padding-bottom: calc(var(--pad) + var(--phone-bottom-room, 0px));
  box-sizing: border-box;
}

.page-header {
  display: flex;
  flex: none;
}

.page-logo {
  display: block;
}

.page-logo img {
  display: block;
  width: var(--logo-w);
  height: var(--logo-h);
}

/* Where a page puts its corner note (Header.js): no box of its own, so the
   note sits in the header as if it were there directly */
.corner-slot {
  display: contents;
}

/* Quiet text in the top right corner, beside the logo: the home page's key
   to the photos, and the item page's link back to the gallery */
.corner-note {
  display: flex;
  flex-direction: column;
  gap: 0.35em;
  margin-left: auto;
  font-size: clamp(11px, 0.75vw, 14px);
  font-weight: 600;
  line-height: 1;
  text-align: right;
}

/* Each line is dimmed and lights up under the pointer */
.corner-note > * {
  opacity: 0.45;
  text-decoration: none;
  cursor: var(--cursor-pointer);
  transition: opacity 0.15s ease;
}

.corner-note > :hover,
.corner-note > :focus-visible {
  opacity: 1;
}

/* Home page, wide screens: the name of the photo under the pointer, at full
   brightness */
.corner-note > .hover-name {
  opacity: 1;
  cursor: inherit;
}

/* Home page, tall screens (phones): the key saying which photo is which, on
   one line under the photos. Just a quiet note: small and faint */
.collage-key {
  display: none;
  margin: calc(var(--pad) * 1.5) 0 0;
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  text-align: center;
  opacity: 0.4;
}

@media (max-aspect-ratio: 6/7) {
  .collage-key {
    display: block;
  }
}

/* FAQ and privacy pages: the footer sits in the bottom right corner, below
   everything else */
.text-page {
  display: flex;
  flex-direction: column;
}

.text-page main {
  flex: 1;
}

/* On the FAQ the footer is pinned in the bottom right corner, beside
   "Custom Inquiry", so it adds no height and the page fits the window.
   (On narrow screens there isn't room beside it, so it goes underneath.) */
@media (min-width: 801px) {
  .faq-page {
    position: relative;
    /* FAQ text sizes are multiples of --u: 1% of the window width, or less
       when the window is too short for the text (about 46u tall) to fit
       under the logo */
    --u: min(1vw, calc((100vh - var(--logo-h) - 3 * var(--pad)) / 46));
  }

  .faq-page .site-footer {
    position: absolute;
    right: var(--pad);
    bottom: var(--pad);
    margin: 0;
  }
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px 22px;
  margin-top: calc(var(--pad) * 3);
  font-size: clamp(11px, 0.75vw, 14px);
  font-weight: 600;
  line-height: 1.3;
  color: rgba(168, 253, 62, 0.55);
}

.site-footer a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(168, 253, 62, 0.35);
  text-underline-offset: 0.2em;
  transition: color 0.15s ease;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--green);
  text-decoration-color: currentColor;
}

.when-tall {
  display: none;
}

@media (max-aspect-ratio: 6/7) {
  .when-wide {
    display: none;
  }

  .when-tall {
    display: inline;
  }
}

.page-message {
  font-size: clamp(18px, 1.35vw, 26px);
  font-weight: 600;
}

/* Item page: picture on the left with its thumbnails underneath, text on
   the right lined up with the picture's bottom */
.product {
  /* the Back link above the picture: its text size, and the room it takes
     (text height plus the gap under it) */
  --back-size: clamp(16px, 1.35vw, 26px); /* same as .product-description */
  --back-space: calc(var(--back-size) + 20px);
  display: grid;
  grid-template-columns: 34.2vw minmax(0, 1fr);
  column-gap: 3vw;
  margin: calc(2.9vw + var(--back-space)) 0 0 4.1vw;
}

.product-picture {
  position: relative;
  grid-column: 1;
  grid-row: 1;
}

/* Back to the gallery: small and dimmed, just above the picture's top left
   corner (in the gap, so it doesn't move anything) */
.back-link {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 20px; /* keep in step with --back-space */
  font-size: var(--back-size);
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  opacity: 0.45;
  transition: opacity 0.15s ease;
}

/* The same link sitting in the page flow (Privacy Policy, back to the FAQ) */
.back-link-flow {
  position: static;
  display: inline-block;
  margin: var(--pad) 0 0;
  font-size: clamp(16px, 1.35vw, 26px);
}

.back-link:hover,
.back-link:focus-visible {
  opacity: 1;
}

.product-info {
  grid-column: 2;
  grid-row: 1;
  align-self: end;
}

.product-thumbs {
  grid-column: 1;
  grid-row: 2;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.6vw;
  margin-top: 0.8vw;
}

.product-thumb {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  cursor: var(--cursor-pointer);
  opacity: 0.5;
  transition: opacity 0.15s ease;
}

.product-thumb:hover {
  opacity: 0.85;
}

.product-thumb[aria-current="true"] {
  opacity: 1;
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.product-title {
  margin: 0;
  font-size: clamp(40px, 5.1vw, 100px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.01em;
}

/* Sold rugs have their title crossed out */
.product-title.is-sold {
  text-decoration: line-through;
  text-decoration-thickness: 0.07em;
}

.product-size {
  margin: 0.6em 0 0.4em;
  font-size: clamp(24px, 2.5vw, 48px);
  font-weight: 600;
  line-height: 1;
}

/* The rug's description: rich text from the admin (paragraphs, lists, bold,
   italic, underline, links). */
.product-description {
  margin: 0;
  font-size: clamp(16px, 1.35vw, 26px);
  font-weight: 600;
  line-height: 1;
}

.product-description p,
.product-description ul,
.product-description ol {
  margin: 0 0 0.35em;
}

.product-description ul,
.product-description ol {
  padding-left: 1.2em;
}

.product-description > :last-child {
  margin-bottom: 0;
}

.product-status {
  margin: 1em 0 0;
  font-size: clamp(16px, 1.35vw, 26px);
  font-weight: 600;
  line-height: 1;
}

.inquire-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--green);
  font: inherit;
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.15em;
  cursor: var(--cursor-pointer);
}

/* Black square shown in place of a picture (and behind one while it loads) */
.picture {
  display: block;
  aspect-ratio: 1;
  background: var(--placeholder);
  overflow: hidden;
}

.picture img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Hidden until loaded and decoded (Picture.js), then faded in */
  opacity: 0;
  transition: opacity 0.2s ease;
}

.picture img.is-shown {
  opacity: 1;
}

/* Store gallery: three columns of pictures, no captions */
.gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2.6vw;
  margin: 2.9vw 4.1vw 4.1vw;
  padding: 0;
  list-style: none;
}

.gallery-cell {
  position: relative;
}

.gallery-item {
  display: block;
  text-decoration: none;
}

/* Sold: a small word under the picture's bottom right corner, in the gap
   between rows, so it never covers the picture */
.gallery-sold {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.4em;
  font-size: clamp(12px, 0.75vw, 15px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.04em;
  opacity: 0.45;
  transition: opacity 0.15s ease;
}

/* Lights up under the pointer, like the home page key (it isn't a link, so the
   usual cursor) */
.gallery-sold:hover {
  opacity: 1;
}

/* The store with nothing in it: lined up with where the gallery would be */
.store-empty {
  margin: 2.9vw 4.1vw;
}

.store-empty .inquiry-link {
  display: block;
  text-decoration: underline;
}

@media (max-width: 800px) {
  .store-empty {
    margin: 24px 0;
  }
}

/* FAQ */
.faq-title {
  margin: 0.25em 0 0.2em;
  font-size: clamp(40px, calc(5.1 * var(--u, 1vw)), 100px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.01em;
}

.faq-list {
  margin: 0;
}

.faq-question {
  margin: 0.6em 0 0;
  font-size: clamp(20px, calc(2.5 * var(--u, 1vw)), 48px);
  font-weight: 700;
  line-height: 1.15;
}

.faq-answer {
  margin: 0.8em 0 0.6em calc(2.2 * var(--u, 1vw));
  font-size: clamp(14px, calc(1.35 * var(--u, 1vw)), 26px);
  font-weight: 600;
  line-height: 1.3;
}

.inquiry-link {
  display: inline-block;
  margin-top: 0.4em;
  padding: 0;
  border: 0;
  background: none;
  color: var(--green);
  font-size: clamp(22px, calc(2.5 * var(--u, 1vw)), 48px);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.12em;
  cursor: var(--cursor-pointer);
}

/* Phones and small tablets */
@media (max-width: 800px) {
  .product {
    grid-template-columns: minmax(0, 1fr);
    margin: calc(24px + var(--back-space)) 0 0;
  }

  .product-thumbs {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
  }

  .product-info {
    grid-column: 1;
    grid-row: 3;
    margin-top: 20px;
  }

  .gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 30px 16px; /* rows leave room for the "Sold" label */
    margin: 24px 0;
  }

  .faq-answer {
    margin-left: 0.9em;
  }

  /* More room above the Custom Inquiry link */
  .inquiry-link {
    margin-top: 1.2em;
  }
}

@media (max-width: 480px) {
  .gallery {
    grid-template-columns: 1fr;
  }
}

/* Phones: a little more room between the logo and the first rug, and the same
   above the FAQ and privacy titles */
@media (max-width: 600px) {
  .gallery,
  .store-empty,
  .faq-page .faq-title {
    margin-top: 40px;
  }

  /* Less room under the last thing on a page than core's default (112px,
     core/page.js): enough to clear Safari's toolbar and scroll a little past
     the end, not a whole empty stretch. html:root outranks core's :root rule,
     which is added to <head> after this sheet. */
  html:root {
    --phone-bottom-room: 80px;
  }
}

/* Contact modal (the email form): a black panel like the pages, bold green
   type, and fields drawn as faint green underlines */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  padding: 24px 16px;
  /* On a phone, the panel ends above Safari's toolbar (--phone-bottom-room, core/page.js) */
  padding-bottom: max(24px, var(--phone-bottom-room, 0px));
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.8);
}

.modal {
  position: relative;
  width: 100%;
  max-width: 540px;
  margin: auto;
  padding: 36px 36px 30px;
  box-sizing: border-box;
  background: #000;
  border: 1px solid rgba(168, 253, 62, 0.25);
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 14px;
  padding: 4px 8px;
  border: 0;
  background: none;
  color: var(--green);
  font-size: 28px;
  line-height: 1;
  opacity: 0.5;
  cursor: var(--cursor-pointer);
  transition: opacity 0.15s ease;
}

.modal-close:hover {
  opacity: 1;
}

.modal-title {
  margin: 0 0 24px;
  font-size: clamp(32px, 2.5vw, 44px);
  font-weight: 700;
  line-height: 1;
}

.contact-form {
  display: grid;
  gap: 18px;
}

/* The Forms app's form (src/forms/Form.js): its fields inherit the gap above */
.contact-form .coral-form__field {
  display: grid;
  gap: 2px;
}

.contact-form .coral-form__label {
  font-size: 15px;
  font-weight: 700;
}

.contact-form .coral-form__input {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 0;
  border: 0;
  border-bottom: 2px solid rgba(168, 253, 62, 0.3);
  border-radius: 0;
  background: transparent;
  color: var(--green);
  font: inherit;
  font-size: 18px; /* 16px or more stops iOS zooming in on focus */
  font-weight: 600;
  transition: border-color 0.15s ease;
}

.contact-form textarea.coral-form__input {
  resize: none;
  min-height: 96px;
}

/* Read-only fields (the product link): plain dimmed text, no underline */
.contact-form .coral-form__input--readonly {
  border-bottom-color: transparent;
  opacity: 0.6;
  text-overflow: ellipsis;
  cursor: var(--cursor-default);
}

.contact-form .coral-form__input:focus {
  outline: none;
  border-bottom-color: var(--green);
}

/* Send: a bold underlined green link, like "click to inquire" */
.button,
.coral-form__submit {
  justify-self: start;
  margin-top: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--green);
  font-size: 24px;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.15em;
  cursor: var(--cursor-pointer);
}

.button:hover:not(:disabled),
.coral-form__submit:hover:not(:disabled) {
  text-decoration-thickness: 0.14em;
}

.button:disabled,
.coral-form__submit:disabled {
  opacity: 0.5;
  cursor: var(--cursor-default);
}

.coral-form__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 18px;
  margin-top: 6px;
}

.coral-form__actions .coral-form__submit {
  margin-top: 0;
}

/* Problems with the form: short red text beside Send */
.coral-form__message--error {
  color: #ff4b3a;
  font-size: 15px;
  font-weight: 700;
}

.modal-done p {
  margin: 0 0 20px;
  font-size: 18px;
  font-weight: 600;
}

/* Phones: the logo and all text a size up, so it's comfortable to read */
@media (max-width: 800px) {
  :root {
    --logo-w: 190px;
  }

  /* The logo in the middle of the top instead of the left corner. The corner
     note is lifted out of the row (its auto margin would push the logo left) */
  .page-header {
    position: relative;
    justify-content: center;
  }

  .corner-note {
    position: absolute;
    top: 0;
    right: 0;
    margin-left: 0;
  }

  .faq-title {
    font-size: 40px;
  }

  .product-title {
    font-size: 46px;
  }

  .faq-question {
    font-size: 23px;
  }

  .faq-answer,
  .product-description,
  .product-status,
  .page-message {
    font-size: 18px;
  }

  .product-description {
    line-height: 1.2;
  }

  /* Same size and weight as the FAQ questions above it */
  .inquiry-link {
    font-size: 23px;
    font-weight: 700;
    text-decoration-thickness: 0.08em;
  }

  .product-size {
    font-size: 27px;
  }

  .product {
    --back-size: 19px;
    padding-bottom: 48px; /* breathing room after the text at the bottom (the page adds --phone-bottom-room under it) */
  }

  .back-link-flow {
    font-size: 19px;
  }

  .corner-note {
    font-size: 15px;
  }

  /* Two quiet centered lines, in the same small faint type as the home page's
     key: the copyright, then the credit // privacy */
  .site-footer {
    justify-content: center;
    gap: 5px 0;
    text-align: center;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.3;
    color: rgba(168, 253, 62, 0.45);
  }

  .site-footer > span:first-child {
    flex-basis: 100%;
  }

  .site-footer > span:last-child::after {
    content: "\00a0//\00a0";
  }

  /* The privacy link last, with a bigger area for a thumb than the text shows */
  .site-footer > a {
    position: relative;
    order: 1;
  }

  .site-footer > a::after {
    content: "";
    position: absolute;
    inset: -12px;
  }

  /* The home page pins its footer in the corner above 600px: here it spans the
     page instead, so it's centered at every phone and small tablet size */
  .landing .site-footer {
    left: var(--pad);
  }

  .gallery-sold {
    font-size: 15px;
  }

  .modal-title {
    font-size: 36px;
  }

  .contact-form .coral-form__label {
    font-size: 17px;
  }

  .button,
  .coral-form__submit {
    font-size: 26px;
  }

  .coral-form__message--error {
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
