/* Page shell, laid out after macro.com, in Zigzag's own type, colors and words: the page between
   two fixed side columns.
   Left: the logo, a search over the pages, and every page and homepage section, in groups.
   Right: the light / dark switch and Get Zigzag, then the page's sections, numbered as on
   getartcraft.com.
   js/shell.js runs the search, lights the section on screen and opens the phone menu.

   Wide screens (1200px and up): both side columns.
   Laptops (1024px to 1199px): only the left one; it ends with the right one's buttons.
   Tablets and phones: a bar across the top, and the left column slides in from the left as a menu.

   Loaded after css/layout.css, which it overrides: pages with the shell have no header pill and
   no feature links on the side (css/feature-nav.css). Loaded after css/grid.css too, whose layout
   grid it fits to the middle column (at the end of this file). */

:root {
  --shell-left: 15rem;
  --shell-right: 16rem;
  /* How far a section may reach under the right column, which has no background (the spiral hero
     does, css/spiral.css): its width where it shows, 0 where it doesn't */
  --shell-under: var(--shell-right);
  /* The content's margin on each side of the middle column (css/layout.css's .container has 2rem).
     Wider where the left menu shows, so text clears the layout grid's left ruler at that edge */
  --shell-gutter: 2rem;
  --shell-top: 3.5rem;
  /* Section titles a step smaller than on the full-width pages: the middle column is narrower */
  --fs-h2: clamp(2.25rem, 1.25rem + 2.2vw, 3.25rem);
}

html { scroll-padding-top: 1.5rem; }

body { padding-top: 0; }

/* The middle column: the page and its footer, between the side columns */
.shell-page {
  margin-left: var(--shell-left);
  margin-right: var(--shell-right);
}

/* The sections and the footer reach under the right column, which has no background, so their
   backgrounds (the blue bands, the footer's dark) run on to the screen's edge behind it. An
   invisible border as wide as the column keeps their content in the middle column; the
   background starts at the border's outer edge, so a band's gradient spans the whole width.
   The spiral hero does the same with padding (css/spiral.css), as its spiral must not be clipped */
.shell-page .container { width: min(100% - 2 * var(--shell-gutter), var(--container)); }

@media (min-width: 1024px) {
  :root { --shell-gutter: 3rem; }
}

/* Text beside a picture (css/layout.css's .feature-row, 4.5rem apart) sits halfway between the
   picture and the middle column's edge: it is pushed in from that edge by what the content's
   margin lacks to match the gap. Only while the two sit side by side (above 900px) */
@media (min-width: 901px) {
  .shell-page .feature-row:not(.reverse) > .feature-text { padding-left: calc(4.5rem - var(--shell-gutter)); }
  .shell-page .feature-row.reverse > .feature-text { padding-right: calc(4.5rem - var(--shell-gutter)); }
}

.shell-page > main > section:not(.sp-hero),
.shell-page > .site-footer {
  margin-right: calc(-1 * var(--shell-under));
  border-right: var(--shell-under) solid transparent;
  background-origin: border-box;
}

/* Side columns */

.shell-nav,
.shell-rail {
  position: fixed;
  top: 0;
  bottom: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  font-size: 0.9375rem;
}

.shell-nav {
  left: 0;
  width: var(--shell-left);
  padding: 1.25rem 1rem 1.5rem;
  border-right: 1px solid var(--border);
  background: var(--bg);
}

.shell-rail {
  right: 0;
  width: var(--shell-right);
  gap: 0.625rem;
  padding: 1.25rem 1.25rem 1.5rem;
}

/* The logo's size, as the height of its capitals (css/components.css) */
.shell-nav .brand {
  --cap: 1.5rem;
  margin: 0 0 1.25rem 0.5rem;
}

/* Every icon in the side columns and the top bar: a line drawing in the text's color */
.shell-icon {
  flex: none;
  width: 1.125rem;
  height: 1.125rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* The platform logos are filled shapes */
.shell-logo {
  flex: none;
  width: 1.125rem;
  height: 1.125rem;
  fill: currentColor;
}

/* Search: a rounded field with a magnifier, and the shortcut that focuses it */
.shell-search {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 1.5rem;
}

.shell-search .shell-icon {
  position: absolute;
  left: 0.875rem;
  width: 1rem;
  height: 1rem;
  color: var(--text-muted);
  pointer-events: none;
}

.shell-search input {
  width: 100%;
  height: 2.5rem;
  padding: 0 3.5rem 0 2.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-alt);
  font: 400 0.9375rem / 1 var(--font-sans);
  color: var(--text);
  outline: none;
  transition: border-color var(--dur-fast) var(--ease);
}

