/* ── Design tokens ── */
:root {
  --green: #2e9e41;
  --green-dark: #29813a;
  --slate: #3b4851;
  --bg: #f7f7f7;
  --heading: #68787c;
  --sidebar-w: 250px;
  --header-h: 5em;
  --white: #ffffff;
  --text: #333333;
  --card-border: #d8d8d8;
}

/* ── Reset / base ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: "Ubuntu", sans-serif;
  font-size: 16px;
  color: var(--text);
}

body {
  background: var(--bg);
  min-height: 100vh;
}

ul {
  list-style: none;
}

a {
  text-decoration: none;
  color: inherit;
}

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

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--green);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-header {
  padding: 1.5rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-brand {
  color: var(--white);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.sidebar-portrait {
  max-height: 100px;
  width: auto;
  border-radius: 4px;
  object-fit: cover;
}

.nav-list {
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0;
  flex: 1;
}

/* ── Nav links (shared by sidebar and topnav) ── */
.nav-link {
  display: block;
  padding: 0.8rem 1.2rem;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.95rem;
  font-weight: 400;
  transition:
    background 0.15s,
    color 0.15s;
  position: relative;
}

.nav-link:hover {
  background: var(--green-dark);
  color: var(--white);
}

/* Active state: darker background + right-arrow indicator */
.nav-link.active {
  background: var(--green-dark);
  color: var(--white);
  font-weight: 500;
}

.sidebar .nav-link.active::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-right: 10px solid var(--bg);
}

/* ── Top nav (mobile only) ── */
.topnav {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--green);
  align-items: center;
  padding: 0 1rem;
  height: 3.5rem;
  z-index: 100;
  gap: 1rem;
  overflow-x: auto;
}

.topnav-brand {
  color: var(--white);
  font-weight: 700;
  font-size: 1rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.topnav-links {
  display: flex;
  gap: 0;
  flex-shrink: 0;
}

.topnav .nav-link {
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  white-space: nowrap;
}

.topnav .nav-link.active::after {
  display: none;
}

/* ── Layout ── */
.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar-spacer {
  width: var(--sidebar-w);
  flex-shrink: 0;
}

.main-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ── Header bar ── */
.header-bar {
  background: var(--slate);
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-title {
  color: var(--white);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* ── Content area ── */
.content {
  padding: 2rem;
  flex: 1;
}

/* ── Sections ── */
.section {
  display: none;
}

.section.active {
  display: block;
}

.section-heading {
  color: var(--heading);
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 0.4rem;
  margin-bottom: 1.25rem;
}

.section-heading--spaced {
  margin-top: 2.5rem;
}

/* ── About Me ── */
.about-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.about-card {
  background: var(--white);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
}

.about-card .section-heading {
  margin-bottom: 0.75rem;
}

.about-card p {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #444;
}

/* ── My Time at ABB ── */
.abb-image {
  max-width: 100%;
  border-radius: 6px;
  margin-top: 0.5rem;
}

/* ── Flip cards ── */
.cards-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.flip-card {
  width: 24em;
  height: 24em;
  perspective: 1000px;
  cursor: pointer;
  flex-shrink: 0;
}

/* Flip on hover (desktop) */
.flip-card:hover .flip-inner,
.flip-card.flipped .flip-inner {
  transform: rotateY(180deg);
}

.flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s ease;
  transform-style: preserve-3d;
}

.flip-front,
.flip-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.flip-front {
  background: var(--white);
  border: 1px solid var(--card-border);
  gap: 1rem;
}

.flip-front h3 {
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--slate);
  text-align: center;
}

.flip-front img {
  max-height: 80px;
  max-width: 160px;
  object-fit: contain;
}

.flip-back {
  background: var(--slate);
  transform: rotateY(180deg);
  align-items: flex-start;
  justify-content: center;
}

.flip-back ul {
  list-style: disc;
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.flip-back ul li {
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.9rem;
  line-height: 1.45;
}

/* ── What's Next cards ── */
.next-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.next-card {
  background: var(--white);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.next-card h3 {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--slate);
}

.next-card p {
  font-size: 0.9rem;
  line-height: 1.6;
  color: #555;
}

.next-card ul {
  list-style: disc;
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.next-card ul li {
  font-size: 0.875rem;
  color: #555;
  line-height: 1.45;
}

/* ── Mobile (< 768px) ── */
@media (max-width: 767px) {
  .sidebar {
    display: none;
  }

  .topnav {
    display: flex;
  }

  .sidebar-spacer {
    display: none;
  }

  .main-column {
    padding-top: 3.5rem; /* topnav height */
  }

  .header-bar {
    position: relative;
    top: 0;
  }

  .content {
    padding: 1.25rem 1rem;
  }

  .flip-card {
    width: 100%;
    max-width: 24em;
  }

  /* Touch: tap to flip — handled by JS adding .flipped class */
  .flip-card:hover .flip-inner {
    transform: none; /* disable hover on touch devices; use .flipped instead */
  }

  .flip-card.flipped .flip-inner {
    transform: rotateY(180deg);
  }

  .next-cards {
    grid-template-columns: 1fr;
  }

  .about-cards {
    grid-template-columns: 1fr;
  }
}
