/* =========================================================
   Joshua Logsdon — portfolio
   Design: cool nature tones, dark-default, WCAG AA-minded.
   ========================================================= */

/* ---------- Tokens ---------- */
:root {
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, "JetBrains Mono", "Cascadia Code", "SF Mono",
               Menlo, Consolas, "Liberation Mono", monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --container: 1080px;
  --gutter: clamp(16px, 3vw, 28px);

  --shadow-sm: 0 1px 2px rgba(0,0,0,.25);
  --shadow-md: 0 8px 24px rgba(0,0,0,.35);

  --focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
  --duration: 180ms;
  --ease: cubic-bezier(.2,.6,.2,1);
}

/* Dark theme (default). Palette: deep slate + moss/teal/sage. */
:root,
:root[data-theme="dark"] {
  --bg:           #0e1618;         /* deep cool slate */
  --bg-elev:      #13212a;         /* panels / cards */
  --bg-elev-2:    #182a33;         /* hovers */
  --border:       #24414b;
  --border-soft:  #1b323b;

  --fg:           #e6eef0;         /* primary text (contrast ≥ 13:1 on --bg) */
  --fg-muted:    #b4c6ca;          /* secondary text (contrast ~7.5:1) */
  --fg-dim:      #8fa7ae;          /* tertiary (contrast ~5:1, AA for large) */

  --accent:      #7cc3a8;          /* sage/teal */
  --accent-fg:   #06221c;          /* text on accent */
  --accent-soft: rgba(124,195,168,.14);

  --sky:         #8fbfd9;          /* secondary accent (sky blue) */
  --warn:        #e6b782;

  --topo-stroke: rgba(124,195,168,.08);
  --topo-stroke-2: rgba(143,191,217,.06);
}

/* Light theme — warm stone with same accents, adjusted for contrast. */
:root[data-theme="light"] {
  --bg:           #f5f2ea;         /* warm stone */
  --bg-elev:      #ffffff;
  --bg-elev-2:    #efeadd;
  --border:       #d6cfbd;
  --border-soft:  #e3dccb;

  --fg:           #1a2a2a;
  --fg-muted:     #3a4a4a;
  --fg-dim:       #556868;

  --accent:       #2d7a5f;         /* deeper sage for AA on light bg */
  --accent-fg:    #ffffff;
  --accent-soft:  rgba(45,122,95,.12);

  --sky:          #2f6f99;
  --warn:         #a25d14;

  --topo-stroke:    rgba(45,122,95,.10);
  --topo-stroke-2:  rgba(47,111,153,.08);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  -webkit-text-size-adjust: 100%;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 3px;
  transition: color var(--duration) var(--ease);
}
a:hover { text-decoration: underline; }
a:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 2px; }

:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }

h1, h2, h3 { font-family: var(--font-mono); letter-spacing: -0.01em; line-height: 1.25; margin: 0; }
h1 { font-size: clamp(2rem, 4.5vw, 3rem); font-weight: 600; }
h2 { font-size: clamp(1.4rem, 2.4vw, 1.75rem); font-weight: 600; }
h3 { font-size: 1.05rem; font-weight: 600; }

p  { margin: 0 0 1em; }

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-fg);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  z-index: 100;
}
.skip-link:focus {
  left: 12px;
  top: 12px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border-soft);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-block: 14px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--fg);
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-mark { color: var(--accent); display: inline-flex; }
.brand-text { display: inline-flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-family: var(--font-mono); font-weight: 600; font-size: 0.98rem; }
.brand-sub { font-size: 0.78rem; color: var(--fg-dim); }

.site-nav {
  margin-inline-start: auto;
}
.site-nav ul {
  display: flex;
  gap: clamp(8px, 1.6vw, 20px);
  list-style: none;
  padding: 0;
  margin: 0;
}
.site-nav a {
  color: var(--fg-muted);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
}
.site-nav a:hover { color: var(--fg); background: var(--accent-soft); text-decoration: none; }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: color var(--duration) var(--ease),
              background var(--duration) var(--ease),
              border-color var(--duration) var(--ease);
}
.theme-toggle:hover { color: var(--fg); background: var(--bg-elev); border-color: var(--accent); }
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
:root[data-theme="light"] .theme-toggle .icon-sun  { display: block; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(48px, 8vw, 96px);
  border-bottom: 1px solid var(--border-soft);
}
.hero-inner {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: clamp(24px, 5vw, 56px);
  align-items: center;
  position: relative;
  z-index: 1;
}
.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  margin-bottom: 18px;
}
.lede {
  color: var(--fg-muted);
  font-size: 1.08rem;
  max-width: 60ch;
  margin-block: 18px 26px;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform var(--duration) var(--ease),
              background var(--duration) var(--ease),
              color var(--duration) var(--ease),
              border-color var(--duration) var(--ease);
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary {
  background: var(--accent);
  color: var(--accent-fg);
}
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, white); }
.btn-ghost {
  background: transparent;
  color: var(--fg);
  border-color: var(--border);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  list-style: none;
  padding: 0; margin: 0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--fg-dim);
}
.hero-meta li { display: inline-flex; gap: 6px; align-items: center; }

