/*
 * Jordan McGilvray.net
 * Layout
 *
 * Full-width fixed header with a centered
 * sidebar + main-content layout.
 */

:root {
  --site-width: 860px;
  --sidebar-width: 250px;
  --content-width: 550px;
  --column-gap: 60px;

  --header-height: 5.5rem;
  --page-padding: 1.5rem;
}

/* Fixed full-width header */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;

  width: 100%;
  min-height: var(--header-height);

  background-color: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.site-header-inner {
  width: 100%;
  padding: 1rem var(--page-padding);
}

/* Centered page shell */
.site-shell {
  display: grid;

  grid-template-columns:
    var(--sidebar-width)
    minmax(0, var(--content-width));

  gap: var(--column-gap);

  width: min(
    var(--site-width),
    calc(100% - (2 * var(--page-padding)))
  );

  margin: 0 auto;

  /*
   * Clears the fixed header and gives the page
   * breathing room underneath it.
   */
  padding-top: calc(var(--header-height) + 2.5rem);
  padding-bottom: 3rem;
}

/*
 * Sidebar
 *
 * The outer sidebar remains in the grid so its
 * column stays reserved. The inner sidebar is
 * fixed so it remains stationary while the main
 * content scrolls.
 */
.site-sidebar {
  width: var(--sidebar-width);
}

.site-sidebar-inner {
  position: fixed;
  top: calc(var(--header-height) + 1.5rem);

  width: var(--sidebar-width);
}

/* Main content */
.site-content {
  min-width: 0;
  width: 100%;
}

/* Tablet / narrow desktop */
@media (max-width: 960px) {
  :root {
    --site-width: 610px;
    --sidebar-width: 200px;
    --content-width: 375px;
    --column-gap: 35px;
  }

  .site-sidebar,
  .site-sidebar-inner {
    width: var(--sidebar-width);
  }
}

/* Mobile */
@media (max-width: 720px) {
  :root {
    --header-height: auto;
    --page-padding: 1rem;
  }

  .site-header {
    position: static;
  }

  .site-header-inner {
    width: 100%;
    padding: 1rem var(--page-padding);
  }

  .site-shell {
    display: block;

    width: 100%;
    margin: 0;

    padding:
      2rem
      var(--page-padding)
      3rem;
  }

  .site-sidebar {
    width: 100%;
    margin-bottom: 2rem;
  }

  .site-sidebar-inner {
    position: static;
    width: 100%;
  }

  .site-content {
    width: 100%;
  }
}

/* Very small screens */
@media (max-width: 480px) {
  :root {
    --page-padding: 0.75rem;
  }
}
