/* ==========================================================================
   Kyler Nats — Portfolio
   Design system: modern technical dark
   Single stylesheet, no build step, no framework.
   ========================================================================== */

/* --- 1. Tokens ----------------------------------------------------------- */
:root {
  /* Surfaces: near-black base, layered upward */
  --bg:            #0B0D10;
  --bg-subtle:     #0F1216;
  --surface:       #13171D;
  --surface-hi:    #1A1F27;
  --border:        #232932;
  --border-hi:     #313947;

  /* Text */
  --text:          #E8EBF0;
  --text-muted:    #98A2B3;
  --text-faint:    #6B7484;

  /* One accent, used sparingly */
  --accent:        #2DD4BF;
  --accent-hi:     #5EEAD4;
  --accent-dim:    rgba(45, 212, 191, 0.12);
  --accent-line:   rgba(45, 212, 191, 0.35);

  /* Domain hues — used only as small identifying marks */
  --d-cloud:       #38BDF8;
  --d-detect:      #F472B6;
  --d-ai:          #A78BFA;
  --d-grc:         #FBBF24;
  --d-offensive:   #FB7185;
  --d-network:     #34D399;

  /* Type */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* Rhythm */
  --w-page:   1140px;
  --w-text:   68ch;
  --r-sm:     6px;
  --r-md:     10px;
  --r-lg:     16px;
  --pad-page: 24px;

  --t-fast:   140ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-base:   240ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- 2. Reset ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }

::selection { background: var(--accent-dim); color: var(--accent-hi); }

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

/* --- 3. Typography ------------------------------------------------------- */
h1, h2, h3, h4 {
  line-height: 1.18;
  letter-spacing: -0.022em;
  font-weight: 650;
  text-wrap: balance;
}
h1 { font-size: clamp(2.25rem, 5.2vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.175rem; }
h4 { font-size: 1rem; }

p { text-wrap: pretty; }

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

code, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--surface-hi);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 0.12em 0.4em;
}

/* Small uppercase label — the workhorse of this design */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.eyebrow--accent { color: var(--accent); }

.lede {
  font-size: clamp(1.0625rem, 2vw, 1.25rem);
  color: var(--text-muted);
  line-height: 1.6;
  max-width: var(--w-text);
}

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

.section { padding-block: clamp(56px, 9vw, 96px); }
.section--tight { padding-block: clamp(40px, 6vw, 64px); }
.section + .section { border-top: 1px solid var(--border); }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}
.section-head p { color: var(--text-muted); margin-top: 6px; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 12px;
  background: var(--accent);
  color: #04211D;
  padding: 10px 18px;
  border-radius: var(--r-sm);
  font-weight: 600;
  z-index: 200;
}
.skip-link:focus { left: 12px; }

/* --- 5. Header / nav ----------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 13, 16, 0.82);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 650;
  letter-spacing: -0.02em;
  font-size: 0.9375rem;
}
.brand:hover { color: var(--text); }
.brand__mark {
  width: 26px; height: 26px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  background: var(--accent-dim);
  border: 1px solid var(--accent-line);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 7px 13px;
  border-radius: var(--r-sm);
  transition: color var(--t-fast), background var(--t-fast);
}
.nav a:hover { color: var(--text); background: var(--surface); }
.nav a[aria-current="page"] { color: var(--text); background: var(--surface-hi); }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border-hi);
  border-radius: var(--r-sm);
  padding: 7px 9px;
  cursor: pointer;
  color: var(--text-muted);
}

@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .nav {
    position: fixed;
    inset: 64px 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 12px var(--pad-page) 20px;
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--border);
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--t-fast), transform var(--t-fast);
  }
  .nav[data-open="true"] { opacity: 1; transform: none; pointer-events: auto; }
  .nav a { padding: 12px 14px; font-size: 0.9375rem; }
}

/* --- 6. Buttons ---------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-hi);
  background: var(--surface);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 550;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast), color var(--t-fast);
}
.btn:hover {
  color: var(--text);
  background: var(--surface-hi);
  border-color: var(--border-hi);
  transform: translateY(-1px);
}
.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #04211D;
  font-weight: 600;
}
.btn--primary:hover { background: var(--accent-hi); border-color: var(--accent-hi); color: #04211D; }
.btn--ghost { background: transparent; }
.btn__icon { width: 15px; height: 15px; flex: none; }

.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* Text link with arrow */
.arrow-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 550;
}
.arrow-link svg { width: 14px; height: 14px; transition: transform var(--t-fast); }
.arrow-link:hover svg { transform: translateX(3px); }

