/* ============================================================
   Cory Tillman — Portfolio
   Vanilla CSS. Theming via custom properties. Mobile-first.
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  --navy: #1a1a2e;
  --navy-2: #16213e;
  --blue: #4361ee;
  --blue-soft: #5a75f0;
  --white: #ffffff;
  --gray: #f8f9fa;

  /* semantic (dark theme default) */
  --bg: var(--navy);
  --bg-alt: var(--navy-2);
  --surface: #22223a;
  --surface-2: #2a2a44;
  --text: #eef0f7;
  --text-muted: #a9b0c6;
  --border: rgba(255, 255, 255, 0.10);
  --accent: var(--blue);
  --accent-text: #93a6f8;      /* AA-compliant accent for small text/graphics on dark */
  --accent-hover: #3a55e0;     /* keeps white button text >= 4.5:1 */
  --accent-contrast: #ffffff;
  --error: #ff6b5e;
  --success: #3fe07f;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.25);

  --radius: 14px;
  --radius-sm: 10px;
  --maxw: 1120px;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --transition: 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg: var(--gray);
  --bg-alt: #eef1f6;
  --surface: var(--white);
  --surface-2: #ffffff;
  --text: #17182b;
  --text-muted: #566079;
  --border: rgba(26, 26, 46, 0.12);
  --accent: var(--blue);
  --accent-text: #3348c9;      /* AA-compliant accent for small text/graphics on light */
  --accent-hover: #3a55e0;
  --accent-contrast: #ffffff;
  --error: #c0392b;
  --success: #177a3f;
  --shadow: 0 10px 30px rgba(26, 26, 46, 0.12);
  --shadow-sm: 0 4px 14px rgba(26, 26, 46, 0.08);
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

body {
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background var(--transition), color var(--transition);
}

h1, h2, h3, h4 { line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul { list-style: none; padding: 0; }

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

/* ---------- Accessibility helpers ---------- */
.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 200;
  background: var(--accent); color: #fff; padding: 0.6rem 1rem; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

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

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.85rem 1.6rem; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 1rem; cursor: pointer; border: 2px solid transparent;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), border-color var(--transition);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 8px 22px rgba(67, 97, 238, 0.4); transform: translateY(-2px); }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent-text); transform: translateY(-2px); }

/* ---------- Header / Nav ---------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: box-shadow var(--transition), background var(--transition);
}
.site-header.scrolled { box-shadow: var(--shadow-sm); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }

.brand { display: inline-flex; align-items: center; gap: 0.6rem; font-weight: 700; }
.brand-mark {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  font-size: 0.85rem; font-weight: 800; letter-spacing: 0.02em; color: #fff;
  background: linear-gradient(135deg, var(--blue) 0%, #7b2ff7 100%);
}
.brand-mark.small { width: 30px; height: 30px; font-size: 0.72rem; }
.brand-name { font-size: 1.05rem; }

.nav-menu { display: flex; align-items: center; gap: 0.4rem; }
.nav-link {
  position: relative; padding: 0.5rem 0.85rem; border-radius: 8px; font-weight: 500; color: var(--text-muted);
  transition: color var(--transition), background var(--transition);
}
.nav-link:hover { color: var(--text); background: var(--surface); }
.nav-link.active { color: var(--accent-text); }
.nav-link.active::after {
  content: ""; position: absolute; left: 0.85rem; right: 0.85rem; bottom: 0.2rem; height: 2px;
  background: var(--accent); border-radius: 2px;
}

.theme-toggle {
  display: grid; place-items: center; width: 40px; height: 40px; margin-left: 0.4rem;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  cursor: pointer; font-size: 1.1rem; transition: background var(--transition), transform var(--transition);
}
.theme-toggle:hover { transform: translateY(-2px); }
.theme-icon-light { display: none; }
[data-theme="light"] .theme-icon-dark { display: none; }
[data-theme="light"] .theme-icon-light { display: inline; }

.nav-toggle { display: none; flex-direction: column; gap: 5px; width: 42px; height: 42px; padding: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.nav-toggle-bar { display: block; height: 2px; width: 100%; background: var(--text); border-radius: 2px; transition: transform var(--transition), opacity var(--transition); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  position: relative; padding-top: 116px; padding-bottom: 0; text-align: center;
  background:
    radial-gradient(60% 60% at 50% 0%, rgba(67, 97, 238, 0.18) 0%, transparent 70%),
    var(--bg);
}
.hero-inner { display: flex; flex-direction: column; align-items: center; padding-bottom: 3rem; }
.hero-avatar {
  display: grid; place-items: center; width: 96px; height: 96px; border-radius: 24px; margin-bottom: 1.5rem;
  font-size: 2.1rem; font-weight: 800; color: #fff; letter-spacing: 0.02em;
  background: linear-gradient(135deg, var(--blue) 0%, #7b2ff7 100%);
  box-shadow: 0 12px 34px rgba(67, 97, 238, 0.45);
}
.hero-name { font-size: clamp(2.4rem, 6vw, 3.8rem); }
.hero-title { font-size: clamp(1.05rem, 2.6vw, 1.4rem); color: var(--accent-text); font-weight: 600; margin-top: 0.5rem; }
.hero-title .sep { color: var(--text-muted); margin-inline: 0.3rem; }
.hero-tagline { font-size: clamp(1.15rem, 3vw, 1.6rem); font-weight: 600; max-width: 40ch; margin: 1.4rem auto 0; }
.hero-value { color: var(--text-muted); max-width: 62ch; margin: 1.4rem auto 0; font-size: 1.02rem; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 0.9rem; justify-content: center; margin-top: 2rem; }

/* ---------- Stats banner ---------- */
.stats-banner {
  overflow: hidden; border-block: 1px solid var(--border);
  background: var(--bg-alt); padding-block: 1rem; white-space: nowrap;
}
.stats-track { display: flex; width: max-content; align-items: center; }
/* Animation only turns on once JS has filled each half to >= viewport width,
   so the -50% loop never exposes empty space (truly continuous). */
