/* ===================================================================
   BLUESTONE — Contact Page (Responsive Full Replacement)
   - Preserves original design language
   - Mobile-first: fluid spacing, safe-area padding, single-column form
   - Disables heavy tilt on touch devices (keeps the look on desktop)
   =================================================================== */

/* ---------------- Tokens (easy tuning) ---------------- */
:root{
  --bg: #0e1116;                 /* page background */
  --surface: #12151d;            /* panel surface */
  --radius: 26px;                /* super smooth rounded edges */
  --wrap-gap: clamp(16px, 3vw, 40px);
  --panel-pad: clamp(18px, 3vw, 36px);
  --text: #e9eef6;
  --muted: #aeb6c3;
  --accent: #79b8ff;
  --accent-2: #8ef0d4;

  /* Glow colors (channel lists, not rgb(...)) */
  --glow1: 255 255 255;   /* outer glow */
  --glow2: 11 201 205;    /* inner glow */

  /* Glow size & strength (tune as you like) */
  --glow1-blur: 50px;
  --glow2-blur: 120px;
  --glow1-alpha: .25;     /* brightness 0–1 */
  --glow2-alpha: .15;

  /* Type scale helpers */
  --h1: clamp(28px, 6vw, 60px);
  --h2: clamp(16px, 3vw, 22px);
  --body: clamp(14px, 2.2vw, 16px);
}

/* ---------------- Reset ---------------- */
*{ box-sizing: border-box; }
html, body { height: 100%; }
body{
  margin: 0;
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial;
  background:
    radial-gradient(1200px 1200px at 10% 0%, rgba(255,255,255,.06), transparent 60%),
    radial-gradient(800px 800px at 100% 100%, rgba(0,153,255,.08), transparent 60%),
    var(--bg);
  -webkit-text-size-adjust: 100%;
}

/* ---------------- Section ---------------- */
.contact{
  position: relative; /* for bg slideshow layering */
  min-height: 100dvh; /* mobile-safe */
  display: grid; place-items: center;
  padding: max(12px, 2.5vw);
  padding-left: max(12px, calc(2.5vw + env(safe-area-inset-left)));
  padding-right: max(12px, calc(2.5vw + env(safe-area-inset-right)));
  padding-top: max(12px, calc(2.5vw + env(safe-area-inset-top)));
  padding-bottom: max(12px, calc(2.5vw + env(safe-area-inset-bottom)));
  overflow: hidden;
}

/* ---- Background slideshow (black & white) ---- */
:root{ --bg-cycle: 36s; }
.bg-slideshow{ position: absolute; inset: 0; z-index: 0; overflow: hidden; }
.bg-slideshow img{
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  filter: grayscale(1) contrast(1.05) brightness(.58);
  opacity: 0; pointer-events: none; user-select: none;
  animation: bgFade var(--bg-cycle) linear infinite;
  will-change: opacity, transform;
}
@keyframes bgFade{
  0%{opacity:0}
  8%{opacity:1}
  25%{opacity:1}
  33%{opacity:0}
  100%{opacity:0}
}
/* staggered delays for 6 images */
.bg-slideshow img:nth-child(1){ animation-delay: calc(0 * var(--bg-cycle) / 6); }
.bg-slideshow img:nth-child(2){ animation-delay: calc(1 * var(--bg-cycle) / 6); }
.bg-slideshow img:nth-child(3){ animation-delay: calc(2 * var(--bg-cycle) / 6); }
.bg-slideshow img:nth-child(4){ animation-delay: calc(3 * var(--bg-cycle) / 6); }
.bg-slideshow img:nth-child(5){ animation-delay: calc(4 * var(--bg-cycle) / 6); }
.bg-slideshow img:nth-child(6){ animation-delay: calc(5 * var(--bg-cycle) / 6); }

/* dimming overlay for readability */
.bg-overlay{
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(60% 60% at 18% 8%, rgba(255,255,255,.05), transparent 60%),
    linear-gradient(180deg, rgba(6,10,14,.58), rgba(6,10,14,.38) 35%, rgba(6,10,14,.58));
}

/* Reduced motion: freeze on first frame */
@media (prefers-reduced-motion: reduce){
  .bg-slideshow img{ animation: none; opacity: 0; }
  .bg-slideshow img:first-child{ opacity: .35; }
}

