/* Saira variable font (SIL Open Font License, see /fonts/Saira-OFL.txt), self-hosted to satisfy the CSP.
   Has weight (100-900) and width (50%-125%) axes; the extended width matches the logo lettering. */
@font-face {
  font-family: "Saira";
  src: url("/fonts/saira.woff2") format("woff2-variations"), url("/fonts/saira.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 50% 125%;
  font-style: normal;
  font-display: swap;
}

:root {
  --jd-charcoal: #373737;   /* the dark grey in the J&D logo */
  --bg-grey: #96acc0;       /* fallback while the canvas loads */
  --box-bg: rgba(55, 55, 55, 0.94); /* contact boxes */
  --jd-navy: #081e3c;       /* contact box outlines */
  --accent: #dfe2e6;        /* light steel grey for headings and buttons on charcoal */
  --flip-time: 0.8s;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  height: 100%;
  /* stop pull-to-refresh and rubber-band bounce while dragging a finger over the background */
  overscroll-behavior: none;
}

body {
  display: flex;
  flex-direction: column;
  background: var(--bg-grey);
  color: #fff;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow-x: hidden;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

#bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.content {
  position: relative;
  z-index: 1;
  flex: 1 0 auto;
  display: grid;
  place-items: center;
  padding: 2rem 16px;
  text-align: center;
  pointer-events: none; /* let the mouse reach the background everywhere except the controls */
}

/* ---------- The flipping card ---------- */

.flip-area {
  width: 100%;
  max-width: 1100px;
  perspective: 1600px;
}

.card {
  display: grid;            /* both faces share one cell, so the card is as tall as the taller face */
  transform-style: preserve-3d;
  transition: transform var(--flip-time) cubic-bezier(0.45, 0, 0.25, 1);
}

.card.is-back { transform: rotateY(180deg); }

.face {
  grid-area: 1 / 1;
  align-self: center;
  justify-self: center;
  width: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.front {
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: rotateY(0deg);
}

.back {
  transform: rotateY(180deg);
}

/* ---------- Front: logo and name ---------- */

.logo img {
  display: block;
  width: 100%;
  height: auto;
  transition: filter 0.25s ease;
}

/* Soft white halo that follows the logo's shape */
.logo:hover img,
.logo:focus-visible img {
  filter:
    drop-shadow(0 0 2px #fff)
    drop-shadow(0 0 8px #fff)
    drop-shadow(0 4px 14px rgba(0, 0, 0, 0.25));
}

.logo-flip {
  pointer-events: auto;
  width: min(600px, 100%);
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.logo-flip:focus { outline: none; }

/* "SERVICE CENTER, LLC": heavy, extended, upright, logo charcoal */
h1 {
  margin: clamp(0.9rem, 2.5vh, 1.6rem) 0 0;
  font-family: "Saira", "Segoe UI", system-ui, sans-serif;
  font-size: clamp(1.15rem, 4vw, 2.5rem);
  font-weight: 800;
  font-stretch: 125%;
  font-variation-settings: "wdth" 125;
  font-synthesis: none;
  line-height: 1.1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--jd-charcoal);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

/* ---------- Back: back button and contact boxes ---------- */

.back {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 2vw, 24px);
}

.back-btn {
  pointer-events: auto;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--box-bg);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.back-btn svg { margin-left: -2px; } /* optically center the arrow */

.back-btn:hover,
.back-btn:focus-visible {
  background: #fff;
  color: var(--jd-charcoal);
  box-shadow: 0 0 14px rgba(0, 0, 0, 0.25);
  outline: none;
}

.boxes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 320px));
  gap: clamp(16px, 2.5vw, 28px);
}

.info-box {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2rem 1.25rem;
  border: 3px solid var(--jd-navy);
  border-radius: 18px;
  background: var(--box-bg);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.3);
  text-align: center;
}

.info-box h3 {
  margin: 0;
  font-family: "Saira", "Segoe UI", system-ui, sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  font-stretch: 125%;
  font-variation-settings: "wdth" 125;
  font-synthesis: none;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.info-box address,
.info-box .email {
  margin: 0;
  font-style: normal;
  font-size: 1.15rem;
  line-height: 1.5;
}

.info-box .email {
  /* fills the space so the button lines up with the Maps button */
  flex: 1 0 auto;
  display: flex;
  align-items: center;
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.pill {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--jd-charcoal);
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.pill:hover,
.pill:focus-visible {
  background: #fff;
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.6);
  outline: none;
}

.phone {
  /* fills the space the address and button take in the other boxes */
  flex: 1 0 auto;
  display: flex;
  align-items: center;
  font-size: clamp(1.5rem, 2.6vw, 1.95rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  text-decoration: none;
  transition: color 0.2s ease, text-shadow 0.2s ease;
}

.phone:hover,
.phone:focus-visible {
  color: var(--accent);
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.4);
  text-decoration: underline;
  text-underline-offset: 6px;
  outline: none;
}

.fax {
  margin: 0;
  font-size: 1.1rem;
  color: var(--accent);
}

/* ---------- Bottom stripe ---------- */

.stripe {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  background: var(--jd-charcoal);
  color: #eceef0;
  border-top: 4px solid #1e1e1e;
  padding: clamp(1rem, 2.5vh, 1.75rem) 16px;
}

.stripe p {
  max-width: 1100px;
  margin: 0 auto;
  font-size: clamp(0.9rem, 1.4vw, 1.05rem);
  line-height: 1.55;
  text-align: center;
}

/* ---------- Narrower screens: boxes stack, back button sits above them ---------- */

@media (max-width: 1000px) {
  .back {
    flex-direction: column;
    align-items: flex-start;
    max-width: 400px;
  }
  .boxes {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .logo img, .back-btn, .pill, .phone { transition: none; }
  .card { transition: none; } /* switch sides instantly */
}
