/* Force theme via attribute on <html> */
html[data-theme="light"] {
  --bg: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --card: #f8fafc;
  --brand-ghost: #e6f0fb;
}
html[data-theme="dark"] {
  --bg: #0b0f14;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --card: #0f1621;
  --brand-ghost: #0a223c;
}

/* Theme toggle button */
.theme-btn {
  background: transparent;
  border: 1px solid color-mix(in oklab, var(--text) 15%, transparent);
  padding: .4rem .7rem;
  border-radius: 10px;
  cursor: pointer;
}
.theme-btn:hover { background: var(--brand-ghost); }

:root {
  --bg: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --card: #f8fafc;
  --brand: #0a66c2;
  --brand-ghost: #e6f0fb;
  --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f14;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --card: #0f1621;
    --brand-ghost: #0a223c;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, rgba(10,102,194,0.15), transparent 60%), var(--bg);
  color: var(--text);
  line-height: 1.6;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { width: min(1100px, 92%); margin: 0 auto; }
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 1rem; top: 1rem; background: #fff; color: #000; padding: .5rem 1rem; border-radius: 8px; }

.site-header {
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: saturate(180%) blur(8px);
  background: color-mix(in oklab, var(--bg) 80%, transparent);
  border-bottom: 1px solid color-mix(in oklab, var(--text) 12%, transparent);
}
.nav { display: flex; align-items: center; justify-content: space-between; padding: .75rem 0; }
.brand { font-weight: 700; font-size: 1.1rem; letter-spacing: .08em; }
.menu { display: flex; gap: 1rem; align-items: center; list-style: none; margin: 0; padding: 0; }
.menu a { padding: .4rem .6rem; border-radius: 10px; }
.menu a:hover { background: var(--brand-ghost); text-decoration: none; }
.menu-btn { display: none; }

.btn {
  display: inline-block;
  background: var(--brand);
  color: #fff; border: 0;
  padding: .75rem 1rem; border-radius: 999px;
  font-weight: 600; letter-spacing: .02em;
}
.btn:hover { filter: brightness(1.05); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--brand); border: 2px solid var(--brand); }
.btn.small { padding: .5rem .8rem; font-weight: 600; }

.hero {
  display: grid; grid-template-columns: 1.6fr 1fr; gap: 2rem;
  padding: 3.5rem 0 2.25rem;
}
.hero-text h1 { font-size: clamp(2rem, 2.8vw, 3rem); line-height: 1.2; margin: 0 0 .6rem; }
.subtitle { color: var(--muted); margin: 0 0 1.25rem; }
.accent { background: linear-gradient(90deg, #0a66c2, #39bdf8); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ctas { display: flex; gap: .75rem; flex-wrap: wrap; }
.hero-media img { width: 240px; max-width: 100%; border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,.15); }

.card { background: var(--card); padding: 1.25rem; border-radius: var(--radius); }
.card h2 { margin-top: 0; }

.bullets { margin: .5rem 0 0; padding-left: 1.1rem; }
.bullets li { margin: .25rem 0; }

#work { padding: 2rem 0; }
#work h2 { margin-bottom: .75rem; }
.grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.proj {
  background: var(--card); padding: 1rem; border-radius: var(--radius);
  border: 1px solid color-mix(in oklab, var(--text) 10%, transparent);
  transition: transform .15s ease, box-shadow .15s ease;
}
.proj:hover { transform: translateY(-2px); box-shadow: 0 10px 20px rgba(0,0,0,.08); }
.proj h3 { margin: 0 0 .4rem; }

.tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.tags span {
  display: inline-block; padding: .25rem .55rem; border-radius: 999px;
  background: var(--brand-ghost); color: color-mix(in oklab, var(--brand) 90%, black 0%);
  font-size: .85rem; font-weight: 600;
}
.tags.lg span { font-size: .95rem; padding: .35rem .7rem; }

#skills { margin: 1.25rem 0 2rem; }

.contact { text-align: center; padding: 2rem 0 2.5rem; }
.contact .ctas { justify-content: center; }

.footer { border-top: 1px solid color-mix(in oklab, var(--text) 12%, transparent); padding: 1.25rem 0; text-align: center; color: var(--muted); }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; text-align: center; }
  .hero-media { order: -1; }
  .menu-btn { display: inline-block; background: transparent; border: 1px solid color-mix(in oklab, var(--text) 15%, transparent); padding: .4rem .7rem; border-radius: 10px; }
  .menu { display: none; position: absolute; right: 4%; top: 56px; background: var(--bg); padding: .75rem; border-radius: 12px; border: 1px solid color-mix(in oklab, var(--text) 10%, transparent); }
  .menu.show { display: grid; gap: .5rem; }
}

/* Category cards on the homepage */
.cats .cat { background: var(--card); padding: 1rem; border-radius: var(--radius);
  border: 1px solid color-mix(in oklab, var(--text) 10%, transparent); }
.cats .tease { color: var(--muted); margin: .25rem 0 .5rem; }
.cat-list { margin: .4rem 0 .8rem; padding-left: 1.1rem; }
.cat-list li { margin: .25rem 0; }


/* 3-position theme switch */
.theme-rail{
  position: relative; display: grid; grid-template-columns: repeat(3, 1fr);
  align-items: center; gap: 0; height: 36px; width: 156px;
  border: 1px solid color-mix(in oklab, var(--text) 15%, transparent);
  border-radius: 14px; background: var(--bg); overflow: hidden;
}
.theme-rail input{ position:absolute; opacity:0; }
.theme-rail label{
  display:flex; align-items:center; justify-content:center; height:100%;
  font-weight:600; cursor:pointer; user-select:none; font-size:.95rem;
}
.theme-rail .thumb{
  position:absolute; inset:3px auto 3px 3px; width:calc(33.333% - 6px);
  border-radius: 10px;
  background: var(--brand-ghost);
  border: 1px solid color-mix(in oklab, var(--text) 12%, transparent);
  transition: transform .18s ease;
}

