/* ============================================================
   Metal Table Legs -- catalog site
   Plain CSS, no build step, safe to edit directly on the server.
   ============================================================ */

:root {
  --ink: #1b1b1c;
  --steel: #3a3d42;
  --steel-light: #6b6f76;
  --line: #dcdcdc;
  --paper: #ffffff;
  --paper-alt: #f4f4f2;
  --accent: #c05621; /* warm rust/copper accent, reads "metal fabrication" */
  --max-width: 1180px;
  --gap: clamp(24px, 5vw, 64px);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
}

img { max-width: 100%; display: block; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.site-header__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 18px 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-header__name {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.04em;
}

.site-header__links {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 30px;
}

.site-header__link {
  font-size: 1.1rem; /* matches .site-header__name */
  color: var(--steel);
  text-decoration: none;
  cursor: pointer;
}

.site-header__link:hover,
.site-header__link:focus-visible {
  color: var(--accent);
  text-decoration: underline;
}

.site-header__phone {
  font-size: 1.1rem; /* matches .site-header__name */
  color: var(--steel);
  text-decoration: none;
}

.site-header__phone:hover,
.site-header__phone:focus-visible {
  color: var(--accent);
}

@media (max-width: 700px) {
  .site-header__inner {
    padding: 14px 14px;
    gap: 6px;
  }

  .site-header__name,
  .site-header__link,
  .site-header__phone {
    font-size: 0.74rem;
    font-weight: 700;
    white-space: nowrap;
  }

  .site-header__links {
    gap: 8px;
    flex-wrap: nowrap;
  }
}

.site-header__nav {
  min-height: 1px; /* reserved for the menu you'll add later */
}

/* ---------- Hero ---------- */
/* When empty (no $heroImage set), this just collapses to a thin strip.
   When a photo is active, its shape is driven by --hero-aspect (set inline
   from index.php to match the actual image's width/height) so the full
   photo always shows -- no cropping of whatever's in the shot. The
   max-height is intentionally generous (covers ~2500px-wide screens before
   any cropping kicks in) -- a tighter cap used to crop the sides on
   ordinary desktop widths (anything over ~1300px), which is most monitors.
   Width is capped and centered to match the product sections below it
   (--max-width, minus their 24px side padding) instead of running edge to
   edge, on both mobile and desktop. */
.hero {
  --hero-aspect: 3.6; /* fallback ratio when no image is set */
  width: calc(100% - 48px);
  max-width: calc(var(--max-width) - 48px);
  margin: 0 auto;
  aspect-ratio: var(--hero-aspect);
  max-height: 1080px;
  min-height: 60px;
  background-color: var(--paper-alt);
  background-size: cover;
  background-position: center;
  border-bottom: 1px solid var(--line);
}

/* ---------- Catalog ---------- */
.catalog {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.catalog__empty {
  padding: 80px 0;
  text-align: center;
  color: var(--steel-light);
}

.product {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: var(--gap);
  align-items: start;
  padding: clamp(48px, 8vw, 96px) 0;
  border-bottom: 1px solid var(--line);
}

.product:last-child { border-bottom: none; }

/* Alternate media/text sides on larger screens for visual rhythm */
.product:nth-of-type(even) .product__media { order: 1; }
.product:nth-of-type(even) .product__text { order: 2; }

/* ---------- Media column ---------- */
.product__media {
  position: sticky;
  top: 88px;
}

.product__main-photo {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--paper-alt);
  border: 1px solid var(--line);
  overflow: hidden;
}

.product__main-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Technical "dim" (dimensions) image that briefly crossfades in on top of
   the main photo once, a couple seconds after the product scrolls into
   view, then fades back out -- see main.js. A manual thumbnail click
   always cancels/overrides this. */
.product__dim-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.product__dim-overlay.is-visible {
  opacity: 1;
}

.product__thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.product__thumb {
  width: 64px;
  height: 64px;
  padding: 0;
  border: 2px solid var(--line);
  background: var(--paper-alt);
  cursor: pointer;
  overflow: hidden;
  border-radius: 2px;
  transition: border-color 0.15s ease;
}

.product__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product__thumb:hover,
.product__thumb:focus-visible {
  border-color: var(--steel-light);
}

.product__thumb.is-active {
  border-color: var(--accent);
}

/* ---------- Text column ---------- */
.product__name {
  margin: 0 0 8px;
  font-size: clamp(1.4rem, 2.2vw, 1.9rem);
  letter-spacing: 0.01em;
}

.product__description {
  margin: 0 0 20px;
  font-size: 1.05rem;
  color: var(--steel);
}

.product__details {
  margin: 0 0 24px;
  color: var(--steel);
}

.product__specs {
  margin: 0;
  border-top: 1px solid var(--line);
}

.product__spec-row {
  display: grid;
  grid-template-columns: 40% 60%;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
}

.product__spec-row dt {
  color: var(--steel-light);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 0.78rem;
  font-weight: 600;
  padding-top: 2px;
}

.product__spec-row dd {
  margin: 0;
  color: var(--ink);
}

/* ---------- Footer ---------- */
.site-footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 24px 64px;
  color: var(--steel-light);
  font-size: 0.85rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .product {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .product:nth-of-type(even) .product__media,
  .product:nth-of-type(even) .product__text {
    order: initial;
  }
  .product__media {
    position: static;
  }
}

/* ---------- WhatsApp product-inquiry button ---------- */
.product__whatsapp-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}
.product__whatsapp {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #B9E6C9; /* muted green, but visible -- not the full flashy WhatsApp green */
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.product__whatsapp:hover,
.product__whatsapp:focus-visible {
  background: #A3DAB8;
  transform: scale(1.06);
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.product__whatsapp svg {
  width: 22px;
  height: 22px;
  fill: #2F6B45; /* deep green icon, readable on the light background */
}

/* ---------- Landing splash screen ---------- */
html.has-splash,
html.has-splash body {
  overflow: hidden;
}

.splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(27, 27, 28, 0.4);
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.splash.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.splash.is-hidden {
  display: none;
}

.splash__box {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.15);
  transform-origin: center center;
  width: max-content;
  max-width: min(90vw, 728px);
  border-radius: 28px;
  border: 1.5px solid transparent; /* the "grey margin line" frame, always present */
  background: transparent;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 62px 73px;
  padding-top: 84px; /* extra clearance so the close button (top:10px, 52px tall) never sits over the first line of text */
  cursor: grab;
  touch-action: none;
  transition: transform 0.5s cubic-bezier(.34, 1.56, .64, 1),
              background-color 0.5s ease,
              border-color 0.5s ease,
              box-shadow 0.5s ease;
}

.splash.is-visible .splash__box {
  transform: translate(-50%, -50%) scale(1);
  background: rgba(244, 244, 242, 0.94); /* grey, matching the header tone */
  border-color: var(--line);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.3);
}