.stats-track.is-ready { animation: marquee 30s linear infinite; will-change: transform; }
.stats-banner:hover .stats-track.is-ready { animation-play-state: paused; }
.stats-group { display: flex; align-items: center; flex: none; }
.stat-item { font-size: 1.05rem; color: var(--text-muted); white-space: nowrap; }
.stat-item strong { color: var(--accent-text); font-size: 1.25rem; font-weight: 800; }
/* Spacing lives entirely in the separators so the sequence is perfectly
   periodic — that keeps the loop seamless (no half-gap jump). */
.stat-dot { color: var(--accent); margin: 0 1.4rem; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .stats-track, .stats-track.is-ready { animation: none !important; width: auto; flex-wrap: wrap; white-space: normal; justify-content: center; }
  .stats-group:nth-child(2) { display: none; }
  .stats-group { flex-wrap: wrap; justify-content: center; }
}

/* ---------- Sections ---------- */
.section { padding-block: clamp(3.5rem, 8vw, 6rem); }
.section-alt { background: var(--bg-alt); }
.section-head { max-width: 60ch; margin-bottom: 2.6rem; }
.section-eyebrow { display: inline-block; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent-text); margin-bottom: 0.6rem; }
.section-title { font-size: clamp(1.7rem, 4vw, 2.5rem); }
.section-lead { color: var(--text-muted); margin-top: 0.9rem; font-size: 1.08rem; }
.subsection { margin-top: 3rem; }
.subsection-title { font-size: 1.35rem; margin-bottom: 0.4rem; }
.subsection-sub { color: var(--text-muted); margin-bottom: 1.4rem; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1fr; gap: 2rem; }
.about-bio h3 { font-size: 1.3rem; margin-bottom: 0.7rem; }
.about-bio p { color: var(--text-muted); margin-bottom: 1rem; }
.about-subhead { margin-top: 1.6rem; }
.capability-list { display: grid; gap: 0.7rem; margin-top: 0.5rem; }
.capability-list li { padding-left: 1.4rem; position: relative; color: var(--text-muted); }
.capability-list li::before { content: "▸"; position: absolute; left: 0; color: var(--accent-text); }
.capability-list strong { color: var(--text); }

