/* ==========================================================================
   site.css — shared styling for /projects
   Built to match the personal site and blog: same palette, same type,
   same weights, same hairlines. Light only, no frameworks, no CDNs.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Fonts — the same three families the blog uses, self-hosted
   -------------------------------------------------------------------------- */
@import url('/assets/fonts/fonts.css');

/* --------------------------------------------------------------------------
   2. Tokens — values lifted from index.html and blog.html
   -------------------------------------------------------------------------- */
:root {
  color-scheme: light;

  /* surfaces & ink */
  --bg:            #fbfbfb;
  --bg-sunken:     #f6f8fa;
  --surface:       #ffffff;
  --surface-2:     #f6f8fa;
  --border:        #e5e7eb;
  --border-strong: #d3d7dd;
  --text:          #444444;
  --text-dark:     #333333;
  --text-2:        #555555;
  --muted:         #888888;

  /* the site's navy, and the blue it uses for accents */
  --accent:        #003d83;
  --accent-hover:  #1f62cc;
  --accent-ink:    #ffffff;
  --accent-bright: #007bff;
  --accent-bg:     rgba(0, 123, 255, 0.05);
  --accent-bg-2:   rgba(0, 123, 255, 0.12);
  --accent-br:     rgba(0, 123, 255, 0.20);
  --menu-ink:      #002147;

  --positive:      #157347;
  --caution:       #8a5b00;
  --critical:      #b02a20;

  --shadow-1: 0 1px 4px rgba(0, 0, 0, 0.06);
  --shadow-2: 0 2px 10px rgba(0, 0, 0, 0.08);
  --ring:     0 0 0 3px rgba(0, 123, 255, 0.25);

  /* type */
  --font-sans:  'Roboto', sans-serif;
  --font-prose: 'Inter', sans-serif;
  --font-serif: 'Inter', sans-serif;
  --font-mono:  'JetBrains Mono', 'Consolas', monospace;

  --fs-xs:   0.72rem;
  --fs-sm:   0.82rem;
  --fs-base: 0.9rem;
  --fs-md:   1rem;
  --fs-lg:   1.15rem;
  --fs-xl:   1.4rem;
  --fs-2xl:  1.8rem;
  --fs-3xl:  2.1rem;

  --lh-tight: 1.3;
  --lh-snug:  1.5;
  --lh-base:  1.7;
  --lh-loose: 1.85;

  /* space */
  --sp-1: 0.25rem;  --sp-2: 0.5rem;  --sp-3: 0.75rem; --sp-4: 1rem;
  --sp-5: 1.5rem;   --sp-6: 2rem;    --sp-7: 2.5rem;  --sp-8: 3rem;
  --sp-9: 4rem;     --sp-10: 5rem;   --sp-12: 7rem;

  /* shape */
  --r-sm:   3px;
  --r:      6px;
  --r-lg:   8px;
  --r-xl:   10px;
  --r-full: 999px;

  /* layout — 820px is the blog's measure */
  --w-prose:  820px;
  --w-narrow: 820px;
  --w-page:   1000px;

  --t-fast: 150ms ease;
  --t:      200ms ease;
}

/* --------------------------------------------------------------------------
   3. Reset & base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-family: var(--font-prose);
  font-weight: 600;
  line-height: var(--lh-tight);
  color: var(--text-dark);
}

p { margin: 0 0 var(--sp-4); }
p:last-child { margin-bottom: 0; }

a {
  color: var(--accent);
  font-weight: 400;
  text-decoration: none;
  transition: color var(--t-fast);
}
a:hover { color: var(--accent-hover); text-decoration: none; }

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

ul, ol { margin: 0 0 var(--sp-4); padding-left: 1.25rem; }
li { margin-bottom: var(--sp-1); }

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

code, kbd, pre, samp { font-family: var(--font-mono); font-size: 0.875em; }

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

::selection { background: var(--accent-bg-2); }

:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--r-sm);
}

/* scrollbars, matching the blog's */
* { scrollbar-width: thin; scrollbar-color: #e0e0e0 transparent; }
*::-webkit-scrollbar { width: 5px; height: 5px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background-color: #e0e0e0; border-radius: 10px; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: var(--surface);
  color: var(--text);
  padding: var(--sp-2) var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--r);
}
.skip-link:focus { left: var(--sp-4); top: var(--sp-4); }