.hero-photo {
  position: relative;
  justify-self: center;
  width: min(320px, 72vw);
  aspect-ratio: 1 / 1;
}
.hero-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid var(--border);
  box-shadow: var(--shadow-md);
}
.hero-ring {
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  border: 1px dashed color-mix(in srgb, var(--accent) 55%, transparent);
  pointer-events: none;
  animation: spin 60s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Subtle topographic background lines (SVG data-URI). */
.hero-topo {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(ellipse 80% 50% at 20% 40%, var(--topo-stroke) 1px, transparent 1px),
    radial-gradient(ellipse 60% 40% at 75% 60%, var(--topo-stroke-2) 1px, transparent 1px);
  background-size: 3px 3px, 4px 4px;
  mask-image: radial-gradient(ellipse at center, black 40%, transparent 80%);
  opacity: 0.55;
  z-index: 0;
  pointer-events: none;
}

/* ---------- Sections ---------- */
.section {
  padding-block: clamp(48px, 7vw, 88px);
}
.section-alt {
  background: var(--bg-elev);
  border-block: 1px solid var(--border-soft);
}

.section h2 {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 28px;
}
.section-num {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.04em;
}

.prose { max-width: 72ch; color: var(--fg-muted); }
.prose p { color: var(--fg-muted); }

/* ---------- Timeline ---------- */
.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  border-left: 1px solid var(--border);
  padding-left: 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.tl-item { position: relative; }
.tl-item::before {
  content: "";
  position: absolute;
  left: -30px;
  top: 8px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 3px var(--bg);
}
.tl-head h3 { font-family: var(--font-mono); font-size: 1.02rem; }
.tl-dim { color: var(--fg-dim); font-weight: 500; }
.tl-meta {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--fg-dim);
  margin: 4px 0 10px;
}
.tl-body {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--fg-muted);
}
.tl-body li {
  position: relative;
  padding-left: 20px;
}
.tl-body li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.7em;
  width: 10px;
  height: 1px;
  background: var(--accent);
  opacity: 0.7;
}

/* ---------- Skills ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.skill-card {
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 18px 18px 14px;
  transition: border-color var(--duration) var(--ease),
              transform var(--duration) var(--ease);
}
:root[data-theme="dark"] .skill-card { background: var(--bg); }
.skill-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.skill-card h3 {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--accent);
  margin-bottom: 10px;
}
.chips {
  list-style: none;
  padding: 0; margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chips li {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--fg-muted);
  background: var(--bg-elev-2);
  border: 1px solid var(--border-soft);
  padding: 3px 8px;
  border-radius: 999px;
}

/* ---------- Education ---------- */
.edu-list {
  list-style: none;
  padding: 0; margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.edu-list li {
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}
:root[data-theme="light"] .edu-list li { background: var(--bg-elev); }
.edu-list h3 { font-family: var(--font-mono); font-size: 0.98rem; }
.edu-meta {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--fg-dim);
  margin: 4px 0 0;
}

/* ---------- Projects placeholder ---------- */
.placeholder {
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 28px;
  background:
    repeating-linear-gradient(
      -45deg,
      transparent 0 12px,
      var(--accent-soft) 12px 13px
    );
  text-align: center;
  color: var(--fg-muted);
}

/* ---------- Contact ---------- */
.contact-lede { color: var(--fg-muted); max-width: 60ch; margin-bottom: 20px; }
.contact-list {
  list-style: none;
  padding: 0; margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.contact-list a {
  display: block;
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  color: var(--fg);
  transition: border-color var(--duration) var(--ease),
              background var(--duration) var(--ease),
              transform var(--duration) var(--ease);
}
:root[data-theme="light"] .contact-list a { background: var(--bg-elev); }
.contact-list a:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
  transform: translateY(-1px);
}
.contact-k {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.contact-v { color: var(--accent); font-family: var(--font-mono); font-size: 0.95rem; word-break: break-word; }

/* ---------- Footer ---------- */
.site-footer {
  padding-block: 28px;
  border-top: 1px solid var(--border-soft);
  color: var(--fg-dim);
  font-size: 0.9rem;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  justify-content: space-between;
  align-items: flex-end;
}
.footer-inner p { margin: 0; }
.footer-meta { font-family: var(--font-mono); font-size: 0.8rem; margin-top: 4px; }
.footer-note {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--fg-dim);
  max-width: 34ch;
  text-align: right;
  opacity: 0.85;
}

/* ---------- Back-to-top (inline + floating) ---------- */
.back-to-top-inline {
  margin-top: 28px;
  text-align: right;
}
.back-to-top-inline a {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--fg-dim);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  transition: color var(--duration) var(--ease),
              border-color var(--duration) var(--ease),
              background var(--duration) var(--ease);
}
.back-to-top-inline a:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
}

.to-top {
  position: fixed;
  right: clamp(14px, 3vw, 28px);
  bottom: clamp(14px, 3vw, 28px);
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elev);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--duration) var(--ease),
              transform var(--duration) var(--ease),
              color var(--duration) var(--ease),
              border-color var(--duration) var(--ease);
  z-index: 40;
}
.to-top[hidden] { display: none; }
.to-top.is-visible { opacity: 1; transform: translateY(0); }
.to-top:hover { color: var(--accent); border-color: var(--accent); }
@media (prefers-reduced-motion: reduce) {
  .to-top { transition: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 780px) {
  .hero-inner {
    grid-template-columns: 1fr;
    text-align: left;
  }
  .hero-photo { order: -1; width: min(200px, 60vw); }
  .site-nav { display: none; }
}

@media (max-width: 520px) {
  body { font-size: 16px; }
  .hero { padding-block: 40px; }
  .hero-photo { width: 170px; }
}

/* Print — clean, document-style for recruiters who print the page */
@media print {
  .site-header, .theme-toggle, .hero-topo, .hero-ring, .skip-link, .site-footer, .placeholder { display: none !important; }
  :root { --bg: #fff; --bg-elev: #fff; --fg: #111; --fg-muted: #222; --fg-dim: #444; --accent: #1a5c45; --border: #ccc; --border-soft: #ddd; }
  body { background: #fff; color: #111; }
  .hero, .section, .section-alt { padding-block: 18px; background: #fff !important; border: none; }
  .hero-photo img { width: 120px; height: 120px; }
  a { color: #1a5c45; text-decoration: underline; }
}
