:root {
  --bg0: #ffffff;
  --bg1: #ffffff;

  --card: rgba(0, 0, 0, 0.02);
  --card2: rgba(0, 0, 0, 0.04);

  --divider: #e6e6e6;
  --stroke: rgba(0, 0, 0, 0.08);

  /* Less harsh than pure #000 */
  --ink: #111111;
  --ink2: rgba(17, 17, 17, 0.88);

  --text: var(--ink2);
  --muted: rgba(17, 17, 17, 0.62);
  --muted2: rgba(17, 17, 17, 0.44);

  --shadow: 0 14px 40px rgba(0, 0, 0, 0.08);

  --radius: 28px;
  --radius2: 18px;
  --max: 1120px;

  --font-main: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;

  /* 2024–2026 motion tokens (calm + snappy) */
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-soft: cubic-bezier(.22, 1, .36, 1);
  --dur-1: 120ms;
  --dur-2: 160ms;
  --dur-3: 220ms;

  /* hover state helpers */
  --hover-bg: rgba(17,17,17,.04);
  --hover-stroke: rgba(17,17,17,.12);
  --hover-shadow: 0 18px 44px rgba(0,0,0,.12);
}

* { box-sizing: border-box; }

html, body {
  font-family: var(--font-main);
  font-weight: 300;
  line-height: 1.65;
  height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background: #fff;
  overflow-x: hidden;
}

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

.wrap { width: min(var(--max), 92vw); margin: 0 auto; }

/* -------------------- Header -------------------- */
header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background: linear-gradient(180deg, rgba(255,255,255,.84), rgba(255,255,255,.58));
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.nav {
  display: flex;
  align-items: center;
  padding: 14px 0;
  justify-content: center;
}

.pill {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.08);
  width: fit-content;
  max-width: 92vw;
  flex-wrap: wrap;
  justify-content: space-between;
}

.pill-side {
  display: flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 800;
}

.links {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 0 6px;
}

.links a {
  font-size: 13px;
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 999px;
  white-space: nowrap;

  /* 2024–2026: no “jump”, just state change */
  transition:
    background var(--dur-2) var(--ease-out),
    color var(--dur-2) var(--ease-out),
    box-shadow var(--dur-2) var(--ease-out),
    border-color var(--dur-2) var(--ease-out);
}

.links a:hover {
  background: var(--ink);
  color: #fff;
}

.links a.active {
  background: var(--ink);
  color: #fff;
}

/* Right side (menu only) */
.pill-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid rgba(82, 82, 82, 0.1);
  background: rgba(255, 255, 255, 0.75);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  display: inline-grid;
  place-items: center;

  /* ✅ keep hamburger black via currentColor */
  color: var(--ink);

  -webkit-appearance: none;
  appearance: none;

  transition:
    background var(--dur-2) var(--ease-out),
    border-color var(--dur-2) var(--ease-out),
    box-shadow var(--dur-2) var(--ease-out);
}

.icon-btn svg { color: inherit; }

.icon-btn:hover {
  border-color: var(--hover-stroke);
  background: rgba(255,255,255,.86);
  box-shadow: var(--hover-shadow);
}

.icon-btn:focus-visible {
  outline: 2px solid rgba(0,0,0,.35);
  outline-offset: 3px;
}

/* Menu icon hidden on desktop */
.icon-menu { display: none; }

/* -------------------- Mobile dropdown -------------------- */
.mobile-menu {
  display: none;
  width: min(980px, 92vw);
  margin: 0 auto 10px;
  padding: 10px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.1);
  gap: 10px;

  /* smooth open (modern) */
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;

  transition:
    opacity var(--dur-2) var(--ease-out),
    transform var(--dur-2) var(--ease-out);
}

.mobile-menu.open {
  display: grid;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.mobile-menu a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 12px;
  border-radius: 14px;
  color: var(--text);

  transition:
    background var(--dur-2) var(--ease-out),
    color var(--dur-2) var(--ease-out);
}

