:root {
  --bg: #ffffff;
  --bg-alt: #f7f8fa;
  --text: #16181d;
  --text-muted: #5b6270;
  --border: #e6e8ec;
  --accent: #3454d1;
  --accent-dark: #253d9e;
  --accent-soft: #eef1fc;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  --max-width: 1080px;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: inherit;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* language visibility */
[data-lang='sv'] .lang-en, [data-lang='sv'] .lang-tr { display: none; }
[data-lang='en'] .lang-sv, [data-lang='en'] .lang-tr { display: none; }
[data-lang='tr'] .lang-sv, [data-lang='tr'] .lang-en { display: none; }

/* header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  padding-bottom: 14px;
}

.brand {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1;
}

.brand-logo {
  width: 78px;
  height: 80px;
  display: block;
}

.brand-accent {
  color: var(--accent);
}

.nav-wrap {
  display: flex;
  align-items: center;
  gap: 2.5rem;
}

.main-nav {
  display: flex;
  gap: 2rem;
}

.main-nav a {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.main-nav a.active {
  color: var(--text);
  border-color: var(--accent);
}

.lang-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.lang-toggle button {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
  font-family: inherit;
}

.lang-toggle button.active {
  background: var(--accent);
  color: #fff;
}

.nav-toggle {
  display: none;
  border: none;
  background: none;
  cursor: pointer;
  padding: 8px;
}

.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  position: relative;
  transition: 0.2s ease;
}

.nav-toggle span::before,
.nav-toggle span::after {
  content: '';
  position: absolute;
}

.nav-toggle span::before { top: -7px; }
.nav-toggle span::after { top: 7px; }

/* hero */
.hero {
  padding: 6rem 0 5rem;
}

.hero .container {
  display: flex;
  align-items: center;
  gap: 3.5rem;
}

.hero-text {
  flex: 1;
  min-width: 0;
}

.eyebrow {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 0.75rem;
}

.hero h1 {
  font-size: clamp(2.2rem, 4vw, 3.2rem);
  margin: 0 0 2rem;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.hero-photo {
  flex: 0 0 auto;
  position: relative;
  width: 300px;
  height: 280px;
}

/* every circle is a permanently-280px box centered on the same anchor point;
   all state changes (default vs. hover) are expressed purely as
   transform (translate + scale) and opacity, which the browser can
   animate on the compositor thread without ever recomputing layout.
   This is what makes the transition butter-smooth instead of stuttering,
   and it's also why hovering one circle never nudges anything else on
   the page (the CTA buttons included) out from under the cursor. */
.photo-circle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 280px;
  height: 280px;
  margin: -140px 0 0 -140px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 20px 40px rgba(20, 30, 60, 0.08);
  opacity: 0;
  transform: translateX(0) scale(0);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease;
  will-change: transform, opacity;
}

.photo-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-circle--suit,
.photo-circle--family {
  opacity: 1;
  transform: translateX(0) scale(0.4643); /* 130px / 280px */
}

.photo-circle--suit {
  transform: translateX(-78px) scale(0.4643);
}

.photo-circle--family {
  transform: translateX(78px) scale(0.4643);
}

.photo-circle--linkedin,
.photo-circle--email {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  background: var(--accent-soft);
}

.photo-circle--linkedin svg,
.photo-circle--email svg {
  width: 34%;
  height: 34%;
  flex: none;
}

/* on hover of a hero CTA button, isolate the matching circle(s); the two
   link icons appear as a side-by-side pair, mirroring the default
   suit+family layout, while about/experience isolate a single full photo */
#heroPhoto[data-hover="about"] .photo-circle--suit,
#heroPhoto[data-hover="about"] .photo-circle--linkedin,
#heroPhoto[data-hover="about"] .photo-circle--email,
#heroPhoto[data-hover="experience"] .photo-circle--family,
#heroPhoto[data-hover="experience"] .photo-circle--linkedin,
#heroPhoto[data-hover="experience"] .photo-circle--email,
#heroPhoto[data-hover="contact"] .photo-circle--suit,
#heroPhoto[data-hover="contact"] .photo-circle--family {
  opacity: 0;
  transform: translateX(0) scale(0);
}

#heroPhoto[data-hover="about"] .photo-circle--family,
#heroPhoto[data-hover="experience"] .photo-circle--suit {
  opacity: 1;
  transform: translateX(0) scale(1);
}

#heroPhoto[data-hover="contact"] .photo-circle--linkedin,
#heroPhoto[data-hover="contact"] .photo-circle--email {
  opacity: 1;
  transform: translateX(-78px) scale(0.4643);
}

#heroPhoto[data-hover="contact"] .photo-circle--email {
  transform: translateX(78px) scale(0.4643);
}

