:root{
  --header-height: 4rem;
  --bg: #f7f7f9;
  --card: #ffffff;
  --text: #0f1724;
  --muted: #6b7280;
  --accent: #0ea5a4;
  --border: #e6e9ef;
  --surface: #f1f5f9;
  --surface-border: #e2e8f0;
  --nav-hover: #f1f5f9;
  --overlay: rgba(255,255,255,0.95);
  --container-width: 1100px;
}

[data-theme="dark"]{
  --bg: #0d1117;
  --card: #161b27;
  --text: #e2e8f0;
  --muted: #8892a4;
  --border: #252d3d;
  --surface: #1a2133;
  --surface-border: #2a3347;
  --nav-hover: #1e2536;
  --overlay: rgba(22,27,39,0.95);
}

/* Simple reset */
*{box-sizing:border-box}
html{min-height:100%;scroll-padding-top:var(--header-height)}
body{min-height:100%}
body{
  margin:0;
  font-family:Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  background:var(--bg);
  color:var(--text);
  line-height:1.5;
  transition:background 0.3s ease,color 0.3s ease;
}

.container{max-width:var(--container-width);margin:0 auto;padding:0 1rem}
.header-inner,.footer-inner{display:flex;align-items:center;justify-content:space-between;padding:0.75rem 0}

