@font-face {
  font-family: "Selawik";
  src: url("fonts/selawik-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
}

@font-face {
  font-family: "Selawik";
  src: url("fonts/selawik-semibold.woff2") format("woff2");
  font-weight: 500 600;
  font-style: normal;
}

@font-face {
  font-family: "Selawik";
  src: url("fonts/selawik-bold.woff2") format("woff2");
  font-weight: 700 900;
  font-style: normal;
}

:root {
  --accent: #1f5a3f;
  --surface: #ffffff;
  --text: #2b2b2b;
  --text-muted: #555;
  --border: #dde3ea;
}

[data-theme="dark"] {
  --accent: #4caf83;
  --surface: #1d2125;
  --text: #e7e9ea;
  --text-muted: #a3a9ad;
  --border: #30363b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Selawik", "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: var(--surface);
  transition: background-color 0.2s, color 0.2s;
}

.page {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  background: var(--surface);
  padding: 28px clamp(16px, 4vw, 56px) 60px;
  min-height: 100vh;
  transition: background-color 0.2s;
}

/* Header */
.header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 16px;
  margin-bottom: 28px;
  flex-wrap: nowrap;
}

.header-main {
  display: flex;
  align-items: center;
  gap: 20px;
  flex: 1 1 auto;
  min-width: 0;
}

.photo {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.name-block {
  min-width: 0;
}

.name-block h1 {
  margin: 0;
  font-size: 28px;
  color: var(--accent);
  overflow-wrap: break-word;
}

.name-block h2 {
  margin: 4px 0 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  overflow-wrap: break-word;
}

.contact-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.contact {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 12px;
  color: var(--text-muted);
  gap: 4px;
  flex-shrink: 0;
}

.contact span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.contact a,
.project-tech a,
.project-more-content a {
  color: var(--accent);
  text-decoration: none;
}

.contact a:hover,
.project-tech a:hover,
.project-more-content a:hover {
  text-decoration: underline;
}

.contact-icon {
  width: 13px;
  height: 13px;
  color: var(--accent);
  flex-shrink: 0;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--border);
}

.theme-toggle .icon-sun {
  display: none;
}

[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

/* Intro */
.intro {
  margin: 0 0 24px;
}

.intro h3 {
  font-size: 22px;
  letter-spacing: 0.02em;
  color: var(--accent);
  margin: 0;
}

/* Projects */
.projects {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.projects.projects-columns {
  flex-direction: row;
  align-items: flex-start;
}

/* Static markup ships pre-split into two columns; without JS to re-flatten
   it on narrow viewports, at least stack the columns instead of squeezing
   them side by side. */
@media (max-width: 880px) {
  .projects.projects-columns {
    flex-direction: column;
  }
}

.projects-col {
  display: flex;
  flex-direction: column;
  gap: 28px;
  flex: 1 1 0;
  min-width: 0;
}

.projects-loading,
.projects-error {
  color: var(--text-muted);
  font-size: 13px;
}

.project {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.15s;
}

.project:hover {
  border-color: var(--accent);
}

.project-hero {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--border);
}

.project-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.project-summary {
  padding: 16px 20px;
}

.project-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.project-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--accent);
  margin: 0;
}

.project-links {
  display: flex;
  gap: 12px;
  font-size: 12px;
}

.project-links a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 3px 9px;
}

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

.project-description {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  margin: 0;
  min-height: 3em;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.project-more-content .project-tech-section {
  margin: 0 0 14px;
}

.project-tech-heading {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  margin: 14px 0 6px;
}

.project-tech-section > .project-tech-heading {
  margin-top: 0;
}

.project-tech {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-muted);
  margin: 0 0 8px;
}

.project-tech p {
  margin: 0 0 6px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.tag {
  font-size: 10.5px;
  background: var(--border);
  color: var(--text-muted);
  border-radius: 3px;
  padding: 3px 8px;
}

.gallery-collage {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  width: 100%;
  margin: 0 0 14px;
}

.gallery-tile {
  position: relative;
  display: block;
  flex: 1 1 0;
  min-width: 0;
  height: 140px;
  border: none;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  border-radius: 6px;
}

.gallery-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: transform 0.15s;
}

.gallery-tile:hover img {
  transform: scale(1.04);
  filter: brightness(0.94);
}

.gallery-tile .gallery-more {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  border-radius: 6px;
}

@media (max-width: 480px) {
  .gallery-tile {
    height: 90px;
  }
}

/* Collapsible "more" section */
.project-more {
  border-top: 1px solid var(--border);
}

.project-more summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
}

.project-more summary::-webkit-details-marker {
  display: none;
}

.project-more summary::before {
  content: "▸";
}

.project-more[open] summary::before {
  content: "▾";
}

.project-more-content {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-muted);
  padding: 4px 20px 18px;
}

.project-more-content p {
  margin: 0 0 8px;
}

.project-more-content ul {
  margin: 0 0 8px;
  padding-left: 18px;
}

.project-more-content li {
  margin: 0 0 4px;
}

.project-more-content li::marker {
  color: var(--accent);
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.lightbox.open {
  display: flex;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: 4px;
  cursor: pointer;
}

.lightbox-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 13px;
  background: rgba(0, 0, 0, 0.5);
  padding: 4px 12px;
  border-radius: 12px;
  z-index: 1;
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  font-size: 28px;
  line-height: 1;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  z-index: 1;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  font-size: 32px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 1;
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.2);
}

.lightbox-prev {
  left: 12px;
}

.lightbox-next {
  right: 12px;
}

footer {
  margin-top: 40px;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
}

@media (max-width: 700px) {
  .header {
    flex-direction: column;
    align-items: stretch;
  }
  .header-main {
    gap: 14px;
    padding-right: 48px;
  }
  .name-block h1 {
    font-size: 22px;
  }
  .contact-row {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .contact {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px 14px;
  }
  .theme-toggle {
    position: absolute;
    top: 48px;
    right: 0;
    transform: translateY(-50%);
  }
  .lightbox-nav {
    width: 40px;
    height: 40px;
    font-size: 26px;
  }
}
