/* Shell, columns and breakpoints. Colours, type and spacing values live in
   components.css/tokens.css; this file only decides where things sit. The
   same markup serves every width — only the rules below change. */

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-left: env(safe-area-inset-left, 0);
  padding-right: env(safe-area-inset-right, 0);
}

.sky {
  position: relative;
  background: linear-gradient(180deg, var(--sky-top), var(--sky-bottom));
  transition: background var(--d-scheme) ease;
}
.sky .gauges-host,
.sky .verdict,
.sky .view-control,
.sky .view-log {
  background: var(--ground);
}

.app-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  padding-top: calc(var(--s-4) + env(safe-area-inset-top, 0));
  padding-bottom: var(--s-2);
}

.app-main {
  flex: 1;
  /* Room for the fixed tab bar below, sized from tokens rather than a magic
     pixel figure: one tap target plus a section of breathing room. */
  padding-bottom: calc(var(--tap) + var(--s-5) + env(safe-area-inset-bottom, 0));
}

/* Phone (below 720 px): one column, views switched by the tab bar, fixed to
   the viewport bottom. */
.view {
  display: none;
}
.view.is-active {
  display: block;
}

.tab-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
}

@media (prefers-reduced-motion: no-preference) {
  .view.is-active {
    animation: view-fade-in var(--d-ui) ease;
  }
}
@keyframes view-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Mid (720–1099 px): Now on the left, Control stacked over Log on the right. */
@media (min-width: 45rem) {
  .tab-bar {
    display: none;
  }
  .view {
    display: block;
  }
  .app-main {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: var(--s-6);
    align-items: start;
    padding: 0 var(--gutter) var(--s-6);
  }
  .view-now {
    grid-column: 1;
    grid-row: 1;
  }
  .view-control {
    grid-column: 2;
    grid-row: 1;
    margin-top: var(--header-overlay-h);
  }
  .view-log {
    grid-column: 2;
    grid-row: 2;
  }
  .view-control,
  .view-log {
    background: var(--surface);
    border-radius: var(--r-panel);
    box-shadow: var(--shadow);
  }
  .arc,
  .strip {
    border-radius: var(--r-panel);
    overflow: hidden;
  }
}

/* Wide (1180 px+): three columns, all visible, no tabs. The sky is the page's
   own backdrop for the top band; Control and Log become surface panels. */
/* Keep this literal aligned with --bp-wide; custom properties cannot be used here. */
@media (min-width: 73.75rem) {
  .app-shell {
    max-width: var(--page-max);
    margin: 0 auto;
    position: relative;
  }

  .app-main,
  .alert-banner {
    position: relative;
    z-index: 1;
  }

  .app-main {
    grid-template-columns: minmax(26rem, 1fr) var(--col-control) var(--col-log);
    padding-bottom: var(--s-7);
  }

  .view-control {
    grid-column: 2;
    grid-row: 1;
    margin-top: var(--header-overlay-h);
  }
  .view-log {
    grid-column: 3;
    grid-row: 1;
    margin-top: var(--header-overlay-h);
  }

  .view-control,
  .view-log {
    max-height: calc(100vh - 8rem);
    overflow-y: auto;
  }

  .strip {
    border-radius: var(--r-panel);
  }
}
