/* ==========================================================================
   Platinum Age PM — Base
   Font faces, reset, element defaults, typography, accessibility helpers.
   Depends on tokens.css.
   ========================================================================== */

/* ---------- Inter, self-hosted (SIL Open Font License 1.1) ---------------- */
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/inter-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/inter-latin-500-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/inter-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/inter-latin-700-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

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

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

body,
h1, h2, h3, h4, h5, h6,
p, figure, blockquote, dl, dd,
ul, ol {
  margin: 0;
}

ul[class],
ol[class] {
  padding: 0;
  list-style: none;
}

body {
  min-height: 100vh;
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-normal);
  font-weight: var(--fw-regular);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
  font-variant-numeric: tabular-nums;
}

img,
picture,
svg,
video {
  max-width: 100%;
  display: block;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}

button[disabled],
input[disabled],
select[disabled],
textarea[disabled] {
  cursor: not-allowed;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%;
}

hr {
  border: 0;
  border-top: 1px solid var(--border-default);
  margin: var(--sp-6) 0;
}

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

legend {
  padding: 0;
}

/* ---------- Links -------------------------------------------------------- */
a {
  color: var(--accent-blue);
  text-decoration: none;
}

a:hover {
  color: var(--accent-blue-hover);
  text-decoration: underline;
}

/* ---------- Focus -------------------------------------------------------- */
:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
  border-radius: var(--radius-small);
}

/* Elements sitting directly on the page background get a ring with an inner
   dark halo so the indicator reads against both the element and the page. */
.btn:focus-visible,
.nav-link:focus-visible,
.sidebar-link:focus-visible,
.project-card:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ---------- Typography --------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  color: var(--text-primary);
}

h1 { font-size: var(--fs-page-title); }
h2 { font-size: var(--fs-panel-title); }
h3 { font-size: var(--fs-card-title); }
h4 { font-size: var(--fs-body); }

p {
  line-height: var(--lh-relaxed);
  max-width: 78ch;
}

small {
  font-size: var(--fs-body-sm);
}

code,
kbd {
  font-family: var(--font-numeric);
  font-size: 0.85em;
  background: var(--bg-panel-dark);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-small);
  padding: 0.1em 0.35em;
}

/* ---------- Reusable text utilities -------------------------------------- */
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--text-primary); }
.text-green { color: var(--accent-green); }
.text-amber { color: var(--accent-amber); }
.text-red { color: var(--accent-red); }
.text-blue { color: var(--accent-blue); }
.text-purple { color: var(--accent-purple); }

.text-sm { font-size: var(--fs-body-sm); }
.text-semibold { font-weight: var(--fw-semibold); }
.text-medium { font-weight: var(--fw-medium); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-nowrap { white-space: nowrap; }

.numeric {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* Compact uppercase label — the reference design's recurring label style. */
.label,
.field-label,
.stat-label,
.section-label {
  display: block;
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--text-muted);
}

.lede {
  color: var(--text-secondary);
  font-size: var(--fs-body);
  line-height: var(--lh-relaxed);
  max-width: 74ch;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Layout utilities --------------------------------------------- */
.stack > * + * { margin-top: var(--sp-4); }
.stack-sm > * + * { margin-top: var(--sp-2); }
.stack-lg > * + * { margin-top: var(--sp-6); }

.row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}

.row-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.grow { flex: 1 1 auto; min-width: 0; }
.shrink-0 { flex-shrink: 0; }

.mt-0 { margin-top: 0; }
.mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }
.mb-2 { margin-top: 0; margin-bottom: var(--sp-2); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-6 { margin-bottom: var(--sp-6); }

/* ---------- Icons -------------------------------------------------------- */
.icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke-width: 2;
  vertical-align: middle;
}

.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }

/* ---------- Accessibility helpers ---------------------------------------- */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: var(--sp-2);
  left: var(--sp-2);
  z-index: 500;
  transform: translateY(-200%);
  background: var(--accent-blue-solid);
  color: var(--text-on-accent);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-small);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-body-sm);
  transition: transform var(--motion-fast) var(--ease-out);
}

.skip-link:focus {
  transform: translateY(0);
  text-decoration: none;
  color: var(--text-on-accent);
}

/* Screen readers must not lose the meaning carried by colour. Every status
   surface in components.css pairs its colour with a text label; this class
   supplies extra description where a visual shorthand is used. */
.sr-detail {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

[hidden] {
  display: none !important;
}

/* ---------- Scrollbars (dark, unobtrusive) -------------------------------- */
* {
  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(--radius-pill);
  border: 2px solid transparent;
  background-clip: content-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: #4a5464;
  background-clip: content-box;
}

/* ---------- Print -------------------------------------------------------- */
@media print {
  body {
    background: #fff;
    color: #000;
  }
  .app-header,
  .app-sidebar,
  .no-print {
    display: none !important;
  }
}
