/* ---------- Variables & reset ---------- */
:root {
  --color-bg: #ffffff;
  --color-text: #424245;
  --color-heading: #1d1d1f;
  --color-faint: #6e6e73;
  --color-accent: #1d1d1f;
  --color-accent-tint: rgba(0, 0, 0, 0.05);
  --color-card-hover: #f5f5f7;
  --color-line: #d2d2d7;
  --max-width: 80rem;
  --radius: 8px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--color-heading);
  color: var(--color-bg);
}

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

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--color-heading);
  outline-offset: 3px;
}

/* ---------- Layout ---------- */
.top-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-line);
}

.header-container {
  max-width: var(--max-width);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  flex-wrap: wrap;
}

@media (min-width: 64rem) {
  .header-container {
    gap: 2rem;
    flex-wrap: nowrap;
    padding: 1.5rem 6rem;
  }
}

.main-content {
  max-width: var(--max-width);
  margin-inline: auto;
  padding: 2rem 1.25rem 4rem;
}

@media (min-width: 48rem) {
  .main-content {
    padding: 3rem 2rem 4rem;
  }
}

@media (min-width: 64rem) {
  .main-content {
    padding: 4rem 6rem;
  }
}

/* ---------- Header ---------- */
.identity {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  min-width: fit-content;
}

.avatar {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.identity h1 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--color-heading);
  line-height: 1.1;
  margin: 0;
}

@media (min-width: 48rem) {
  .identity h1 {
    font-size: 1.15rem;
  }
}

.identity h1 a {
  text-decoration: none;
}

/* Top nav */
.top-nav {
  order: 3;
  width: 100%;
  min-width: 100%;
}

.top-nav ul {
  list-style: none;
  display: flex;
  gap: 1rem;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.top-nav a {
  text-decoration: none;
  text-transform: uppercase;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--color-faint);
  transition: color 0.2s ease;
  padding: 0.5rem 0.75rem;
}

.top-nav a:hover,
.top-nav a.active {
  color: var(--color-heading);
}

@media (min-width: 48rem) {
  .top-nav {
    order: unset;
    width: auto;
    min-width: auto;
    flex: 1;
  }

  .top-nav ul {
    gap: 2rem;
  }

  .top-nav a {
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    padding: 0;
  }
}

/* Social icons */
.social-links {
  display: flex;
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.social-links a {
  display: flex;
  align-items: center;
  justify-content: center;
}

.social-links svg {
  width: 20px;
  height: 20px;
}

@media (min-width: 48rem) {
  .social-links {
    gap: 1.25rem;
  }

  .social-links svg {
    width: 24px;
    height: 24px;
  }
}

.social-links a {
  display: block;
  color: var(--color-text);
  transition: color 0.2s ease;
}

.social-links a:hover {
  color: var(--color-heading);
}

/* ---------- Sections ---------- */
section {
  margin-bottom: 4rem;
  scroll-margin-top: 8rem;
}

@media (min-width: 48rem) {
  section {
    margin-bottom: 6rem;
  }
}

@media (min-width: 64rem) {
  section {
    margin-bottom: 9rem;
  }
}

section p + p {
  margin-top: 0.75rem;
}

@media (min-width: 48rem) {
  section p + p {
    margin-top: 1.25rem;
  }
}

/* Section headings: sticky bar on mobile, hidden on desktop (nav labels them) */
.section-heading {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 0 -1.25rem 1.25rem;
  padding: 1rem 1.25rem;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-heading);
}

@media (min-width: 48rem) {
  .section-heading {
    margin: 0 -2rem 1.5rem;
    padding: 1.25rem 2rem;
    font-size: 0.875rem;
  }
}

@media (min-width: 64rem) {
  .section-heading {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

/* ---------- About ---------- */
.skills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  margin-top: 1.25rem;
  clear: both;
}

.skills li,
.tags li {
  background: var(--color-card-hover);
  color: var(--color-heading);
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
}

@media (min-width: 48rem) {
  .skills,
  .tags {
    gap: 0.5rem;
  }

  .skills li,
  .tags li {
    padding: 0.25rem 0.85rem;
    font-size: 0.8rem;
  }
}

/* ---------- Projects ---------- */
.project-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

@media (min-width: 48rem) {
  .project-list {
    gap: 1rem;
  }
}

.project-card {
  position: relative;
  padding: 1rem;
  border-radius: var(--radius);
  transition: background 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.project-card h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-heading);
}

@media (min-width: 48rem) {
  .project-card {
    padding: 1.5rem;
  }

  .project-card h3 {
    font-size: 1rem;
  }
}

.project-card h3 a {
  text-decoration: none;
}

/* Make the whole card clickable when it has a link */
.project-card h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.project-card .arrow {
  display: inline-block;
  vertical-align: baseline;
  margin-left: 0.25rem;
  transition: transform 0.2s ease;
}

.project-card p {
  margin-top: 0.4rem;
  font-size: 0.85rem;
}

@media (min-width: 48rem) {
  .project-card p {
    margin-top: 0.5rem;
    font-size: 0.925rem;
  }
}

.project-note {
  color: var(--color-faint);
  font-size: 0.8rem !important;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin-top: 1rem;
}

@media (min-width: 64rem) {
  .project-card:hover {
    background: var(--color-card-hover);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  }

  .project-card:hover .arrow {
    transform: translate(3px, -3px);
  }

  /* Dim sibling cards while one is hovered */
  .project-list:hover .project-card {
    opacity: 0.5;
  }

  .project-list:hover .project-card:hover {
    opacity: 1;
  }
}