/* Outer wrapper so panels feel embedded in scene */
.wrap{
  width: min(1320px, 100%);
  display: grid;
  grid-template-columns: 0.7fr 1.3fr; /* form bigger on desktop */
  gap: var(--wrap-gap);
  align-items: stretch;
  position: relative; z-index: 2; /* above slideshow & overlay */
}

/* ---------------- Beveled Panels ---------------- */
.panel{
  position: relative;
  background: linear-gradient(180deg, #141923, var(--surface));
  border-radius: var(--radius);
  padding: var(--panel-pad);
  box-shadow:
    20px 24px 48px rgba(0,0,0,.55),   /* big drop shadow */
    -10px -12px 26px rgba(255,255,255,.035), /* lift from top-left */
    inset 0 1px 0 rgba(255,255,255,.06),    /* top rim highlight */
    inset 0 -1px 0 rgba(0,0,0,.55);         /* bottom inner shade */
  overflow: clip; /* ensures pseudo-els respect radius */
}

/* Subtle glossy bevel sheen */
.panel::before{
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background:
    radial-gradient(140% 120% at 12% 10%, rgba(255,255,255,.12), transparent 45%),
    radial-gradient(140% 120% at 88% 92%, rgba(0,0,0,.35), transparent 45%);
  mix-blend-mode: overlay; opacity: .65;
}

/* Hairline outer edge for crispness */
.panel::after{
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 0 1px rgba(255,255,255,.05) inset;
}

/* Info container without panel styling */
.info{ padding: var(--panel-pad) clamp(4px, 1vw, 12px); background: transparent; }

/* ---------------- Left: Info ---------------- */
.info h1{
  margin: 0 0 .25em 0; font-size: var(--h1); line-height: 1.04; letter-spacing: -.02em;
  text-shadow: 0 2px 10px rgba(0,0,0,.25);
}
.info h2{
  margin: 0 0 .8rem; font-weight: 500; color: var(--muted); font-size: var(--h2);
  line-height: 1.4;
}
.tagline{ color: var(--muted); margin: 0 0 1rem; font-size: var(--body); }
.nice{ margin: 0; padding: 0 0 0 1.1em; line-height: 1.65; font-size: var(--body); }
.nice li::marker{ color: var(--accent-2); }

.meta{ margin-top: 1.25rem; display: flex; gap: 12px; flex-wrap: wrap; }
.meta a{
  color: #f0f6ff; text-decoration: none; padding: 12px 16px; border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  box-shadow: inset 1px 1px 0 rgba(255,255,255,.12), inset -1px -1px 0 rgba(0,0,0,.5);
  border: 1px solid rgba(255,255,255,.08);
  line-height: 1;
}

/* ---------------- Right: Form ---------------- */
form.form{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
  font-size: var(--body);
}
.field{ display: grid; gap: 6px; }
.field.full{ grid-column: 1 / -1; }
label{ font-size: 12px; color: var(--muted); letter-spacing: .02em; }
input, textarea{
  width: 100%;
  color: var(--text);
  background: linear-gradient(180deg, #141923, #10141b);
  border: 1px solid rgba(255, 38, 45, 0.08);
  border-radius: 14px;
  padding: 12px 12px;
  outline: none;
  box-shadow:
    inset 4px 4px 10px rgba(0,0,0,.55),
    inset -4px -4px 10px rgba(255,255,255,.05);
  font-size: 16px; /* prevent iOS zoom */
  line-height: 1.25;
}
textarea{ resize: vertical; min-height: 110px; }
input:focus, textarea:focus{
  border-color: rgba(121,184,255,.6);
  box-shadow:
    0 0 0 3px rgba(121,184,255,.25),
    inset 4px 4px 10px rgba(0,0,0,.55),
    inset -4px -4px 10px rgba(255,255,255,.05);
}

.btn{
  grid-column: 1 / -1; border: 0; cursor: pointer;
  padding: 14px 18px; border-radius: 16px; font-weight: 700; letter-spacing: .02em;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #091016;
  box-shadow: 12px 14px 28px rgba(0,0,0,.45), -4px -6px 14px rgba(255,255,255,.05);
  transition: transform .15s ease, box-shadow .2s ease;
  font-size: 16px; /* tap-friendly */
}
.btn:hover{ transform: translateY(-1px); }
.btn:active{ transform: translateY(0); }

/* ---------------- Gel Form (glossy squircle) ---------------- */
.panel.form{
  background:
    radial-gradient(170% 140% at var(--hlx,15%) var(--hly,12%), rgba(255,255,255,.18), rgba(255,255,255,.08) 22%, rgba(255,255,255,0) 58%),
    radial-gradient(120% 150% at 85% 90%, rgba(0,0,0,.35), transparent 45%),
    linear-gradient(180deg, #1a2333, #121a28 70%, #0f1624);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 28px;
  color: var(--text);
  box-shadow:
    0 0 var(--glow1-blur) rgb(var(--glow1) / var(--glow1-alpha)),
    0 0 var(--glow2-blur) rgb(var(--glow2) / var(--glow2-alpha)),
    inset 0 1px 0 rgba(255,255,255,.10),
    inset 0 -3px 8px rgba(0,0,0,.30);
  transform: perspective(1100px) rotateX(var(--rx,0deg)) rotateY(var(--ry,0deg)) scale(var(--scale,1));
  transform-origin: center;
  transition: box-shadow .2s ease;
  will-change: transform, box-shadow;
  position: relative;
  overflow: hidden;
}
.panel.form::before{
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background:
    radial-gradient(170% 140% at var(--hlx,15%) calc(var(--hly,12%) - 4%), rgba(255,255,255,.22), rgba(255,255,255,.10) 22%, rgba(255,255,255,0) 60%),
    radial-gradient(140% 140% at 95% 100%, rgba(0,0,0,.35), transparent 50%);
  opacity: .95; mix-blend-mode: screen;
}
.panel.form::after{
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 0 1px rgba(255,255,255,.10) inset, 0 0 0 1px rgba(0,0,0,.12);
}

/* Form fields on light surface */
.form label{ color: var(--muted); }
.form input, .form textarea{
  background: linear-gradient(180deg, #1b2232, #101724);
  border: 1px solid rgba(255,255,255,.10);
  color: var(--text);
  box-shadow: inset 6px 6px 14px rgba(0,0,0,.45), inset -6px -6px 14px rgba(255,255,255,.04);
}
.form input::placeholder, .form textarea::placeholder{ color: #9aa8bd; }
.form input:focus, .form textarea:focus{
  border-color: rgba(121,184,255,.7);
  box-shadow: 0 0 0 3px rgba(121,184,255,.28), inset 6px 6px 14px rgba(0,0,0,.45), inset -6px -6px 14px rgba(255,255,255,.04);
}

/* Slightly stronger glow on hover (no drop shadow) */
@media (hover:hover){
  .panel.form:hover{
    box-shadow:
      0 0 var(--glow1-blur) rgb(var(--glow1) / calc(var(--glow1-alpha) + .04)),
      0 0 var(--glow2-blur) rgb(var(--glow2) / calc(var(--glow2-alpha) + .04)),
      inset 0 1px 0 rgba(255,255,255,.10),
      inset 0 -3px 8px rgba(0,0,0,.30);
  }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce){
  .panel.form{ transform: none; }
}

/* ---------------- Responsiveness ---------------- */

/* Laptops / small desktops: even columns for balance */
@media (max-width: 1280px){
  .wrap{ grid-template-columns: 1fr 1fr; }
}

/* Tablets: keep 2 columns but relax spacing and type a bit */
@media (max-width: 1024px){
  :root{
    --radius: 22px;
  }
  .meta a{ padding: 10px 14px; }
  .panel{ padding: clamp(16px, 2.2vw, 28px); }
}

/* Narrow tablets & large phones: stack into single column */
@media (max-width: 980px){
  .wrap{
    grid-template-columns: 1fr;
  }
  /* keep info above form (original order) */
  .info{ padding-top: 70px; }
}

/* Phones: single-column form, bigger tap targets, toned-down visuals */
@media (max-width: 720px){
  :root{
    --radius: 20px;
  }
  form.form{
    grid-template-columns: 1fr; /* stack fields */
    gap: 12px;
  }
  .field.full{ grid-column: 1; }
  .btn{ padding: 16px 18px; }
  .meta{ gap: 10px; }
  .meta a{ padding: 12px 14px; }
}

/* Very small phones */
@media (max-width: 480px){
  :root{
    --radius: 18px;
  }
  .panel{ padding: clamp(14px, 4vw, 22px); }
  .meta a{ width: 100%; text-align: center; }
}

/* Touch devices: keep the look but avoid 3D tilt jitter while scrolling */
@media (hover:none), (pointer:coarse){
  .panel.form{
    transform: none !important; /* static on touch */
  }
}