.skip-link{position:absolute;left:-999px;top:auto;width:1px;height:1px;overflow:hidden}
.skip-link:focus{position:static;left:0;top:0;width:auto;height:auto;padding:0.5rem;background:#111;color:#fff}

.site-header{background:var(--card);border-bottom:1px solid var(--border);transition:background 0.3s ease,border-color 0.3s ease;position:sticky;top:0;z-index:100}
.logo{font-weight:700;color:var(--text);text-decoration:none}

.site-nav ul{list-style:none;margin:0;padding:0;display:flex;gap:1rem}
.site-nav a{text-decoration:none;color:var(--text);padding:0.5rem;border-radius:4px}
.site-nav a:hover{background:var(--nav-hover)}

.nav-toggle{display:none;background:none;border:1px solid var(--surface-border);padding:0.4rem 0.6rem;border-radius:4px;color:var(--text)}

.header-controls{display:flex;align-items:center;gap:0.5rem}

/* language switch pill — mirrors the saber-track style */
.lang-switch{
  display:flex;
  align-items:center;
  gap:9px;
  padding:0 14px;
  height:34px;
  border-radius:20px;
  border:1.5px solid var(--border);
  background:var(--surface);
  box-shadow:inset 0 1px 3px rgba(0,0,0,0.07);
  cursor:pointer;
  font-family:inherit;
  transition:border-color 0.15s,box-shadow 0.15s,background 0.3s ease;
}
.lang-switch:hover{
  border-color:var(--accent);
  box-shadow:inset 0 1px 3px rgba(0,0,0,0.07),0 0 0 2px rgba(14,165,164,0.12);
}
.lang-switch:focus-visible{outline:2px solid var(--accent);outline-offset:3px;border-radius:20px}
.lang-flag{display:block;border-radius:2px;transition:opacity 0.15s;filter:drop-shadow(0 1px 2px rgba(0,0,0,0.18))}
.lang-flag--current{opacity:1}
.lang-flag--other{opacity:0.38}

.hero{padding:3.5rem 0;background:linear-gradient(180deg, rgba(14,165,164,0.06), transparent)}
[data-theme="dark"] .hero{background:linear-gradient(180deg, rgba(14,165,164,0.10), transparent)}
.hero h1{margin:0 0 0.5rem;font-size:clamp(1.6rem, 3vw, 2.25rem)}
.btn{display:inline-block;background:var(--accent);color:#fff;padding:0.5rem 0.9rem;border-radius:6px;text-decoration:none}

.content{padding:2rem 0}
.site-footer{padding:1rem 0;border-top:1px solid var(--border);background:transparent}
.footer-links{display:flex;gap:1rem}
.footer-link{color:var(--muted);font-size:0.85rem;text-decoration:none}
.footer-link:hover{color:var(--accent)}

/* Responsive */
@media (max-width:800px){
  .site-nav{display:none}
  .nav-toggle{display:inline-flex}
  .site-nav[aria-hidden="false"]{
    display:block;
    position:absolute;
    top:100%;
    left:0;
    right:0;
    background:var(--card);
    border-bottom:1px solid var(--border);
    padding:0 1rem;
    z-index:99;
  }
  .site-nav ul{flex-direction:column;gap:0}
  .site-nav a{display:block;padding:0.75rem 0}
}

@media (prefers-reduced-motion: no-preference){
  .btn{transition:transform .12s ease, box-shadow .12s}
  .btn:active{transform:translateY(1px)}
}

/* small utilities */
.muted{color:var(--muted)}
h3 + .muted{margin-top:0.125rem;margin-bottom:0.5rem}
.card-body h3,.card-header-text h3{margin-top:0;margin-bottom:0.5rem}

/* Sections & cards */
.section-header h2{margin:0 0 0.25rem}
.section-header .muted{margin:0}
.section-grid{display:grid;grid-template-columns:1fr;gap:1rem;margin-top:1rem}
@media (min-width:800px){
  .section-grid{grid-template-columns:repeat(2,1fr)}
  .section-grid .card--expanded{grid-column:1/-1}
}
.card{background:var(--card);padding:1rem;border-radius:8px;border:1px solid var(--border);transition:border-color 0.15s,box-shadow 0.15s}
.card-trigger{cursor:pointer}
.card:hover{border-color:var(--accent);box-shadow:0 2px 12px rgba(0,0,0,0.07)}
.card--expanded .card-preview{display:none}
.card-header{display:flex;justify-content:space-between;align-items:flex-start;gap:0.75rem;margin-bottom:0.5rem}
.card-header-text{flex:1}
.card-close-row{display:flex;justify-content:flex-end;margin-top:0.75rem}
.review-rating{margin:0 0 1rem;font-size:0.875rem}
.review-stars{color:#f59e0b;letter-spacing:0.05em}
.review-verdict{font-style:italic}
.project-stats{margin:0 0 1rem;font-size:0.875rem}
.project-cost,.project-duration{display:inline-flex;align-items:center;gap:0.2em}
.project-duration svg{vertical-align:-1px}
.project-verdict{font-style:italic}

/* Card preview (thumbnail + text) */
.card-preview{display:flex;gap:0.75rem;align-items:flex-start;flex-direction:row-reverse}
.card-thumb{width:200px;height:200px;object-fit:cover;border-radius:6px;flex-shrink:0}
.card-body{flex:1}
.card-body h3{margin:0}
.card-body>p:first-child{margin-top:0}
@media (max-width:700px){
  .card-preview{flex-direction:column}
  .card-thumb{width:100%;height:auto}
}

/* Gallery shared styles */
.gallery-slide{min-width:100%;flex:0 0 100%;display:none;margin:0}
.gallery-slide.active{display:block}
.gallery-dots{display:flex;gap:0.4rem;justify-content:center;margin-top:0.5rem;margin-bottom:0}
.gallery-dot{width:10px;height:10px;border-radius:50%;border:1px solid var(--border);background:var(--overlay);padding:0}
.gallery-dot[aria-pressed="true"]{background:var(--accent);border-color:var(--accent)}

/* ensure slides are positioned to contain inline dots */
.gallery-slide{position:relative;padding-bottom:0}

/* Card gallery (carousel inside expanded card content) */
.card-gallery{position:relative;overflow:hidden;border-radius:6px;margin:0.75rem 0}
.card-gallery .gallery-track{display:flex;touch-action:pan-y}
.card-gallery .gallery-slide img{width:100%;height:auto;display:block;border-radius:6px;aspect-ratio:4/3;object-fit:cover;background:var(--surface)}
.card-gallery .gallery-prev,.card-gallery .gallery-next{position:absolute;top:50%;transform:translateY(-50%);background:var(--overlay);border:1px solid var(--border);padding:0.35rem 0.6rem;border-radius:6px;cursor:pointer;color:var(--text)}
.card-gallery .gallery-prev{left:0.5rem}
.card-gallery .gallery-next{right:0.5rem}

/* Gallery inside expanded content */
.expanded-content .gallery{display:grid;grid-template-columns:repeat(3,1fr);gap:0.5rem;margin-top:0.75rem}
.expanded-content .gallery img{width:100%;height:auto;display:block;border-radius:6px}
.expanded-content .gallery figcaption{font-size:0.85rem;margin-top:0.25rem}
@media (max-width:700px){
  .expanded-content .gallery{grid-template-columns:repeat(1,1fr)}
}

/* Inline figures for projects */
.expanded-content .inline-figure{margin:0.75rem 0}
.expanded-content .inline-figure img{width:100%;height:auto;display:block;border-radius:6px;margin:0}
.expanded-content .inline-figure figcaption{font-size:0.85rem;margin-top:0.25rem;color:var(--muted)}

/* Responsive sizing for inline images and card gallery: full width on small screens,
   constrained on larger viewports for better readability */
@media (min-width:700px){
  .expanded-content .inline-figure img,.article-body .inline-figure img,.hero-body .inline-figure img,.about-content .inline-figure img{max-width:85%}
  .expanded-content .card-gallery,.article-body .card-gallery{max-width:85%}
}
@media (min-width:1000px){
  .expanded-content .inline-figure img,.article-body .inline-figure img,.hero-body .inline-figure img,.about-content .inline-figure img{max-width:70%}
  .expanded-content .card-gallery,.article-body .card-gallery{max-width:70%}
}

/* Article page body */
.article-body .inline-figure{margin:0.75rem 0}
.article-body .inline-figure img{width:100%;height:auto;display:block;border-radius:6px}
.article-body .card-gallery{margin:0.75rem 0}

/* Section inline images (hero, about, etc.) */
.hero-body .inline-figure,.about-content .inline-figure{margin:0.75rem 0}
.hero-body .inline-figure img,.about-content .inline-figure img{width:100%;height:auto;display:block;border-radius:6px}
.hero-body .inline-figure figcaption,.about-content .inline-figure figcaption{font-size:0.85rem;margin-top:0.25rem;color:var(--muted)}

/* Inline expansion styles */
.read-more{background:none;border:1px solid var(--accent);color:var(--accent);padding:0.35rem 0.6rem;border-radius:6px;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;width:1.8rem;height:1.8rem;transition:transform .28s ease;flex-shrink:0}
.read-more[aria-expanded="true"]{transform:rotate(180deg)}
.read-more:focus{outline:2px solid rgba(14,165,164,0.2);outline-offset:2px}
.close-expanded{background:none;border:1px solid var(--accent);color:var(--accent);padding:0.35rem 0.6rem;border-radius:6px;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;width:1.8rem;height:1.8rem}
.close-expanded:focus{outline:2px solid rgba(14,165,164,0.2);outline-offset:2px}
.expanded-content{max-height:0;overflow:hidden;transition:max-height .28s ease;padding:0;margin-top:0}
.expanded-content.open{padding:0.75rem 0 0.5rem}

/* Prose defaults for richer body content */
.prose p{margin:0.5rem 0}
.prose a{color:var(--accent);text-decoration:underline}
.prose a:hover{text-decoration:none}
.prose table{width:100%;border-collapse:collapse;margin:0.75rem 0;font-size:0.95rem}
.prose th,.prose td{padding:0.4rem 0.6rem;border:1px solid var(--border);text-align:left}
.prose thead th{background:var(--surface);font-weight:600}
.prose tfoot th{background:var(--surface);font-weight:600}

/* Highlighted external link / callout box */
.callout{background:var(--surface);border:1px solid var(--surface-border);padding:0.6rem 0.75rem;border-radius:8px;margin:0.75rem 0}
.callout a{display:flex;align-items:center;gap:0.5rem;color:var(--text);text-decoration:none}
.callout a:hover{color:var(--accent)}
.callout .muted{margin:0}

/* ── Lightsaber dark mode toggle ──────────────────────────────────── */
.theme-toggle{
  background:none;
  border:none;
  cursor:pointer;
  padding:0;
  display:flex;
  align-items:center;
}
.theme-toggle:focus-visible{outline:2px solid var(--accent);outline-offset:3px;border-radius:20px}

/* pill track — makes it read as an interactive toggle */
.saber-track{
  display:flex;
  align-items:center;
  padding:0 14px;
  height:34px;
  border-radius:20px;
  border:1.5px solid var(--border);
  background:var(--surface);
  box-shadow:inset 0 1px 3px rgba(0,0,0,0.07);
  transition:border-color 0.15s,box-shadow 0.15s,background 0.3s ease;
}
.theme-toggle:hover .saber-track{
  border-color:var(--accent);
  box-shadow:inset 0 1px 3px rgba(0,0,0,0.07),0 0 0 2px rgba(14,165,164,0.12);
}

.lightsaber{display:flex;align-items:center}

.saber-hilt{
  width:17px;
  height:9px;
  background:linear-gradient(180deg,#c8d0da 0%,#8892a4 38%,#9aa4b2 62%,#525c6c 100%);
  border-radius:2px 0 0 2px;
  border:1px solid #40495a;
  position:relative;
  flex-shrink:0;
  z-index:1;
}
/* grip lines */
.saber-hilt::before{
  content:'';
  position:absolute;
  top:2px;bottom:2px;left:3px;
  width:1px;
  background:rgba(0,0,0,0.2);
  box-shadow:3px 0 0 rgba(0,0,0,0.2),6px 0 0 rgba(0,0,0,0.2),9px 0 0 rgba(0,0,0,0.2);
}
/* emitter collar */
.saber-hilt::after{
  content:'';
  position:absolute;
  right:-3px;top:-2px;bottom:-2px;
  width:4px;
  background:linear-gradient(180deg,#7a8494,#353d4a);
  border:1px solid #2a3040;
  border-radius:0 1px 1px 0;
  z-index:2;
}

.saber-blade{
  height:4px;
  width:40px;
  border-radius:0 2px 2px 0;
  margin-left:2px;
  background:linear-gradient(90deg,#60a5fa 0%,#93c5fd 40%,#bae6fd 70%,#e0f2fe 100%);
  box-shadow:
    0 0 3px 1px rgba(96,165,250,0.95),
    0 0 7px 2px rgba(59,130,246,0.6),
    0 0 16px 5px rgba(37,99,235,0.2);
  transition:background 0.4s ease,box-shadow 0.4s ease;
}
[data-theme="dark"] .saber-blade{
  background:linear-gradient(90deg,#f87171 0%,#fca5a5 40%,#fecaca 70%,#fff1f2 100%);
  box-shadow:
    0 0 3px 1px rgba(248,113,113,0.95),
    0 0 7px 2px rgba(239,68,68,0.6),
    0 0 16px 5px rgba(185,28,28,0.2);
}

/* flicker on toggle */
@keyframes saber-flicker{
  0%  {opacity:1}
  10% {opacity:0.2}
  20% {opacity:1}
  35% {opacity:0.5}
  47% {opacity:1}
  60% {opacity:0.65}
  75% {opacity:1}
  87% {opacity:0.4}
  100%{opacity:1}
}
.saber-blade.flicker{
  animation:saber-flicker 0.5s ease-in-out;
}


