/* ── Design Tokens ── */
:root {
  /* Surfaces */
  --color-bg: #171A1F;
  --color-surface: #1e2127;
  --color-border: rgba(253, 253, 253, 0.06);
  --color-border-subtle: rgba(253, 253, 253, 0.08);
  --color-border-input: rgba(253, 253, 253, 0.15);

  /* Text */
  --color-text: #FDFDFD;
  --color-text-primary: rgba(253, 253, 253, 0.85);
  --color-text-heading: rgba(253, 253, 253, 0.7);
  --color-text-body: rgba(253, 253, 253, 0.65);
  --color-text-secondary: rgba(253, 253, 253, 0.5);
  --color-text-muted: rgba(253, 253, 253, 0.45);
  --color-text-faint: rgba(253, 253, 253, 0.4);

  /* Accent (teal) */
  --color-accent: rgba(16, 191, 204, 0.85);
  --color-accent-hover: rgba(16, 191, 204, 0.5);
  --color-accent-subtle: rgba(16, 191, 204, 0.3);
  --color-accent-bg: rgba(16, 191, 204, 0.15);
  --color-accent-bg-hover: rgba(16, 191, 204, 0.22);
  --color-accent-bg-faint: rgba(16, 191, 204, 0.08);
  --color-accent-bg-tint: rgba(16, 191, 204, 0.1);
  --color-accent-link: rgba(16, 191, 204, 0.7);
  --color-accent-focus: rgba(16, 191, 204, 0.6);

  /* Semantic */
  --color-error: rgba(252, 188, 50, 0.7);
  --color-error-border: rgba(252, 188, 50, 0.5);

  /* Elevation */
  --overlay-bg: rgba(0, 0, 0, 0.7);
  --input-bg: rgba(253, 253, 253, 0.06);
  --input-bg-focus: rgba(253, 253, 253, 0.08);
}

