/* ====== CSS Reset (trim) ====== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
img { max-width: 100%; display: block; }

/* ====== Theme tokens ====== */
:root{
  --bg: #f6f7fb;
  --text: #101214;
  --muted: #5f6b7a;
  --card: #ffffff;
  --border: #e6e8eb;
  --accent: #0b74ff;
  --accent-weak: #d7e7ff;

  --radius: 14px;
  --shadow: 0 10px 28px rgba(16,24,40,.08);
}

body.dark{
  --bg: #0e1117;
  --text: #e6e9ef;
  --muted: #a6b0c0;
  --card: #161a22;
  --border: #242a35;
  --accent: #66b2ff;
  --accent-weak: #1b2a44;
  --shadow: 0 12px 34px rgba(0,0,0,.45);
}

body.dark .contact-section {
  background: var(--card);
  border: 1px solid var(--border);
}

/* ====== Base ====== */
body{
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Inter, "DM Sans", Arial, sans-serif;
  background:
    radial-gradient(1200px 700px at 10% -10%, rgba(20,99,255,.05), transparent 60%),
    radial-gradient(1000px 600px at 110% 0%, rgba(102,178,255,.04), transparent 55%),
    var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* ====== Skip Link ====== */
.skip-link{
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: #fff; padding: .5rem .75rem; border-radius: 8px;
}
.skip-link:focus{ left: 12px; top: 12px; z-index: 9999; }

.section{ padding: 52px 20px; }
h1,h2,h3{ line-height: 1.2; margin: 0 0 12px; }
p{ margin: 0 0 16px; color: var(--text); }
a{ color: var(--accent); text-decoration: none; }
a:hover{ text-decoration: underline; }

.btn{
  display:inline-block; border:1px solid var(--border); background: var(--card);
  color: var(--text); padding: .55rem .9rem; border-radius: 8px; font-weight: 600;
  transition: transform .15s ease, background .2s;
}
.btn:hover{ transform: translateY(-1px); background: var(--accent-weak); text-decoration: none; }
.btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.btn--primary{ background: var(--accent); color:#fff; border-color: transparent; box-shadow: 0 1px 0 rgba(0,0,0,.04) inset; }
.btn--primary:hover{ filter: brightness(.96); }

/* ====== Header / Nav ====== */
.site-header{
  position: sticky; top: 0; z-index: 10;
  display:flex; align-items:center; justify-content:space-between;
  gap: 12px; padding: 12px 16px; background: var(--bg); border-bottom:1px solid var(--border);
  flex-wrap: wrap; overflow-x: clip;
}

.brand{ display:flex; align-items:center; gap:8px; font-weight:800; color:var(--text); flex: 0 0 auto; }
.brand__dot{ width:10px; height:10px; border-radius:50%; background: var(--accent); display:inline-block; }

.site-nav .nav-link:focus-visible{
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  text-decoration: none;
  border-radius: 8px;
}
.site-nav{ margin-left: auto; }
.site-nav ul{ display:flex; flex-wrap: wrap; gap:8px; justify-content: flex-end; align-items:center; list-style:none; padding:0; margin:0; }
.site-nav .nav-link{
  padding: 5px 10px; border-radius: 999px;
  background: transparent;
}
.site-nav .nav-link.active{ background: var(--accent-weak); text-decoration:none; }
#theme-toggle{ white-space: nowrap; padding: 6px 10px; border-radius: 999px; flex: 0 0 auto; }

/* ====== Hero ====== */
.hero{
  display:grid; gap: 24px; padding: 64px 20px 44px; align-items:center;
  grid-template-columns: minmax(0,1fr);
}
.hero__content{ max-width: 840px; margin: 0 auto; text-align:center; }
.hero__content .tagline{ color: var(--muted); }
.hero__art{ max-width: 920px; margin: 0 auto; opacity:.95; }

.cta-row{ display:flex; gap:12px; justify-content:center; margin-top: 12px; flex-wrap: wrap; }

/* ====== Projects ====== */
.projects-grid{
  display:grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.card{
  background: var(--card);
  border:1px solid var(--border);
  border-radius: var(--radius);
  overflow: clip; display:flex; flex-direction: column;
  transition: transform .18s ease, box-shadow .2s ease, background .2s;
}
.card:hover{
  transform: translateY(-3px);
  box-shadow: 0 14px 34px rgba(16,24,40,.10);
}
.card.project {
  display: grid;
  grid-template-rows: auto 1fr auto;
}

#projects h2{ margin-bottom: 18px; }

.project__thumb { position: relative; aspect-ratio: 16 / 9; overflow: hidden; }
.project__thumb img{ width: 100%; height: 100%; object-fit: cover; display: block; }
.project__body{ padding: 18px 18px 16px; }
.project__body p { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pill-list{ display:flex; gap:8px; flex-wrap: wrap; padding: 0; margin: 8px 0 12px; list-style: none; }
.pill-list li{ padding: 4px 10px; background: var(--bg); border:1px solid var(--border); border-radius: 999px; font-size: .85rem; color: var(--muted); }
.project__links{ display:flex; gap:8px; flex-wrap: wrap; align-items: center; }
.project__links .btn { white-space: nowrap; height: 32px; display: inline-flex; align-items: center; }

/* ====== Archived ====== */
.badge {
  position: absolute; top: .5rem; left: .5rem;
  padding: .25rem .5rem;
  border-radius: .4rem;
  font-size: .75rem; font-weight: 700;
  background: #999; color: white;
}
.badge--archived { background: #6b7280; } /* neutral gray */

.project--archived { opacity: .9; }
.project--archived .muted { color: #6b7280; font-weight: 500; }
.btn--muted {
  background: #e5e7eb; color: #374151; cursor: not-allowed;
  pointer-events: none; /* prevent clicks */
}

/* ====== About ====== */
.about{ max-width: 840px; }
#about .pill-list li{ background: var(--card); }

/* ====== Contact & Footer ====== */
.contact-section {
  padding: 52px 20px;          /* match .section spacing */
  max-width: 800px;            /* keep the text column comfortable */
  margin: 0 auto;              /* center the section */
  background: #f8f9fa;         /* optional subtle panel */
  border-radius: var(--radius);
}

.contact-section h2 {
  margin-bottom: 1rem;
}

.contact-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.contact-section li {
  margin: 0.5rem 0;
  font-size: 1.05rem;
}

#contact a { font-weight: 600; }
.site-footer{
  padding: 24px 20px; border-top:1px solid var(--border); text-align:center; color: var(--muted);
}

/* ====== Utilities ====== */
.container{ max-width: 1120px; margin: 0 auto; }
h2{ font-size: clamp(1.4rem, 1.1rem + 1vw, 1.9rem); margin-bottom: 16px; }
.hero h1{
  font-size: clamp(1.9rem, 1.4rem + 2.2vw, 3rem);
  line-height: 1.1;
  margin-bottom: .4rem;
  letter-spacing: -0.01em;
}
.hero p{ color: var(--muted); max-width: 60ch; color: var(--muted); }

/* ====== Reduce Motion ====== */
@media (prefers-reduced-motion: reduce){
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ====== Small screens ====== */
@media (min-width: 860px){
  .hero{ grid-template-columns: 1.1fr .9fr; padding: 88px 24px; }
  .hero__content{ text-align: left; margin: 0; }
  .cta-row{ justify-content: flex-start; }
}

/* ====== Small screens: comfy spacing ====== */
@media (max-width: 640px) {
  .hero{ padding: 56px 16px 40px; }
  .section{ padding: 40px 16px; }
  .site-header{ padding: 12px 14px; }
  .site-nav ul{ gap: 8px; }
}

/* === Mobile spacing polish === */

/* Tablet-ish: make projects 2-up, tighten gutters */
@media (max-width: 900px){
  .section{ padding: 44px 18px; }
  .projects-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }
  .project__body{ padding: 16px; }
  .pill-list{ gap: 6px; margin: 6px 0 10px; }
}

/* Phones: single column + compact paddings */
@media (max-width: 560px){
  .site-header{ padding: 10px 12px; }
  .site-nav ul{ gap: 6px; }
  #theme-toggle{ padding: 5px 10px; }

  .hero{ padding: 44px 14px 28px; }
  .hero h1{ font-size: clamp(1.6rem, 7vw, 2.1rem); margin-bottom: .4rem; }
  .hero p{ font-size: .95rem; margin-bottom: 14px; }

  .section{ padding: 28px 14px; }

  .projects-grid{
    grid-template-columns: 1fr;   /* single column */
    gap: 16px;
  }
  .project__thumb img{
    aspect-ratio: 16/10;          /* less tall thumbs on mobile */
    object-fit: cover;
  }
  .project__body{ padding: 14px; }
  .project__links{ gap: 8px; }
  .btn{ padding: .5rem .8rem; }

  /* Contact panel: centered with comfy gutters */
  .contact-section{
    padding: 28px 16px;
    margin-inline: 8px;            /* pull away from the edge */
    text-align: center;
  }
  .contact-section li{ margin: .4rem 0; }
}

/* Make links a touch lighter on small screens */
@media (max-width: 430px) {
  .site-nav .nav-link{ padding:4px 8px; font-size: .95rem; }
  /* shorten GitHub label to avoid wrapping issues */
  .site-nav a[href*="github.com"]{ white-space: nowrap; }
}
