/* ==========================================================================
   site.css — shared foundation for nsit.ca
   Brand tokens, reset, and layout primitives used by every page.
   Link this BEFORE each page's own styles.css:
     <link rel="stylesheet" href="/site.css" />
     <link rel="stylesheet" href="styles.css" />
   Page-specific tokens (e.g. --shadow, --mono) stay in the page's stylesheet.
   ========================================================================== */

:root {
  --rose: #f0426b;
  --gold: #fcb215;
  --navy: #1f2a44;
  --light-blue: #e6edf5;
  --off-white: #f7f5f0;
  --white: #ffffff;
  --black: #000000;
  --container: 1280px;
  --page: 1680px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  /* Offset in-page anchor jumps so targets clear the sticky header bar. */
  scroll-padding-top: 90px;
}

body {
  margin: 0;
  background: #d9d9d9;
  color: var(--navy);
  font-family: "Inter", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

.page-shell {
  width: min(100%, var(--page));
  margin: 0 auto;
  /* `clip`, not `hidden`: still contains the homepage hero art, but does
     not become a scroll container — a scroll container would trap the
     sticky .site-header-bar inside it. */
  overflow: clip;
  background: var(--white);
}

.container {
  width: min(var(--container), calc(100% - 48px));
  margin-inline: auto;
}

/* ==========================================================================
   Site header / primary nav — shared across every page.
   Each page's stylesheet keeps its own responsive (mobile-menu) rules.
   ========================================================================== */

/* Sticky wrapper — pins the header to the top of the viewport on scroll.
   Spans the full page-shell width; the header inside keeps its .container
   width. The off-white fill matches every page's hero area, so the bar is
   seamless at a page's top and only reads as a distinct bar once content
   scrolls beneath it. Needs .page-shell { overflow: clip }. */
.site-header-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--off-white);
  box-shadow: 0 4px 16px rgba(31, 42, 68, 0.07);
}

/* Bar thickness — desktop (row header) and mobile (hamburger) get a
   thicker bar; the 761–1400 stacked-header range stays compact since
   that column header is already tall on its own. */
@media (min-width: 1401px) {
  .site-header-bar {
    padding: 30px 0;
  }
}

@media (max-width: 760px) {
  .site-header-bar {
    padding: 15px 0;
  }
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 64px;
  min-height: 45px;
}

.brand {
  flex: 0 0 auto;
}

.brand img {
  width: 208px;
  height: auto;
  display: block;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 65px;
  font-size: 15px;
  font-weight: 600;
}

.main-nav a {
  position: relative;
  padding: 12px 0;
  transition: color 160ms ease;
}

.main-nav a:hover,
.main-nav .active {
  color: var(--rose);
}

.menu-toggle {
  display: none;
}

/* Sign-in button — SSO is not live yet.
   The label reads "Sign In" and swaps to "SSO Coming Soon" on hover while a
   pale-grey circle sweeps up to fill the button — the same radial-fill effect
   as the .outline-button "Launch Tool" buttons.
   WHEN SSO LAUNCHES, flip the two custom properties below to the rose variant:
     --sign-in-fill: var(--rose);  --sign-in-fill-text: var(--white); */
.sign-in {
  --sign-in-fill: var(--light-blue);
  --sign-in-fill-text: var(--navy);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 158px;
  padding: 10px 24px !important;
  border-radius: 8px;
  background: var(--navy);
  color: var(--off-white);
  overflow: hidden;
  transition: color 160ms ease;
}

/* Radial-sweep fill: a dot tucked below the button that expands to cover it. */
.sign-in::before {
  position: absolute;
  left: 50%;
  top: 52px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--sign-in-fill);
  content: "";
  transform: translateX(-50%);
  transition:
    top 180ms ease,
    width 180ms ease,
    height 180ms ease,
    transform 180ms ease;
}

.sign-in-label,
.sign-in-alt {
  z-index: 1;
  transition: opacity 160ms ease;
}

.sign-in-label {
  position: relative;
}

/* Hover label, stacked on top of "Sign In" so the button never reflows. */
.sign-in-alt {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}

