/* TechSparq DAM base styles: reset, page shell, header, shared control
   surfaces. Values are lifted from the design boards (design/html) and use the
   tokens in tokens.css, never raw hex. Components layer on top of this. */

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

/* The header and every page share one fluid column bounded by a fixed gutter
   on both sides. The left edge is a single vertical line at --margin from the
   viewport and never moves; content fills the width between the gutters, so
   right-aligned controls stay pinned to the right edge at any screen width.
   Responsive behaviour (gutter steps, the hamburger) lives in responsive.css. */

/* The body is at least window height but grows with the page. A fixed height: 100% made it
   exactly one window tall, which is as far as the sticky header could follow the scroll. */
html { height: 100%; }

body {
  min-height: 100%;
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--text);
  text-underline-offset: 4px;
}
a:hover { color: var(--red-text); }

button, input, select, textarea { font-family: inherit; }

h1, h2, h3 { margin: 0; }

/* Two-tone focus ring from the tokens, applied to keyboard focus only. */
:focus-visible {
  outline: 0;
  box-shadow: var(--focus);
  border-radius: var(--radius);
}

/* Skip link, hidden until focused. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--inverse-bg);
  color: var(--inverse-text);
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 600;
}
.skip-link:focus {
  left: 16px;
  color: var(--inverse-text);
}

/* ---- Shared surfaces -------------------------------------------------- */

.micro {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-quiet);
}

/* Tonal control: a fill, never an outline (settled decision). */
.tone {
  background: var(--tone-solid);
  border: 0;
  cursor: pointer;
  color: var(--text);
  transition: background var(--t-hover) var(--ease-out);
}
.tone:hover { background: var(--tone-solid-hover); }

.red {
  background: var(--red);
  color: var(--on-red);
  border: 0;
  cursor: pointer;
  transition: background var(--t-hover) var(--ease-out);
}
.red:hover { background: var(--red-hover); }

/* Frosted glass for anything that floats (header, menus, drawers, toasts). */
.glass {
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-edge);
}

/* ---- App shell -------------------------------------------------------- */

#main {
  display: block;
  outline: 0;
}

.shell {
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 88px var(--margin) var(--margin);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.page-eyebrow {
  color: var(--red-text);
}

.page-title {
  font-family: var(--font-display);
  font-weight: 900;
  letter-spacing: -.02em;
  font-size: var(--title);
  line-height: 1.1;
}

/* Placeholder block for areas built in later milestones. */
.placeholder {
  margin-top: 8px;
  padding: 40px;
  background: var(--surface);
  border: 1px dashed var(--rule);
  border-radius: var(--radius);
  color: var(--text-quiet);
  max-width: 640px;
}
.placeholder h2 {
  font-size: var(--section);
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

/* ---- Header component (light DOM, styled here) ------------------------ */

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 16px 0 14px;
  /* The glass is near-cream in light mode, so the band needs a defined edge.
     A hairline in Rule gray (the brand's divider token) separates it from the
     page in both themes; a whisper of shadow keeps the floating-glass feel.
     Keep the inset glass edge from .glass by listing it first. */
  border-bottom: 1px solid var(--rule);
  box-shadow: var(--glass-edge), 0 10px 24px -18px rgba(26, 26, 26, .22);
}

/* Rows carry the gutter so the glass background stays full bleed while the
   logo, client switcher and page content all line up on the same left edge. */
.app-header__row {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  width: 100%;
  padding: 0 var(--margin);
}

/* Top row: wordmark + product name on the left, theme + account on the right. */
.app-header__product {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: 28px;
  letter-spacing: .01em;
  text-transform: uppercase;
  color: var(--red-text);
  padding-left: 18px;
  border-left: 1px solid var(--rule);
  line-height: 1;
}

.app-header__logo {
  display: block;
  flex-shrink: 0;
  padding: 4px 0;
}
.app-header__logo img {
  height: 21px;
  width: auto;
  display: block;
}

.client-chip {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 9px;
  height: 36px;
  padding: 0 12px 0 6px;
  border-radius: var(--radius);
  color: var(--text);
}
.client-chip__badge {
  width: 26px;
  height: 26px;
  border-radius: var(--radius);
  background: var(--red);
  color: var(--on-red);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 11px;
}
.client-chip__name {
  font-size: 14px;
  font-weight: 600;
}
.client-chip svg { stroke: currentColor; }

.app-nav {
  display: flex;
  gap: 6px;
  margin-left: 8px;
}
.navp {
  height: 32px;
  padding: 0 13px;
  display: flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text);
  background: var(--tone-solid);
  border-radius: var(--radius);
  transition: background var(--t-hover) var(--ease-out);
}
.navp:hover { background: var(--tone-solid-hover); color: var(--text); }
.navp.on { background: var(--inverse-bg); color: var(--inverse-text); }

.app-header__right {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
}

/* Upload sits at the far right of the bottom row. */
.app-header__row--bottom .btn-upload {
  margin-left: auto;
}

.btn-upload {
  text-decoration: none;
  height: 36px;
  padding: 0 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--on-red);
}

.btn-round {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
}
.btn-round svg { stroke: currentColor; }

.btn-account {
  font-weight: 600;
  font-size: 13px;
}

/* ---- Account menu ----------------------------------------------------- */

.account { position: relative; }

.account-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 248px;
  padding: 8px;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 40;
}
.account-menu[hidden] { display: none; }

.account-menu__id {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px 12px;
}
.account-menu__name {
  font-weight: 600;
  font-size: 14px;
}
.account-menu__email {
  font-size: 12px;
  color: var(--text-quiet);
}

.account-menu__sep {
  height: 1px;
  background: var(--rule);
  margin: 2px 6px 6px;
}

.account-menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--t-hover) var(--ease-out);
}
.account-menu__item:hover { background: var(--tone-solid); color: var(--text); }
.account-menu__item.on { background: var(--tone-solid); }
.account-menu__item[disabled] { color: var(--text-quiet); cursor: default; }
.account-menu__item[disabled]:hover { background: transparent; }
.account-menu__item svg { stroke: currentColor; flex-shrink: 0; }
