/* Weave */

:root {
  --navy: #283150;
  --navy-light: #3d4a6b;
  --teal: #2d9a9a;
  --teal-light: #4fb8b8;
  --orange: #e8913a;
  --orange-warm: #f5a623;
  --purple: #7b5ba6;
  
  --white: #fafafa;
  --grey-light: #f0f0f0;
  --grey: #6b7280;
  --grey-dark: #374151;
  
  --font-display: 'Source Serif 4', 'Georgia', serif;
  --font-body: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
  
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 2rem;
  --space-lg: 4rem;
  --space-xl: 8rem;
}

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

html {
  font-size: 18px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  color: var(--navy);
  background-color: var(--white);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.3;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }

p { max-width: 65ch; }

a {
  color: var(--teal);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover { color: var(--navy); }

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

/* Teaser Page */
.teaser {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: var(--space-lg) var(--space-md);
  min-height: 100vh;
}

.teaser__logo {
  max-width: 500px;
  width: 100%;
  height: auto;
  margin-bottom: var(--space-lg);
}

.teaser__message {
  max-width: 540px;
  margin-bottom: var(--space-lg);
}

.teaser__message p {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--grey-dark);
  line-height: 1.7;
  margin: 0 auto;
}

/* Email Signup */
.signup {
  width: 100%;
  max-width: 420px;
  margin-bottom: var(--space-lg);
}

.signup__form {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.signup__input {
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.875rem 1.25rem;
  border: 1px solid var(--grey-light);
  border-radius: 4px;
  background: var(--white);
  color: var(--navy);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.signup__input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(45, 154, 154, 0.1);
}

.signup__input::placeholder { color: var(--grey); }

.signup__button {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  padding: 0.875rem 1.5rem;
  background: var(--orange);
  color: var(--white);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.signup__button:hover { background: var(--orange-warm); }
.signup__button:active { transform: scale(0.98); }

.teaser__note {
  font-size: 0.875rem;
  color: var(--grey);
  font-style: italic;
}

.teaser::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    radial-gradient(circle at 20% 80%, rgba(45, 154, 154, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(232, 145, 58, 0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

/* Home Page Content (descriptor + body) */
.home__content {
  max-width: 560px;
  margin: 0 auto var(--space-lg) auto;
  padding: 0 var(--space-sm);
}

.home__content h2 {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 1.65rem;
  line-height: 1.4;
  color: var(--navy);
  letter-spacing: 0.005em;
  margin-bottom: var(--space-md);
  text-align: center;
}

.home__content p {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--grey-dark);
  line-height: 1.7;
  margin: 0 0 1.1em 0;
  text-align: left;
  max-width: none;
}

.home__content p:last-child {
  margin-bottom: 0;
}

/* Navigation */
.nav {
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--grey-light);
}

.nav__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav__logo {
  height: 40px;
  width: auto;
}

.nav__links {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-xs) var(--space-md);
  list-style: none;
}

/* Hamburger toggle — hidden at desktop, shown below the breakpoint (see
   the 768px media query at the foot of this file). */
.nav__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  background: none;
  border: none;
  cursor: pointer;
}

.nav__toggle-bar {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--navy);
  border-radius: 2px;
}

.nav__toggle:hover .nav__toggle-bar { background: var(--teal); }

.nav__toggle:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.nav__link {
  color: var(--navy);
  font-size: 0.9375rem;
}

.nav__link:hover { color: var(--teal); }

/* Primary nav dropdown (About) */
.nav__item--has-dropdown {
  position: relative;
}

.nav__dropdown-trigger {
  font-family: inherit;
  font-size: 0.9375rem;
  color: var(--navy);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  line-height: inherit;
}

.nav__dropdown-trigger::after {
  content: "\25BE"; /* ▾ */
  font-size: 0.7rem;
  line-height: 1;
}

.nav__dropdown-trigger:hover,
.nav__item--has-dropdown:focus-within .nav__dropdown-trigger {
  color: var(--teal);
}

.nav__dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  left: auto;
  display: none;
  min-width: 9rem;
  margin: 0;
  padding: var(--space-xs) 0;
  list-style: none;
  background: #ffffff;
  border: 1px solid var(--grey-light);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(40, 49, 80, 0.12);
  z-index: 1000;
}

.nav__item--has-dropdown:hover .nav__dropdown,
.nav__item--has-dropdown:focus-within .nav__dropdown {
  display: block;
}

.nav__dropdown li {
  list-style: none;
}

.nav__dropdown .nav__link {
  display: block;
  padding: var(--space-xs) var(--space-sm);
  white-space: nowrap;
}

.nav__dropdown .nav__link:hover {
  background: var(--grey-light);
  color: var(--teal);
}

.nav__dropdown-trigger:focus-visible,
.nav__dropdown .nav__link:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

/* Article/Content Pages */
.article {
  padding: var(--space-lg) 0;
}

