/* ============================================================
   JAMES LAWLESS — PORTFOLIO
   Dark & Minimal | Process & Change Leadership
   ============================================================ */

/* --- DESIGN TOKENS --- */
:root {
  /* Type Scale (fluid) */
  --text-xs:   clamp(0.75rem,  0.7rem  + 0.25vw, 0.875rem);
  --text-sm:   clamp(0.875rem, 0.8rem  + 0.35vw, 1rem);
  --text-base: clamp(1rem,     0.95rem + 0.25vw, 1.125rem);
  --text-lg:   clamp(1.125rem, 1rem    + 0.75vw, 1.5rem);
  --text-xl:   clamp(1.5rem,   1.2rem  + 1.25vw, 2.25rem);
  --text-2xl:  clamp(2rem,     1.2rem  + 2.5vw,  3.5rem);
  --text-3xl:  clamp(2.5rem,   1rem    + 4vw,    5rem);
  --text-hero: clamp(3rem,     0.5rem  + 7vw,    8rem);

  /* Spacing (4px base) */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Content widths */
  --content-narrow: 640px;
  --content-default: 960px;
  --content-wide: 1200px;

  /* Fonts */
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-body: 'Satoshi', 'Inter', sans-serif;
}

/* --- DARK THEME (default) --- */
:root, [data-theme="dark"] {
  --color-bg:             #0a0a0a;
  --color-surface:        #111111;
  --color-surface-2:      #181818;
  --color-surface-offset: #141414;
  --color-divider:        #1e1e1e;
  --color-border:         #2a2a2a;

  --color-text:           #e8e8e6;
  --color-text-muted:     #8a8a86;
  --color-text-faint:     #555550;
  --color-text-inverse:   #0a0a0a;

  --color-primary:        #c8a97e;
  --color-primary-hover:  #b8955e;
  --color-primary-active: #a88040;
  --color-primary-highlight: #2a2520;

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.3);
  --shadow-md: 0 4px 12px oklch(0 0 0 / 0.4);
  --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.5);
}

/* --- LIGHT THEME --- */
[data-theme="light"] {
  --color-bg:             #fafaf8;
  --color-surface:        #ffffff;
  --color-surface-2:      #f5f5f3;
  --color-surface-offset: #ededeb;
  --color-divider:        #e0e0de;
  --color-border:         #d0d0ce;

  --color-text:           #1a1a18;
  --color-text-muted:     #6a6a66;
  --color-text-faint:     #a0a09c;
  --color-text-inverse:   #fafaf8;

  --color-primary:        #8b6c3e;
  --color-primary-hover:  #765a2e;
  --color-primary-active: #614a22;
  --color-primary-highlight: #f0e8dc;

  --shadow-sm: 0 1px 2px oklch(0.2 0.01 80 / 0.06);
  --shadow-md: 0 4px 12px oklch(0.2 0.01 80 / 0.1);
  --shadow-lg: 0 12px 32px oklch(0.2 0.01 80 / 0.14);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --color-bg:             #fafaf8;
    --color-surface:        #ffffff;
    --color-surface-2:      #f5f5f3;
    --color-surface-offset: #ededeb;
    --color-divider:        #e0e0de;
    --color-border:         #d0d0ce;
    --color-text:           #1a1a18;
    --color-text-muted:     #6a6a66;
    --color-text-faint:     #a0a09c;
    --color-text-inverse:   #fafaf8;
    --color-primary:        #8b6c3e;
    --color-primary-hover:  #765a2e;
    --color-primary-active: #614a22;
    --color-primary-highlight: #f0e8dc;
    --shadow-sm: 0 1px 2px oklch(0.2 0.01 80 / 0.06);
    --shadow-md: 0 4px 12px oklch(0.2 0.01 80 / 0.1);
    --shadow-lg: 0 12px 32px oklch(0.2 0.01 80 / 0.14);
  }
}

/* ============================================================
   LAYOUT
   ============================================================ */

.container {
  width: 100%;
  max-width: var(--content-wide);
  margin: 0 auto;
  padding-inline: var(--space-6);
}

@media (min-width: 768px) {
  .container { padding-inline: var(--space-10); }
}

/* ============================================================
   HEADER / NAV
   ============================================================ */

