/* ============================================================
   FOSCO — V1 "Resonance"
   One dark, calm, resonating room.
   ============================================================ */

:root {
  --gutter: clamp(24px, 6vw, 96px);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

html {
  background: var(--midnight);
}
html, body {
  overflow-x: clip;
}
body {
  background: var(--midnight);
  color: var(--ivory);
  min-height: 100vh;
}
[hidden] { display: none !important; }

/* Scrollbar (safe, subtle) */
html { scrollbar-width: thin; scrollbar-color: #3A4157 var(--midnight); }
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--midnight); }
::-webkit-scrollbar-thumb { background: #3A4157; border-radius: 5px; border: 2px solid var(--midnight); }

/* ------------------------------------------------------------
   Canvas field + overlays
   ------------------------------------------------------------ */
#field {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}
.top-fade {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 110px;
  z-index: 5;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(25, 29, 46, 0.88), rgba(25, 29, 46, 0));
}

/* ------------------------------------------------------------
   Nav
   ------------------------------------------------------------ */
.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(18px, 2.4vw, 32px) clamp(24px, 3.4vw, 48px);
}
.fosco-logo {
  display: inline-flex;
  align-items: baseline;
  text-decoration: none;
  color: var(--ivory);
  padding: 12px 2px;
}
.fosco-word {
  font-weight: 700;
  letter-spacing: -0.02em;
  text-transform: lowercase;
  font-size: 1.4rem;
  line-height: 1;
}
.fosco-mark {
  height: 0.87em;
  width: auto;
  margin-left: 0.12em;
  transform: translateY(12%);
  align-self: center;
}
.nav-cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ivory);
  text-decoration: none;
  font-size: 0.95rem;
  padding: 12px 2px;
}
.nav-cta::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--coral);
  flex: none;
}
.nav-cta::after {
  content: '';
  position: absolute;
  left: 16px; right: 0; bottom: 6px;
  height: 1px;
  background: var(--ivory-dim);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s var(--ease-out);
}
.nav-cta:hover::after,
.nav-cta:focus-visible::after { transform: scaleX(1); }

/* ------------------------------------------------------------
   Main / sections
   ------------------------------------------------------------ */
main {
  position: relative;
  z-index: 1;
}
section { position: relative; }

/* Soft vignettes so type stays readable over the field */
.hero-inner::before,
.standfirst-text::before,
.referral-inner::before {
  content: '';
  position: absolute;
  inset: -22% -18%;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse 65% 60% at 50% 50%, rgba(25, 29, 46, 0.46), rgba(25, 29, 46, 0) 72%);
}
.hero-inner::before {
  inset: -30% -24%;
  background: radial-gradient(ellipse 62% 58% at 42% 52%, rgba(25, 29, 46, 0.44), rgba(25, 29, 46, 0) 72%);
}

