/* ==========================================================================
   Kevin RUBY — Resume
   Design tokens
   ========================================================================== */

:root {
  /* Brand */
  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --primary-soft: rgba(37, 99, 235, 0.1);

  /* Neutrals (slate) */
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #475569;
  --text-faint: #64748b;

  /* Shape & elevation */
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.07);

  /* Type scale */
  --fs-hero: clamp(32px, 5vw, 40px);
  --fs-section: 22px;
  --fs-job: 18px;
  --fs-body: 16px;
  --fs-body-sm: 15px;
  --fs-small: 13px;

  --nav-height: 64px;

  color-scheme: light;
}

[data-theme='dark'] {
  --primary: #3b82f6;
  --primary-strong: #60a5fa;
  --primary-soft: rgba(59, 130, 246, 0.15);

  --bg: #0b1120;
  --surface: #0f172a;
  --surface-2: #1e293b;
  --border: #253349;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-faint: #7c8ba1;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);

  color-scheme: dark;
}

/* ==========================================================================
   Base
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family:
    'Inter',
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    Roboto,
    sans-serif;
  font-size: var(--fs-body);
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  transition:
    background-color 0.25s ease,
    color 0.25s ease;
}

h1,
h2,
h3,
p,
ul {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--primary-strong);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.container {
  max-width: 1080px;
  margin-inline: auto;
  padding-inline: 24px;
}

.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;
}

/* Accessibility: focus & skip link */

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

.skip-link {
  position: absolute;
  top: -48px;
  left: 16px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--primary);
  color: #ffffff;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 12px;
  color: #ffffff;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease;
}

.btn:hover {
  background: var(--surface-2);
  border-color: var(--text-faint);
}

.btn:active {
  transform: scale(0.97);
}

.btn .icon {
  width: 15px;
  height: 15px;
}

.btn--primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.btn--primary:hover {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
  color: #ffffff;
}

.btn--ghost {
  background: transparent;
}

.btn--icon {
  padding: 8px;
  background: transparent;
}

/* Theme toggle: show one icon at a time */
.icon--moon {
  display: none;
}

[data-theme='dark'] .icon--sun {
  display: none;
}

[data-theme='dark'] .icon--moon {
  display: block;
}

/* ==========================================================================
   Navigation
   ========================================================================== */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.site-nav__inner {
  max-width: 1080px;
  margin-inline: auto;
  padding-inline: 24px;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  gap: 24px;
}

.site-nav__brand {
  font-weight: 800;
  font-size: 17px;
  color: var(--text);
  letter-spacing: -0.02em;
}

.site-nav__brand:hover {
  color: var(--primary);
  text-decoration: none;
}

.site-nav__links {
  display: flex;
  gap: 4px;
  margin-right: auto;
}

.site-nav__links a {
  display: block;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
}

.site-nav__links a:hover {
  color: var(--text);
  background: var(--surface-2);
  text-decoration: none;
}

.site-nav__links a[aria-current='true'] {
  color: var(--primary);
  background: var(--primary-soft);
}

.site-nav__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
  padding: 72px 0 56px;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(600px 300px at 85% 0%, var(--primary-soft), transparent 70%), var(--bg);
}

.hero__status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  margin-bottom: 24px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: var(--fs-small);
  font-weight: 500;
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
}

.hero__status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
}

.hero__name {
  font-size: var(--fs-hero);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.hero__role {
  margin-top: 12px;
  font-size: 19px;
  font-weight: 600;
  color: var(--primary);
  letter-spacing: -0.01em;
}

.hero__tagline {
  margin-top: 14px;
  max-width: 620px;
  font-size: var(--fs-body);
  color: var(--text-muted);
}

/* ==========================================================================
   Resume layout
   ========================================================================== */

.resume {
  display: grid;
  grid-template-columns: 316px minmax(0, 1fr);
  gap: 40px;
  padding-top: 48px;
  padding-bottom: 72px;
}

.section {
  scroll-margin-top: calc(var(--nav-height) + 24px);
}

.section + .section {
  margin-top: 48px;
}

.section__title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: var(--fs-section);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}