.shell-search input::placeholder { color: var(--text-muted); }
.shell-search input:focus { border-color: var(--accent-text); }
.shell-search input::-webkit-search-cancel-button { display: none; }

.shell-search kbd {
  position: absolute;
  right: 0.75rem;
  padding: 0.125rem 0.375rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  font: 500 0.6875rem / 1.4 var(--font-sans);
  color: var(--text-muted);
  pointer-events: none;
}

.shell-search input:focus ~ kbd { display: none; }

/* A group's name, small and muted, over its links */
.shell-label {
  margin: 1.5rem 0 0.5rem 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* The right column's list of sections, as the old side links were (css/feature-nav.css): spread
   down the screen's right edge, under the button, each name flush against the scrollbar */
.shell-rail-sections {
  position: absolute;
  top: max(6.5rem, 14vh);
  right: 0;
  bottom: max(2rem, 10vh);
}

/* The links: an icon and a name. A group's links hang off a thin line, as on macro.com */
.shell-list {
  display: grid;
  gap: 0.125rem;
}

.shell-group {
  margin-left: 0.5rem;
  padding-left: 0.5rem;
  border-left: 1px solid var(--border);
}

.shell-list a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.375rem 0.5rem;
  border-radius: 0.5rem;
  line-height: 1.4;
  white-space: nowrap;
  color: var(--text-muted);
  transition: color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}

.shell-list a[href]:hover {
  color: var(--text);
  background: var(--bg-alt);
}

/* The page you are on, and the homepage section on screen (js/shell.js) */
.shell-list a[aria-current="page"] {
  color: var(--text);
  font-weight: 500;
}

.shell-list a[aria-current="location"] {
  color: var(--text);
  background: var(--bg-alt);
}

.shell-list a[aria-current="location"] .shell-icon,
.shell-list a[aria-current="location"] .shell-logo { color: var(--accent-text); }

/* While searching: what doesn't match hides, and so does a group left empty */
.shell-nav [hidden] { display: none; }

.shell-empty {
  padding: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* The buttons: macro.com's pills, in Zigzag's blue (the solid one) and the page's surface (the outlined one) */
.shell-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.625rem 1.25rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font: 500 0.9375rem / 1.2 var(--font-sans);
  white-space: nowrap;
  color: var(--text);
  background: var(--bg-alt);
  transition: background-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.shell-btn:hover { background: var(--surface); }

.shell-btn-primary {
  border-color: transparent;
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 rgb(0 0 0 / 0.15), 0 6px 20px -8px rgb(37 99 235 / 0.7);
}

.shell-btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: inset 0 -2px 0 rgb(0 0 0 / 0.15), 0 8px 28px -6px rgb(37 99 235 / 0.9);
}

.shell-btn .shell-icon { width: 1rem; height: 1rem; stroke-width: 2; }

/* The right column's button and the theme row, at the end of the left column: only shown when the
   right column is not */
.shell-extra {
  display: none;
  gap: 0.625rem;
  margin-top: auto;
  padding-top: 2rem;
}

.shell-theme {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  border: 0;
  border-radius: 0.5rem;
  background: none;
  font: 400 0.9375rem / 1.4 var(--font-sans);
  color: var(--text-muted);
  cursor: pointer;
}

.shell-theme:hover { color: var(--text); background: var(--bg-alt); }

/* The top bar and the menu button: tablets and phones only */
.shell-top,
.shell-backdrop { display: none; }

/* The right column's list of the page's sections, in the terminal-font labels the side links had.
   Each takes up to 4.5rem of the height (fewer, when a long list must fit the screen), the list
   centered in it. Each name ends in a short tick out to the screen's edge; the section on screen
   (js/shell.js) gets a longer blue tick and blue text */
.shell-sections {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  height: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.shell-sections li {
  display: flex;
  flex: 0 1 4.5rem;
  align-items: center;
  min-height: 1.75rem;
}

.shell-sections a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0 0.25rem 0.5rem;
  font: 500 0.8125rem / 1.4 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--text-muted);
  transition: color var(--dur-fast) var(--ease);
}

