/* Fixboard base: reset, typography, the page shell (header, main,
   footer), buttons and utilities. Tokens live in tokens.css.
   Hover styles sit inside @media (hover: hover) so a tap on a phone never
   leaves a control looking hovered. */

/* ------------------------------------------------------------ reset */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--sticky-h) + 16px); }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font: 400 1rem/1.55 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
h1, h2, h3, h4, h5, p, ul, ol, dl, dd, figure, blockquote, pre { margin: 0; }
ul[class], ol[class] { list-style: none; padding: 0; }
img, svg { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--link); text-underline-offset: 3px; text-decoration-thickness: 1px; }
@media (hover: hover) { a:hover { text-decoration-thickness: 2px; } }
code, pre { font-family: var(--font-mono); font-size: 0.875em; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }
[tabindex="-1"]:focus { outline: none; }
::selection { background: rgba(30, 78, 216, 0.22); }

/* ------------------------------------------------------------ utilities */

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
.muted { color: var(--text-3); }
.wide-only { display: none; }
@media (min-width: 560px) { .wide-only { display: inline; } }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  padding: 10px 16px; border-radius: var(--radius-sm);
  background: var(--brand); color: var(--on-brand); font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 10px; }

/* ------------------------------------------------------------ header */

.site-header {
  position: sticky; top: 0; z-index: 40;
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--border);
}
/* overflow-x: clip keeps any long word inside the page width without
   making a scroll container (sticky and focus rings keep working). */
.site-header__inner {
  max-width: var(--max); height: var(--header-h);
  margin: 0 auto; padding: 0 var(--pad-r) 0 var(--pad-l);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  overflow-x: clip;
}
.brand {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; min-width: 44px;
  color: var(--text); text-decoration: none; flex-shrink: 0;
}
.brand__mark { width: 30px; height: 30px; flex-shrink: 0; border-radius: 8px; box-shadow: 0 2px 6px rgba(30, 78, 216, 0.28); }
.brand__name { font-size: 1.125rem; font-weight: 750; letter-spacing: -0.015em; }
.brand__tag {
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; line-height: 1;
  padding: 4px 6px; border-radius: 6px;
  background: var(--brand-wash); color: var(--brand-ink);
}
.site-header__actions { display: flex; align-items: center; gap: 6px; min-width: 0; }
.site-header__report { padding-inline: 14px 16px; }
.site-header__report[aria-current="page"] { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35); }

.admin-badge {
  display: inline-flex; align-items: center;
  border-radius: 10px; background: var(--brand-wash); color: var(--brand-ink);
}
.admin-badge__link, .admin-signout {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; min-width: 44px; padding: 0 10px;
  color: inherit; font-size: 0.875rem; font-weight: 700; text-decoration: none;
  background: transparent; border: 0; border-radius: 10px;
}
.admin-badge__text, .admin-signout { display: none; }
@media (hover: hover) { .admin-badge__link:hover, .admin-signout:hover { background: rgba(30, 78, 216, 0.1); } }
@media (min-width: 560px) {
  .admin-badge__text { display: inline; }
  .admin-signout { display: inline-flex; padding: 0; border-left: 1px solid rgba(30, 78, 216, 0.18); border-radius: 0 10px 10px 0; }
}

/* Small phones (360px is the most common Android width): the header drops
   the JCF tag before anything else when the team badge needs the room. */
@media (max-width: 399px) {
  .site-header.is-admin .brand__tag { display: none; }
  .site-header__actions { gap: 4px; }
  .site-header__report { padding-inline: 12px 14px; }
}
@media (max-width: 359px) {
  .brand__tag { display: none; }
}
@media (max-width: 349px) {
  .site-header.is-admin .brand__name { display: none; }
}
/* Short landscape screens: a sticky header would cover a fifth of the
   height, so it scrolls away with the page (tokens.css sets --sticky-h). */
@media (orientation: landscape) and (max-height: 500px) {
  .site-header { position: relative; }
}

.theme-toggle__sun { display: none; }
.theme-toggle.is-dark .theme-toggle__sun { display: block; }
.theme-toggle.is-dark .theme-toggle__moon { display: none; }

/* ------------------------------------------------------------ main and footer */