.mobile-menu a:hover,
.mobile-menu a:focus-visible,
.mobile-menu a:active {
  background: var(--ink);
  color: #fff;
}

.mobile-menu a.active {
  background: var(--ink);
  color: #fff;
}

.mobile-menu a:focus-visible {
  outline: 2px solid rgba(0,0,0,.35);
  outline-offset: 2px;
}

/* -------------------- Main + section switching -------------------- */
main { padding: 56px 0 84px; }

section[data-section] {
  display: none;
  opacity: 0;
  transform: translateY(6px);

  /* 2024–2026: calm + quick */
  transition:
    opacity var(--dur-3) var(--ease-out),
    transform var(--dur-3) var(--ease-out);
}

section[data-section].active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* Simple cards */
.section-card {
  margin-top: 22px;
  padding: 22px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.08);
}

.section-card h2 { margin: 0 0 6px; font-size: 22px; letter-spacing: -0.3px; }
.section-card p { margin: 0; color: var(--muted); line-height: 1.7; }

/* -------------------- About -------------------- */
.about-header { margin-bottom: 18px; }
.about-header h2 { margin: 0; }

.about-split {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 40px;
  align-items: start;
}

.about-image {
  width: 100%;
  max-width: 230px;
  height: auto;
  object-fit: cover;
  border: 1px solid var(--ink);
}

/* About – contact links */
.about-contact {
  margin-top: 18px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.about-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.1);
  background: rgba(255,255,255,.75);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;

  /* modern: remove “lift”, keep crisp state */
  transition:
    background var(--dur-2) var(--ease-out),
    color var(--dur-2) var(--ease-out),
    box-shadow var(--dur-2) var(--ease-out),
    border-color var(--dur-2) var(--ease-out);
}

.about-link:hover {
  background: var(--ink);
  color: #fff;
  border-color: rgba(0,0,0,.18);
  box-shadow: none;
}

.about-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
}

.about-ico svg { display: block; }

/* Shared subtitle style */
.page-sub {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}

/* -------------------- Hobbies -------------------- */
.hobbies-split {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 44px;
  align-items: start;
}

.hobbies-left h2 { margin: 0 0 10px; }
.hobbies-left .sub { margin: 0 0 26px; color: var(--muted); }

.hobby-cats {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 18px;
}

.cat {
  text-align: left;
  padding: 10px 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-weight: 500;
  color: var(--ink);
  width: fit-content;
  border-bottom: 1px solid transparent;

  transition:
    border-color var(--dur-1) var(--ease-out),
    opacity var(--dur-1) var(--ease-out);
}

.cat:hover {
  border-bottom-color: var(--ink);
}

.cat.active {
  font-weight: 700;
  border-bottom: 2px solid var(--ink);
}

.gallery-wrap { display: none; }
.gallery-wrap.active { display: block; }

.gallery {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, 1fr);
}

.gallery-item {
  overflow: hidden;
  border: 1px solid rgba(0,0,0,.08);
  background: rgba(255,255,255,.75);
  box-shadow: 0 14px 30px rgba(0,0,0,.10);
  display: block;
  padding: 0;
  cursor: pointer;

  /* modern: no jump */
  transition:
    box-shadow var(--dur-2) var(--ease-out),
    border-color var(--dur-2) var(--ease-out),
    filter var(--dur-2) var(--ease-out);
}

.gallery-item:hover {
  box-shadow: 0 20px 45px rgba(0,0,0,.14);
  border-color: var(--hover-stroke);
  filter: saturate(1.02);
}

.gallery-item:focus-visible {
  outline: 2px solid rgba(0,0,0,.35);
  outline-offset: 3px;
}

.gallery-item img {
  width: 100%;
  height: 320px;
  object-fit: cover;
  display: block;
}

/* -------------------- Footer -------------------- */
.site-footer p { margin: 0; font-size: 14px; letter-spacing: .04em; }

.site-footer {
  margin-top: 80px;
  padding: 24px 0 32px;
  text-align: center;
  border-top: 1px solid var(--divider);
}