.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: oklch(from var(--color-bg) l c h / 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--color-divider);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.header--hidden { transform: translateY(-100%); }
.header--scrolled { box-shadow: var(--shadow-sm); }

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.header__logo {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--color-text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.header__nav {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.header__link {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-decoration: none;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  position: relative;
}

.header__link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--color-primary);
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.header__link:hover { color: var(--color-text); }
.header__link:hover::after { width: 100%; }

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  cursor: pointer;
}
.theme-toggle:hover { color: var(--color-text); background: var(--color-surface-2); }

/* Mobile nav */
.mobile-menu-btn {
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  color: var(--color-text);
}

.mobile-nav {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--color-bg);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.mobile-nav__link {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--color-text);
  text-decoration: none;
}
.mobile-nav__link:hover { color: var(--color-primary); }

.mobile-nav__close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-6);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text);
}

@media (max-width: 767px) {
  .header__nav { display: none; }
  .mobile-menu-btn { display: flex; }
  .mobile-nav { display: flex; }
  .mobile-nav.active { opacity: 1; pointer-events: all; }
}

/* ============================================================
   HERO
   ============================================================ */

.hero {
  min-height: 90vh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}

@media (max-width: 767px) {
  .hero {
    min-height: auto;
    padding-block: var(--space-16) var(--space-20);
    align-items: flex-start;
  }
}

.hero__content {
  position: relative;
  z-index: 2;
  max-width: 800px;
}

.hero__label {
  display: inline-block;
  font-size: var(--text-xs);
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: var(--space-6);
}

.hero__name {
  font-family: var(--font-display);
  font-size: var(--text-hero);
  font-weight: 400;
  color: var(--color-text);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-6);
}

.hero__name em {
  font-style: italic;
  color: var(--color-primary);
}

.hero__subtitle {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  line-height: 1.5;
  max-width: 560px;
  margin-bottom: var(--space-10);
}

.hero__cta-group {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.hero__line {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-primary), transparent);
  opacity: 0.3;
}

/* Scroll indicator */
.scroll-indicator {
  position: absolute;
  bottom: var(--space-8);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text-faint);
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

@media (max-width: 767px) {
  .scroll-indicator { display: none; }
}

.scroll-indicator__line {
  width: 1px;
  height: 40px;
  background: linear-gradient(to bottom, var(--color-primary), transparent);
  animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
  0%, 100% { opacity: 0.3; transform: scaleY(0.6); }
  50% { opacity: 1; transform: scaleY(1); }
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--radius-sm);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.btn--primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}
.btn--primary:hover { background: var(--color-primary-hover); }

.btn--ghost {
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-border);
}
.btn--ghost:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* ============================================================
   SECTION BASE
   ============================================================ */

.section {
  padding-block: clamp(var(--space-16), 8vw, var(--space-32));
}

.section__label {
  font-size: var(--text-xs);
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: var(--space-3);
}

.section__title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 400;
  color: var(--color-text);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-4);
}

.section__subtitle {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  max-width: 560px;
  margin-bottom: var(--space-12);
}

.section--alt {
  background: var(--color-surface);
}

.divider {
  width: 100%;
  height: 1px;
  background: var(--color-divider);
}

/* ============================================================
   COMPANY LOGOS
   ============================================================ */

.logos-section {
  padding-block: var(--space-10) var(--space-12);
  border-top: 1px solid var(--color-divider);
  border-bottom: 1px solid var(--color-divider);
}

.logos-section__label {
  display: block;
  text-align: center;
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: var(--space-8);
}

.logos-track {
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, black 10%, black 90%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, black 10%, black 90%, transparent);
}

.logos-track__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  flex-wrap: wrap;
}

@media (min-width: 768px) {
  .logos-track__inner {
    gap: var(--space-8);
    flex-wrap: nowrap;
  }
}

.company-logo {
  height: 20px;
  width: auto;
  object-fit: contain;
  opacity: 0.85;
  transition: opacity 0.3s ease;
  filter: none;
}

[data-theme="light"] .company-logo {
  filter: brightness(0);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .company-logo {
    filter: brightness(0);
  }
}

.company-logo--icon {
  height: 28px;
}

.company-logo:hover {
  opacity: 1;
}

/* ============================================================
   ABOUT
   ============================================================ */

.about__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-12);
  align-items: start;
}

@media (min-width: 768px) {
  .about__grid { grid-template-columns: 1fr 1fr; gap: var(--space-16); }
}

