/* ===== Theme ===== */
:root{
  --bg:#f7f8fb;
  --panel:#ffffff;
  --text:#1a1f2b;
  --muted:#5b667a;
  --border:#e6e9f2;
  --accent:#2f6fed;
  --accent-2:#10b981;
  --chip:#eef2ff;
  --shadow:0 10px 30px rgba(16,24,40,.08);
}

/* ===== Base ===== */
*{
  box-sizing:border-box;
}

html,
body{
  margin:0;
  padding:0;
  background:var(--bg);
  color:var(--text);
  font:16px/1.6 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  overflow-x:hidden;
}

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

a{
  color:var(--accent);
  text-decoration:none;
}

a:hover{
  text-decoration:underline;
}

/* ===== Layout ===== */
.container{
  width:100%;
  max-width:1100px;
  margin:0 auto;
  padding:28px;
}

/* ===== Top nav ===== */
.nav{
  position:sticky;
  top:0;
  z-index:20;
  background:rgba(255,255,255,.85);
  backdrop-filter:saturate(180%) blur(8px);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:14px 28px;
  border-bottom:1px solid var(--border);
}

.nav .brand{
  font-weight:700;
  letter-spacing:.2px;
  color:var(--text);
  flex-shrink:0;
}

.nav .links{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  justify-content:flex-end;
  gap:12px 18px;
  min-width:0;
}

.nav .links a{
  margin-left:0;
  color:var(--muted);
  white-space:nowrap;
}

.nav .links a.active,
.nav .links a:hover{
  color:var(--accent);
}

/* ===== Hero (Home) ===== */
.hero{
  display:grid;
  grid-template-columns:minmax(0, 120px) minmax(0, 1fr);
  gap:18px;
  align-items:center;
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:18px;
  padding:22px;
  box-shadow:var(--shadow);
  min-width:0;
}

@media (min-width:760px){
  .hero{
    grid-template-columns:minmax(0, 160px) minmax(0, 1fr);
  }
}

.hero > div{
  min-width:0;
}

.hero img{
  width:120px;
  height:120px;
  border-radius:12px;
  object-fit:cover;
  border:1px solid var(--border);
}

@media (min-width:760px){
  .hero img{
    width:160px;
    height:160px;
  }
}

.hero h1{
  margin:0 0 4px 0;
  font-size:34px;
  line-height:1.2;
}

.lead{
  color:var(--muted);
  margin:0 0 8px 0;
}

/* ===== Hero overflow protection ===== */
.hero,
.hero > div,
.hero .kv,
.hero .kv div,
.hero a,
.hero p,
.hero h1{
  min-width:0;
  overflow-wrap:break-word;
  word-wrap:break-word;
}

.hero a{
  word-break:break-word;
}

/* ===== Key-value block ===== */
.kv{
  display:grid;
  grid-template-columns:120px 1fr;
  gap:6px 12px;
  margin-top:8px;
  min-width:0;
}

.kv b{
  color:var(--text);
}

/* ===== Tags / chips ===== */
.taglist,
.tags{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:8px;
  min-width:0;
}

.tag{
  background:var(--chip);
  border:1px solid #dfe3ff;
  color:#3b4ab5;
  padding:4px 10px;
  border-radius:999px;
  font-size:12px;
  line-height:1.4;
}

/* ===== Buttons ===== */
.btnbar{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-top:12px;
  min-width:0;
}

.btn{
  display:inline-block;
  padding:10px 14px;
  border-radius:12px;
  border:1px solid var(--border);
  background:var(--panel);
  color:var(--text);
  box-shadow:var(--shadow);
  transition:.15s transform ease;
}

.btn:hover{
  transform:translateY(-1px);
}

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

.btn.ghost{
  background:#fff;
}

.btn.green{
  background:var(--accent-2);
  border-color:transparent;
  color:#fff;
}

/* ===== Sections / cards ===== */
.section{
  margin-top:18px;
  display:grid;
  gap:18px;
}

.card{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:18px;
  padding:22px;
  box-shadow:var(--shadow);
}

.card h1,
.card h2,
.card h3{
  margin:0 0 8px 0;
  line-height:1.25;
}