.site-footer .credit { margin-top: 6px; font-size: 12px; color: var(--muted2); }

/* =========================
   Lightbox (clean + consistent)
   ========================= */

.lightbox {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;

  background: rgba(255,255,255,.92);
  z-index: 9999;
  padding: 18px;

  /* open/close: opacity only */
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.lightbox.open {
  opacity: 1;
  pointer-events: auto;
}

.lb-stage {
  width: min(980px, 92vw);
  height: min(78vh, 720px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.lb-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  border-radius: 14px;
}

/* Controls: ALWAYS white background */
.lb-close,
.lb-prev,
.lb-next {
  position: absolute;
  z-index: 10000;

  height: 42px;
  width: 42px;
  border-radius: 999px;

  border: 1px solid var(--divider);
  background: #fff;         /* locked */
  color: var(--ink);

  cursor: pointer;
  display: grid;
  place-items: center;

  /* subtle, non-jumpy interaction */
  transition: border-color 160ms ease, opacity 160ms ease;
}

.lb-close { top: 18px; right: 18px; }
.lb-prev { left: 18px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 18px; top: 50%; transform: translateY(-50%); }

.lb-prev,
.lb-next {
  font-size: 26px;
  line-height: 1;
}

/* Hover: keep white, just a tiny cue */
.lb-close:hover,
.lb-prev:hover,
.lb-next:hover {
  background: #fff;                 /* keep white */
  border-color: rgba(0,0,0,0.18);   /* slightly stronger than divider */
  opacity: 0.92;
}

/* Focus: same white background + soft ring */
.lb-close:focus-visible,
.lb-prev:focus-visible,
.lb-next:focus-visible {
  background: #fff;                 /* keep white */
  outline: 2px solid rgba(0,0,0,0.14);
  outline-offset: 3px;
}

/* Optional: remove default focus outline in browsers that still show it */
.lb-close:focus,
.lb-prev:focus,
.lb-next:focus {
  outline: none;
}


/* -------------------- Responsive -------------------- */
@media (max-width: 900px) {
  .gallery { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .links { display: none; }
  .icon-menu { display: inline-grid; }

  .about-split { grid-template-columns: 1fr; gap: 22px; }
  .hobbies-split { grid-template-columns: 1fr; }
  .hobby-cats { flex-direction: row; flex-wrap: wrap; gap: 18px; }

  .lightbox { padding: 14px; }
  .lb-stage { width: 100%; height: 78vh; }
}

/* Force-hide mobile dropdown on desktop even if it has .open */
@media (min-width: 769px){
  .mobile-menu,
  .mobile-menu.open{
    display: none !important;
  }
}

/* =========================
   Divider utility (SAFE)
   ========================= */
.head-line {
  height: 1px;
  width: 100%;
  background: var(--divider);
}

/* =========================
   Achievements (JSON-rendered)
   Editorial list style
   ========================= */
.ach-section {
  margin-top: 44px;
}

.ach-section:first-child {
  margin-top: 22px;
}

.ach-heading {
  margin: 0;
  font-size: 20px;
  font-weight: 300;
  letter-spacing: -0.2px;
  line-height: 1.2;
}

/* Divider ONLY under section headings */
.ach-section .head-line {
  margin: 18px 0 26px;
}

.ach-list {
  display: flex;
  flex-direction: column;
}

.ach-item {
  margin: 0 0 34px;
  padding: 0;
  border: 0;
}

.ach-title {
  margin: 0;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: -0.2px;
}

.ach-meta {
  margin-top: 6px;
  font-size: 15px;
  color: var(--muted);
}

.ach-desc {
  margin: 14px 0 0;
}

/* Dash list instead of bullets */
.ach-bullets {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
}

.ach-bullets li {
  position: relative;
  padding-left: 18px;
  margin: 0 0 10px;
}

.ach-bullets li::before {
  content: "—";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--muted);
}

.ach-link {
  display: inline-block;
  margin-top: 14px;
  font-size: 14px;
  text-decoration: underline;
  color: var(--ink);
}

/* Mobile tighten */
@media (max-width: 768px) {
  .ach-section { margin-top: 34px; }
  .ach-section .head-line { margin: 16px 0 22px; }
  .ach-item { margin-bottom: 26px; }
}

/* Achievements: media rendered as a single gallery tile */
.ach-media-gallery{
  margin-top: 14px;
  width: min(520px, 100%);
}

.ach-media-gallery .gallery-item img{
  height: clamp(240px, 45vh, 520px);
  object-fit: cover;
}

.ach-spacer{
  height: 14px;
}

/* Achievements: make media image bigger */
#achievementRoot .ach-media-gallery {
  margin-top: 18px;
  width: 100%;
  max-width: 720px;
}

#achievementRoot .ach-media-gallery .gallery-item {
  width: 100%;
  box-shadow: none;
  border: 1px solid rgba(0,0,0,.08);
}

