/* ===== Variables ===== */
:root {
  --bg: #0a0a0a;
  --bg-elevated: #141414;
  --surface: #1a1a1a;
  --text: #e5e5e5;
  --text-muted: #a3a3a3;
  --accent: #22c55e;
  --accent-hover: #16a34a;
  --border: #262626;
  --radius: 8px;
  --radius-lg: 12px;
  --font-sans: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --header-h: 64px;
  --container: min(100% - 2rem, 720px);
  --container-wide: min(100% - 2rem, 960px);
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== Layout ===== */
.container { width: var(--container); max-width: 100%; margin-inline: auto; padding-inline: 1rem; }
.projects .container { width: var(--container-wide); }

/* ===== Header ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
}
.logo {
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.05em;
  color: var(--text);
  text-decoration: none;
}
.logo:hover { color: var(--accent); }

.nav-menu {
  display: flex;
  gap: 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-menu a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9375rem;
  transition: color 0.2s;
}
.nav-menu a:hover { color: var(--accent); }

.lang-switcher {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.lang-btn {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.25rem 0.5rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
}
.lang-btn:hover { color: var(--text); }
.lang-btn[aria-pressed="true"] {
  color: var(--accent);
  background: rgba(34, 197, 94, 0.12);
}
.lang-sep {
  color: var(--border);
  font-size: 0.875rem;
  user-select: none;
}

/* Mobile menu button */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  border-radius: var(--radius);
}
.nav-toggle span {
  display: block;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 768px) {
  .nav-toggle { display: flex; }
  .nav-menu {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    padding: 1rem;
    gap: 0;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    transform: translateY(-100%);
    visibility: hidden;
    opacity: 0;
    transition: transform 0.25s, visibility 0.25s, opacity 0.25s;
  }
  .nav-menu.is-open {
    transform: translateY(0);
    visibility: visible;
    opacity: 1;
  }
  .nav-menu li { border-bottom: 1px solid var(--border); }
  .nav-menu li:last-child { border-bottom: none; }
  .nav-menu a {
    display: block;
    padding: 0.875rem 0;
  }
  .nav-lang {
    padding: 0.875rem 0;
    border-top: 1px solid var(--border);
    margin-top: 0.5rem;
  }
}
.about-quote {
  margin: 1.5rem 0 0;
  padding: 0 0 0 1rem;
  border-left: 3px solid var(--accent);
  color: var(--text-muted);
  font-style: italic;
  font-size: 1rem;
}

/* ===== Hero ===== */
.hero {
  min-height: calc(100vh - var(--header-h));
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 3rem 0 4rem;
  position: relative;
}
.hero-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  max-width: 42rem;
}
@media (min-width: 640px) {
  .hero-inner {
    flex-direction: row;
    text-align: left;
    align-items: center;
    gap: 2.5rem;
  }
  .hero-content { align-items: flex-start; }
}
.hero-photo {
  flex-shrink: 0;
}
.hero-photo img {
  width: 260px;
  height: 260px;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid var(--border);
}
@media (min-width: 640px) {
  .hero-photo img {
    width: 340px;
    height: 340px;
  }
}
.hero-content {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.hero-label {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
  letter-spacing: 0.05em;
}
.hero-title {
  font-size: clamp(2.75rem, 8vw, 4rem);
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 1rem;
  letter-spacing: -0.02em;
}
.hero-subtitle {
  color: var(--text-muted);
  font-size: 1.25rem;
  margin: 0 0 1.75rem;
  max-width: 36ch;
  margin-inline: auto;
  line-height: 1.5;
}
@media (min-width: 640px) {
  .hero-subtitle { margin-inline: 0; }
}
.btn {
  display: inline-block;
  padding: 0.875rem 1.75rem;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 1.0625rem;
  text-decoration: none;
  border-radius: var(--radius);
  transition: background 0.2s, color 0.2s;
  cursor: pointer;
  border: none;
}
.btn-primary {
  background: var(--accent);
  color: #0a0a0a;
}
.btn-primary:hover { background: var(--accent-hover); }

.hero-scroll {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
}
.hero-scroll span {
  display: block;
  width: 24px;
  height: 40px;
  border: 2px solid var(--text-muted);
  border-radius: 12px;
  position: relative;
}
.hero-scroll span::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 8px;
  background: var(--accent);
  border-radius: 2px;
  animation: scroll-dot 2s ease-in-out infinite;
}
@keyframes scroll-dot {
  0%, 100% { opacity: 0.3; transform: translateX(-50%) translateY(0); }
  50% { opacity: 1; transform: translateX(-50%) translateY(8px); }
}

