/* styles.css
 * App-specific styles. Brand tokens (colors, type) come from
 * ./assets/colors_and_type.css. Anything in this file is page layout +
 * interactive states — keep brand decisions in the design-system file.
 */

/* ---- Page chrome ---------------------------------------------------- */

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

body.delmar {
  background: var(--bg-muted);
  display: flex;
  flex-direction: column;
}

/* Top bar: brand left, icon actions right. */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 32px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
}
.topbar__logo {
  height: 44px;
  width: auto;
  display: block;
}
.topbar__actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
/* [hidden] sets display:none via the UA stylesheet, but our display:flex
 * rule above overrides it. Re-apply none when hidden is present. */
.topbar__actions[hidden] { display: none; }

/* Icon button — used for the help (?) and user-account triggers. */
.icon-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  color: var(--fg-1);
  transition: background 140ms ease, color 140ms ease;
  padding: 0;
}
.icon-btn:hover { background: var(--bg-muted); }
.icon-btn[aria-expanded="true"] {
  background: var(--blue-700);
  color: var(--white);
}
.icon-btn svg {
  width: 22px;
  height: 22px;
  display: block;
}

/* Popover (help text + user menu). Anchored to its trigger via .menu. */
.menu { position: relative; }
.popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 280px;
  max-width: 340px;
  background: var(--white);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-2);
  padding: 20px 22px;
  z-index: var(--z-overlay);
  /* Subtle entrance — keeps the brand "professional, no bounce" feel. */
  animation: popover-in 140ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes popover-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.popover__title {
  font-family: var(--font-branded);
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 14px;
  color: var(--blue-700);
  margin: 0 0 12px;
}
.popover__list {
  margin: 0 0 14px;
  padding-left: 18px;
  font-family: var(--font-branded);
  font-weight: 500;
  font-size: var(--fs-small);
  line-height: 1.55;
  color: var(--fg-body);
}
.popover__list li { margin-bottom: 6px; }
.popover__list li:last-child { margin-bottom: 0; }
.popover__note { margin: 0; }

.popover--user { min-width: 240px; }
.popover__label {
  font-family: 'Noto Sans', Arial, sans-serif;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-3);
  margin-bottom: 4px;
}
.popover__email {
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--fg-1);
  word-break: break-all;
  margin-bottom: 14px;
}

/* 12° forward-leaning brand stripe — runs under the top bar.
 * Pure brand signature; no functional role.
 */
.brand-stripe {
  height: 6px;
  background:
    linear-gradient(90deg, var(--blue-700) 0%, var(--blue-500) 50%, var(--blue-700) 100%);
  position: relative;
  overflow: hidden;
}
.brand-stripe::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--white);
  width: 24px;
  left: 38%;
  transform: skewX(-12deg);
  opacity: 0.45;
}

/* ---- Main content area --------------------------------------------- */

.main {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 24px;
}

.card {
  background: var(--white);
  width: 100%;
  max-width: 560px;
  padding: 40px 40px 32px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-1);
  /* Sharp corners (0 radius) per brand book. */
  border-radius: var(--radius-0);
}

/* Sign-in card has no form below the title — center it. */
.card--signin {
  text-align: center;
  padding: 56px 40px 48px;
}
.card--signin .card__title {
  margin-bottom: 28px;
}

.card__title {
  font-family: var(--font-branded);
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  font-size: var(--fs-h2);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-branded);
  color: var(--fg-1);
  margin: 0 0 12px;
}

.card__lede {
  font-family: var(--font-branded);
  font-weight: 500;
  font-size: var(--fs-body);
  line-height: var(--lh-normal);
  color: var(--fg-body);
  margin: 0 0 28px;
}

.muted { color: var(--fg-3); }
.muted--small { font-size: var(--fs-small); }

code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--bg-muted);
  padding: 1px 6px;
}

/* ---- Form fields --------------------------------------------------- */

.field {
  display: block;
  margin-bottom: 22px;
}
.field__label {
  display: block;
  font-family: 'Noto Sans', Arial, sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--blue-500);
  margin-bottom: 8px;
}