/* ---------------- Hero ---------------- */
.hero {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding: 96px var(--gutter) 120px;
}
.hero-inner {
  position: relative;
  max-width: 1240px;
}
.hero-eyebrow {
  color: var(--cool-muted);
  margin: 0 0 clamp(20px, 3vh, 34px);
}
.hero-title {
  font-size: clamp(2.45rem, 7.4vw, 6.5rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
}
.line-mask {
  display: block;
  overflow: hidden;
  padding-bottom: 0.07em;
  margin-bottom: -0.07em;
}
.line-mask .line { display: block; }
.hero-dot {
  display: inline-block;
  color: var(--coral);
  font-size: 1.06em;
  line-height: 0;
  transform-origin: 50% 62%;
}
.scroll-cue {
  position: absolute;
  bottom: 40px;
  left: 50%;
  width: 1px;
  height: 48px;
  overflow: hidden;
}
.scroll-cue::before {
  content: '';
  display: block;
  width: 1px; height: 100%;
  background: var(--ivory-dim);
  animation: cue 2.3s cubic-bezier(0.7, 0, 0.3, 1) infinite;
}
@keyframes cue {
  0%   { transform: scaleY(0); transform-origin: top; }
  44%  { transform: scaleY(1); transform-origin: top; }
  56%  { transform: scaleY(1); transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

/* ---------------- Standfirst ---------------- */
.standfirst {
  min-height: 56vh;
  min-height: 56svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(76px, 11vh, 150px) var(--gutter);
}
.standfirst-text {
  position: relative;
  margin: 0;
  max-width: 32ch;
  font-size: clamp(1.35rem, 1.05rem + 1.55vw, 2.4rem);
  font-weight: 400;
  line-height: 1.42;
  color: var(--ivory);
  text-align: center;
  text-wrap: balance;
}
.unit { white-space: nowrap; }
.coral-text { color: var(--coral); }

/* JS-split lines (standfirst + referral) */
.split-line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.09em;
  margin-bottom: -0.09em;
}
.split-line .split-inner { display: block; }

/* ---------------- Referral ---------------- */
.referral {
  min-height: 50vh;
  min-height: 50svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(64px, 10vh, 140px) var(--gutter);
}
.referral-inner {
  position: relative;
  text-align: center;
}
.referral-text {
  margin: 0;
  max-width: 22ch;
  margin-inline: auto;
  font-size: clamp(1.9rem, 4.2vw, 3.6rem);
  line-height: 1.12;
  text-wrap: balance;
}
.referral-rule {
  display: block;
  width: 120px;
  height: 2px;
  margin: clamp(28px, 4vh, 44px) auto 0;
  background: var(--coral);
}

/* ---------------- Contact ---------------- */
.contact {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(72px, 9vh, 120px) var(--gutter) clamp(24px, 3.5vh, 48px);
}
.contact-inner {
  width: 100%;
  max-width: 640px;
}
.contact-title {
  font-size: clamp(2.6rem, 5vw, 4.4rem);
  line-height: 1.04;
  margin-bottom: clamp(16px, 2.4vh, 26px);
}
.panel {
  position: relative;
  background: linear-gradient(180deg, rgba(46, 52, 76, 0.58), rgba(30, 35, 55, 0.66));
  border: 1px solid rgba(246, 244, 239, 0.16);
  border-radius: 20px;
  padding: clamp(20px, 2.2vw, 30px) clamp(26px, 3.2vw, 44px);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  box-shadow: 0 30px 80px rgba(8, 10, 20, 0.4), inset 0 1px 0 rgba(246, 244, 239, 0.07);
}
@supports not ((backdrop-filter: blur(18px)) or (-webkit-backdrop-filter: blur(18px))) {
  .panel { background: linear-gradient(180deg, rgba(42, 48, 70, 0.92), rgba(28, 33, 52, 0.94)); }
}

.field { margin-bottom: clamp(14px, 1.9vh, 18px); }
.field label {
  display: block;
  color: var(--cool-muted);
  font-size: 0.68rem;
  margin-bottom: 6px;
}
.control { position: relative; }
.control input,
.control textarea {
  display: block;
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--midnight-line);
  border-radius: 0;
  color: var(--ivory);
  font-size: 1.05rem;
  line-height: 1.4;
  padding: 8px 0 10px;
  caret-color: var(--coral);
  transition: border-color 0.4s ease;
}
.control textarea { resize: none; height: clamp(68px, 9vh, 82px); min-height: 0; }
.control input:focus-visible,
.control textarea:focus-visible { outline: none; }
.control::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--coral);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.55s var(--ease-out);
}
.field:focus-within .control::after { transform: scaleX(1); }
.field.invalid .control::after { transform: scaleX(1); }
.field.invalid input,
.field.invalid textarea { border-bottom-color: rgba(255, 107, 74, 0.45); }
.field-error {
  margin: 8px 0 0;
  font-size: 0.78rem;
  color: var(--coral);
}

.submit-btn {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 56px;
  margin-top: 6px;
  border: 0;
  border-radius: 28px;
  background: var(--coral);
  color: var(--midnight);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.01em;
  cursor: pointer;
}
.submit-btn .submit-label { position: relative; z-index: 1; }
.submit-btn::after {
  content: '';
  position: absolute;
  width: 380px; height: 380px;
  border-radius: 50%;
  left: var(--x, 50%);
  top: var(--y, 50%);
  transform: translate(-50%, -50%) scale(0);
  background: radial-gradient(circle, rgba(246, 244, 239, 0.32), rgba(246, 244, 239, 0) 62%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.9s var(--ease-out), opacity 0.5s ease;
}
.submit-btn:hover::after,
.submit-btn:focus-visible::after {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

/* Success state */
.success { text-align: center; padding: clamp(8px, 2vh, 24px) 0; }
.success-mark {
  width: 76px;
  height: 76px;
  margin: 0 auto clamp(20px, 3vh, 30px);
}
.success-title {
  font-size: clamp(1.9rem, 3.4vw, 2.7rem);
  margin-bottom: 14px;
}
.success-body {
  margin: 0 auto;
  max-width: 34ch;
  color: var(--ivory-dim);
  font-size: 1rem;
}

/* ---------------- Footer ---------------- */
.site-footer {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px 32px;
  padding: 28px var(--gutter) 30px;
  border-top: 1px solid var(--midnight-line);
}
.site-footer p { margin: 0; }
.footer-copy {
  color: var(--cool-muted);
  font-size: 0.8rem;
}
.footer-flourish {
  color: var(--ivory-dim);
  font-size: 0.92rem;
  text-align: center;
}
.footer-url {
  text-align: right;
  font-size: 0.8rem;
}
.footer-url a {
  display: inline-block;
  color: var(--cool-muted);
  text-decoration: none;
  padding: 14px 4px;
  margin: -14px -4px;
  transition: color 0.35s ease;
}
.footer-url a:hover { color: var(--ivory); }

/* ------------------------------------------------------------
   Responsive
   ------------------------------------------------------------ */
@media (max-width: 720px) {
  .standfirst { min-height: 44svh; padding-block: 72px; }
  .referral { min-height: 38svh; padding-block: 64px; }
  .contact { padding-block: 76px 16px; }
  .site-footer {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    gap: 10px;
    padding-block: 20px 22px;
  }
  .footer-url { text-align: center; }
  .footer-flourish { order: -1; }
}

/* ------------------------------------------------------------
   Reduced motion
   ------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .scroll-cue::before { transform: scaleY(1); }
}
