/* Shared styles for every page on christopherthomas.dev */

:root {
  --bg: #fbfaf7;
  --text: #1d2330;
  --muted: #5b6474;
  --accent: #1f3864;
  --rule: #e3e0d8;
  --card: #ffffff;
  --nav-bg: rgba(251, 250, 247, 0.9);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151b;
    --text: #e8ebf0;
    --muted: #9aa3b2;
    --accent: #8fb0e8;
    --rule: #2a303b;
    --card: #191d25;
    --nav-bg: rgba(18, 21, 27, 0.9);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); text-underline-offset: 3px; }

/* ---------- Header and tabs ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--nav-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}

.site-header .inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
}

.site-name {
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
  padding: 6px 12px;
  border-radius: 999px;
}

.site-nav a:hover { color: var(--text); background: var(--rule); }

.site-nav a[aria-current="page"] {
  color: var(--bg);
  background: var(--accent);
}

/* ---------- Page body ---------- */

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 56px 20px 48px;
}

h1 {
  font-size: clamp(2rem, 6vw, 2.8rem);
  line-height: 1.1;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}

.tagline {
  color: var(--accent);
  font-weight: 600;
  margin: 0 0 28px;
}

p { margin: 0 0 16px; }

h2 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 44px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}

/* Cards (projects, highlights) */

.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 14px;
}

.card h3 { margin: 0 0 6px; font-size: 1.1rem; }
.card p { color: var(--muted); }
.card p:last-child, .card ul:last-child { margin-bottom: 0; }

.card-figure { margin: 18px 0 14px; }

.card-figure img {
  display: block;
  width: 100%;
  max-width: 480px;
  height: auto;
  margin: 0 auto; /* centers the image in the card */
  border-radius: 10px;
  border: 1px solid var(--rule);
}

.card-figure figcaption {
  text-align: center;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 1px 9px;
  margin-left: 6px;
  vertical-align: 2px;
}

/* Stat row on the About page */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 8px 0 0;
}

.stat {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 14px 16px;
}

.stat strong {
  display: block;
  font-size: 1.6rem;
  line-height: 1.2;
  color: var(--accent);
}

.stat span { color: var(--muted); font-size: 0.9rem; }

/* Experience entries */

.job { margin-bottom: 32px; }

.job-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0 16px;
}

.job-head h3 { margin: 0; font-size: 1.1rem; }
.job-dates { color: var(--muted); font-size: 0.9rem; white-space: nowrap; }
.job-org { color: var(--accent); font-weight: 600; margin: 2px 0 10px; }

ul { margin: 0 0 16px; padding-left: 1.2em; }
li { margin-bottom: 6px; }

/* Skill tags */

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; padding: 0; list-style: none; }

.tags li {
  margin: 0;
  font-size: 0.85rem;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--rule);
}

.skill-group h3 { font-size: 0.95rem; margin: 0 0 8px; }

/* Buttons */

.button {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--bg);
  text-decoration: none;
  font-weight: 600;
}

.button.secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 24px 0 0; }

/* ---------- PDF popup (pdf-viewer.js) ---------- */

body.pdf-viewer-open { overflow: hidden; }

.pdf-viewer {
  width: min(1000px, calc(100vw - 32px));
  height: calc(100vh - 48px);
  max-width: none;
  max-height: none;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  overflow: hidden;
}

/* ---------- Chris Cube demo (cube.js) ---------- */

.cube-demo {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
}

.cube-demo h4 { margin: 0 0 6px; font-size: 1rem; }

button.button { font: inherit; font-weight: 600; border: 0; cursor: pointer; }
button.button:disabled { opacity: 0.5; cursor: default; }

.cube-file-label { position: relative; cursor: pointer; }
.cube-file-label:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.cube-file-label input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.cube-editor { margin-top: 18px; }

.cube-crop {
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
}

.cube-crop canvas {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  border: 1px solid var(--rule);
  background: #fff;
  cursor: grab;
  touch-action: none; /* lets drag and pinch work on phones */
}

.cube-crop canvas:active { cursor: grabbing; }

/* Locked while the cube is being made */
.cube-editor.is-locked canvas { opacity: 0.6; cursor: progress; }
.cube-editor.is-locked .cube-zoom { opacity: 0.5; }
.cube-file-label:has(input:disabled) { opacity: 0.5; cursor: default; }
.cube-crop canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.cube-hint {
  font-size: 0.85rem;
  text-align: center;
  margin: 8px 0 12px;
}

.cube-zoom {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 360px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 0.9rem;
}

.cube-zoom input { flex: 1; accent-color: var(--accent); }

.cube-editor .actions, .cube-result .actions { justify-content: center; margin-top: 16px; }

.card p.cube-status { margin: 14px 0 0; text-align: center; font-size: 0.9rem; min-height: 1.4em; }
.card p.cube-status.is-error { color: #c0392b; }
.card p.cube-status:empty { margin: 0; min-height: 0; }

.pdf-viewer::backdrop { background: rgba(10, 12, 16, 0.6); }

.pdf-viewer-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: var(--card);
}

.pdf-viewer-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 8px 16px;
  border-bottom: 1px solid var(--rule);
}

.pdf-viewer-title {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pdf-viewer-btn {
  font: inherit;
  font-size: 0.85rem;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 4px 12px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.pdf-viewer-btn:hover { background: var(--rule); }

.pdf-viewer-close {
  font-size: 1.3rem;
  line-height: 1;
  padding: 2px 10px 4px;
}

.pdf-viewer-frame {
  flex: 1;
  width: 100%;
  border: 0;
  background: #525659;
}

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

.site-footer {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 20px 48px;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.9rem;
}