.about-side { display: grid; gap: 1.4rem; align-content: start; }
.philosophy-card, .working-style-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.6rem; box-shadow: var(--shadow-sm); }
.philosophy-card h3, .working-style-card h3 { font-size: 1.1rem; margin-bottom: 0.8rem; }
.philosophy { font-size: 1.2rem; font-weight: 700; line-height: 1.6; background: linear-gradient(120deg, var(--blue), #7b2ff7); -webkit-background-clip: text; background-clip: text; color: transparent; }
.style-list { display: grid; gap: 0.6rem; }
.style-list li { padding-left: 1.4rem; position: relative; color: var(--text-muted); }
.style-list li::before { content: "✓"; position: absolute; left: 0; color: var(--accent-text); font-weight: 700; }

/* ---------- Certifications ---------- */
.cert-grid { display: grid; grid-template-columns: 1fr; gap: 1.2rem; }
.cert-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; text-align: center; box-shadow: var(--shadow-sm); transition: transform var(--transition), box-shadow var(--transition); }
.cert-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.cert-badge { display: inline-grid; place-items: center; width: 54px; height: 54px; border-radius: 12px; margin-bottom: 0.9rem; font-weight: 800; font-size: 0.85rem; color: #1a1a2e; background: linear-gradient(135deg, #ff9900, #ff6a00); }
.cert-card h4 { font-size: 1.05rem; }
.cert-code { color: var(--text-muted); font-size: 0.9rem; margin-block: 0.3rem 0.8rem; letter-spacing: 0.05em; }
.cert-status { display: inline-block; padding: 0.3rem 0.8rem; border-radius: 999px; font-size: 0.8rem; font-weight: 700; }
.status-done { background: rgba(46, 204, 113, 0.15); color: var(--success); }
.status-progress { background: rgba(67, 97, 238, 0.15); color: var(--accent-text); }

/* ---------- Tools ---------- */
.tools-grid { display: grid; grid-template-columns: 1fr; gap: 1.2rem; }
.tool-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.4rem; box-shadow: var(--shadow-sm); transition: transform var(--transition), box-shadow var(--transition); border-left: 3px solid var(--accent); }
.tool-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.tool-card h4 { font-size: 1.05rem; margin-bottom: 0.4rem; }
.tool-card p { color: var(--text-muted); font-size: 0.96rem; }

/* ---------- Systems grid ---------- */
.systems-grid { display: grid; grid-template-columns: 1fr; gap: 1.4rem; }
.system-card {
  text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.6rem; cursor: pointer; box-shadow: var(--shadow-sm); width: 100%; color: inherit; font: inherit;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  display: flex; flex-direction: column; gap: 0.7rem;
}
.system-card:hover { transform: translateY(-6px); box-shadow: var(--shadow); border-color: var(--accent); }
.system-type { font-size: 0.74rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-text); }
.system-name { font-size: 1.2rem; }
.system-problem { color: var(--text-muted); font-size: 0.98rem; flex-grow: 1; }
.system-metric { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 700; color: var(--text); margin-top: 0.4rem; }
.system-metric::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.system-cta { font-size: 0.85rem; color: var(--accent-text); font-weight: 600; margin-top: 0.3rem; }

/* ---------- Methodology ---------- */
.methodology-grid { display: grid; grid-template-columns: 1fr; gap: 2rem; }
.method-col { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.8rem; box-shadow: var(--shadow-sm); }
.method-title { font-size: 1.4rem; margin-bottom: 1.2rem; padding-bottom: 0.8rem; border-bottom: 2px solid var(--accent); display: inline-block; }
.flow { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 1.4rem; }
.flow-step { display: flex; align-items: center; gap: 0.4rem; background: var(--bg-alt); border: 1px solid var(--border); border-radius: 999px; padding: 0.5rem 0.9rem; font-weight: 600; font-size: 0.9rem; }
.flow-num { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 0.72rem; }
.flow-step-human { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.2) inset; }
.flow-arrow { color: var(--accent-text); font-weight: 700; }
.method-belief { background: var(--bg-alt); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); padding: 1rem 1.1rem; margin-bottom: 1.2rem; color: var(--text-muted); font-size: 0.98rem; }
.principle-list { display: grid; gap: 0.8rem; }
.principle-list li { padding-left: 1.5rem; position: relative; color: var(--text-muted); font-size: 0.98rem; }
.principle-list li::before { content: "→"; position: absolute; left: 0; color: var(--accent-text); font-weight: 700; }
.principle-list strong { color: var(--text); }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr; gap: 2rem; }
.contact-form { display: grid; gap: 1.2rem; }
.form-field { display: grid; gap: 0.4rem; }
.form-field label { font-weight: 600; font-size: 0.95rem; }
.form-field input, .form-field textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.8rem 1rem; transition: border-color var(--transition), box-shadow var(--transition); resize: vertical;
}
.form-field input:focus, .form-field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.2); }
.form-field.invalid input, .form-field.invalid textarea { border-color: var(--error); }
.form-error { color: var(--error); font-size: 0.85rem; min-height: 1em; }
.form-success { color: var(--success); font-weight: 600; }

