/* 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%;
  display: flex;
  flex-direction: column;
  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). */
/* Secondary text on glass must stay readable over any photo behind it, so inside a glass layer the quiet
   text colour is the darker glass one (review finding 1). */
.glass {
  --text-quiet: var(--glass-text-2);
  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;
}

/* ---- First-paint skeleton (the markup lives in index.html) ----------- */
.boot__head { display: flex; flex-direction: column; gap: 12px; }
.boot__bar { display: block; background: var(--surface); border-radius: 2px; animation: pulse 1.2s ease-in-out infinite; }
.boot__bar--eyebrow { width: 220px; max-width: 60%; height: 12px; }
.boot__bar--title { width: 420px; max-width: 80%; height: 44px; }
.boot__bar--search { width: 100%; height: 48px; }
html.boot-off .boot { display: none; }
html.unconfigured ts-header { display: none; }
@media (prefers-reduced-motion: reduce) { .boot__bar { animation: none; } }

/* 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;
}

/* The client picker is quiet text on the header with no box, a hairline before the tabs; a tint only on hover. */
.client-chip {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 9px;
  height: 36px;
  padding: 0 8px 0 4px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background var(--t-hover) var(--ease-out);
}
.client-chip:hover { background: var(--tone-solid); }
.client-chip svg { color: var(--text-quiet); }
.app-header__sep { align-self: center; width: 1px; height: 22px; margin: 0 4px 0 6px; background: var(--rule); }
.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; }

/* Header tabs: Library, Recently viewed, My uploads. Quiet text at rest; the current page is a
   brighter glass pane that meets the header's bottom edge, with a 2px red bar on that edge. The
   tabs stretch to the bottom edge (a negative margin equal to the header's 14px bottom padding),
   so the click area is over 44px tall. Asset detail lights Library; Trash lights none. */
.app-nav {
  display: flex;
  gap: 4px;
  align-self: stretch;
  margin: 0 0 -14px 8px;
}
.app-tab {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 18px;
  font: 500 15px/1 var(--font-ui);
  color: var(--text-quiet);
  text-decoration: none;
  border-radius: var(--radius) var(--radius) 0 0; /* square bottom: it meets the header edge */
  transition: background var(--t-hover) var(--ease-out), color var(--t-hover) var(--ease-out);
}
.app-tab:hover { color: var(--text); background: rgba(255, 255, 255, .32); }
.app-tab[aria-current="page"] {
  color: var(--text);
  background: rgba(255, 255, 255, .62);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .95), inset 1px 0 0 rgba(255, 255, 255, .6), inset -1px 0 0 rgba(255, 255, 255, .6);
}
.app-tab[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--red);
}
.app-tab:focus-visible { outline: none; box-shadow: var(--focus); }
[data-theme="dark"] .app-tab:hover { background: rgba(255, 255, 255, .05); }
[data-theme="dark"] .app-tab[aria-current="page"] { background: rgba(255, 255, 255, .09); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16); }
[data-theme="dark"] .app-tab[aria-current="page"]::after { background: var(--red-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; }

/* ---- Footer (index.html) ---------------------------------------------- */
/* The body is a column, so the page fills the window height and the footer rests at the bottom
   of a short page and follows a long one. The sign-in screen is a whole page of its own, so its
   container grows to fill the space above the footer. */
body > main { flex: 1 0 auto; }
main:has(> .si) { display: flex; flex-direction: column; }
.footer { flex: 0 0 auto; border-top: 1px solid var(--rule); }
.footer-row {
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  padding: 28px var(--margin);
}
.footer-mark {
  font-family: var(--font-display); font-weight: 500; font-size: 20px; letter-spacing: -.01em; line-height: 1;
}
.footer-mark i { font-style: italic; font-weight: 500; color: var(--red-text); }
.footer-row img { height: 20px; width: auto; display: block; }
:root[data-theme="dark"] .tag-light { display: none; }
:root:not([data-theme="dark"]) .tag-dark { display: none; }
/* The embedded picker is shown inside another tool, so it carries no footer. */
html.picker-route .footer { display: none; }