/* --------------------------------------------------------------------------
   4. Layout primitives
   -------------------------------------------------------------------------- */
.wrap {
  width: 100%;
  max-width: var(--w-page);
  margin-inline: auto;
  padding-inline: 1.5rem;
}
.wrap--narrow { max-width: var(--w-narrow); }
.wrap--prose  { max-width: var(--w-prose); }

.stack > * + * { margin-top: var(--sp-4); }
.row { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }

.section { margin-top: var(--sp-8); }
.section:first-child { margin-top: 0; }

/* the site's section heading: .header-1 in index.html */
.section-title {
  font-family: var(--font-prose);
  font-size: var(--fs-2xl);
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: var(--sp-5);
}

/* --------------------------------------------------------------------------
   5. Header bar — the blog's nav, reused
   -------------------------------------------------------------------------- */
.site-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(251, 251, 251, 0.92);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0;
}

.site-bar__inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  max-width: var(--w-page);
  margin-inline: auto;
  padding-inline: 1.5rem;
}

.site-bar__home {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--accent);
  font-weight: 400;
  font-size: 0.95rem;
}
.site-bar__home:hover { color: var(--accent-hover); }

.site-bar__sep { color: var(--border); font-size: 1.1rem; user-select: none; }

.site-bar__crumb {
  color: var(--muted);
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
a.site-bar__crumb:hover { color: var(--text-2); }

.site-bar__nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.site-bar__link {
  color: var(--menu-ink);
  font-size: 0.88rem;
  font-weight: 300;
  white-space: nowrap;
}
.site-bar__link:hover { color: var(--accent-hover); }
.site-bar__link[aria-current='page'] { color: var(--muted); }

@media (max-width: 34rem) {
  .site-bar__inner { gap: 0.75rem; }
  .site-bar__nav { gap: 0.75rem; }
  .site-bar__sep, .site-bar__crumb { display: none; }
}

/* dark mode was removed to match the rest of the site */
.theme-toggle { display: none !important; }

/* --------------------------------------------------------------------------
   6. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 0.4rem 0.85rem;
  font-family: var(--font-prose);
  font-size: var(--fs-sm);
  font-weight: 500;
  line-height: 1.4;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.btn:hover { background: var(--surface-2); border-color: var(--muted); color: var(--text); }
.btn[disabled], .btn[aria-disabled='true'] { opacity: .45; pointer-events: none; }
.btn svg { width: 14px; height: 14px; flex: none; }

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--accent-ink);
}

.btn--ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn--ghost:hover { background: var(--surface-2); border-color: transparent; color: var(--accent-hover); }

.btn--sm { padding: 0.2rem 0.5rem; font-size: var(--fs-xs); }
.btn--lg { padding: 0.55rem 1.1rem; font-size: var(--fs-base); }
.btn--block { width: 100%; }

/* --------------------------------------------------------------------------
   7. Tags / chips / badges — the site's .tag, exactly
   -------------------------------------------------------------------------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  color: var(--text);
  border: 1px solid rgb(155, 155, 155);
  padding: 2px 4px;
  border-radius: 3px;
  margin: 0 1px;
  font-size: 90%;
  background-color: rgba(88, 88, 88, 0.05);
  text-decoration: none;
}
a.tag:hover { color: var(--accent-hover); border-color: var(--accent-br); }
.tag svg { width: 11px; height: 11px; }

/* the blog's tag pills */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent);
  background: var(--accent-bg);
  border: 1px solid var(--accent-br);
  border-radius: 12px;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.chip:hover { background: var(--accent-bg-2); }