/* ---------- Experience ---------- */
.company-group {
  margin-bottom: 2rem;
  position: relative;
}

@media (min-width: 48rem) {
  .company-group {
    margin-bottom: 3rem;
  }
}

/* Company Header */
.company-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-line);
}

@media (min-width: 48rem) {
  .company-header {
    gap: 1.25rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
  }
}

.company-logo {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: #1f2937;
  color: white;
  font-weight: 700;
  font-size: 1.1rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

@media (min-width: 48rem) {
  .company-logo {
    width: 48px;
    height: 48px;
    font-size: 1.25rem;
  }
}

.company-logo-green {
  background: #10b981;
}

.company-header-info {
  flex: 1;
}

.company-header-info h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-heading);
}

@media (min-width: 48rem) {
  .company-header-info h3 {
    font-size: 1.1rem;
  }
}

.company-header-info h3 a {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.company-header-info h3 .arrow {
  display: inline-block;
  vertical-align: baseline;
  transition: transform 0.2s ease;
}

.company-header-info h3 a:hover .arrow {
  transform: translate(3px, -3px);
}

.company-duration {
  font-size: 0.75rem;
  color: var(--color-faint);
  font-weight: 500;
  margin: 0.25rem 0 0 0;
}

@media (min-width: 48rem) {
  .company-duration {
    font-size: 0.85rem;
  }
}

.company-timeline-dot {
  display: none;
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: var(--color-bg);
  border: 2.5px solid var(--color-heading);
  margin-top: 0.25rem;
}

@media (min-width: 48rem) {
  .company-timeline-dot {
    display: block;
  }
}

/* Company Roles Container */
.company-roles {
  position: relative;
  margin-left: 0;
}

.company-roles::before {
  display: none;
  content: "";
  position: absolute;
  left: -1.125rem;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--color-line);
}

@media (min-width: 48rem) {
  .company-roles {
    margin-left: 2.25rem;
  }

  .company-roles::before {
    display: block;
  }
}

/* Individual Role Item */
.role-item {
  position: relative;
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 48rem) {
  .role-item {
    gap: 1rem;
    margin-bottom: 2rem;
  }
}

.role-item:last-child {
  margin-bottom: 0;
}

.role-timeline-dot {
  display: none;
  flex-shrink: 0;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--color-line);
  margin-top: 0.375rem;
}

@media (min-width: 48rem) {
  .role-timeline-dot {
    display: block;
  }
}

.role-content {
  flex: 1;
  padding-bottom: 0.3rem;
}

@media (min-width: 48rem) {
  .role-content {
    padding-bottom: 0.5rem;
  }
}

.role-header {
  margin-bottom: 0.5rem;
}

@media (min-width: 48rem) {
  .role-header {
    margin-bottom: 0.75rem;
  }
}

.role-header h4 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-heading);
}

@media (min-width: 48rem) {
  .role-header h4 {
    font-size: 0.95rem;
  }
}

.role-date {
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-faint);
  margin: 0.2rem 0 0 0;
}

.role-location {
  font-size: 0.75rem;
  color: var(--color-faint);
  margin: 0.1rem 0 0 0;
}

@media (min-width: 48rem) {
  .role-date {
    font-size: 0.75rem;
    margin: 0.25rem 0 0 0;
  }

  .role-location {
    font-size: 0.8rem;
    margin: 0.15rem 0 0 0;
  }
}

/* Role Bullets */
.role-bullets {
  list-style: none;
  margin: 0.75rem 0;
  padding: 0;
}

.role-bullets li {
  margin-bottom: 0.4rem;
  padding-left: 1rem;
  position: relative;
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--color-text);
}

@media (min-width: 48rem) {
  .role-bullets li {
    margin-bottom: 0.5rem;
    padding-left: 1.25rem;
    font-size: 0.9rem;
    line-height: 1.5;
  }
}

.role-bullets li:last-child {
  margin-bottom: 0;
}

.role-bullets li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--color-heading);
  font-weight: 700;
}

/* Role Skills - Now using .tags style */
.role-item .tags {
  margin-top: 0.75rem;
}

/* ---------- Buttons ---------- */
.btn,
.cv-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0.75rem 1.75rem;
  border: 1px solid var(--color-heading);
  border-radius: 0;
  background: transparent;
  color: var(--color-heading);
  text-decoration: none;
  text-transform: uppercase;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  overflow: hidden;
  transition: color 0.25s ease;
}

@media (min-width: 48rem) {
  .btn,
  .cv-link {
    margin-top: 1.5rem;
    padding: 0.9rem 2.25rem;
    font-size: 0.75rem;
    letter-spacing: 0.2em;
  }
}

.cv-link {
  margin-left: 1.5rem;
}

/* Sliding fill on hover */
.btn::before,
.cv-link::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--color-heading);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
  z-index: 0;
}

.btn:hover::before,
.cv-link:hover::before {
  transform: scaleX(1);
}

.btn:hover,
.cv-link:hover {
  color: var(--color-bg);
}

.btn > *,
.cv-link > * {
  position: relative;
  z-index: 1;
}

.btn .arrow,
.cv-link .arrow {
  transition: transform 0.2s ease;
}

.btn:hover .arrow,
.cv-link:hover .arrow {
  transform: translate(3px, -3px);
}

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

  .spotlight {
    display: none;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