.input {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 12px;
  font-family: var(--font-branded);
  font-size: var(--fs-body);
  border: 1px solid rgba(0, 54, 133, 0.25);
  border-radius: var(--radius-0);
  background: var(--white);
  color: var(--fg-1);
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.input:focus {
  border-color: var(--blue-700);
  /* Red underline accent on focus — from the design system spec. */
  box-shadow: inset 0 -2px 0 var(--red-700);
}

.input-prefix {
  position: relative;
  display: flex;
  align-items: stretch;
}
.input-prefix__sign {
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: var(--bg-muted);
  border: 1px solid rgba(0, 54, 133, 0.25);
  border-right: none;
  font-family: var(--font-branded);
  font-weight: 700;
  color: var(--fg-1);
  transition: border-color 140ms ease;
}
.input-prefix .input { border-left: none; }
/* When the input inside the group is focused, promote the prefix box's
 * border to match so the whole field reads as one unified container
 * instead of two side-by-side boxes with mismatched borders. */
.input-prefix:focus-within .input-prefix__sign {
  border-color: var(--blue-700);
}

/* Drop zone -------------------------------------------------------- */

.dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 96px;
  padding: 16px 20px;
  background: var(--bg-muted);
  border: 1px dashed rgba(0, 54, 133, 0.35);
  border-radius: var(--radius-0);
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
  text-align: center;
}
.dropzone:hover,
.dropzone:focus-visible,
.dropzone.is-dragging {
  background: #eef3fb;
  border-color: var(--blue-700);
  outline: none;
}
.dropzone__prompt {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dropzone__prompt strong {
  font-family: var(--font-branded);
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--blue-700);
}
.dropzone__picked {
  display: flex;
  align-items: center;
  gap: 12px;
}
/* [hidden] is overridden by display:flex above, so re-apply here. */
.dropzone__prompt[hidden],
.dropzone__picked[hidden] { display: none; }
.dropzone__filename {
  font-weight: 600;
  color: var(--fg-1);
  word-break: break-all;
  text-align: left;
}

/* ---- Buttons ------------------------------------------------------ */

.btn {
  font-family: 'Noto Sans', Arial, sans-serif;
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 12px 22px;
  border: none;
  border-radius: var(--radius-0);
  cursor: pointer;
  line-height: 1;
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn--primary {
  background: var(--blue-700);
  color: var(--white);
}
.btn--primary:hover:not(:disabled) { background: var(--blue-800); }
.btn--primary:active:not(:disabled) { transform: scale(0.985); }

.btn--outline {
  background: transparent;
  color: var(--blue-700);
  box-shadow: inset 0 0 0 2px var(--blue-700);
}
.btn--outline:hover { background: var(--blue-700); color: var(--white); }

.btn--lg { padding: 16px 28px; font-size: 16px; width: 100%; }
.btn--sm { padding: 9px 14px; font-size: 11px; width: 100%; }

.link {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--blue-500);
  font-family: var(--font-branded);
  font-size: var(--fs-small);
  text-decoration: underline;
}
.link:hover { color: var(--blue-700); }

/* ---- Inline messages --------------------------------------------- */

.err-msg {
  margin-top: 12px;
  color: var(--red-800);
  font-size: var(--fs-small);
  font-weight: 700;
}

.success-mark {
  width: 56px;
  height: 56px;
  margin: 0 auto 20px;
  border: 3px solid var(--fresh-700);
  color: var(--fresh-700);
  font-size: 32px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
}

/* ---- Spinner ----------------------------------------------------- */

.spinner {
  width: 32px;
  height: 32px;
  margin: 24px auto 12px;
  border: 3px solid var(--bg-muted);
  border-top-color: var(--blue-700);
  border-radius: var(--radius-pill);
  animation: spin 600ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn .spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin: 0 8px 0 0;
  vertical-align: middle;
  border-width: 2px;
  border-top-color: var(--white);
}

/* ---- Footer ------------------------------------------------------ */

.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  font-size: var(--fs-micro);
  color: var(--fg-3);
  background: var(--white);
  border-top: 1px solid var(--border);
}
.footer__tag {
  font-family: var(--font-branded);
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--blue-700);
}

/* ---- Small viewports --------------------------------------------- */

@media (max-width: 600px) {
  .topbar, .footer { padding: 12px 16px; }
  .topbar__logo { height: 36px; }
  .main { padding: 24px 12px; }
  .card { padding: 28px 22px; }
  .card--signin { padding: 40px 22px 32px; }
  .card__title { font-size: 24px; }
  .popover { right: -8px; min-width: 260px; }
}
