:root {
  --bg: #F5F9FF;
  --surface: #FFFFFF;
  --accent: #2049C9;
  --accent-soft: rgba(32, 73, 201, 0.08);
  --text-muted: #5B6B8C;
  --text: #0D1B3E;
  --border: #D3E1F7;
  --shadow: rgba(13, 27, 62, 0.08);
  --error: #C0392B;
  --success: #1E7B4D;
  --footer-bg: #0D1B3E;
  --footer-text: #8CA0C4;
  --font-heading: "Space Grotesk", "Segoe UI", sans-serif;
  --font-body: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Spacing scale (4px base) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Typography scale */
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-md: 1.125rem;
  --font-size-lg: 1.25rem;
  --font-size-xl: 1.5rem;
  --font-size-2xl: 1.875rem;
  --font-size-3xl: 2.25rem;
  --font-size-4xl: 3rem;

  --leading-tight: 1.2;
  --leading-snug: 1.35;
  --leading-normal: 1.6;

  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* Radius scale */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 999px;

  --touch-target: 44px;
}

[data-theme="dark"] {
  --bg: #0C1428;
  --surface: #17233F;
  --accent: #4C7DFF;
  --accent-soft: rgba(76, 125, 255, 0.14);
  --text-muted: #8CA0C4;
  --text: #EAF1FF;
  --border: #263559;
  --shadow: rgba(0, 0, 0, 0.35);
  --error: #FF8A80;
  --success: #6FE3A0;
  --footer-bg: #060B18;
  --footer-text: #8CA0C4;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

*,
*::before,
*::after {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

html {
  scroll-behavior: smooth;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  background: var(--bg);
  color: var(--text);
  line-height: var(--leading-normal);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  background: var(--accent);
  color: #FFFFFF;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-sm);
  z-index: 100;
  text-decoration: none;
}

.skip-link:focus {
  top: var(--space-4);
}

header {
  position: sticky;
  top: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 12px -8px var(--shadow);
}

nav {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-8);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  justify-self: start;
  text-decoration: none;
}

.brand-icon {
  display: block;
  border-radius: var(--radius-md);
}

.brand-name {
  font-family: var(--font-heading);
  font-weight: var(--weight-semibold);
  font-size: var(--font-size-md);
  color: var(--text);
}

.accent-text {
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: var(--space-6);
  list-style: none;
  flex-wrap: wrap;
  justify-self: center;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: var(--weight-medium);
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--accent);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: end;
  width: var(--touch-target);
  height: var(--touch-target);
  flex-shrink: 0;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  display: none;
}

main {
  flex: 1 0 auto;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: var(--space-8);
}

#contact {
  padding: var(--space-16) 0;
  text-align: center;
}

.section-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: var(--space-4);
}

.section-icon svg {
  width: 26px;
  height: 26px;
}

#contact h1 {
  font-family: var(--font-heading);
  font-weight: var(--weight-bold);
  font-size: var(--font-size-3xl);
}

.section-intro {
  color: var(--text-muted);
  margin-top: var(--space-2);
}

.contact-card {
  margin-top: var(--space-8);
  padding: var(--space-8);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 1px 3px var(--shadow);
  text-align: left;
}

form {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.field-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.field-row .field {
  flex: 1 1 160px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.field[hidden] {
  display: none;
}

#company-field {
  overflow: hidden;
  max-height: 100px;
  opacity: 1;
  transition: max-height 0.3s ease, opacity 0.25s ease;
}

#company-field.is-collapsing {
  max-height: 0;
  opacity: 0;
}

.field label,
.field-label {
  font-size: var(--font-size-sm);
  font-weight: var(--weight-medium);
  color: var(--text);
}

.field-optional {
  font-weight: var(--weight-normal);
  color: var(--text-muted);
}

input,
textarea,
select {
  padding: var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: var(--font-size-base);
  min-height: var(--touch-target);
}

textarea {
  resize: vertical;
}

input:invalid[data-touched="true"],
textarea:invalid[data-touched="true"],
select:invalid[data-touched="true"] {
  border-color: var(--error);
}

.segmented {
  display: inline-flex;
  width: fit-content;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.segmented input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.segmented label {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch-target);
  padding: var(--space-2) var(--space-5);
  font-size: var(--font-size-sm);
  font-weight: var(--weight-medium);
  color: var(--text-muted);
  cursor: pointer;
}

.segmented input:checked + label {
  background: var(--accent);
  color: #FFFFFF;
}

.segmented input:focus-visible + label {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

button {
  padding: var(--space-3);
  border: none;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: #FFFFFF;
  font-weight: var(--weight-semibold);
  font-size: var(--font-size-base);
  cursor: pointer;
  min-height: var(--touch-target);
  transition: background-color 0.3s ease, color 0.3s ease, opacity 0.2s ease;
}

button:hover {
  opacity: 0.9;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

#contact-status {
  margin-top: var(--space-5);
  font-size: var(--font-size-sm);
}

#contact-status[data-state="success"] {
  color: var(--success);
}

#contact-status[data-state="error"] {
  color: var(--error);
}

footer {
  text-align: center;
  padding: var(--space-8);
  background: var(--footer-bg);
  color: var(--footer-text);
}

.footer-links {
  margin-top: var(--space-2);
  font-size: var(--font-size-sm);
}

.footer-links a {
  color: inherit;
  text-decoration: underline;
  opacity: 0.8;
}

.footer-links a:hover,
.footer-links a:focus-visible {
  opacity: 1;
}

.footer-links span {
  margin: 0 var(--space-2);
  opacity: 0.5;
}

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

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