/* Positions: left=light, middle=auto, right=dark */
#th-light:checked ~ .thumb{ transform: translateX(0%); }
#th-auto:checked  ~ .thumb{ transform: translateX(100%); }
#th-dark:checked  ~ .thumb{ transform: translateX(200%); }

.theme-rail:hover label{ background: color-mix(in oklab, var(--text) 6%, transparent); }
/* End theme switch */

/* 2-position theme toggle */
.theme-toggle2{
  position: relative; display: grid; grid-template-columns: 1fr 1fr;
  align-items: center; gap: 0; width: 96px; height: 36px;
  border: 1px solid color-mix(in oklab, var(--text) 15%, transparent);
  border-radius: 999px; background: var(--bg); cursor: pointer; user-select: none;
}
.theme-toggle2 .icon{ text-align:center; font-size: .95rem; opacity: .9; z-index:1; }
.theme-toggle2 .thumb{
  position: absolute; top: 3px; bottom: 3px; left: 3px;
  width: calc(50% - 6px); border-radius: 999px;
  background: var(--brand-ghost);
  border: 1px solid color-mix(in oklab, var(--text) 12%, transparent);
  transition: transform .18s ease;
}
/* Positions driven by data-state */
.theme-toggle2[data-state="light"] .thumb{ transform: translateX(0%); }
.theme-toggle2[data-state="dark"]  .thumb{ transform: translateX(100%); }

/* Hover nicety */
.theme-toggle2:hover{ background: color-mix(in oklab, var(--text) 6%, transparent); }
/* End 2-position theme toggle */

/* ===== Horizontal Experience Timeline (fits container, no scroll) ===== */

/* spacing from About so sections don't merge */
.experience { margin-top: 1.4rem; }

/* container: equal columns across the available width (no horizontal scroll) */
.h-timeline{
  position: relative;
  display: flex;
  align-items: center;         /* for the center rail ref */
  gap: 1rem;                   /* horizontal gap between items */
  padding: 1.4rem 0;           /* vertical room for branches */
  list-style: none;
  margin: 0;
  overflow: visible;
}

/* central horizontal rail */
.h-timeline::before{
  content:"";
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  height: 2px;
  background: color-mix(in oklab, var(--text) 18%, transparent);
  pointer-events: none;
}

/* each item takes an equal share of the row */
.h-item{
  position: relative;
  flex: 1 1 0;          /* equal columns */
  min-width: 0;         /* allow content to shrink */
  min-height: 200px;    /* vertical room for branches */
}

/* center node (dot) on the rail */
.h-item .node{
  position: absolute;
  top: 50%; left: 50%;
  width: 12px; height: 12px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--brand);
  border: 2px solid var(--card);
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--brand) 25%, transparent);
  z-index: 2;
}

/* card centered within its column; width adapts to column size */
.h-card{
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, 3200px);     /* never exceed column width; cap at 280px */
  background: var(--card);
  border: 1px solid color-mix(in oklab, var(--text) 10%, transparent);
  border-radius: 10px;
  padding: .6rem .75rem;       /* compact */
  box-shadow: 0 1px 0 color-mix(in oklab, var(--text) 6%, transparent);
  z-index: 1;

  /* center inner content (dates, title, company) */
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* alternate cards above/below the rail */
.h-item:nth-child(odd)  .h-card{ bottom: calc(50% + 20px); }
.h-item:nth-child(even) .h-card{ top:    calc(50% + 20px); }

/* stems (vertical branches) from card to rail */
.h-card::after{
  content:"";
  position: absolute;
  left: 50%;
  width: 2px;
  height: 16px;
  transform: translateX(-50%);
  background: color-mix(in oklab, var(--text) 18%, transparent);
}
.h-item:nth-child(odd)  .h-card::after{ top: 100%; }     /* down to rail */
.h-item:nth-child(even) .h-card::after{ bottom: 100%; }  /* up to rail */

/* 3-line layout inside each card */
.h-card .t-title{
  margin: 0 0 .18rem;
  font-size: .94rem;
  line-height: 1.2;
}
.h-card .t-company{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  margin: 0 0 .22rem;
  font-weight: 600;
}
.h-card .t-company .logo{
  height: 1.05em;
  vertical-align: -0.15em;
  opacity: .95;
}
.h-card .t-meta{
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.2;
  margin-bottom: .18rem;
}

/* --- Small screens: still no horizontal scroll.
       We stack into a vertical timeline so everything fits. --- */
@media (max-width: 720px){
  .h-timeline{
    display: grid;
    grid-template-columns: 1fr;   /* single column */
    gap: 1rem 0;
    padding: 1.1rem 0 1.2rem;
  }
  .h-timeline::before{
    left: 18px; right: auto; width: 3px; height: 100%; top: 0; /* vertical rail on left */
  }
  .h-item{
    min-height: auto;
    padding-left: 2.2rem;         /* room for rail + node */
  }
  .h-item .node{
    left: 18px; top: 1.1rem; transform: translate(-50%, 0);
  }
  .h-card{
    position: relative;
    left: auto; transform: none;
    width: 100%;
    margin: 0;
  }
  .h-card::after{
    display: none;                /* node already touches the rail */
  }
}