/* ── Self-hosted Fonts ── */
@font-face {
  font-family: 'Source Sans 3';
  font-style: normal;
  font-weight: 300 600;
  font-display: swap;
  src: url('fonts/source-sans-3-latin-400.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Source Sans 3';
  font-style: normal;
  font-weight: 300 600;
  font-display: swap;
  src: url('fonts/source-sans-3-latin-ext-400.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Source Sans 3';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/source-sans-3-latin-400i.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Source Sans 3';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/source-sans-3-latin-ext-400i.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ── Reset ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  height: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ── Base ── */
body {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100%;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  font-feature-settings: "kern" 1, "liga" 1;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ── Skip Link ── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 200;
  padding: 0.5em 1em;
  background: var(--color-text);
  color: var(--color-bg);
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 0.25rem;
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
}

/* ── Focus ── */
:focus-visible {
  outline: 2px solid var(--color-accent-focus);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ── Reduced Motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Fade-in sequence ── */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ── Canvas Background ── */
#dag {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ── Main ── */
main {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  width: 100%;
}

/* ── Landing ── */
.landing {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  z-index: 1;
  overflow: hidden;
}

.landing-footer {
  position: absolute;
  bottom: 10rem;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ── Logo ── */
.logo {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: clamp(0.75rem, 2vw, 1.5rem);
  width: min(85vw, 560px);
  margin-bottom: 2.5rem;
  animation: fadeIn 0.6s ease both;
}

.logo svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.logo svg path {
  fill: var(--color-text);
}

.logo-mark {
  position: relative;
  width: 18%;
  height: 0;
  padding-bottom: 23.1%; /* 18% * (299/233) */
  flex-shrink: 0;
}

.logo-type {
  position: relative;
  width: 65%;
  height: 0;
  padding-bottom: 20.8%; /* 65% * (188/588) */
  flex-shrink: 0;
}

/* ── Tagline ── */
.tagline {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--color-text-primary);
  font-style: italic;
  margin-bottom: 0.75rem;
  animation: fadeIn 0.6s ease 0.15s both;
}

.tagline .tm {
  font-weight: 400;
  font-style: normal;
  font-size: 0.6em;
  vertical-align: super;
}

/* ── Subheadline ── */
.subheadline {
  font-size: clamp(0.9375rem, 2vw, 1.125rem);
  font-weight: 300;
  letter-spacing: 0.03em;
  color: var(--color-text-body);
  max-width: 40rem;
  text-align: center;
  line-height: 1.5;
  margin-bottom: 2rem;
  animation: fadeIn 0.6s ease 0.3s both;
}

.subheadline em {
  color: var(--color-text-body);
  font-style: italic;
  position: relative;
  display: inline-block;
}

.subheadline em::after {
  content: '';
  position: absolute;
  left: -10%;
  right: -10%;
  bottom: -0.15em;
  height: 0.55em;
  background: url("underline.svg") no-repeat center;
  background-size: 100% 100%;
  opacity: 0.85;
}

/* ── CTA Button ── */
.cta {
  font-family: inherit;
  font-size: clamp(0.85rem, 1.6vw, 1rem);
  font-weight: 400;
  letter-spacing: 0.03em;
  color: var(--color-accent);
  background: transparent;
  padding: 0.6em 1.8em;
  border: 1px solid var(--color-accent-subtle);
  border-radius: 2rem;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
  animation: fadeIn 0.6s ease 0.45s both;
}

.cta:hover {
  background-color: var(--color-accent-bg-faint);
  border-color: var(--color-accent-hover);
}

.cta:active {
  background-color: var(--color-accent-bg);
  border-color: var(--color-accent);
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--overlay-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  position: relative;
  width: min(92vw, 36rem);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: 0.75rem;
  padding: 2.5rem 2rem 2rem;
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  font-size: 1.5rem;
  color: var(--color-text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  line-height: 1;
  padding: 0.75rem;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: var(--color-text-heading);
}

.modal-title {
  font-size: clamp(1.125rem, 2vw, 1.333rem);
  font-weight: 400;
  color: var(--color-text-heading);
  margin-bottom: 1.5rem;
  text-align: center;
}

/* ── Lead Form ── */
.lead-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-row-half {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.form-row-half .form-field {
  flex: 1;
  min-width: 10rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-field label {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--color-text-body);
}

.form-field label .req {
  color: var(--color-accent-link);
}

.form-field input,
.form-field select {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 300;
  color: var(--color-text);
  background: var(--input-bg);
  border: 1px solid var(--color-border-input);
  border-radius: 0.375rem;
  padding: 0.65em 0.85em;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.form-field input:focus,
.form-field select:focus {
  border-color: var(--color-accent-hover);
  background: var(--input-bg-focus);
}

.form-field input.invalid,
.form-field select.invalid {
  border-color: var(--color-error-border);
}

.form-field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='rgba(253,253,253,0.4)' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85em center;
  padding-right: 2.5em;
}

.form-field select option {
  background: var(--color-surface);
  color: var(--color-text);
}

/* ── Fieldsets (checkboxes) ── */
.form-fieldset {
  border: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-fieldset legend {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--color-text-body);
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.875rem;
  font-weight: 300;
  color: var(--color-text-secondary);
  cursor: pointer;
  line-height: 1.4;
}

.checkbox-label input[type="checkbox"] {
  flex-shrink: 0;
  margin-top: 0.15em;
  cursor: pointer;
  accent-color: var(--color-accent);
}

/* ── Submit Button ── */
.form-submit {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-text);
  background: var(--color-accent-bg);
  border: 1px solid var(--color-accent-subtle);
  border-radius: 0.375rem;
  padding: 0.75em 2em;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
  align-self: flex-start;
  margin-top: 0.5rem;
}

.form-submit:hover {
  background: var(--color-accent-bg-hover);
  border-color: var(--color-accent-hover);
}

.form-submit:active:not(:disabled) {
  background: var(--color-accent-subtle);
}

.form-submit:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ── Feedback Messages ── */
.signup-feedback {
  font-size: 0.875rem;
  font-weight: 300;
  min-height: 1.5em;
  margin-top: 0.25rem;
}

.signup-feedback.success {
  color: var(--color-accent-link);
}

.signup-feedback.error {
  color: var(--color-error);
}

/* ── AEO Content Sections (visually hidden, crawlable) ── */
.aeo-section {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Service Description ── */
.service-description {
  font-size: clamp(0.875rem, 1.5vw, 1rem);
  font-weight: 400;
  letter-spacing: 0.03em;
  color: var(--color-text-secondary);
  max-width: 34rem;
  text-align: center;
  line-height: 1.5;
  margin-bottom: 0.25rem;
  padding: 0 1rem;
  animation: fadeIn 0.6s ease 0.55s both;
}

/* ── Footer ── */
footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem 1rem 2rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  width: 100%;
  position: relative;
  z-index: 1;
  line-height: 1.5;
  animation: fadeIn 0.6s ease 0.65s both;
}

/* Site Footer. Harmonized with sitewide pattern. Includes tagline block above the grid row. */
.site-footer {
  position: relative;
  z-index: 1;
  width: 100%;
  border-top: 1px solid var(--color-border-subtle);
  padding: 1.5rem 1.5rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  letter-spacing: 0.05em;
  animation: fadeIn 0.6s ease 0.65s both;
}

.site-footer__tagline {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em;
  justify-content: center;
  align-items: baseline;
  text-align: center;
  margin: 0 0 1rem 0;
  padding: 0 0 1rem 0;
  border-bottom: 1px solid var(--color-border-subtle);
  font-size: clamp(0.8125rem, 1.2vw, 0.9375rem);
  line-height: 1.5;
  letter-spacing: 0.015em;
  color: var(--color-text-muted);
  font-weight: 400;
}

.site-footer__tagline-antecedent {
  color: var(--color-text-faint);
  font-style: italic;
}

.site-footer__tagline-claim {
  color: var(--color-text-primary);
  font-weight: 500;
  font-style: normal;
}

.site-footer__copy {
  justify-self: start;
  margin: 0;
}

.site-footer__nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 1.5rem;
  justify-self: center;
}

.site-footer__nav a {
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 0.15s ease;
}

.site-footer__nav a:hover {
  color: var(--color-text-primary);
}

.site-footer__nav a[aria-current="page"] {
  color: var(--color-text-primary);
}

.site-footer__meta {
  justify-self: end;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  letter-spacing: 0.12em;
  margin: 0;
}

/* ── Subpages (body.page) ── */

body.page {
  display: block;
  padding: 0 1.5rem 4rem;
}

.page-header {
  max-width: 42rem;
  margin: 0 auto;
  padding: 1.5rem 0 0;
}

.back-link {
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.15s ease;
}

.back-link:hover {
  color: var(--color-text-primary);
}

.page-content {
  display: block;
  max-width: 42rem;
  margin: 0 auto;
  padding: 2rem 0;
  line-height: 1.7;
}

.page-content h1 {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 400;
  letter-spacing: 0.02em;
  text-align: left;
  padding: 0 0 0.5rem;
  color: var(--color-text-primary);
}

.page-content h2 {
  font-size: 1.333rem;
  font-weight: 600;
  margin: 2rem 0 0.5rem;
  color: var(--color-text-heading);
}

.page-content h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 1.5rem 0 0.5rem;
  color: var(--color-text-body);
}

.page-content p {
  margin: 0.5rem 0;
  font-size: 1rem;
  color: var(--color-text-body);
}

.page-content ul {
  margin: 0.5rem 0 1rem 1.5rem;
  font-size: 1rem;
  color: var(--color-text-body);
}

.page-content li {
  margin: 0.3rem 0;
}

.page-content a {
  color: var(--color-accent-link);
  text-decoration: none;
}

.page-content a:hover {
  text-decoration: underline;
}

.last-updated {
  font-size: 0.75rem;
  color: var(--color-text-faint);
  margin-bottom: 1.5rem;
}

.site-footer--page {
  position: static;
  padding: 2rem 0 1rem;
  max-width: 42rem;
  margin: auto auto 0;
  animation: none;
}

/* ── Status page ── */

.status-banner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem 1.25rem;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 500;
  margin: 1.5rem 0;
}

.status-ok {
  background: var(--color-accent-bg-tint);
  color: var(--color-accent);
}

.status-dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.status-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
  margin: 1.5rem 0;
}

.status-table th,
.status-table td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
}