.about__text p {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
  line-height: 1.7;
}

.about__stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-6);
}

.stat {
  padding: var(--space-6);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.stat__number {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--color-primary);
  margin-bottom: var(--space-1);
}

.stat__label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ============================================================
   EXPERIENCE
   ============================================================ */

.timeline {
  position: relative;
  padding-left: var(--space-8);
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(to bottom, var(--color-primary), var(--color-divider));
}

.timeline__item {
  position: relative;
  padding-bottom: var(--space-12);
}

.timeline__item:last-child { padding-bottom: 0; }

.timeline__dot {
  position: absolute;
  left: calc(-1 * var(--space-8) - 4px);
  top: 6px;
  width: 9px;
  height: 9px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  border: 2px solid var(--color-bg);
}

.timeline__item--current .timeline__dot {
  box-shadow: 0 0 0 4px oklch(from var(--color-primary) l c h / 0.2);
}

.timeline__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.timeline__logo {
  height: 24px;
  width: auto;
  max-width: 100px;
  object-fit: contain;
  opacity: 0.5;
  filter: none;
  flex-shrink: 0;
  margin-top: var(--space-1);
}

[data-theme="light"] .timeline__logo {
  filter: brightness(0);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .timeline__logo {
    filter: brightness(0);
  }
}

.timeline__dates {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-2);
}

.timeline__role {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 400;
  color: var(--color-text);
  margin-bottom: var(--space-1);
}

.timeline__company {
  font-size: var(--text-sm);
  color: var(--color-primary);
  margin-bottom: 0;
}

.timeline__bullets {
  list-style: none;
  padding: 0;
  margin-bottom: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.timeline__bullets li {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.65;
  padding-left: var(--space-5);
  position: relative;
}

.timeline__bullets li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 8px;
  height: 1px;
  background: var(--color-primary);
}

.timeline__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.tag {
  display: inline-block;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  letter-spacing: 0.02em;
}

/* ============================================================
   SKILLS
   ============================================================ */

.skills__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-6);
}

.skill-card {
  padding: var(--space-8);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  transition: border-color var(--transition-interactive),
              transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.skill-card:hover {
  border-color: var(--color-primary);
  transform: translateY(-2px);
}

.skill-card__icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
  color: var(--color-primary);
}

.skill-card__title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--color-text);
  margin-bottom: var(--space-3);
}

.skill-card__list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.skill-card__list li {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  padding-left: var(--space-4);
  position: relative;
}

.skill-card__list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 6px;
  height: 1px;
  background: var(--color-primary);
}

/* ============================================================
   CERTIFICATIONS
   ============================================================ */

.certs__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
}

@media (max-width: 767px) {
  .certs__grid { grid-template-columns: 1fr; }
}

.cert-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-8) var(--space-6);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-2);
  transition: border-color var(--transition-interactive),
              transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.cert-card:hover {
  border-color: var(--color-primary);
  transform: translateY(-2px);
}

.cert-card__logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-5);
  height: 64px;
}

.cert-card__img {
  max-height: 100%;
  max-width: 140px;
  width: auto;
  height: auto;
  object-fit: contain;
  filter: none;
}

[data-theme="light"] .cert-card__img {
  filter: brightness(0);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .cert-card__img {
    filter: brightness(0);
  }
}

.cert-card__title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.cert-card__issuer {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ============================================================
   CONTACT
   ============================================================ */

.contact__inner {
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
}

.contact__links {
  display: flex;
  justify-content: center;
  gap: var(--space-6);
  margin-top: var(--space-8);
  flex-wrap: wrap;
}

.contact__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-decoration: none;
  padding: var(--space-3) var(--space-5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
}

.contact__link:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.contact__link svg {
  width: 18px;
  height: 18px;
}

/* ============================================================
   FOOTER
   ============================================================ */

.footer {
  padding-block: var(--space-8);
  border-top: 1px solid var(--color-divider);
}

.footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.footer__text {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

.footer__text a {
  color: var(--color-text-faint);
  text-decoration: none;
}
.footer__text a:hover { color: var(--color-text-muted); }

/* ============================================================
   ANIMATIONS (scroll reveal)
   ============================================================ */

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }

/* ============================================================
   SUBTLE GRAIN OVERLAY
   ============================================================ */

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 128px 128px;
}