.chip[aria-pressed='true'] {
  background: rgba(0, 123, 255, 0.9);
  border-color: rgba(0, 123, 255, 0.9);
  color: #fff;
}

.badge {
  display: inline-block;
  padding: 1px 7px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  border-radius: 3px;
  background: var(--accent-bg);
  color: var(--accent);
  border: 1px solid var(--accent-br);
}

/* --------------------------------------------------------------------------
   8. Cards
   -------------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-1);
  padding: var(--sp-5);
}
.card--flat { background: transparent; border-color: transparent; box-shadow: none; padding: 0; }

a.card, .card--link {
  display: block;
  color: inherit;
  transition: border-color var(--t), box-shadow var(--t);
}
a.card:hover, .card--link:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-2);
  color: inherit;
}

/* --------------------------------------------------------------------------
   9. Form controls
   -------------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: var(--sp-2); }
.label {
  font-family: var(--font-prose);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-2);
}
.hint { font-size: var(--fs-xs); color: var(--muted); }

.input, .select, .textarea {
  width: 100%;
  padding: 0.45rem 0.65rem;
  font-size: var(--fs-sm);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  appearance: none;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent-bright);
  box-shadow: var(--ring);
}
.input::placeholder, .textarea::placeholder { color: var(--muted); }

.select {
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
  background-size: 15px;
}

input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 20px;
  background: transparent;
  cursor: pointer;
}
input[type='range']::-webkit-slider-runnable-track {
  height: 4px; border-radius: var(--r-full); background: var(--border);
}
input[type='range']::-moz-range-track {
  height: 4px; border-radius: var(--r-full); background: var(--border);
}
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px; margin-top: -5px;
  border-radius: 50%; background: var(--accent-bright);
  border: 2px solid var(--surface);
  box-shadow: var(--shadow-1);
}
input[type='range']::-moz-range-thumb {
  width: 14px; height: 14px; border: 2px solid var(--surface);
  border-radius: 50%; background: var(--accent-bright);
}

input[type='checkbox'], input[type='radio'] { accent-color: var(--accent-bright); width: 15px; height: 15px; }

.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex: none;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute;
  inset: 0;
  background: var(--border-strong);
  border-radius: var(--r-full);
  transition: background var(--t);
  cursor: pointer;
}
.switch span::before {
  content: '';
  position: absolute;
  height: 14px; width: 14px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--t);
}
.switch input:checked + span { background: var(--accent-bright); }
.switch input:checked + span::before { transform: translateX(16px); }
.switch input:focus-visible + span { box-shadow: var(--ring); }

/* --------------------------------------------------------------------------
   10. Small pieces
   -------------------------------------------------------------------------- */
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.mono  { font-family: var(--font-mono); }
.nums  { font-variant-numeric: tabular-nums; }
.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;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.2rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.meta-row > span { display: inline-flex; align-items: center; gap: 0.3rem; }
.meta-row svg { width: 13px; height: 13px; opacity: .8; }

.divider { height: 1px; background: var(--border); border: 0; margin: var(--sp-6) 0; }

.callout {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-bright);
  background: var(--surface);
  border-radius: var(--r);
  padding: var(--sp-4);
  font-size: var(--fs-base);
  color: var(--text-2);
}

.empty-state {
  text-align: center;
  padding: var(--sp-8) var(--sp-4);
  color: var(--muted);
  font-size: var(--fs-base);
}

.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-bright);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------------
   11. Footer
   -------------------------------------------------------------------------- */
.site-foot {
  margin-top: var(--sp-9);
  border-top: 1px solid var(--border);
  padding: var(--sp-5) 0 var(--sp-7);
  font-size: var(--fs-sm);
  color: var(--muted);
}
.site-foot__inner {
  max-width: var(--w-page);
  margin-inline: auto;
  padding-inline: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-5);
  align-items: center;
  justify-content: space-between;
}
.site-foot a { color: var(--menu-ink); font-weight: 300; }
.site-foot a:hover { color: var(--accent-hover); }
