/* ===========================================================================
   dentbrain: app shell — reset, layout, header, drawer
   =========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--size-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;              /* belt and braces against horizontal scroll */
}

h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
svg { display: block; }

:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 2px;
  border-radius: 4px;
}
/* Never remove focus rings. If a component needs a different ring it overrides
   the colour, not the existence. */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  color: var(--text);
  border-radius: 0 0 var(--r-md) 0;
  box-shadow: var(--shadow-2);
  text-decoration: none;
}
.skip-link:focus { left: 0; }

/* --- The app column ------------------------------------------------------ */

.app {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  width: 100%;
  max-width: var(--app-max);
  margin-inline: auto;
  background: var(--surface);
  overflow-x: clip;
}

@media (min-width: 560px) {
  .app {
    min-height: 100dvh;
    box-shadow: 0 0 0 1px var(--line), var(--shadow-2);
  }
}

/* --- Header -------------------------------------------------------------- */

.hdr {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: var(--tap) 1fr var(--tap);
  align-items: center;
  gap: var(--sp-2);
  height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  padding-inline: var(--sp-2);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}

.hdr__btn {
  display: grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  background: none;
  border: 0;
  border-radius: var(--r-md);
  color: var(--text);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease);
}
.hdr__btn:hover { background: var(--surface-2); }
.hdr__btn svg { width: 22px; height: 22px; }

/* Back replaces the hamburger in the same grid cell when inside a tool. */
.hdr__btn--back { grid-column: 1; grid-row: 1; }
.hdr__btn--info { justify-self: end; }

.hdr__mark {
  grid-column: 2;
  text-align: center;
  font-size: var(--size-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The wordmark grammar: bold discipline, light "brain", gold colon.
   Gold is spent here and nowhere else. */
.wm          { font-family: var(--font-display); font-weight: 600; }
.wm__strong  { font-weight: 700; letter-spacing: 0.01em; }
.wm__light   { font-weight: 400; }
.wm__colon   { color: var(--gold); font-family: var(--font-display); font-weight: 700; }

.hdr__mark--plain { font-family: var(--font-ui); font-weight: 600; }

/* --- Main ---------------------------------------------------------------- */

.main {
  flex: 1;
  padding: var(--sp-4) var(--sp-4) var(--sp-7);
  outline: none;
}
.main[data-pad="flush"] { padding-inline: 0; }

.standing-note {
  padding: var(--sp-3) var(--sp-4)
           calc(var(--sp-3) + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  color: var(--text-3);
  font-size: var(--size-xs);
  text-align: center;
  letter-spacing: 0.01em;
}

/* --- Floating action ----------------------------------------------------- */

.fab-slot {
  position: fixed;
  right: max(var(--sp-4), calc(50vw - var(--app-max) / 2 + var(--sp-4)));
  bottom: calc(var(--sp-5) + env(safe-area-inset-bottom, 0px));
  z-index: 45;
}

.fab {
  min-width: 128px;
  min-height: 52px;
  padding: 0 var(--sp-5);
  background: linear-gradient(135deg, var(--mint), var(--mint-bright));
  color: var(--mint-ink);
  font-weight: 600;
  font-size: var(--size-md);
  letter-spacing: 0.01em;
  border: 0;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-float);
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease), filter var(--t-fast) var(--ease);
}
.fab:hover { filter: brightness(1.04); }
.fab:active { transform: translateY(1px); }

/* --- Drawer -------------------------------------------------------------- */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(12, 16, 20, 0.44);
  opacity: 0;
  transition: opacity var(--t-base) var(--ease);
}
.scrim[data-open="1"] { opacity: 1; }

.drawer {
  position: fixed;
  inset-block: 0;
  left: 0;
  z-index: 61;
  width: min(78vw, 340px);
  display: flex;
  flex-direction: column;
  background: var(--surface-2);
  border-right: 1px solid var(--line);
  transform: translateX(-101%);
  transition: transform var(--t-slow) var(--ease);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.drawer[data-open="1"] { transform: translateX(0); }

.drawer__crest {
  display: grid;
  place-items: center;
  padding: var(--sp-6) var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
:root[data-theme="dark"] .drawer__crest,
.drawer__crest { color: var(--text); }
.crest { width: 68px; height: 62px; }

.drawer__list { padding: var(--sp-3) 0 var(--sp-5); }

.drawer__item {
  display: block;
  width: 100%;
  padding: var(--sp-3) var(--sp-5);
  background: none;
  border: 0;
  text-align: left;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease);
}
.drawer__item:hover { background: var(--surface-3); }
.drawer__item[aria-current="page"] { background: var(--mint-soft); }

.drawer__title { font-size: var(--size-md); }
.drawer__sub   { color: var(--text-2); font-size: var(--size-sm); }

.drawer__group {
  padding: var(--sp-4) var(--sp-5) var(--sp-1);
  color: var(--text-3);
  font-size: var(--size-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* --- Home grid ----------------------------------------------------------- */

.home__lede {
  padding: var(--sp-2) 0 var(--sp-5);
  color: var(--text-2);
  font-size: var(--size-base);
  text-wrap: pretty;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--sp-3);
}

.card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  min-height: 116px;
  padding: var(--sp-4);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease),
              transform var(--t-fast) var(--ease),
              background var(--t-fast) var(--ease);
}
.card:hover { border-color: var(--mint-edge); background: var(--surface); }
.card:active { transform: translateY(1px); }

.card__mark { font-size: var(--size-md); margin-bottom: var(--sp-1); }
.card__desc { color: var(--text-2); font-size: var(--size-sm); line-height: 1.35; }
.card__foot { margin-top: auto; padding-top: var(--sp-2); }

.card--soon { cursor: pointer; opacity: 0.82; }
.card--soon:hover { border-color: var(--line-strong); }

.pill {
  display: inline-block;
  padding: 2px var(--sp-2);
  border-radius: var(--r-pill);
  font-size: var(--size-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.pill--soon   { background: var(--surface-3); color: var(--text-3); }
.pill--live   { background: var(--mint-soft); color: var(--ok); }
.pill--unver  { background: var(--warn-soft); color: var(--warn); }

/* --- Utility ------------------------------------------------------------- */

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.stack > * + * { margin-top: var(--sp-4); }
.muted { color: var(--text-2); }
.small { font-size: var(--size-sm); }