#achievementRoot .ach-media-gallery .gallery-item img {
  width: 100%;
  height: auto !important;
  max-height: 680px;
  object-fit: contain;
  display: block;
}

/* ===== Portfolio (tabs like hobbies, content like achievements) ===== */
.portfolio-split{
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 44px;
  align-items: start;
}

.portfolio-left h2{ margin: 0 0 10px; }

.portfolio-left .sub{
  margin: 0 0 14px;
  color: var(--muted);
}

.portfolio-left .note{
  margin: 0 0 26px;
  color: var(--muted2);
  font-size: 14px;
  line-height: 1.7;
}

.portfolio-tabs{
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 18px;
}

.ptab{
  text-align: left;
  padding: 10px 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-weight: 500;
  color: var(--ink);
  width: fit-content;
  border-bottom: 1px solid transparent;

  transition:
    border-color var(--dur-1) var(--ease-out),
    opacity var(--dur-1) var(--ease-out);
}

.ptab:hover{ border-bottom-color: var(--ink); }
.ptab.active{ font-weight: 700; border-bottom: 2px solid var(--ink); }

.portfolio-panel{ display: none; }
.portfolio-panel.active{ display: block; }

.ach-tech{
  font-weight: 600;
  color: var(--ink);
}

@media (max-width: 768px){
  .portfolio-split{ grid-template-columns: 1fr; }
  .portfolio-tabs{ flex-direction: row; flex-wrap: wrap; gap: 18px; }
}

/* ===== Portfolio ===== */
#portfolioWeb,
#portfolioIot {
  display: flex;
  flex-direction: column;
  gap: 42px;
}

.port-item h4 {
  margin: 0;
  font-size: 20px;
  font-weight: 400;
}

.port-meta {
  margin-top: 4px;
  font-size: 14px;
  color: var(--muted);
}

.port-desc {
  margin-top: 14px;
  line-height: 1.7;
}

.port-link {
  display: inline-block;
  margin-top: 10px;
  font-size: 14px;
  text-decoration: underline;
}

.port-line {
  margin: 6px 0;
}

.port-tech {
  margin-top: 14px;
  color: var(--muted);
  font-size: 14px;
}

/* Portfolio – contained large image */
.port-gallery {
  margin: 18px 0 10px;
}

.port-gallery .gallery-item {
  width: 100%;
  max-width: 100%;
  padding: 0;
  border: 1px solid var(--stroke);
  box-shadow: 0 14px 30px rgba(0,0,0,.08);
}

.port-gallery img {
  width: 100%;
  height: auto;
  max-height: 420px;
  object-fit: cover;
  display: block;
}

@media (min-width: 900px) {
  .port-gallery img { max-height: 460px; }
}

@media (max-width: 768px) {
  .port-gallery img { max-height: 52vh; }
}

/* --------------------
   Accessibility: reduce motion
   -------------------- */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
  section[data-section] {
    transform: none !important;
  }
  .mobile-menu {
    transform: none !important;
  }
}