/* --- 7. Tags / pills ----------------------------------------------------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface-hi);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 3px 10px;
  white-space: nowrap;
}
.tag--dot::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--dot, var(--accent));
  flex: none;
}
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 5px 13px 5px 11px;
}
.status__pulse {
  width: 7px; height: 7px; flex: none;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent-line);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(45, 212, 191, 0.5); }
  70%  { box-shadow: 0 0 0 8px rgba(45, 212, 191, 0); }
  100% { box-shadow: 0 0 0 0 rgba(45, 212, 191, 0); }
}

/* --- 8. Hero ------------------------------------------------------------- */
.hero {
  position: relative;
  padding-block: clamp(48px, 7vw, 88px) clamp(32px, 4vw, 48px);
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: -40% -10% auto -10%;
  height: 560px;
  background: radial-gradient(ellipse 60% 50% at 50% 50%, rgba(45, 212, 191, 0.09), transparent 70%);
  pointer-events: none;
}
.hero__grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 72px);
  align-items: center;
}
.hero h1 { margin-block: 18px 20px; }
.hero h1 .accent { color: var(--accent); }

.hero__portrait {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--border-hi);
  background: var(--surface);
  aspect-ratio: 4 / 5;
  max-width: 340px;
  margin-left: auto;
}
.hero__portrait img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 50% 18%;
  filter: saturate(0.92) contrast(1.02);
}
.hero__portrait::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(11, 13, 16, 0.55), transparent 45%);
  pointer-events: none;
}

@media (max-width: 860px) {
  .hero__grid { grid-template-columns: 1fr; }
  .hero__portrait { max-width: 200px; margin-left: 0; aspect-ratio: 1; }
}

/* --- 9. Metric strip ----------------------------------------------------- */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.metric { background: var(--bg-subtle); padding: 22px 24px; }
.metric__value {
  font-size: clamp(1.5rem, 3.4vw, 2rem);
  font-weight: 660;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text);
}
.metric__label {
  margin-top: 6px;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* --- 10. Cards ----------------------------------------------------------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.card-grid--2 { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px;
  transition: border-color var(--t-base), background var(--t-base), transform var(--t-base);
}
a.card, .card--link { cursor: pointer; }
.card:hover {
  border-color: var(--border-hi);
  background: var(--surface-hi);
  transform: translateY(-2px);
}
.card__title {
  font-size: 1.0625rem;
  font-weight: 620;
  letter-spacing: -0.018em;
  color: var(--text);
}
.card__desc { font-size: 0.9rem; color: var(--text-muted); line-height: 1.6; flex: 1; }
.card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}

/* Domain card: accent bar keyed to the domain hue */
.card--domain { padding-left: 26px; }
.card--domain::before {
  content: "";
  position: absolute;
  left: 0; top: 18px; bottom: 18px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--hue, var(--accent));
  opacity: 0.85;
}
.card__count {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-faint);
}

/* Project card */
.project-card__index {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-faint);
}
.project-card__stack {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-faint);
  line-height: 1.5;
}

/* State badge for in-progress work */
.badge {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 100px;
  border: 1px solid;
}
.badge--live    { color: var(--accent);   border-color: var(--accent-line);  background: var(--accent-dim); }
.badge--building{ color: #FBBF24;         border-color: rgba(251,191,36,.3); background: rgba(251,191,36,.1); }
.badge--planned { color: var(--text-faint); border-color: var(--border-hi);  background: transparent; }

/* --- 11. Filter bar ------------------------------------------------------ */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.filter {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 6px 14px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--t-fast);
}
.filter:hover { color: var(--text); border-color: var(--border-hi); }
.filter[aria-pressed="true"] {
  color: var(--accent);
  border-color: var(--accent-line);
  background: var(--accent-dim);
}

/* --- 12. Timeline -------------------------------------------------------- */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 5px; top: 8px; bottom: 8px;
  width: 1px;
  background: linear-gradient(to bottom, var(--border-hi), var(--border), transparent);
}
.tl-item { position: relative; padding-bottom: 32px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: "";
  position: absolute;
  left: -28px; top: 7px;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border-hi);
}
.tl-item--current::before { border-color: var(--accent); background: var(--accent-dim); }
.tl-item__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.tl-item__role { font-weight: 600; font-size: 1rem; letter-spacing: -0.015em; }
.tl-item__org { color: var(--accent); font-size: 0.9375rem; }
.tl-item__meta { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-faint); }
.tl-item__body { margin-top: 8px; color: var(--text-muted); font-size: 0.9rem; }
.tl-item__body ul { margin: 0; padding-left: 18px; }
.tl-item__body li { margin-bottom: 5px; }
.tl-item__body li::marker { color: var(--text-faint); }

