/* ==========================================================================
   ArchiTask — Reset + base element styles + utilities
   ========================================================================== */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-14);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6, p, figure, blockquote { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; padding: 0; }
/* Links inherit their surrounding ink. Tinting them meant every block link —
   a notification row, a card, a table row — rendered its whole contents in
   the accent. Affordance in running text comes from the underline below. */
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

/* In running text an accent-coloured link would read as ordinary ink, so
   these carry a standing underline for affordance. Block-level links (cards,
   nav items, rows) set their own text-decoration and are unaffected. */
.feed-item .txt a,
.auth .alt a,
.auth .forgot,
.card-foot a {
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: var(--border-strong);
}
.feed-item .txt a:hover,
.auth .alt a:hover,
.auth .forgot:hover,
.card-foot a:hover { text-decoration-color: currentColor; }
table { border-collapse: collapse; width: 100%; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--s5) 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}
:focus:not(:focus-visible) { outline: none; }

::selection { background: var(--brand-soft-2); color: var(--text); }

/* Scrollbars — quiet, consistent across panes. */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--r-full);
  border: 3px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background-color: var(--text-3); background-clip: content-box; }

/* --- Typography helpers --------------------------------------------------- */
.h1 { font-size: var(--fs-24); font-weight: 650; letter-spacing: -.02em; line-height: 1.25; }
.h2 { font-size: var(--fs-18); font-weight: 620; letter-spacing: -.01em; line-height: 1.3; }
.h3 { font-size: var(--fs-15); font-weight: 600; line-height: 1.35; }
.eyebrow {
  font-size: var(--fs-11); font-weight: 620; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-3);
}
.muted    { color: var(--text-2); }
.subtle   { color: var(--text-3); }
.tnum     { font-variant-numeric: tabular-nums; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.clamp-2 {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --- Layout utilities ----------------------------------------------------- */
.row  { display: flex; align-items: center; gap: var(--s3); }
.row-t{ display: flex; align-items: flex-start; gap: var(--s3); }
.col  { display: flex; flex-direction: column; gap: var(--s3); }
.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.center  { justify-content: center; }
.end     { justify-content: flex-end; }
.grow    { flex: 1 1 auto; min-width: 0; }
.gap-1{gap:var(--s1)} .gap-2{gap:var(--s2)} .gap-4{gap:var(--s4)}
.gap-5{gap:var(--s5)} .gap-6{gap:var(--s6)}
.mt-2{margin-top:var(--s2)} .mt-4{margin-top:var(--s4)} .mt-6{margin-top:var(--s6)}
.hidden { display: none !important; }

/* Screen-reader only, but focusable when it needs to be (skip link). */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; top: var(--s3); left: var(--s3); z-index: 999;
  padding: var(--s2) var(--s4); background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--sh-3);
  transform: translateY(-200%); transition: transform var(--t-med) var(--ease);
}
.skip-link:focus { transform: translateY(0); text-decoration: none; }

/* --- Motion --------------------------------------------------------------- */
@keyframes fade-in   { from { opacity: 0 } to { opacity: 1 } }
@keyframes rise-in   { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: none } }
@keyframes pop-in    { from { opacity: 0; transform: scale(.96) translateY(6px) } to { opacity: 1; transform: none } }
@keyframes slide-left{ from { opacity: 0; transform: translateX(16px) } to { opacity: 1; transform: none } }
@keyframes spin      { to { transform: rotate(360deg) } }
@keyframes pulse     { 0%, 100% { opacity: 1 } 50% { opacity: .5 } }
@keyframes draw      { from { stroke-dashoffset: var(--dash) } to { stroke-dashoffset: 0 } }

.anim-rise { animation: rise-in var(--t-slow) var(--ease-out) both; }
.anim-fade { animation: fade-in var(--t-med) var(--ease) both; }

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

/* The in-app "reduce motion" setting, independent of the OS preference. */
:root[data-motion="reduced"] *,
:root[data-motion="reduced"] *::before,
:root[data-motion="reduced"] *::after {
  animation-duration: .01ms !important;
  animation-delay: 0ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .01ms !important;
}

/* --- Skeletons ------------------------------------------------------------ */
.skel {
  background: var(--surface-3); border-radius: var(--r-sm);
  animation: pulse 1.6s var(--ease) infinite;
}
.skel-line { height: 12px; margin-bottom: var(--s2); }
.skel-line:last-child { width: 60%; margin-bottom: 0; }

/* Refetch hold: keep the previous render, dim it — never a skeleton flash. */
.is-refetching { opacity: .55; transition: opacity var(--t-fast) var(--ease); pointer-events: none; }

/* --- Print ---------------------------------------------------------------- */
@media print {
  .app-rail, .topbar, .fab, .toast-root { display: none !important; }
  .app-main { margin: 0 !important; }
  .card { break-inside: avoid; box-shadow: none; border: 1px solid #ccc; }
}