.section__title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ==========================================================================
   Sidebar
   ========================================================================== */

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition:
    box-shadow 0.2s ease,
    border-color 0.2s ease;
  scroll-margin-top: calc(var(--nav-height) + 24px);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card__title {
  font-size: var(--fs-small);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: 14px;
}

.photo-card {
  display: flex;
  justify-content: center;
  padding: 26px;
}

.photo {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #ffffff;
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.02em;
  user-select: none;
}

[data-theme='dark'] .photo {
  background: linear-gradient(135deg, #1d4ed8, #3b82f6);
}

/* Contact */

.contact-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: var(--fs-body-sm);
}

.contact-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.contact-list .icon {
  color: var(--text-faint);
}

.contact-list a {
  color: var(--text);
  overflow-wrap: anywhere;
}

.contact-list a:hover {
  color: var(--primary);
}

/* Chips */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chips li {
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: var(--fs-small);
  font-weight: 500;
  color: var(--text-muted);
  transition:
    border-color 0.15s ease,
    color 0.15s ease,
    background-color 0.15s ease;
}

.chips li:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

/* Detail lists (languages, certifications, education) */

.detail-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.detail-list li {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.detail-list__main {
  font-size: var(--fs-body-sm);
  font-weight: 600;
}

.detail-list__sub {
  font-size: var(--fs-small);
  color: var(--text-faint);
}

/* ==========================================================================
   Summary
   ========================================================================== */

.summary {
  display: flex;
  flex-direction: column;
  gap: 14px;
  color: var(--text-muted);
}

.summary p:first-child {
  color: var(--text);
}

/* ==========================================================================
   Experience timeline
   ========================================================================== */

.timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 36px;
  padding-left: 28px;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 5px;
  width: 2px;
  background: var(--border);
  border-radius: 1px;
}

.job {
  position: relative;
}

.job::before {
  content: '';
  position: absolute;
  top: 7px;
  left: -28px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--text-faint);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.job:first-child::before {
  border-color: var(--primary);
  background: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.job:hover::before {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.job__title {
  font-size: var(--fs-job);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.job__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 8px;
  row-gap: 2px;
  margin-top: 4px;
  font-size: var(--fs-body-sm);
}

.job__company {
  font-weight: 600;
  color: var(--primary);
}

.job__dates,
.job__location {
  color: var(--text-faint);
  font-size: var(--fs-small);
}

.job__dates::before,
.job__location::before {
  content: '·';
  margin-right: 8px;
  color: var(--border);
}

.job__bullets {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: var(--text-muted);
  font-size: var(--fs-body-sm);
}

.job__bullets li {
  position: relative;
  padding-left: 18px;
}

.job__bullets li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 0.62em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0.6;
}

/* ==========================================================================
   Achievements
   ========================================================================== */

.achievements {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.achievement {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition:
    box-shadow 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease;
}

.achievement:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
  transform: translateY(-2px);
}

.achievement__title {
  font-size: var(--fs-body-sm);
  font-weight: 700;
  margin-bottom: 6px;
}

.achievement__text {
  font-size: var(--fs-body-sm);
  color: var(--text-muted);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
}

.site-footer__inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: var(--fs-small);
  color: var(--text-faint);
}

/* ==========================================================================
   Back to top
   ========================================================================== */

.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 40;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}

.back-to-top.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.back-to-top:hover {
  color: var(--primary);
  border-color: var(--primary);
}

/* ==========================================================================
   Reveal on scroll (subtle)
   ========================================================================== */

.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity 0.5s ease,
    transform 0.5s ease;
}

.reveal.is-inview {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 900px) {
  .resume {
    grid-template-columns: 1fr;
    gap: 32px;
    padding-top: 32px;
  }

  .site-nav__links {
    display: none;
  }

  .hero {
    padding: 48px 0 40px;
  }

  .achievements {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .container {
    padding-inline: 16px;
  }

  .site-nav__inner {
    padding-inline: 16px;
    gap: 12px;
  }

  .btn span {
    display: none;
  }

  .btn {
    padding: 8px 10px;
  }

  #lang-toggle {
    padding: 8px 12px;
  }

  .timeline {
    padding-left: 22px;
  }

  .job::before {
    left: -22px;
  }
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