.article__header {
  margin-bottom: var(--space-md);
}

.article__title {
  margin-bottom: var(--space-xs);
}

.article__meta {
  font-size: 0.875rem;
  color: var(--grey);
}

.article__content {
  max-width: 65ch;
}

.article__content p {
  margin-bottom: 1.5em;
}

.article__content h2 {
  margin-top: 2em;
  margin-bottom: 0.75em;
}

.article__content h3 {
  margin-top: 1.75em;
  margin-bottom: 0.5em;
  font-size: 1.15rem;
}

.article__content ul,
.article__content ol {
  margin-bottom: 1.5em;
  padding-left: 1.5em;
}

.article__content li {
  margin-bottom: 0.5em;
}

.article__content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 0.9375rem;
}

.article__content th,
.article__content td {
  padding: 0.75em 1em;
  text-align: left;
  border-bottom: 1px solid var(--grey-light);
}

.article__content th {
  font-weight: 600;
  color: var(--navy);
  background: var(--grey-light);
}

.article__content tr:hover {
  background: rgba(45, 154, 154, 0.03);
}

.article__content blockquote {
  margin: 1.5em 0;
  padding-left: 1.5em;
  border-left: 3px solid var(--teal);
  color: var(--grey-dark);
  font-style: italic;
}

.article__content hr {
  border: none;
  border-top: 1px solid var(--grey-light);
  margin: 2em 0;
}

.article__content strong {
  font-weight: 600;
  color: var(--navy);
}

.article__content em {
  font-style: italic;
}

/* Weave page (conceptual long-form) */
.weave-page .article__content {
  max-width: 700px;
}

/* Diagrams are wrapped in a button that opens the lightbox (render-image hook). */
.weave-page .article__content .diagram-trigger {
  display: block;
  width: 90%;
  margin: var(--space-md) auto;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  -webkit-appearance: none;
  appearance: none;
}

.weave-page .article__content .diagram-trigger img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
}

.weave-page .article__content .diagram-trigger:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 4px;
}

/* Lightbox (native <dialog>, used by the Weave-page diagrams) */
.lightbox {
  max-width: 90vw;
  max-height: 90vh;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
  /* Restore modal centring: the global '* { margin: 0 }' reset overrides the
     UA dialog's margin:auto, which would otherwise pin the modal top-left. */
  margin: auto;
}

.lightbox::backdrop {
  background: rgba(20, 24, 40, 0.85);
}

.lightbox__image {
  display: block;
  max-width: 90vw;
  max-height: 90vh;
  width: auto;
  height: auto;
}

.lightbox__close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--white);
  background: rgba(20, 24, 40, 0.7);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.lightbox__close:hover,
.lightbox__close:focus-visible {
  background: var(--navy);
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

/* Responsive primary nav.
   768px is the single source of truth for the desktop/mobile split: at and
   above it the horizontal nav and hover dropdown apply unchanged; below it the
   hamburger toggle drives an inline, stacked menu with click-toggled About. */
@media (max-width: 768px) {
  /* Let the open menu wrap onto its own full-width row below the brand. */
  .nav__inner {
    flex-wrap: wrap;
  }

  .nav__toggle {
    display: flex;
  }

  /* Hidden until the hamburger sets data-open="true". */
  .nav__links {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0;
    margin-top: var(--space-xs);
  }

  .nav__links[data-open="true"] {
    display: flex;
  }

  /* Generous tap targets (44px min) for every menu item. */
  .nav__links > li {
    width: 100%;
  }

  .nav__links .nav__link,
  .nav__dropdown-trigger {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 44px;
    padding: var(--space-xs) var(--space-sm);
  }

  .nav__dropdown-trigger {
    justify-content: space-between;
  }

  /* About submenu becomes an inline, indented, click-toggled block. */
  .nav__dropdown {
    position: static;
    min-width: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: var(--grey-light);
  }

  .nav__dropdown .nav__link {
    padding-left: var(--space-md);
  }

  /* Neutralise the desktop hover/focus reveal; click-driven state wins. */
  .nav__item--has-dropdown:hover .nav__dropdown,
  .nav__item--has-dropdown:focus-within .nav__dropdown {
    display: none;
  }

  .nav__item--has-dropdown[data-expanded="true"] .nav__dropdown {
    display: block;
  }
}

/* Responsive */
@media (max-width: 640px) {
  html { font-size: 16px; }
  .teaser { padding: var(--space-md); }
  .teaser__logo {
    max-width: 320px;
    margin-bottom: var(--space-md);
  }
  .teaser__message { margin-bottom: var(--space-md); }
  .teaser__message p { font-size: 1.15rem; }
  .home__content h2 { font-size: 1.4rem; }
  .home__content p { font-size: 1rem; }
  .weave-page .article__content .diagram-trigger { width: 100%; }
}