/* --- 13. Prose (case studies, posts) ------------------------------------- */
.prose { max-width: var(--w-text); }
.prose > * + * { margin-top: 1.1em; }
.prose h2 { margin-top: 2em; padding-top: 0.4em; }
.prose h3 { margin-top: 1.6em; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin-bottom: 0.4em; }
.prose li::marker { color: var(--text-faint); }
.prose blockquote {
  border-left: 2px solid var(--accent-line);
  padding-left: 18px;
  color: var(--text-muted);
  font-style: italic;
}
.prose pre {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 18px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.6;
}
.prose pre code { background: none; border: none; padding: 0; font-size: inherit; }
.prose img { border-radius: var(--r-md); border: 1px solid var(--border); }
.prose hr { border: none; border-top: 1px solid var(--border); margin-block: 2em; }

/* --- 14. Tables ---------------------------------------------------------- */
.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-md); }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th, td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--border); }
th { color: var(--text-faint); font-weight: 550; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.07em; font-family: var(--font-mono); background: var(--bg-subtle); }
tr:last-child td { border-bottom: none; }

/* --- 15. Callout --------------------------------------------------------- */
.callout {
  display: flex;
  gap: 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-md);
  padding: 18px 20px;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.callout strong { color: var(--text); }

/* --- 16. Placeholder (content not yet written) --------------------------- */
.placeholder {
  border: 1px dashed var(--border-hi);
  border-radius: var(--r-lg);
  padding: 36px 28px;
  text-align: center;
  color: var(--text-faint);
  background: repeating-linear-gradient(
    45deg, transparent, transparent 12px,
    rgba(255,255,255,0.012) 12px, rgba(255,255,255,0.012) 24px
  );
}
.placeholder__title { color: var(--text-muted); font-weight: 550; margin-bottom: 6px; }
.placeholder p { font-size: 0.875rem; max-width: 46ch; margin-inline: auto; }

/* --- 17. Footer ---------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
  padding-block: 48px 36px;
  margin-top: 24px;
}
.site-footer__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(auto-fit, minmax(130px, 1fr));
  gap: 32px;
  margin-bottom: 36px;
}
.site-footer h4 { font-size: 0.75rem; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-faint); margin-bottom: 12px; font-weight: 500; }
.site-footer ul { list-style: none; padding: 0; }
.site-footer li { margin-bottom: 7px; }
.site-footer li a { color: var(--text-muted); font-size: 0.875rem; }
.site-footer li a:hover { color: var(--accent); }
.site-footer__bottom {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--text-faint);
}
.site-footer__tagline { color: var(--text-muted); font-size: 0.9rem; max-width: 40ch; margin-top: 10px; }

/* --- 18. Page header (interior pages) ------------------------------------ */
.page-head {
  padding-block: clamp(40px, 6vw, 64px) clamp(28px, 4vw, 40px);
  border-bottom: 1px solid var(--border);
}
.page-head h1 { margin-block: 14px 16px; }
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-faint);
}
.breadcrumb a { color: var(--text-faint); }
.breadcrumb a:hover { color: var(--accent); }

/* --- 19. Utilities ------------------------------------------------------- */
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.mono { font-family: var(--font-mono); }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.center { text-align: center; }
[hidden] { display: none !important; }

/* Entrance animation, opt-in via JS */
.reveal { opacity: 0; transform: translateY(12px); }
.reveal.is-visible {
  opacity: 1; transform: none;
  transition: opacity 520ms ease, transform 520ms cubic-bezier(0.22, 1, 0.36, 1);
}
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
}

/* --- 20. About page layout ----------------------------------------------- */
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}
.about-aside {
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 88px;
}
.about-aside .card:hover { transform: none; background: var(--surface); border-color: var(--border); }

@media (max-width: 880px) {
  .about-grid { grid-template-columns: 1fr; gap: 40px; }
  .about-aside { position: static; }
  .about-aside > div:first-child { max-width: 240px; }
}

/* Cards used purely as containers shouldn't lift on hover */
.card--static:hover { transform: none; background: var(--surface); border-color: var(--border); }