.shell-sections a::after {
  content: '';
  flex: none;
  width: 1rem;
  height: 1px;
  background: currentColor;
  transition: width var(--dur-fast) var(--ease);
}

.shell-sections a:hover { color: var(--text); }
.shell-sections a[aria-current] { color: var(--accent-text); }
.shell-sections a[aria-current]::after { width: 2rem; }

/* The right column's top: the light / dark switch, then Get Zigzag filling the rest of the row */
.shell-rail-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.shell-rail-top .shell-btn { flex: 1; }


/* The demo, right under the hero as on the previous homepage */
.shell-demo { padding-top: 0; }
.shell-demo .hero-shot { margin-top: 0; }

/* The cards that the left column links to stop a little below the top of the screen */
.fg-card { scroll-margin-top: 2rem; }

/* Laptops: only the left column; it ends with the right column's buttons and the theme row */
@media (max-width: 1199px) {
  :root { --shell-under: 0px; }
  .shell-rail { display: none; }
  .shell-page { margin-right: 0; }
  .shell-extra { display: grid; }
}

/* Tablets and phones: a bar across the top with the logo, Get Zigzag and the menu button.
   The left column slides in from the left as the menu, over a dimmed page */
@media (max-width: 1023px) {
  html { scroll-padding-top: calc(var(--shell-top) + 1rem); }
  body { padding-top: var(--shell-top); }

  .shell-page { margin-left: 0; }

  .shell-top {
    position: fixed;
    inset: 0 0 auto;
    z-index: 90;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    height: var(--shell-top);
    padding: 0 0.5rem 0 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-header);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
  }

  .shell-top .brand { --cap: 1.25rem; margin-right: auto; }
  .shell-top .shell-btn { min-height: 2.25rem; padding: 0.375rem 1rem; font-size: 0.875rem; }

  .shell-menu {
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    border: 0;
    border-radius: 999px;
    background: none;
    color: var(--text);
    cursor: pointer;
  }

  .shell-menu .shell-icon { width: 1.375rem; height: 1.375rem; stroke-width: 2; }

  .shell-nav {
    width: min(18rem, 100% - 3rem);
    box-shadow: 16px 0 32px -12px rgb(0 0 0 / 0.4);
    visibility: hidden;
    transform: translateX(-100%);
  }

  .is-menu-open .shell-nav {
    visibility: visible;
    transform: none;
  }

  .shell-backdrop {
    position: fixed;
    inset: 0;
    z-index: 95;
    display: block;
    background: rgb(16 16 20 / 0.5);
    opacity: 0;
    visibility: hidden;
  }

  .is-menu-open .shell-backdrop {
    opacity: 1;
    visibility: visible;
  }

  .shell-search kbd { display: none; }
}

/* Layout grid (css/grid.css, js/grid.js), fitted to the middle column: its columns line up with
   the content between the side columns rather than with the whole screen, its rows and top ruler
   stay out of the side columns, and its left ruler sits at the middle column's left edge.
   --grid-left and --grid-right: the side columns' widths, 0 where they don't show.
   Phones keep css/grid.css's own layout (no side columns there) */
:root {
  --grid-left: var(--shell-left);
  --grid-right: var(--shell-right);
}

@media (max-width: 1199px) {
  :root { --grid-right: 0px; }
}

@media (min-width: 761px) {
  :root { --grid-width: min(100% - var(--grid-left) - var(--grid-right) - 2 * var(--shell-gutter), var(--container)); }

  body::before { left: calc(var(--grid-left) + (100% - var(--grid-left) - var(--grid-right)) / 2); }
  /* The rows run under the right column too, which has no background: the page shows through it */
  body::after { left: var(--grid-left); }

  .grid-ruler-cols {
    margin-left: calc(var(--grid-left) + (100% - var(--grid-left) - var(--grid-right) - var(--grid-width)) / 2);
    margin-right: 0;
  }

  .grid-ruler-left { left: var(--grid-left); }
}

/* Tablets and phones: no left column, and the top ruler sits under the top bar */
@media (max-width: 1023px) {
  :root { --grid-left: 0px; }
  .grid-ruler-top { top: var(--shell-top); }
}

@media print {
  .shell-nav,
  .shell-rail,
  .shell-top { display: none; }
  .shell-page { margin: 0; }
}