@media (max-width: 480px) {
  .hero { padding: 2rem 0 3rem; }
  .hero-subtitle { font-size: 1rem; }
}

/* ===== Sections ===== */
.section {
  padding: 4rem 0;
}
.section-title {
  font-size: clamp(1.5rem, 4vw, 1.75rem);
  font-weight: 700;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
  text-align: center;
}
.section-desc {
  color: var(--text-muted);
  margin: 0 0 2rem;
  font-size: 1rem;
  text-align: center;
}
.projects-subtitle {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 2.5rem 0 0.5rem;
  letter-spacing: -0.02em;
  text-align: center;
}
.projects-subtitle:first-of-type { margin-top: 0; }
.projects-subtitle-web { margin-top: 3rem; }

/* ===== App Store cards ===== */
.app-grid {
  display: grid;
  gap: 1.25rem;
  margin-bottom: 0.5rem;
  align-items: stretch;
}
@media (min-width: 500px) {
  .app-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
}
.app-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
  display: flex;
}
.app-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.app-card-link {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  padding: 1.25rem;
  text-decoration: none;
  color: inherit;
  width: 100%;
  height: 100%;
  min-height: 100%;
}
.app-icon {
  width: 80px;
  height: 80px;
  min-width: 80px;
  flex-shrink: 0;
  border-radius: 18px;
  object-fit: cover;
  background: var(--bg-elevated);
}
@media (min-width: 500px) {
  .app-icon { width: 100px; height: 100px; min-width: 100px; border-radius: 22px; }
}
.app-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.app-title {
  font-size: 1.0625rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.3;
  color: var(--text);
  flex-shrink: 0;
}
.app-excerpt {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin: 0;
  line-height: 1.45;
  flex: 1;
  min-height: 0;
}
.app-store-cta {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent);
  margin-top: 0.5rem;
  flex-shrink: 0;
}

/* ===== About ===== */
.about { background: var(--bg-elevated); text-align: center; }
.about-content { max-width: 56ch; margin-inline: auto; text-align: left; }
.about-text {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: 1.0625rem;
}
.about-text:last-child { margin-bottom: 0; }

/* ===== Projects (blog cards) ===== */
.project-grid {
  display: grid;
  gap: 1.25rem;
}
@media (min-width: 600px) {
  .project-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
  .project-grid { grid-template-columns: repeat(3, 1fr); }
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
}
.project-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.project-card-inner {
  padding: 1.5rem;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.project-card-with-image .project-card-inner {
  padding-top: 0;
}
.project-card-image {
  margin: -1.5rem -1.5rem 1rem -1.5rem;
  line-height: 0;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow: hidden;
  background: var(--bg-elevated);
}
.project-card-image img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
}
.project-link-disabled {
  cursor: default;
  color: var(--text-muted);
  font-size: 0.9375rem;
  font-weight: 600;
}
.project-link-disabled:hover {
  color: var(--text-muted);
}
.project-date {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}
.project-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  line-height: 1.3;
}
.project-excerpt {
  color: var(--text-muted);
  font-size: 0.9375rem;
  margin: 0 0 1rem;
  flex-grow: 1;
  line-height: 1.5;
}
.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.project-tags span {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  background: var(--bg-elevated);
  color: var(--text-muted);
  border-radius: 4px;
}
.project-link {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}
.project-link:hover { color: var(--accent-hover); }

/* ===== Contact ===== */
.contact { background: var(--bg-elevated); }
.contact-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}
.contact-link {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  padding: 0.5rem 0;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.contact-link:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ===== Footer ===== */
.footer {
  margin-top: auto;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  text-align: center;
}
.footer .container {
  text-align: center;
}
.footer p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-scroll span::before { animation: none; }
  .project-card:hover { transform: none; }
}
