/* Styles for the home page (index.html). Kept in its own file so the
   Content-Security-Policy in netlify.toml can block inline styles. */

  /* ============ Fonts ============
     Cambria where installed; Caladea (SIL OFL, same letter widths as Cambria) everywhere else.
     Both families only ship Regular and Bold — there is no in-between weight. */
  @font-face { font-family: "Caladea"; src: url("Caladea-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
  @font-face { font-family: "Caladea"; src: url("Caladea-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
  /* Radnika Next (licensed): hero heading (Bold), buttons (Semibold), form field labels (Light) */
  @font-face { font-family: "Radnika Next"; src: url("radnika-next-light.woff2") format("woff2"); font-weight: 300; font-display: swap; }
  @font-face { font-family: "Radnika Next"; src: url("radnika-next-semibold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
  @font-face { font-family: "Radnika Next"; src: url("radnika-next-bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

  /* ============ CONFIG: brand values ============ */
  :root {
    --font: Cambria, "Caladea", Georgia, serif;
    --font-brand: "Radnika Next", Helvetica, Arial, sans-serif;
    --pill-bg: #ff4632;          /* Apple notification red, nudged slightly orange */
    --pill-fg: #ffffff;
    --pill-size: clamp(16px, 2.6vw, 28px);
    --pill-weight: 400;          /* Regular... */
    --pill-stroke: 0.014em;      /* ...thickened slightly toward a medium. Set 0 for plain Regular */
    --ink: #ffffff;
    --button-bg: #222829;
    --button-fg: #ffffff;
    --grow-ms: 700ms;
    --roll-ms: 456ms;            /* set from JS */
    --morph-ms: 840ms;           /* set from JS */
    --tracking: 0.035em;         /* extra space between letters in the pill phrases */
    --line: 1.3em;               /* height of one rolling line */
    --wheel-r: calc(var(--line) * 1.539); /* radius of a 10-sided letter wheel */
  }

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

  body { font-family: var(--font); color: var(--ink); background: #2390b3; }
  body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background: url("background.webp") center / cover no-repeat;
  }

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

  /* ============ Stage ============
     The hero layout is in place from the start (art and copy just hidden),
     so the pill can be pinned to where the notepad will land. */
  .stage {
    position: relative;
    overflow: hidden;
    min-height: 100svh;
    display: grid;
    /* space above, hero, space below, footer. The hero sits slightly above center:
       the space above gets 0.85 shares of the leftover height and the space below 1.15 */
    grid-template-rows: 0.85fr auto 1.15fr auto;
    place-items: center;
  }
  .stage > .hero { grid-row: 2; }
  .stage > .site-footer { grid-row: 4; }
  .notif-anchor {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 1;
    transform: translate(-50%, -50%);
  }

  /* The pill is a link to /services once it shows the industries. It looks exactly
     like the pill: no underline, just a faint brighten on hover */
  .notif-link {
    display: inline-flex;
    color: inherit;
    text-decoration: none;
    border-radius: calc(var(--pill-size) * 0.55);
    -webkit-tap-highlight-color: transparent;
  }
  .notif-link:hover .notif { filter: brightness(1.06); }
  .notif-link:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }

  /* ============ The pill ============ */
  .notif {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 0.45em 0.7em;
    font-size: var(--pill-size);
    font-weight: var(--pill-weight);
    -webkit-text-stroke: var(--pill-stroke) currentColor;
    color: var(--pill-fg);
    background: var(--pill-bg);
    border-radius: 0.55em;
    box-shadow: 0 0.4em 1.2em rgb(0 0 0 / 0.22);
    transform-origin: 50% 120%;
    opacity: 0;
    transform: scale(0.6) translateY(0.4em);
    transition: opacity 400ms ease, transform 600ms cubic-bezier(0.34, 1.56, 0.64, 1);
  }
  .notif.is-in { opacity: 1; transform: none; }
  .notif::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -0.38em;
    width: 0.8em;
    height: 0.8em;
    background: inherit;
    border-radius: 0.12em;
    transform: translateX(-50%) rotate(45deg);
    z-index: -1;
  }

  .notif__viewport {
    position: relative;
    height: var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: width var(--morph-ms) cubic-bezier(0.22, 1, 0.36, 1);
  }
  .layer { display: flex; align-items: center; flex: none; white-space: nowrap; }
  .layer--text { gap: var(--tracking); }
  /* width: max-content stops the outgoing row from being squeezed when it's taken out of the flow */
  .layer.is-leaving { position: absolute; left: 50%; top: 50%; width: max-content; transform: translate(-50%, -50%); }

  /* ============ Industries reel (the pill's final state) ============
     After "Industries served:" each industry rolls in as a whole phrase:
     the old one tips up and out, the new one comes up from below. */
  .ind-reel {
    position: relative;
    display: inline-block;
    flex: none;
    height: var(--line);
    margin-left: 0.3em;
    overflow: hidden;
    transition: width var(--ind-roll-ms) cubic-bezier(0.22, 1, 0.36, 1);
  }
  .ind-label, .ind-item {
    line-height: var(--line);
    white-space: pre;
    letter-spacing: var(--tracking);
    transition: transform var(--ind-roll-ms) cubic-bezier(0.22, 1, 0.36, 1), opacity var(--ind-roll-ms) ease;
  }
  .ind-label { display: inline-block; flex: none; }
  .ind-item { position: absolute; left: 0; top: 0; }
  .ind-label.is-below, .ind-item.is-below { transform: translateY(90%) scaleY(0.4); opacity: 0; }
  .ind-item.is-above { transform: translateY(-90%) scaleY(0.4); opacity: 0; }

  /* ============ Counter slots ============ */
  .slot {
    display: grid;
    grid-template-columns: 0fr;
    transition: grid-template-columns var(--grow-ms) cubic-bezier(0.22, 1, 0.36, 1);
  }
  .slot.is-open { grid-template-columns: 1fr; }
  .slot__inner { overflow: hidden; display: flex; align-items: center; gap: 0.28em; min-width: 0; }
  .slot__icon {
    width: 1em;
    height: 1em;
    flex: none;
    opacity: 0;
    transform: scale(0.3) rotate(-25deg);
    transition: opacity 300ms ease 150ms, transform 500ms cubic-bezier(0.34, 1.56, 0.64, 1) 150ms;
  }
  .slot + .slot .slot__icon { margin-left: 0.7em; }
  .slot.is-open .slot__icon { opacity: 1; transform: none; }

  .num { display: inline-flex; line-height: 1; height: 1em; }
  .num__digit { display: inline-block; height: 1em; overflow: hidden; }
  .num__reel {
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform var(--roll-ms) cubic-bezier(0.22, 1, 0.36, 1);
  }
  .num__reel span { height: 1em; line-height: 1; }
  .num__comma { line-height: 1; }

  /* ============ Letter wheels ============
     Each letter is a 10-sided drum in 3D. Rotating the drum turns the faces
     over the top edge like an odometer wheel; the hidden sizer keeps each
     cell exactly as wide as its final letter. */
  .tcell {
    position: relative;
    display: inline-block;
    height: var(--line);
    overflow: hidden;
    perspective: 5em;
  }
  .tcell__sizer { display: block; visibility: hidden; line-height: var(--line); white-space: pre; }
  .tcell__drum {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
    transform: translateZ(calc(var(--wheel-r) * -1)) rotateX(0deg);
  }
  .tcell__face {
    position: absolute;
    inset: 0;
    text-align: center;
    line-height: var(--line);
    white-space: pre;
    backface-visibility: hidden;
  }
  /* Once a wheel stops, show the flat letter instead of the 3D drum so it sits
     crisp and level on the baseline (3D-rendered text lands at fractional pixels) */
  .tcell.is-landed .tcell__sizer { visibility: visible; }
  .tcell.is-landed .tcell__drum { visibility: hidden; }

  /* ============ Hero ============ */
  .hero {
    width: min(1200px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    align-items: center;
    gap: clamp(1.5rem, 4vw, 4rem);
    --hero-pad: clamp(1.5rem, 5vw, 5rem);
    padding: var(--hero-pad);
    /* 15% of the top padding moves to the bottom: same total height, content sits a little higher */
    padding-top: calc(var(--hero-pad) * 0.85);
    padding-bottom: calc(var(--hero-pad) * 1.15);
  }
  .hero__art-wrap {
    position: relative;
    z-index: 2;            /* notepad lands in front of the pill */
    width: 100%;
    max-width: 640px;
    justify-self: center;
  }
  .hero__art {
    display: block;
    width: 100%;
    height: auto;
    transform: translateY(-120vh); /* parked above the screen until it drops */
  }
  .hero__art.is-landed { transform: none; }

  /* Company name: parked above the screen, drops in with the notepad */
  .brand {
    position: absolute;
    top: clamp(1rem, 3vw, 2.25rem);
    left: clamp(1rem, 3vw, 2.5rem);
    z-index: 3;
    width: clamp(130px, 14vw, 210px);
    height: auto;
    opacity: 0;
    transition: opacity 1000ms ease;
  }
  .brand.is-in { opacity: 1; }

  /* Footer: privacy link bottom-left, copyright bottom-right; fades in with the hero copy */
  .site-footer {
    justify-self: stretch;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem clamp(1rem, 3vw, 2.5rem) clamp(1rem, 2.5vw, 1.75rem);
    font-size: 0.85rem;
    color: rgb(255 255 255 / 0.85);
    opacity: 0;
    transition: opacity 1000ms ease;
  }
  .site-footer.is-in { opacity: 1; }
  .site-footer a { color: inherit; text-underline-offset: 0.2em; }
  .site-footer a:hover { color: #fff; }
  .site-footer a:focus-visible { outline: 2px solid #fff; outline-offset: 3px; border-radius: 2px; }

  .hero__copy h1 {
    font-family: var(--font-brand);
    font-size: clamp(1.75rem, 3.3vw, 2.4rem);
    line-height: 1.12;
    font-weight: 700;
    margin-bottom: 0.4em;
    text-wrap: balance;
  }
  .hero__copy p { text-wrap: pretty; font-size: clamp(1.1rem, 1.5vw, 1.3rem); line-height: 1.5; margin-bottom: 1.5em; color: rgb(255 255 255 / 0.92); }

  /* ============ Buttons ============
     Every button: dark, with a lit top edge, a soft shadow, and a highlight that
     follows the cursor (--glow-x/y are set from JS). The hero button adds the
     glass look on top (.btn--glass). */
  .btn {
    --glow-x: 50%;
    --glow-y: 0%;
    position: relative;
    isolation: isolate;          /* keeps the cursor highlight between the fill and the text */
    display: inline-block;
    padding: 0.85rem 1.6rem;
    font: 600 1rem var(--font-brand);
    text-decoration: none;       /* for links styled as buttons */
    color: var(--button-fg);
    background: linear-gradient(180deg, #343c3d, var(--button-bg));
    border: 0;
    border-radius: 0.75rem;
    box-shadow:
      inset 0 1px 0 rgb(255 255 255 / 0.16),   /* lit top edge */
      inset 0 -1px 0 rgb(0 0 0 / 0.3),
      0 1px 2px rgb(0 0 0 / 0.12),
      0 6px 16px -6px rgb(0 0 0 / 0.4);
    cursor: pointer;
    transition: translate 220ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 220ms ease, scale 120ms ease;
  }
  /* The highlight that follows the cursor */
  .btn::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    background: radial-gradient(7rem circle at var(--glow-x) var(--glow-y), rgb(255 255 255 / 0.2), transparent 70%);
    opacity: 0;
    transition: opacity 250ms ease;
    pointer-events: none;
  }
  @media (hover: hover) {
    .btn:hover:not(:disabled) {
      translate: 0 -1px;
      box-shadow:
        inset 0 1px 0 rgb(255 255 255 / 0.2),
        inset 0 -1px 0 rgb(0 0 0 / 0.3),
        0 2px 4px rgb(0 0 0 / 0.12),
        0 12px 24px -8px rgb(0 0 0 / 0.45);
    }
    .btn:hover:not(:disabled)::after { opacity: 1; }
  }
  .btn:active:not(:disabled) { translate: 0 0; scale: 0.98; }
  .btn:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

  /* Glass: a smoky see-through fill, a light-catching rim and an inner shine.
     The tint stays dark enough that the white text keeps strong contrast. */
  .btn--glass {
    background:
      linear-gradient(180deg, rgb(255 255 255 / 0.18), rgb(255 255 255 / 0) 55%),  /* shine on the top half */
      rgb(10 34 44 / 0.42);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    backdrop-filter: blur(14px) saturate(160%);
    box-shadow:
      inset 0 1px 0 rgb(255 255 255 / 0.35),
      inset 0 -10px 18px -12px rgb(255 255 255 / 0.25),   /* light pooling at the bottom edge */
      0 10px 28px -10px rgb(3 30 42 / 0.55);
  }
  /* The rim: a 1px border that's bright at the top-left and bottom-right, like light on glass */
  .btn--glass::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(145deg, rgb(255 255 255 / 0.75), rgb(255 255 255 / 0.12) 35%, rgb(255 255 255 / 0.05) 65%, rgb(255 255 255 / 0.4));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask-composite: exclude;    /* after `mask`, which would otherwise reset it */
    pointer-events: none;
  }
  @media (hover: hover) {
    .btn--glass:hover {
      box-shadow:
        inset 0 1px 0 rgb(255 255 255 / 0.45),
        inset 0 -10px 18px -12px rgb(255 255 255 / 0.35),
        0 16px 36px -12px rgb(3 30 42 / 0.6);
    }
    .btn--glass:hover::after { background: radial-gradient(8rem circle at var(--glow-x) var(--glow-y), rgb(255 255 255 / 0.3), transparent 70%); }
  }

  .btn--pill { border-radius: 999px; }
  /* Buttons with an icon: icon and label side by side */
  .btn:has(.btn__icon) { display: inline-flex; align-items: center; gap: 0.55em; padding-left: 1.35rem; }
  .btn__icon { width: 1.15em; height: 1.15em; flex: none; }
  .btn__icon--solid { fill: currentColor; }

  /* Hero buttons: side by side, wrapping if there isn't room */
  /* Equal-width columns: every button is as wide as the widest one (Connect) */
  .hero__cta { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0.75rem; }
  .hero__cta .btn { justify-content: center; }

  /* Copy fades in with a small, quiet movement */
  .hero__copy > * {
    opacity: 0;
    transform: translateY(0.75rem);
    transition: opacity 900ms ease, transform 1000ms cubic-bezier(0.22, 1, 0.36, 1);
  }
  .hero__copy.is-in > * { opacity: 1; transform: none; }
  .hero__copy.is-in > :nth-child(2) { transition-delay: 120ms; }
  .hero__copy.is-in > :nth-child(3) { transition-delay: 240ms; }
  @media (min-width: 761px) {
    .hero__copy > * { transform: translateX(2rem); }
  }
  .hero__copy.no-anim > *, .brand.no-anim, .site-footer.no-anim { transition: none; }

  @media (max-width: 760px) {
    .hero { grid-template-columns: 1fr; text-align: center; }
    .hero__art-wrap { max-width: 340px; }
  }

  /* ============ Contact modal ============ */
  .modal {
    width: min(32rem, calc(100% - 2rem));
    margin: auto;
    padding: clamp(1.5rem, 4vw, 2.25rem);
    border: 0;
    border-radius: 1rem;
    color: #222829;
    background: #fbfaf6;
    font-family: var(--font);
    box-shadow: 0 1.5rem 4rem rgb(0 0 0 / 0.3);
  }
  .modal[open] { animation: modal-in 320ms cubic-bezier(0.22, 1, 0.36, 1); }
  .modal::backdrop { background: rgb(8 30 40 / 0.45); backdrop-filter: blur(4px); }
  @keyframes modal-in { from { opacity: 0; transform: translateY(1rem) scale(0.97); } }

  .modal__close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 2.25rem;
    height: 2.25rem;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #222829;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
  }
  .modal__close:hover { background: rgb(0 0 0 / 0.06); }
  .modal h2 { font-family: var(--font-brand); font-weight: 700; font-size: 1.6rem; margin-bottom: 0.35em; }
  .modal__title { display: flex; align-items: center; gap: 0.4em; }
  .modal__title-icon { width: 0.9em; height: 0.9em; flex: none; color: #2390b3; }
  .modal__intro { font-family: var(--font-brand); font-weight: 300; font-size: .85rem; line-height: 1.5; margin-bottom: 1.25rem; color: #4a5354; }

  .field { display: grid; gap: 0.35rem; margin-bottom: 0.9rem; }
  .field label { font-family: var(--font-brand); font-weight: 300; font-size: 0.85rem; }
  .field label span { color: #6b7475; }
  .field input, .field textarea, .field select {
    width: 100%;
    padding: 0.7rem 0.85rem;
    font: 1rem var(--font);
    color: #222829;
    background: #fff;
    border: 1.5px solid #cfd5d5;
    border-radius: 0.5rem;
  }
  .field textarea { resize: vertical; min-height: 6.5rem; }
  /* Dropdown: the browser's arrow swapped for a chevron that matches the site */
  .field select {
    appearance: none;
    padding-right: 2.5rem;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23222829' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 0.85rem center / 1rem;
    cursor: pointer;
  }
  .field select:has(option[value=""]:checked) { color: #6b7475; } /* placeholder looks like a placeholder */
  .field select option { color: #222829; }
  .field input:focus-visible, .field textarea:focus-visible, .field select:focus-visible { outline: none; border-color: #222829; }
  .modal .btn { width: 100%; margin-top: 0.25rem; border-radius: 999px; }
  .modal .btn:focus-visible { outline-color: #222829; }
  .form-msg { min-height: 1.4em; margin-top: 0.75rem; font-size: 0.95rem; }
  .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
  .turnstile:not(:empty) { margin: 0.25rem 0 0.75rem; }
  .modal .btn:disabled { opacity: 0.6; cursor: wait; }

  /* Thank-you message that replaces the form after a successful send */
  .thanks { text-align: center; padding: 0.5rem 0; animation: modal-in 320ms cubic-bezier(0.22, 1, 0.36, 1); }
  .thanks h2:focus { outline: none; }
  .thanks__icon { display: block; width: 3rem; height: 3rem; margin: 0 auto 0.75rem; color: #2390b3; }

  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
  }