.card ul{
  margin:0 0 0 1.2rem;
  padding:0;
}

.card li{
  margin:.35rem 0;
}

/* ===== Simple grids for project cards etc. ===== */
.grid{
  display:grid;
  gap:18px;
}

.grid.cols-2{
  grid-template-columns:1fr;
}

.grid.cols-3{
  grid-template-columns:1fr;
}

@media (min-width:700px){
  .grid.cols-2{
    grid-template-columns:1fr 1fr;
  }
}

@media (min-width:980px){
  .grid.cols-3{
    grid-template-columns:repeat(3, 1fr);
  }
}

/* ===== Project cards ===== */
.project{
  display:flex;
  flex-direction:column;
  gap:10px;
  min-width:0;
}

.project .stack{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  min-width:0;
}

.project .stack .tag{
  background:#f2f4f7;
  border-color:var(--border);
  color:#475467;
}

/* ===== Footer ===== */
.footer{
  margin:28px 0;
  padding:18px;
  text-align:center;
  color:var(--muted);
}

hr{
  border:none;
  border-top:1px solid var(--border);
  margin:6px 0 14px;
}

/* ===== About page ===== */
.about-card{
  margin-bottom:2rem;
}

.about-header{
  display:flex;
  align-items:center;
  gap:1.5rem;
  flex-wrap:wrap;
  min-width:0;
}

.profile-photo{
  width:150px;
  height:150px;
  border-radius:16px;
  object-fit:cover;
  border:1px solid var(--border);
  box-shadow:0 6px 18px rgba(0,0,0,.08);
}

.section.card ul{
  line-height:1.6;
}

.section.card ul li b{
  color:#0f172a;
}

/* ===== Tablet ===== */
@media (max-width:900px){
  .container{
    padding:20px;
  }

  .nav{
    padding:12px 20px;
  }

  .hero{
    padding:20px;
  }

  .card{
    padding:20px;
  }

  .hero h1{
    font-size:30px;
  }

  .profile-photo{
    width:130px;
    height:130px;
  }
}

/* ===== Mobile ===== */
@media (max-width:720px){
  .container{
    padding:16px;
  }

  .nav{
    flex-direction:column;
    align-items:flex-start;
    justify-content:flex-start;
    gap:10px;
    padding:12px 16px;
  }

  .nav .links{
    justify-content:flex-start;
    gap:10px 14px;
    width:100%;
  }

  .hero{
    display:flex;
    flex-direction:column;
    align-items:flex-start;
    text-align:left;
    padding:18px;
    overflow:hidden;
  }

  .hero img{
    width:110px;
    height:110px;
    margin:0 0 14px 0;
  }

  .hero > div{
    width:100%;
    min-width:0;
  }

  .hero h1{
    font-size:26px;
  }

  .lead{
    font-size:15px;
  }

  .kv{
    grid-template-columns:1fr;
    gap:4px;
    text-align:left;
    width:100%;
  }

  .hero .kv div,
  .hero .kv a,
  .hero .kv span{
    max-width:100%;
  }

  .btnbar{
    flex-direction:column;
    align-items:stretch;
  }

  .btn{
    width:100%;
    text-align:center;
  }

  .card{
    padding:18px;
    border-radius:16px;
  }

  .about-header{
    flex-direction:column;
    align-items:center;
    text-align:center;
  }

  .profile-photo{
    width:110px;
    height:110px;
  }

  .taglist,
  .tags,
  .project .stack{
    justify-content:flex-start;
  }
}

/* ===== Small phones ===== */
@media (max-width:480px){
  .container{
    padding:12px;
  }

  .nav{
    padding:10px 12px;
  }

  .hero{
    padding:16px;
    gap:14px;
  }

  .hero h1{
    font-size:22px;
  }

  .hero img{
    width:96px;
    height:96px;
  }

  .lead{
    font-size:14px;
  }

  .card{
    padding:16px;
    border-radius:14px;
  }

  .profile-photo{
    width:96px;
    height:96px;
  }

  .tag{
    font-size:11px;
    padding:4px 8px;
  }

  .footer{
    padding:14px 10px;
  }
}