.site-main {
  flex: 1 0 auto; width: 100%; max-width: var(--max);
  margin: 0 auto; padding: 16px var(--pad-r) 64px var(--pad-l);
  overflow-x: clip;
}
.site-main:focus { outline: none; }
.noscript { padding: 16px; border-radius: var(--radius); background: var(--st-needs-bg); color: var(--st-needs-ink); font-weight: 600; }

.site-footer { border-top: 1px solid var(--border); background: var(--surface); }
.site-footer__inner {
  max-width: var(--max); margin: 0 auto; padding: 20px var(--pad-r) max(28px, env(safe-area-inset-bottom, 0px)) var(--pad-l);
  display: flex; flex-wrap: wrap; gap: 4px 20px; align-items: center;
  color: var(--text-3); font-size: 0.875rem;
  overflow-x: clip;
}
.site-footer__warn { font-weight: 600; color: var(--text-2); }
.site-footer a { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; font-weight: 600; }

.page { display: flex; flex-direction: column; gap: 16px; }
.page-head { display: flex; flex-direction: column; gap: 4px; }
.page-title { font-size: 1.5rem; line-height: 1.2; font-weight: 750; letter-spacing: -0.02em; }
.page-intro { color: var(--text-2); max-width: 60ch; font-size: 0.9375rem; line-height: 1.5; }
.back-link {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; margin: -8px 0 -10px; padding-right: 8px;
  color: var(--text-2); font-weight: 600; font-size: 0.9375rem; text-decoration: none;
}
@media (hover: hover) { .back-link:hover { color: var(--text); text-decoration: underline; } }

@media (min-width: 560px) {
  .site-main { padding-top: 20px; padding-bottom: 72px; }
  .page { gap: 20px; }
  .page-head { gap: 6px; }
  .page-title { font-size: 1.625rem; }
  .page-intro { font-size: 1rem; line-height: 1.55; }
}
@media (min-width: 900px) {
  .site-main { padding-top: 28px; }
  .page-title { font-size: 2rem; }
}

/* ------------------------------------------------------------ buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px;
  border: 1px solid transparent; border-radius: 10px;
  font: 600 0.9375rem/1.2 var(--font); text-decoration: none; white-space: nowrap;
  transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease), box-shadow 0.15s var(--ease), transform 0.08s var(--ease);
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn .icon { flex-shrink: 0; }
.btn--primary { background: var(--brand); color: var(--on-brand); box-shadow: 0 1px 2px rgba(16, 24, 40, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.14); }
@media (hover: hover) { .btn--primary:hover:not(:disabled) { background: var(--brand-hover); } }
.btn--primary:active:not(:disabled) { background: var(--brand-active); }
.btn--secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-1); }
@media (hover: hover) { .btn--secondary:hover:not(:disabled) { background: var(--surface-2); border-color: var(--input-border); } }
.btn--ghost { background: transparent; color: var(--text-2); }
@media (hover: hover) { .btn--ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--text); } }
.btn--danger { background: var(--surface); color: var(--danger); border-color: var(--danger-border); }
@media (hover: hover) { .btn--danger:hover:not(:disabled) { background: var(--danger-wash); } }
.btn--success { background: var(--st-fixed-solid); color: #FFFFFF; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.14); }
@media (hover: hover) { .btn--success:hover:not(:disabled) { background: #116A32; } }
.btn--sm { padding: 8px 12px; font-size: 0.875rem; gap: 6px; }
.btn--lg { min-height: 52px; padding: 14px 24px; font-size: 1.0625rem; border-radius: 12px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 44px; height: 44px; padding: 0;
  border: 1px solid transparent; border-radius: 10px;
  background: transparent; color: var(--text-2);
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}
@media (hover: hover) { .icon-btn:hover { background: var(--surface-3); color: var(--text); } }
.icon-btn--overlay { background: rgba(15, 23, 42, 0.72); color: #FFFFFF; border-radius: 999px; }
@media (hover: hover) { .icon-btn--overlay:hover { background: rgba(15, 23, 42, 0.9); color: #FFFFFF; } }

.link-btn {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px;
  border: 0; background: none; color: var(--link);
  font-weight: 600; text-decoration: underline; text-underline-offset: 3px;
}
@media (hover: hover) { .link-btn:hover { text-decoration-thickness: 2px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
