/* ==========================================================================
   BUMASS.STORE — layout.css
   Page shell: masthead, navigation, grids, taskbar, responsive behaviour.
   Desktop reads as a desktop environment. Mobile reinterprets it as chunky
   stacked panels — it is not the desktop shrunk down.
   ========================================================================== */

.shell {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: var(--gap) var(--gap-sm) 0;
}

/* ==========================================================================
   CRT overlay
   ========================================================================== */

.crt {
  position: fixed;
  inset: 0;
  z-index: 900;
  pointer-events: none;
  opacity: var(--fx-scanline, 1);
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(0, 0, 0, .16) 0 1px,
      transparent        1px 3px
    );
  mix-blend-mode: multiply;
}
.crt::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, .40) 100%);
}
html[data-fx="off"] .crt { display: none; }

/* ==========================================================================
   Masthead
   ========================================================================== */

.masthead {
  position: relative;
  background:
    radial-gradient(ellipse at 50% 120%, #16224a 0%, transparent 62%),
    linear-gradient(180deg, #05050c 0%, #0b0f26 55%, #05050c 100%);
  box-shadow: var(--bevel-well);
  padding: 22px 16px 16px;
  text-align: center;
  overflow: hidden;
  --focus: #fff;
}

/* Faint starfield/dither so it isn't a flat gradient. */
.masthead::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .5;
  background-image:
    radial-gradient(1px 1px at 12% 22%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 78% 14%, #9fd 50%, transparent 51%),
    radial-gradient(1px 1px at 44% 68%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 91% 74%, #fda 50%, transparent 51%),
    radial-gradient(1px 1px at 27% 88%, #fff 50%, transparent 51%),
    repeating-conic-gradient(rgba(255,255,255,.03) 0 25%, transparent 0 50%);
  background-size: auto, auto, auto, auto, auto, 4px 4px;
}

.logo {
  position: relative;
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2.4rem, 12vw, 7.5rem);
  line-height: .86;
  letter-spacing: -.015em;
  text-transform: uppercase;
  color: #fff;
  text-shadow:
    3px 3px 0 #000,
    5px 5px 0 var(--cap-a-1),
    7px 7px 0 rgba(0, 0, 0, .5);
}

/* Chrome fill, applied only where it can't break legibility. */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .logo__fill {
    background: linear-gradient(180deg, #ffffff 6%, #cfe0f5 38%, #6d84a4 51%, #eaf2ff 64%, #ffffff 96%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
}

.logo__dot { color: var(--warn); -webkit-text-fill-color: var(--warn); }

.tagline {
  position: relative;
  margin-top: 10px;
  min-height: 1.5em;
  font-family: var(--mono);
  font-size: clamp(11px, 2.6vw, 14px);
  color: var(--term-ink);
  text-shadow: 0 0 6px rgba(43, 255, 43, .55);
}
.tagline::before { content: "> "; color: var(--term-dim); }

.masthead__meta {
  position: relative;
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 6px;
  font-family: var(--mono);
  font-size: var(--fs-xs);
  color: #9fb0c8;
}
.masthead__meta span {
  padding: 1px 6px;
  background: rgba(255, 255, 255, .07);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14);
}

/* --- Subpage masthead: same identity, a third of the height ---------- */

.masthead--sub {
  padding: 14px 16px 12px;
  text-align: left;
}
.masthead--sub .logo {
  font-size: clamp(1.7rem, 7vw, 3.4rem);
  text-shadow: 2px 2px 0 #000, 4px 4px 0 var(--cap-a-1);
}
.masthead--sub .tagline { margin-top: 6px; }
.masthead--sub .masthead__meta { justify-content: flex-start; margin-top: 9px; }

.crumb {
  position: relative;
  margin: 0 0 2px;
  font-family: var(--mono);
  font-size: var(--fs-xs);
  color: #9fb0c8;
  letter-spacing: .04em;
}
.crumb a {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 2px 5px;
  margin-left: -5px;
  color: #cfe0f5;
}
.crumb a:hover { background: var(--warn); color: #000; }
@media (pointer: coarse) {
  .crumb a { min-height: 38px; padding: 8px 10px; margin-left: -10px; }
}

/* Corner tag, because every site in 2003 had one. */
.masthead__corner {
  position: absolute;
  top: 0;
  right: 0;
  padding: 3px 8px;
  font-family: var(--mono);
  font-size: 10px;
  color: #000;
  background: var(--warn);
  box-shadow: var(--bevel-thin-out);
}

/* ==========================================================================
   Primary navigation — desktop icon strip
   ========================================================================== */

.mainnav {
  margin-top: var(--gap-sm);
  background: var(--face);
  box-shadow: var(--bevel-out);
  padding: 4px;
}

.mainnav__list {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 3px;
}

.navlink {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 62px;
  padding: 8px 4px;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-align: center;
  color: var(--ink);
  text-decoration: none;
  background: transparent;
  box-shadow: var(--bevel-thin-out);
}
.navlink:visited { color: var(--ink); }
.navlink:hover {
  background: var(--light);
  text-decoration: none;
  color: var(--ink);
}
.navlink:active { box-shadow: var(--bevel-thin-in); }
.navlink[aria-current="page"] {
  background: var(--sel);
  color: var(--sel-ink);
  box-shadow: var(--bevel-thin-in);
  --focus: #fff;
}
.navlink[aria-current="page"] .ico { filter: drop-shadow(0 0 3px #fff); }
.navlink .ico { width: 22px; height: 22px; }

/* ==========================================================================
   Page body grid
   ========================================================================== */

.page {
  display: grid;
  gap: var(--gap-sm);
  margin-top: var(--gap-sm);
  padding-bottom: var(--gap);
  align-items: start;
}

/* Two-column split used on the homepage and section pages. */
.page--split {
  grid-template-columns: minmax(0, 1fr);
}

.stack { display: grid; gap: var(--gap-sm); align-content: start; }

/* Card grid for catalog output. */
.grid {
  display: grid;
  gap: var(--gap-sm);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 265px), 1fr));
}
.grid--wide {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  margin-bottom: 2px;
}
.section-head h2 {
  font-family: var(--display);
  font-size: clamp(1.35rem, 4vw, 2rem);
  letter-spacing: .02em;
  text-transform: uppercase;
}
.section-head p { font-size: var(--fs-sm); color: var(--ink-soft); }

/* ==========================================================================
   Footer
   ========================================================================== */

.colophon {
  margin-top: var(--gap-sm);
  padding: var(--pad);
  background: var(--face);
  box-shadow: var(--bevel-out);
  font-size: var(--fs-xs);
  color: var(--ink-soft);
  text-align: center;
}
.colophon__row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 2px 6px;
}
.colophon__row + .colophon__row { margin-top: 6px; }

/* Footer links are secondary navigation, but they are still navigation. */
.colophon__row a {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 2px 6px;
}
@media (pointer: coarse) {
  .colophon__row a { min-height: 36px; padding: 6px 10px; }
}

/* ==========================================================================
   Taskbar
   ========================================================================== */

.taskbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 800;
  display: flex;
  align-items: center;
  gap: 4px;
  height: calc(var(--taskbar-h) + env(safe-area-inset-bottom, 0px));
  padding: 3px 4px calc(3px + env(safe-area-inset-bottom, 0px));
  background: var(--face);
  box-shadow: inset 0 1px 0 var(--hilite), inset 0 2px 0 var(--light), 0 -2px 6px rgba(0,0,0,.3);
}

.start {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 10px 0 6px;
  border: 0;
  background: var(--face);
  box-shadow: var(--bevel-out);
  font-size: var(--fs-sm);
  font-weight: 700;
  font-style: italic;
  cursor: pointer;
  flex: 0 0 auto;
}
.start[aria-expanded="true"] { box-shadow: var(--bevel-in); background: var(--face-dim); }

.taskbar__tasks {
  flex: 1 1 auto;
  display: flex;
  gap: 3px;
  min-width: 0;
  overflow: hidden;
}
.taskbar__task {
  flex: 0 1 168px;
  min-width: 0;
  height: 26px;
  padding: 0 8px;
  border: 0;
  background: var(--face);
  box-shadow: var(--bevel-out);
  font-size: var(--fs-xs);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.taskbar__task[aria-pressed="true"] { box-shadow: var(--bevel-in); background: var(--face-dim); font-weight: 700; }

.tray {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 26px;
  padding: 0 8px;
  box-shadow: var(--bevel-thin-in);
  font-size: var(--fs-xs);
  font-family: var(--mono);
}
.tray__btn {
  min-height: 20px;
  padding: 2px 7px;
  border: 0;
  background: var(--face);
  box-shadow: var(--bevel-thin-out);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  cursor: pointer;
}
.tray__btn[aria-pressed="false"] { box-shadow: var(--bevel-thin-in); color: var(--ink-mute); }

.tray__clock { min-width: 6.2em; text-align: center; }

/* Touch: the bar grows so its controls can meet the target size. */
@media (pointer: coarse) {
  :root { --taskbar-h: 50px; }
  .start { height: 40px; padding: 0 14px 0 10px; font-size: var(--fs-md); }
  .tray { height: 40px; gap: 10px; }
  .tray__btn { min-height: 32px; padding: 6px 11px; font-size: 11px; }
}

/* Start menu */
.startmenu {
  position: fixed;
  left: 4px;
  bottom: calc(var(--taskbar-h) + env(safe-area-inset-bottom, 0px) + 2px);
  z-index: 850;
  width: min(280px, calc(100vw - 8px));
  background: var(--face);
  box-shadow: var(--bevel-out), 4px -4px 12px rgba(0,0,0,.4);
  padding: 3px;
  display: flex;
}
.startmenu[hidden] { display: none; }

/* The vertical "Windows 98" spine. */
.startmenu__spine {
  flex: 0 0 26px;
  background: linear-gradient(180deg, var(--cap-a-2), var(--cap-a-1));
  color: #fff;
  font-family: var(--display);
  font-size: 17px;
  letter-spacing: .04em;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-align: right;
  padding: 8px 4px;
  text-transform: uppercase;
}
.startmenu__list { flex: 1 1 auto; min-width: 0; }
.startmenu__list li + li { margin-top: 1px; }
.startmenu__list a,
.startmenu__list button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 34px;
  padding: 4px 10px;
  border: 0;
  background: none;
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--ink);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.startmenu__list a:hover,
.startmenu__list button:hover,
.startmenu__list a:focus-visible,
.startmenu__list button:focus-visible {
  background: var(--sel);
  color: var(--sel-ink);
  --focus: #fff;
}
.startmenu__sep { height: 2px; margin: 3px 4px; box-shadow: var(--bevel-thin-in); }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (min-width: 720px) {
  :root { --gap-sm: 10px; --pad: 12px; }
  .shell { padding: 16px 16px 0; }
  .masthead { padding: 34px 24px 20px; }
}

@media (min-width: 1000px) {
  .page--split {
    grid-template-columns: minmax(0, 1fr) 322px;
  }
  .page--split > .stack--rail { position: sticky; top: 12px; }
}

/* --- Mobile reinterpretation ---------------------------------------- */
@media (max-width: 719px) {
  /* Nav becomes a scrollable chunky strip rather than a 7-up icon grid. */
  .mainnav {
    position: sticky;
    top: 0;
    z-index: 700;
    margin-top: 6px;
  }
  .mainnav__list {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(74px, 1fr);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .mainnav__list::-webkit-scrollbar { display: none; }
  .navlink {
    min-height: var(--tap);
    scroll-snap-align: start;
    flex-direction: row;
    gap: 6px;
    padding: 10px 8px;
  }
  .navlink .ico { width: 16px; height: 16px; }

  /* Decorative clutter earns its place less easily on a small screen. */
  .taskbar__tasks { display: none; }
  .desktop-only { display: none !important; }
  .masthead__corner { display: none; }
  .logo { text-shadow: 2px 2px 0 #000, 4px 4px 0 var(--cap-a-1); }
}

@media (min-width: 720px) {
  .mobile-only { display: none !important; }
}

/* Coarse pointers never get drag affordances they can't use well. */
@media (pointer: coarse) {
  .win[data-draggable] > .win__bar { cursor: default; }
}