.contact-links { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.8rem; box-shadow: var(--shadow-sm); align-self: start; }
.contact-links h3 { margin-bottom: 1.2rem; }
.social-list { display: grid; gap: 0.9rem; }
.social-list a { display: flex; align-items: center; gap: 0.9rem; padding: 0.8rem; border-radius: var(--radius-sm); border: 1px solid var(--border); transition: transform var(--transition), border-color var(--transition), background var(--transition); }
.social-list a:hover { transform: translateX(4px); border-color: var(--accent); background: var(--bg-alt); }
.social-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; background: var(--bg-alt); color: var(--accent-text); font-weight: 700; flex-shrink: 0; }
.social-list strong { color: var(--text); }
.social-list a { color: var(--text-muted); font-size: 0.92rem; }

/* ---------- Footer ---------- */
.site-footer { background: var(--bg-alt); border-top: 1px solid var(--border); padding-block: 2.4rem; text-align: center; }
.footer-inner { display: grid; gap: 0.4rem; place-items: center; }
.footer-brand { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 700; }
.footer-tagline { color: var(--accent-text); font-weight: 500; }
.footer-copy { color: var(--text-muted); font-size: 0.88rem; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; padding: 1.2rem; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(10, 10, 20, 0.7); backdrop-filter: blur(4px); animation: fade 200ms ease; }
.modal-dialog {
  position: relative; z-index: 1; width: min(680px, 100%); max-height: 88vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem;
  box-shadow: var(--shadow); animation: pop 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.modal-close { position: absolute; top: 0.8rem; right: 1rem; width: 40px; height: 40px; border: none; background: transparent; color: var(--text-muted); font-size: 1.8rem; line-height: 1; cursor: pointer; border-radius: 8px; transition: color var(--transition), background var(--transition); }
.modal-close:hover { color: var(--text); background: var(--bg-alt); }
.modal-type { font-size: 0.76rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-text); }
.modal-title { font-size: 1.5rem; margin-block: 0.3rem 0.4rem; padding-right: 2rem; }
.modal-metric { display: inline-block; background: rgba(67, 97, 238, 0.14); color: var(--accent-text); font-weight: 700; padding: 0.3rem 0.8rem; border-radius: 999px; font-size: 0.85rem; margin-bottom: 1.2rem; }
.modal-block { margin-bottom: 1.2rem; }
.modal-block h4 { font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.35rem; }
.modal-block p { color: var(--text); }
.modal-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.modal-tag { background: var(--bg-alt); border: 1px solid var(--border); border-radius: 999px; padding: 0.3rem 0.8rem; font-size: 0.84rem; color: var(--text-muted); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ---------- Scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 600ms ease, transform 600ms ease; }
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } }

/* ---------- Responsive ---------- */
@media (min-width: 640px) {
  .cert-grid { grid-template-columns: repeat(3, 1fr); }
  .tools-grid { grid-template-columns: repeat(2, 1fr); }
  .systems-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
  .about-grid { grid-template-columns: 1.7fr 1fr; }
  .methodology-grid { grid-template-columns: 1fr 1fr; }
  .contact-grid { grid-template-columns: 1.4fr 1fr; }
  .systems-grid { grid-template-columns: repeat(3, 1fr); }
  .tools-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 820px) {
  .nav-toggle { display: flex; }
  .nav-menu {
    position: fixed; inset: 68px 0 auto 0; flex-direction: column; align-items: stretch; gap: 0.2rem;
    background: var(--bg); border-bottom: 1px solid var(--border); padding: 1rem var(--gutter);
    transform: translateY(-140%); transition: transform var(--transition); box-shadow: var(--shadow);
  }
  .nav-menu.open { transform: translateY(0); }
  .nav-link { padding: 0.8rem 0.85rem; }
  .nav-link.active::after { display: none; }
  .theme-toggle { margin: 0.4rem 0 0; width: 100%; height: 44px; }
}

/* ---------- Print (PDF export) ---------- */
@media print {
  :root { --bg: #fff; --bg-alt: #fff; --surface: #fff; --text: #000; --text-muted: #333; --border: #ccc; --accent-text: #2f43be; --error: #c0392b; --success: #177a3f; }
  .site-header, .nav-toggle, .theme-toggle, .stats-banner, .hero-cta, .nav-menu, .modal, .contact-form, .skip-link { display: none !important; }
  body { font-size: 12pt; }
  .section, .hero { padding-block: 1rem; }
  .reveal { opacity: 1 !important; transform: none !important; }
  .system-card, .cert-card, .tool-card, .method-col, .philosophy-card, .working-style-card, .contact-links { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  a { color: #000; }
  .hero-avatar, .brand-mark { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