/* Hover effect is pointer-only — touch devices keep the plain "Sign In". */
@media (hover: hover) {
  .sign-in:hover {
    color: var(--sign-in-fill-text);
  }

  .sign-in:hover::before {
    top: -96px;
    width: 230px;
    height: 230px;
  }

  .sign-in:hover .sign-in-label {
    opacity: 0;
  }

  .sign-in:hover .sign-in-alt {
    opacity: 1;
  }
}

/* ==========================================================================
   Waitlist modal — shared "Notify Me" dialog used by the tool cards.
   ========================================================================== */

.wl-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

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

.wl-overlay {
  position: absolute;
  inset: 0;
  background: rgba(31, 42, 68, 0.55);
}

.wl-dialog {
  position: relative;
  width: min(440px, 100%);
  padding: 40px;
  background: var(--white);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(31, 42, 68, 0.35);
  animation: wl-pop 160ms ease;
}

@keyframes wl-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.wl-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--navy);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.wl-close:hover {
  background: var(--off-white);
  color: var(--rose);
}

.wl-eyebrow {
  margin: 0 0 10px;
  color: var(--rose);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.wl-dialog h2 {
  margin: 0 0 10px;
  font-family: "Faculty Glyphic", Georgia, serif;
  font-weight: 400;
  font-size: 28px;
  line-height: 1.2;
  color: var(--navy);
}

.wl-lede {
  margin: 0 0 22px;
  color: var(--navy);
  font-size: 16px;
  line-height: 1.5;
}

.wl-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wl-input {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid rgba(31, 42, 68, 0.25);
  border-radius: 10px;
  font: inherit;
  font-size: 16px;
  color: var(--navy);
}

.wl-input:focus {
  outline: none;
  border-color: var(--rose);
}

.wl-submit {
  padding: 14px 20px;
  border: 0;
  border-radius: 10px;
  background: var(--rose);
  color: var(--white);
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background 160ms ease;
}

.wl-submit:hover {
  background: var(--navy);
}

.wl-submit:disabled {
  opacity: 0.6;
  cursor: default;
}

.wl-error {
  margin: 12px 0 0;
  color: var(--rose);
  font-size: 14px;
}

.wl-success {
  text-align: center;
}

.wl-check {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--navy);
  font-size: 28px;
  font-weight: 700;
}

.wl-success p {
  margin: 0 0 22px;
  color: var(--navy);
  font-size: 16px;
}

.wl-done {
  width: 100%;
}

/* ==========================================================================
   Footer watermark — subtle link. Looks like the surrounding text by
   default, rolls over to rose on hover. (The watermark layout itself
   stays in each page's footer CSS, per the README note.)
   ========================================================================== */

.watermark a,
.footer-disclaimer a {
  color: inherit;
  text-decoration: none;
  transition: color 160ms ease;
}

.watermark a:hover,
.footer-disclaimer a:hover {
  color: var(--rose);
}

/* Footer disclaimer — single message under the divider, with an info icon.
   The grid-column rule lets the single <p> span the existing two-column
   .footer-bottom grid so we don't need to touch each page's layout CSS. */
.footer-bottom p {
  grid-column: 1 / -1;
}

.footer-disclaimer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

/* Desktop footer layout — widen the watermark column so the long
   disclaimer wraps to two lines instead of three, and keep the four
   nav links on a single row. The per-page rules use a 380px middle
   column with 112px gaps; this widens the middle to 580px and
   tightens the column gap to 64px so the nav still fits. The per-page
   footer-nav rules use repeat(3, max-content), which would wrap with
   four links — overridden here to four columns. Mobile/tablet rules
   in each page's stylesheet still apply at <=1400px. */
@media (min-width: 1401px) {
  .footer-top {
    grid-template-columns: 177px 580px 1fr !important;
    gap: 64px !important;
  }

  .footer-nav {
    grid-template-columns: repeat(4, max-content) !important;
    gap: 24px !important;
  }
}

