/* ==========================================================================
   LAYOUT — the page shell: sidebar, content column, footer.
   Desktop and mobile share these rules; only the tokens differ.
   ========================================================================== */

   .page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
  }
  
  /* ---- sidebar (desktop) --------------------------------------------------
     Fixed so it stays put while the page scrolls. Transparent on purpose:
     the footer gradient runs full width underneath it, as in the design.     */
  
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--nav-w);
    padding: var(--nav-y) 0 0 var(--nav-x);
    z-index: 10;
  }
  
  /* ---- topbar (mobile) ----------------------------------------------------
     Logo on the left with the name stacked beside it, menu button on the far
     right. The brand block sizes to its content; the button is pushed out by
     the auto margin, so nothing shifts if the name length changes.           */
  
  .topbar {
    --logo-w-topbar: 64px;   /* the logo runs a little larger next to the name */
  
    display: none;
    align-items: center;
    gap: 16px;
    padding: 40px var(--page-edge) 50px;
  }
  
  .topbar__brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
  }
  
  .topbar__text { display: block; min-width: 0; }
  
  /* On the narrowest phones the logo steps down so the name keeps clear of
     the menu button. */
  @media (max-width: 359px) {
    .topbar { --logo-w-topbar: 50px; gap: 12px; }
  }
  
  .topbar__end {
    flex: 0 0 auto;
    margin-left: auto;
    display: flex;
    justify-content: flex-end;
  }
  
  /* ---- content column -----------------------------------------------------
     The vertical rule lives on this element, not on the sidebar, so it runs
     the height of the content and stops where the footer starts.             */
  
  .main {
    flex: 1 1 auto;
    margin-left: var(--nav-w);
    padding: 0 var(--page-edge) var(--rule-overhang) var(--main-inset);
    border-left: var(--rule-w) solid var(--c-rule);
  }
  
  /* Top padding is set per page type, so one class controls the whole page. */
  [data-page="work"]    .main { padding-top: var(--top-work); }
  [data-page="project"] .main { padding-top: var(--top-page); }
  [data-page="text"]    .main { padding-top: var(--top-text); }
  
  /* ---- footer -------------------------------------------------------------
     Spans the full width, including behind the sidebar.                      */
  
  .site-footer {
    flex: 0 0 auto;
    height: var(--footer-h);
    margin-top: calc(var(--footer-gap) - var(--rule-overhang));
    padding: 0 var(--page-edge);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    font-size: var(--fs-footer);
    font-weight: var(--w-medium);
    line-height: var(--lh-footer);
    background-image: linear-gradient(
      180deg,
      var(--c-footer-top) 29.33%,
      var(--c-footer-bottom) 100%
    );
  }
  
  /* Same hover as the contact page links. */
  .site-footer a { transition: opacity var(--dur) ease; }
  .site-footer a:hover { opacity: .7; }
  
  /* ---- responsive switch --------------------------------------------------- */
  
  @media (max-width: 767px) {
    .sidebar { display: none; }
    .topbar  { display: flex; }
    .main    { margin-left: 0; }
  
    .site-footer {
      flex-direction: column;
      align-items: flex-start;
      justify-content: center;
    }
  }