:root {
  --bg: #333;
  --sidebar: #6cb2e2;
  --sidebar-active: #3792cb;
  --card: #fff;
  --border: #000;
  --text: #000;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background-color: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
}

a { outline: 0; }
p { line-height: 1.5; font-size: 15px; }

.card {
  display: flex;
  width: 65%;
  max-width: 1170px;
  margin: 20px auto 0;
  flex: 1 1 auto;
  min-height: 0;
  border-radius: 10px;
  box-shadow: 0 0 5px #000;
  overflow: hidden;
  background-color: var(--card);
}

.sidebar {
  width: 30%;
  background-color: var(--sidebar);
  border-right: 3px solid var(--border);
  padding: 15px 0;
  text-align: center;
  overflow: auto;
}

.photo {
  width: 45%;
  border-radius: 50%;
  border: 5px solid var(--border);
  padding: 3px;
  background-color: #fff;
  display: block;
  margin: 0 auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.profile h1 {
  margin: 14px 0 5px;
  font-size: 1.5em;
}
.profile p {
  margin: 0;
  color: #fff;
  font-weight: bold;
  font-size: 14px;
  line-height: 1.25;
}

.social {
  display: flex;
  justify-content: space-around;
  align-items: center;
  margin: 16px auto 0;
  width: 70%;
}
.social a {
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  padding: 2px;
  transition: background-color 400ms;
}
.social a:hover { background-color: #fff; }

.nav {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 60%;
  margin: 1em auto 0;
}
.nav-btn {
  padding: 0.8em 0.5em;
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: 0 0 3px #000;
  background-color: #fff;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform .15s;
}
.nav-btn:hover { transform: scale(1.03); }
.nav-btn.active {
  background-color: var(--sidebar-active);
  font-weight: bold;
}

.content {
  flex: 1;
  background-color: var(--card);
  padding: 15px 2em 15px 1.5em;
  overflow-y: auto;
}
.page.hidden { display: none; }

footer {
  flex-shrink: 0;
  text-align: center;
  color: #fff;
  font-size: 14px;
  padding: 12px 10px;
}
footer a { color: #fff; }

#projects > h3 {
  font-size: 1.4em;
}

/* Project cards */
.project {
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  margin-bottom: 20px;
}
.project .project-title {
  margin: 0 0 6px;
}
.project-bottom {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.project-bottom-left { flex: 1; min-width: 0; }
.project-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.project-btn {
  padding: 8px;
  border-radius: 5px;
  border: 1px solid var(--border);
  font-weight: bold;
  font-size: 15px;
  color: var(--text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.project-btn.live { background-color: lightgreen; }
.project-btn.source { background-color: lightblue; }
.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.project-tag {
  background-color: lightgrey;
  padding: 5px 8px;
  border-radius: 5px;
  border: 1px solid var(--border);
  font-size: 13px;
}
.project-preview {
  max-width: 40%;
  border-radius: 10px;
  height: auto;
}

/* Wide screens */
@media only screen and (min-width: 1800px) {
  .card { width: 1170px; }
}

/* Tablet */
@media only screen and (max-width: 1200px) {
  .card {
    width: 80%;
    flex-direction: column;
  }
  .sidebar {
    display: grid;
    grid-template-columns: auto auto 1fr;
    grid-template-rows: auto auto;
    grid-template-areas:
      "photo profile social"
      "photo profile nav";
    column-gap: 16px;
    row-gap: 8px;
    align-items: center;
    text-align: left;
    padding: 14px 18px;
    width: 100%;
    border-right: none;
    border-bottom: 3px solid var(--border);
    flex-shrink: 0;
  }
  .photo {
    grid-area: photo;
    width: 80px;
    margin: 0;
  }
  .profile { grid-area: profile; }
  .profile h1 { font-size: 1.3em; margin: 0 0 4px; }
  .profile p { font-size: 13px; }
  .social {
    grid-area: social;
    margin: 0;
    width: auto;
    justify-content: flex-end;
    gap: 8px;
  }
  .nav {
    grid-area: nav;
    flex-direction: row;
    flex-wrap: wrap;
    margin: 0;
    width: auto;
    justify-content: flex-end;
    gap: 8px;
  }
  .nav-btn {
    flex: 0 1 auto;
    padding: 0.5em 0.9em;
    max-width: none;
    font-size: 13px;
  }
  .content { width: 100%; padding: 15px 26px; overflow-y: auto; }
}

/* Mobile */
@media only screen and (max-width: 800px) {
  .card { width: 95%; }
  .sidebar { column-gap: 12px; padding: 12px; }
  .photo { width: 64px; }
  .nav-btn { padding: 0.45em 0.75em; font-size: 12px; }
  .project-preview { display: none; }
}

/* Narrow — keep social on the right of photo/profile, drop nav to its own full-width row */
@media only screen and (max-width: 600px) {
  .sidebar {
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto auto;
    grid-template-areas:
      "photo profile social"
      "nav   nav     nav";
    column-gap: 12px;
    row-gap: 10px;
  }
  .social { justify-content: flex-end; }
  .nav {
    justify-content: stretch;
    flex-wrap: nowrap;
    gap: 6px;
  }
  .nav-btn {
    flex: 1 1 0;
    min-width: 0;
    padding: 0.45em 0.5em;
  }
}

/* Tiny — fall back to fully stacked if it really won't fit */
@media only screen and (max-width: 360px) {
  .sidebar {
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto auto;
    grid-template-areas:
      "photo profile"
      "social social"
      "nav   nav";
  }
  .social { justify-content: flex-start; gap: 12px; }
  .card { width: 98%; }
  p { font-size: 14px; }
}