.status-table th {
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-faint);
}

.status-badge--ok {
  color: var(--color-accent);
  font-size: 0.875rem;
  font-weight: 500;
}

.status-note {
  margin-top: 2rem;
  font-size: 0.875rem;
  color: var(--color-text-faint);
}

.status-note p {
  margin: 0.4rem 0;
}

/* ── FAQ page ── */

.page-content .faq-item {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--color-border);
}

.page-content .faq-item:last-child {
  border-bottom: none;
}

.page-content .faq-item h2 {
  font-size: 1.125rem;
  font-weight: 400;
  margin: 0 0 0.6rem;
}

.page-content .faq-item p {
  margin: 0;
}

/* ── Support page ── */

.contact-block {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--color-border);
}

.contact-block:last-of-type {
  border-bottom: none;
}

.contact-block h2 {
  margin-top: 0;
}

/* ── Cookie Notice ── */
.cookie-notice {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

.cookie-notice[hidden] {
  display: none;
}

.cookie-notice a {
  color: var(--color-accent-link);
  text-decoration: none;
}

.cookie-notice a:hover {
  text-decoration: underline;
}

.cookie-notice button {
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--color-text);
  background: var(--color-accent-bg);
  border: 1px solid var(--color-accent-subtle);
  border-radius: 0.25rem;
  padding: 0.35em 1em;
  cursor: pointer;
  transition: background-color 0.15s ease;
  white-space: nowrap;
}

