:root {
  --bg: #000000;
  --card-bg: rgba(16, 16, 20, 0.92);
  --border: rgba(255, 255, 255, 0.1);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.55);
  --faint: rgba(255, 255, 255, 0.38);
  --accent: #7fded2;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

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

/* Ensure the hidden attribute always wins over display rules */
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* —— Starfield —— */
.stars {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.star {
  position: absolute;
  background: #fff;
  border-radius: 50%;
  animation: twinkle var(--tw-dur, 4s) ease-in-out var(--tw-delay, 0s) infinite;
}

@keyframes twinkle {
  0%,
  100% {
    opacity: var(--tw-min, 0.15);
  }
  50% {
    opacity: var(--tw-max, 0.7);
  }
}

/* —— Header —— */
.site-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding:
    max(1.1rem, env(safe-area-inset-top))
    max(2rem, env(safe-area-inset-right))
    1.1rem
    max(2rem, env(safe-area-inset-left));
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  color: var(--text);
}

.brand-mark {
  width: 38px;
  height: auto;
  display: block;
}

.brand-name {
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.38em;
  color: rgba(255, 255, 255, 0.92);
}

.site-nav {
  display: flex;
  gap: 2.25rem;
}

.site-nav a {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.85);
  transition: color 0.2s ease;
  padding: 0.35rem 0;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: #fff;
}

/* —— Hero —— */
.hero {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding:
    0
    max(1rem, env(safe-area-inset-right))
    max(1rem, env(safe-area-inset-bottom))
    max(1rem, env(safe-area-inset-left));
}

.emblem-wrap {
  position: relative;
  margin-top: clamp(0.25rem, 1.5vh, 1rem);
}

.emblem-wrap::before {
  content: "";
  position: absolute;
  inset: -18%;
  background: radial-gradient(
    ellipse at center,
    rgba(150, 160, 180, 0.14) 0%,
    rgba(90, 95, 110, 0.06) 42%,
    transparent 70%
  );
  pointer-events: none;
}

.emblem {
  position: relative;
  display: block;
  width: min(78vw, 470px);
  height: auto;
  opacity: 0;
  animation: emblemIn 1.4s var(--ease-out) 0.1s forwards;
}

@keyframes emblemIn {
  0% {
    opacity: 0;
    transform: scale(1.06);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* —— Contact card —— */
.contact-card {
  position: relative;
  width: min(92vw, 880px);
  margin-top: clamp(1.25rem, 3.5vh, 2.5rem);
  padding: 1.5rem 1.75rem 1.65rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transform: translateY(16px);
  animation: cardIn 0.9s var(--ease-out) 0.5s forwards;
}

@keyframes cardIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card-head {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.mail-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.9);
}

.mail-badge svg {
  width: 17px;
  height: 17px;
}

.card-title {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.95);
}

.card-accent {
  display: block;
  width: 40px;
  height: 2px;
  margin: 0.65rem 0 0.85rem;
  background: var(--accent);
  border-radius: 1px;
}

.card-copy {
  margin: 0 0 1.15rem;
  font-size: 0.82rem;
  font-weight: 300;
  line-height: 1.6;
  color: var(--muted);
}

/* —— Form —— */
.contact-form {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 0.75rem;
}

.field {
  position: relative;
}

.field-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: rgba(255, 255, 255, 0.45);
  pointer-events: none;
}

.field input {
  width: 100%;
  height: 46px;
  padding: 0 0.85rem 0 2.4rem;
  font-family: inherit;
  font-size: 16px;
  color: #fff;
  background: rgba(8, 8, 11, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.field input::placeholder {
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.84rem;
}

.field input:focus {
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(14, 14, 18, 0.9);
}

.send-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  height: 46px;
  padding: 0 1.35rem;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(180deg, #f4f4f6 0%, #c6c6cd 100%);
  color: #0a0a0c;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: filter 0.2s ease, transform 0.15s ease;
}

.send-btn svg {
  width: 15px;
  height: 15px;
}

.send-btn:hover,
.send-btn:focus-visible {
  filter: brightness(1.06);
}

.send-btn:active {
  transform: translateY(1px);
}

.send-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.form-status {
  margin: 0.85rem 0 0;
  font-size: 0.8rem;
  line-height: 1.5;
  color: #ffb4b4;
}

.form-success {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.5rem 0 0.25rem;
}

.success-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 50%;
  font-size: 1.1rem;
  color: #fff;
}

.form-success p {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.82);
}

/* —— Trust footer —— */
.trust {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  margin: clamp(1.25rem, 3vh, 2rem) 0 clamp(1rem, 2.5vh, 1.75rem);
}

.trust-shield {
  width: 26px;
  height: 26px;
  color: rgba(255, 255, 255, 0.6);
}

.trust-text {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}

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

/* —— Reduced motion —— */
@media (prefers-reduced-motion: reduce) {
  .emblem,
  .contact-card {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .star {
    animation: none;
    opacity: 0.4;
  }
}

/* —— Mobile —— */
@media (max-width: 900px) {
  .contact-form {
    grid-template-columns: 1fr 1fr;
  }

  .send-btn {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .site-header {
    padding-left: max(1.1rem, env(safe-area-inset-left));
    padding-right: max(1.1rem, env(safe-area-inset-right));
  }

  .brand-name {
    font-size: 0.72rem;
    letter-spacing: 0.3em;
  }

  .brand-mark {
    width: 32px;
  }

  .site-nav {
    gap: 1.25rem;
  }

  .site-nav a {
    font-size: 0.66rem;
    letter-spacing: 0.2em;
  }

  .emblem {
    width: min(86vw, 400px);
  }

  .contact-card {
    width: min(94vw, 880px);
    padding: 1.25rem 1.15rem 1.35rem;
  }

  .contact-form {
    grid-template-columns: 1fr;
  }

  .send-btn {
    width: 100%;
  }
}