.splash__box.is-dragging {
  cursor: grabbing;
  transition: none; /* no easing lag while actively dragging */
}

@media (max-width: 700px) {
  .splash__box {
    max-width: 85vw;
    padding: 40px 32px;
    padding-top: 76px; /* same close-button clearance, adjusted for the smaller mobile padding */
  }
}

.splash__text {
  text-align: center;
  pointer-events: none; /* text never blocks the drag gesture */
}

.splash__text p {
  margin: 0 0 14px;
  font-size: clamp(1.5rem, 4.6vw, 3.1rem);
  font-weight: 600;
  color: var(--ink);
  line-height: 1.5;
  white-space: nowrap;
}

.splash__text p:last-child {
  margin-bottom: 0;
  font-size: clamp(1.2rem, 3vw, 2.15rem);
  font-weight: 400;
  color: var(--steel);
}

@media (max-width: 700px) {
  .splash__text p {
    white-space: normal;
  }
}

.splash__close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 52px;
  height: 52px;
  border: none;
  background: var(--paper-alt);
  color: var(--steel);
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.splash__close img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  pointer-events: none;
}

.splash__close:hover,
.splash__close:focus-visible {
  background: var(--line);
  color: var(--ink);
  transform: scale(1.06);
}

/* ---------- Second splash card ("about us") -- reading-column style ----------
   The default .splash__box/.splash__text rules above are tuned for the
   first card's short, big, poster-style 2-line greeting (wide box, huge
   nowrap text). This card holds a full paragraph of body copy instead, so
   it needs its own narrower, normal-reading-size treatment. Added as
   modifier classes (alongside the base .splash__box/.splash__text classes)
   so the first card is completely unaffected. */