.cookie-notice button:hover {
  background: var(--color-accent-bg-hover);
}

/* ── Responsive ── */

@media (max-width: 480px) {
  /* Landing: switch from absolute footer to natural flow */
  .landing {
    justify-content: flex-start;
    padding: 15vh 1rem 0;
    min-height: 100vh;
    min-height: 100dvh;
  }

  .landing-footer {
    position: static;
    margin-top: auto;
    padding-bottom: 1rem;
  }

  .site-footer {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 0.75rem;
  }

  .site-footer__copy,
  .site-footer__nav,
  .site-footer__meta {
    justify-self: center;
  }

  .logo {
    width: 90vw;
    margin-bottom: 1.5rem;
  }

  /* Modal: full-width on small screens */
  .modal {
    width: calc(100vw - 1.5rem);
    padding: 2rem 1.25rem 1.5rem;
    border-radius: 0.5rem;
  }

  /* CTA: full-width for easier tap */
  .cta {
    padding: 0.75em 2.5em;
  }

  /* Subpages: tighter padding */
  body.page {
    padding: 0 1rem 3rem;
  }

  /* Footer nav: tighter gaps */
  .site-footer__nav {
    gap: 0.3rem 1rem;
  }

  /* Back link: larger touch target */
  .back-link {
    display: inline-block;
    padding: 0.5rem 0;
  }

  /* Service description: tighter bottom margin */
  .service-description {
    margin-bottom: 0.5rem;
  }
}

@media (max-width: 360px) {
  /* Very small screens: single-column form */
  .form-row-half {
    flex-direction: column;
  }

  .tagline {
    text-align: center;
  }
}