.button-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.6rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-secondary {
  background: var(--bg-alt);
  color: var(--text);
  border: 1px solid var(--border);
}

/* generic sections */
.section {
  padding: 3.5rem 0;
}

/* page layout with side table-of-contents (About, Experience) */
.page-layout {
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 3rem;
  align-items: start;
}

.page-content {
  min-width: 0;
}

.page-content .section {
  scroll-margin-top: 118px;
  padding: 2.5rem 0;
}

.page-content .section:first-child {
  padding-top: 0;
}

.page-content .section + .section {
  border-top: 1px solid var(--border);
}

.page-toc {
  padding-top: 1.5rem;
}

/* only the nav links are sticky - the photo above stays where it is
   in the page and scrolls away normally */
.page-toc-sticky {
  position: sticky;
  top: 118px;
}

.page-toc-photo {
  display: block;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  box-shadow: 0 12px 24px rgba(20, 30, 60, 0.08);
  margin: 0 0 1.5rem;
}

.page-toc-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  margin: 0 0 0.9rem;
}

.page-toc nav {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  border-left: 2px solid var(--border);
}

.page-toc a {
  padding-left: 0.9rem;
  margin-left: -2px;
  border-left: 2px solid transparent;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  line-height: 1.3;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.page-toc a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}

@media (max-width: 960px) {
  .page-layout {
    grid-template-columns: 1fr;
  }

  .page-toc {
    display: none;
  }
}

.section-heading {
  margin: 0 0 0.75rem;
}

.section-heading .eyebrow {
  margin-bottom: 0.5rem;
}

.section-heading h2 {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  letter-spacing: -0.01em;
  margin: 0;
}

.highlight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.5rem;
}

.highlight-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  background: var(--bg);
}

.highlight-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
}

.highlight-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.about-body {
  flex: 1;
  max-width: 70ch;
}

.about-body p {
  color: var(--text-muted);
  margin: 0 0 1.25rem;
}

.about-body p:last-child {
  margin-bottom: 0;
}

/* timeline (experience) */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.timeline-item {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 1.5rem;
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--border);
}

.timeline-item:last-child {
  border-bottom: none;
}

.timeline-date {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9rem;
}

.timeline-role {
  font-size: 1.1rem;
  margin: 0 0 0.15rem;
}

.timeline-company {
  color: var(--text-muted);
  font-weight: 500;
  margin: 0 0 0.6rem;
  font-size: 0.95rem;
}

.timeline-bullets {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-muted);
}

.timeline-bullets li {
  margin-bottom: 0.35rem;
}

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

.lead-text {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 70ch;
  margin: 0;
}

.tag-group + .tag-group {
  margin-top: 2rem;
}

.tag-group h3 {
  font-size: 0.95rem;
  margin: 0 0 0.9rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
}

.plain-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.plain-list li {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}

.plain-list li:last-child {
  border-bottom: none;
}

.plain-list strong {
  color: var(--text);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.tag {
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
}

/* contact page */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.contact-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.contact-card .icon {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.contact-card .icon svg {
  width: 20px;
  height: 20px;
}

.contact-card h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

.contact-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
}

.site-footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.site-footer p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.footer-links a svg {
  width: 16px;
  height: 16px;
  flex: none;
}

/* :hover only for devices with a real pointer (mouse/trackpad). Scoping it
   this way stops touch devices (iOS Safari especially) from requiring a
   double-tap to follow a link - WebKit uses the first tap to preview the
   :hover state on elements that define one, and only navigates on the
   second tap unless no :hover applies. */
@media (hover: hover) and (pointer: fine) {
  .main-nav a:hover {
    color: var(--text);
    border-color: var(--accent);
  }

  .btn-primary:hover {
    background: var(--accent-dark);
    transform: translateY(-1px);
  }

  .btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
  }

  .page-toc a:hover {
    color: var(--text);
  }

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

  .footer-links a:hover {
    color: var(--accent);
  }
}

@media (max-width: 860px) {
  .hero .container {
    flex-direction: column-reverse;
    text-align: center;
  }

  .button-row {
    justify-content: center;
  }

  .two-col,
  .highlight-grid,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .timeline-item {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }
}

@media (max-width: 560px) {
  .button-row {
    flex-direction: column;
    align-items: stretch;
  }

  .button-row .btn {
    width: 100%;
  }

  /* hover isn't reachable on touch, so keep the photo box sized to the
     default (both circles) state instead of reserving room for the
     280px hover size */
  .hero-photo {
    width: 280px;
    height: 150px;
  }
}

@media (max-width: 720px) {
  .main-nav {
    position: absolute;
    top: 72px;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 1rem 24px;
    gap: 1rem;
    display: none;
  }

  .main-nav.open {
    display: flex;
  }

  .nav-toggle {
    display: block;
  }
}