.splash__box--reading {
  width: min(92vw, 480px);
  max-width: min(92vw, 480px);
  padding: 48px 40px;
  padding-top: 80px; /* extra clearance so the close button never sits over the first line of text */
}

/* .splash__box is display:flex with justify-content:center, which by
   default shrink-wraps its single child to the child's own content width
   instead of filling the fixed card width above -- fine for card 1's
   short headline, but it left card 3's form (and its full-width inputs)
   narrower than the card itself. Forcing the text/form container to fill
   the flex item's main-axis size fixes both. */
.splash__text--reading {
  width: 100%;
}

@media (max-width: 700px) {
  .splash__box--reading {
    width: min(94vw, 420px);
    max-width: min(94vw, 420px);
    padding: 36px 24px;
    padding-top: 72px; /* same close-button clearance, adjusted for the smaller mobile padding */
  }

  /* More see-through on mobile specifically, per request -- lets the
     product photo behind the card show through a bit more. */
  .splash.is-visible .splash__box--reading {
    background: rgba(244, 244, 242, 0.6);
  }
}

.splash__text--reading p,
.splash__text--reading p:last-child {
  font-size: clamp(0.95rem, 2.6vw, 1.05rem);
  font-weight: 400;
  color: var(--steel);
  line-height: 1.65;
  white-space: normal;
  margin: 0 0 14px;
}

.splash__text--reading p:last-child {
  margin-bottom: 0;
}

/* ---------- Third splash card ("contact") -- form ---------- */
.splash__form-title {
  margin: 0 0 18px;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ink);
  text-align: center;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: right;
  pointer-events: auto; /* .splash__text sets pointer-events:none for the drag gesture -- the form needs to be usable */
}

.contact-form label {
  font-size: 0.82rem;
  color: var(--steel-light);
  margin-top: 12px;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: 0.95rem;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  resize: vertical;
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.contact-form .g-recaptcha {
  margin-top: 6px;
  transform-origin: right top;
}

/* Google's widget is a fixed 304px wide -- on very narrow phones the
   contact card's content area can be a little tighter than that, so
   scale it down and reclaim the empty space the scale leaves behind. */
@media (max-width: 380px) {
  .contact-form .g-recaptcha {
    transform: scale(0.87);
    margin-bottom: -10px;
  }
}

.contact-form .btn-submit {
  margin-top: 18px;
  padding: 12px 20px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.contact-form .btn-submit:hover {
  opacity: 0.9;
}

.contact-form__status {
  margin: 10px 0 0;
  font-size: 0.85rem;
  min-height: 1.2em;
  color: var(--steel);
  text-align: center;
}

.contact-form__status--ok {
  color: #2F6B45;
}

.contact-form__status--error {
  color: #b3261e;
}

.contact-footer {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  pointer-events: auto; /* same override as .contact-form above */
}

.contact-footer a {
  color: var(--steel);
  text-decoration: none;
}

.contact-footer a:hover {
  color: var(--ink);
  text-decoration: underline;
}

.contact-footer__whatsapp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 999px;
  background: #B9E6C9; /* muted green, but visible -- not the full flashy WhatsApp green */
  color: #2F6B45 !important;
  font-weight: 600;
}

.contact-footer__whatsapp svg {
  width: 18px;
  height: 18px;
  fill: #2F6B45;
}

.contact-footer__whatsapp:hover {
  background: #A3DAB8;
  text-decoration: none;
}
