:root {
  --blue:       #0099E6;
  --blue-dark:  #0077B8;
  --blue-deep:  #005A8E;
  --gray:       #808080;
  --gray-light: #F4F6F8;
  --silver:     #C0C0C0;
  --white:      #FFFFFF;
  --charcoal:   #1A2A3A;
  --soft-blue:  #D6EEF8;
  --shadow:     0 24px 70px rgba(0, 153, 230, 0.20);
}

*, *::before, *::after { box-sizing: border-box; }

html { min-height: 100%; background: var(--gray-light); }

body {
  min-height: 100%;
  margin: 0;
  font-family: 'DM Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--charcoal);
  background:
    radial-gradient(circle at top left,  rgba(0, 153, 230, 0.14), transparent 34rem),
    radial-gradient(circle at bottom right, rgba(128, 128, 128, 0.10), transparent 32rem),
    linear-gradient(135deg, #ffffff 0%, #f4f6f8 52%, #e8f6fd 100%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

/* ── Page Layout ─────────────────────────────────────────────── */
.card-page {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 4vw, 2.5rem);
}

.brand-shell {
  width: min(100%, 36rem);       /* wider shell to match wider card */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}

/* ── Flip Area ───────────────────────────────────────────────── */
.flip-area {
  width: min(100%, 34rem);       /* wider card — was 28rem */
  height: 34rem;                 /* taller to accommodate larger logo */
  padding: 0;
  margin: 0.4rem 0 0.2rem;
  border: 0;
  background: transparent;
  perspective: 1200px;
  cursor: default;
  -webkit-tap-highlight-color: transparent;
}

.business-card {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 680ms cubic-bezier(0.2, 0.72, 0.2, 1);
}

.flip-area.is-flipped .business-card { transform: rotateY(180deg); }

/* ── Card Faces ──────────────────────────────────────────────── */
.card-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 1.75rem 1.75rem;
  border-radius: 2rem;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: var(--shadow);
}

/* ── Card Front ──────────────────────────────────────────────── */
.card-front {
  color: var(--white);
  background:
    linear-gradient(145deg, rgba(0, 90, 142, 0.96), rgba(0, 153, 230, 0.88)),
    radial-gradient(circle at 18% 18%, rgba(255,255,255,0.28), transparent 16rem);
  border: 1px solid rgba(255, 255, 255, 0.32);
  pointer-events: none;
}

/* decorative ring — front only, removed from back */
.card-front::before {
  content: "";
  position: absolute;
  width: 16rem;
  height: 16rem;
  border-radius: 999px;
  border: 1px solid rgba(192, 192, 192, 0.30);
  top: -5.5rem;
  right: -5.5rem;
}

/* ── Logo Medallion (front) ──────────────────────────────────── */
.logo-medallion {
  width: 11rem;
  height: 11rem;
  display: grid;
  place-items: center;
  padding: 0.58rem;
  background: var(--white);
  border-radius: 999px;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.18);
  border: 3px solid rgba(192, 192, 192, 0.72);
  z-index: 1;
}

.medallion-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 999px;
  background: var(--white);
}

.logo-only-front { gap: 0; }

.logo-medallion-large {
  width: min(88%, 20rem);
  height: auto;
  aspect-ratio: 1;
  padding: 0.85rem;
}

/* ── Card Back ───────────────────────────────────────────────── */
.card-back {
  color: var(--charcoal);
  background: linear-gradient(160deg, var(--white), #fdfeff 70%, #eaf6fd);
  transform: rotateY(180deg);
  border: 1px solid rgba(0, 153, 230, 0.16);
  pointer-events: none;
  gap: 0.3rem;
  justify-content: flex-start;
  padding-top: 1rem;
}

.flip-area.is-flipped .card-back { pointer-events: auto; }

/* ── Back Logo ──────────────────────────────────────────────── */
.back-logo-wrap {
  width: 10.5rem;                /* larger — was 8rem */
  height: 10.5rem;
  display: grid;
  place-items: center;
  background: var(--white);
  border-radius: 999px;
  border: 2px solid rgba(0, 153, 230, 0.22);
  box-shadow: 0 4px 14px rgba(0, 153, 230, 0.14);
  flex-shrink: 0;
  margin-bottom: 0.15rem;
}

.back-logo {
  width: 85%;
  height: 85%;
  object-fit: contain;
  border-radius: 999px;
}

/* ── Back Typography ─────────────────────────────────────────── */
.card-name,
.back-heading {
  z-index: 1;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.1;
}

.card-title,
.card-business,
.card-note,
.contact-line { z-index: 1; }

.card-title {
  font-weight: 700;
  color: #3a8ab5;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.card-business {
  font-weight: 700;
  max-width: 20rem;
  font-size: 1rem;
}

.card-back .card-name    { color: var(--blue-deep); font-size: 1.35rem; }
.card-back .card-title   { color: var(--blue); margin-top: -0.1rem; font-size: 0.72rem; }
.card-back .card-business{ color: #1a5a7a; margin-bottom: 0.15rem; }

/* .back-heading removed — no longer used */

/* ── Contact Lines ───────────────────────────────────────────── */
.contact-line {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  padding: 0.6rem 0.85rem;
  border-radius: 0.85rem;
  background: rgba(214, 238, 248, 0.58);
  color: #1a3a50;
  text-align: left;
  font-size: 0.86rem;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: transform 170ms ease, background-color 170ms ease, box-shadow 170ms ease;
}

/* Email and Website tiles — smaller font so long URLs fit on one line */
.contact-line.email-line,
.contact-line.website-line {
  font-size: clamp(0.68rem, 1.9vw, 0.78rem);
  letter-spacing: -0.01em;
}

.contact-line strong {
  color: var(--blue-deep);
  font-size: 0.70rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: block;
}

.contact-line:hover,
.contact-line:focus-visible {
  background: rgba(214, 238, 248, 0.90);
  box-shadow: 0 10px 22px rgba(0, 153, 230, 0.14);
  transform: translateY(-1px);
  outline: 2px solid rgba(0, 153, 230, 0.55);
  outline-offset: 2px;
}

/* ── Save Button ─────────────────────────────────────────────── */
.save-button {
  width: min(100%, 34rem);       /* match wider card */
  min-height: 3.65rem;
  margin-top: 0.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0.01em;
  font-size: 1.02rem;
  color: var(--white);
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-deep) 100%);
  border: 1px solid var(--blue-dark);
  box-shadow: 0 16px 36px rgba(0, 153, 230, 0.28);
  transition: transform 170ms ease, box-shadow 170ms ease;
}

.save-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 44px rgba(0, 153, 230, 0.34);
}

/* ── Tagline ─────────────────────────────────────────────────── */
.affirmation {
  width: min(100%, 34rem);
  margin: 0.4rem 0 0;
  color: #3a6a80;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 0.98rem;
  line-height: 1.55;
}

/* ── Footer ──────────────────────────────────────────────────── */
.card-footer { color: #577174; font-size: 0.8rem; margin-top: 0.15rem; }
.card-footer a { color: var(--blue-deep); font-weight: 800; text-decoration: none; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 420px) {
  .card-page  { padding: 0.75rem 0.6rem; }
  .flip-area  { height: 30rem; }
  .logo-medallion { width: 9.5rem; height: 9.5rem; }
  .logo-medallion-large { width: min(86%, 17rem); height: auto; }
  .card-face  { padding: 1.25rem; }
  .contact-line { white-space: normal; word-break: break-all; overflow-wrap: anywhere; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}