/* ==========================================================================
   Mobile-menu pattern — sitewide, opt-in.

   Pages that want the hamburger mobile menu add class="has-mobile-menu" to
   <body>. The page HTML then needs the standard header structure:
   <header class="site-header"> with .brand, <button class="menu-toggle">
   (three <span> bars), and <nav class="main-nav" id="primary-navigation">,
   plus the inline menu-toggle script (copy from tools/NSchart/index.html).

   The existing content pages (homepage, tools, about, notices) keep their
   own per-page mobile-menu rules for now — they were built with different
   historical breakpoints (760 vs 820), so they haven't been migrated to
   this shared pattern. This pattern is for NSchart and any new page.
   ========================================================================== */
@media (max-width: 820px) {
  .has-mobile-menu .site-header {
    position: relative;
    z-index: 20;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0;
    min-height: 44px;
  }

  .has-mobile-menu .site-header.menu-open::before {
    position: absolute;
    z-index: -1;
    top: -20px;
    left: -20px;
    width: 390px;
    height: 421px;
    background: var(--off-white);
    content: "";
  }

  .has-mobile-menu .brand img {
    width: 177px;
  }

  .has-mobile-menu .menu-toggle {
    position: relative;
    z-index: 2;
    display: block;
    width: 44px;
    height: 40px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
  }

  .has-mobile-menu .menu-toggle span {
    position: absolute;
    right: 0;
    display: block;
    width: 44px;
    height: 4px;
    border-radius: 13px;
    background: var(--black);
    transition:
      transform 180ms ease,
      opacity 180ms ease;
  }

  .has-mobile-menu .menu-toggle span:nth-child(1) { top: 0; }
  .has-mobile-menu .menu-toggle span:nth-child(2) { top: 18px; }
  .has-mobile-menu .menu-toggle span:nth-child(3) { top: 36px; }

  .has-mobile-menu .site-header.menu-open .menu-toggle span:nth-child(1) {
    top: 18px;
    transform: rotate(45deg);
  }

  .has-mobile-menu .site-header.menu-open .menu-toggle span:nth-child(2) {
    opacity: 0;
  }

  .has-mobile-menu .site-header.menu-open .menu-toggle span:nth-child(3) {
    top: 18px;
    transform: rotate(-45deg);
  }

  .has-mobile-menu .main-nav {
    position: absolute;
    top: 72px;
    left: 33px;
    right: 33px;
    display: grid;
    width: auto;
    gap: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
    transition:
      opacity 180ms ease,
      transform 180ms ease;
  }

  .has-mobile-menu .site-header.menu-open .main-nav {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .has-mobile-menu .main-nav a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 46px;
    padding: 0;
    border-bottom: 1px solid var(--navy);
    color: var(--black);
    font-size: 20px;
    font-weight: 400;
    line-height: 1.2;
    text-align: left;
  }

  .has-mobile-menu .main-nav a:hover,
  .has-mobile-menu .main-nav .active {
    color: var(--black);
    font-weight: 600;
  }

  .has-mobile-menu .main-nav a::after {
    display: inline-block;
    width: 18px;
    height: 18px;
    background: currentColor;
    color: var(--black);
    content: "";
    -webkit-mask: url("data:image/svg+xml,%3Csvg width='14' height='14' viewBox='0 0 14 14' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M-6.2212e-05 7.95429V5.91425H9.93812L5.03453 1.42242L6.43823 3.24784e-06L13.1011 6.26985V7.57997L6.43823 13.8498L5.01582 12.4087L9.90068 7.95429H-6.2212e-05Z' fill='%23000'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg width='14' height='14' viewBox='0 0 14 14' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M-6.2212e-05 7.95429V5.91425H9.93812L5.03453 1.42242L6.43823 3.24784e-06L13.1011 6.26985V7.57997L6.43823 13.8498L5.01582 12.4087L9.90068 7.95429H-6.2212e-05Z' fill='%23000'/%3E%3C/svg%3E") center / contain no-repeat;
  }

  .has-mobile-menu .main-nav a:last-child {
    border-bottom: 0;
  }

  .has-mobile-menu .sign-in {
    min-width: 0;
    margin-top: 0;
    padding: 0 !important;
    border-radius: 0;
    background: transparent;
    color: var(--black) !important;
    text-align: left !important;
  }

  .has-mobile-menu .sign-in:hover {
    background: transparent;
    color: var(--black) !important;
  }
}
