/* ── Reset ── */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Design tokens ── */

:root {
  --bg:              #F7F4EE;
  --ink:             #111111;
  --accent:          #C8391D;
  --muted:           #8A8680;
  --rule:            #D8D4CC;
  --card-bg:         #FFFFFF;
  --screenshot-bg:   #ECEAE4;
  --screenshot-line: #D0CDC6;
}

/* ── Base ── */

html {
  font-size: 16px;
}

body {
  background-color: var(--bg);
  color: var(--ink);
  font-family: 'Fraunces', serif;
  font-weight: 400;
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 40px;
}

/* ── Site header ── */

.site-header {
  padding: 80px 0 0;
}

.header-name {
  font-family: 'Instrument Serif', serif;
  font-size: clamp(72px, 10vw, 140px);
  font-weight: 400;
  line-height: 0.92;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 24px;
}

.header-rule {
  border: none;
  border-top: 1.5px solid var(--ink);
  margin-bottom: 40px;
}

.header-meta {
  display: flex;
  gap: 80px;
  padding-bottom: 80px;
}

.meta-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

.about-block p {
  font-size: 17px;
  line-height: 1.5;
  margin-bottom: 20px;
}

.about-block p:last-child {
  margin-bottom: 0;
}

.header-details {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-left: auto;
  flex-shrink: 0;
}

.detail-item {
  text-align: right;
}

.detail-label {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-bottom: 3px;
}

.detail-value {
  font-family: 'DM Mono', monospace;
  font-size: 14px;
}

.github-links {
  align-items: flex-end;
}


/* ── Projects section ── */

.projects-section {
  border-top: 1.5px solid var(--ink);
  padding-top: 40px;
  padding-bottom: 120px;
}

.section-header {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 48px;
}

.section-title {
  font-family: 'Instrument Serif', serif;
  font-size: clamp(36px, 5vw, 64px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.01em;
}

.section-description {
  font-family: 'Fraunces', serif;
  font-size: 16px;
  color: var(--muted);
  margin-bottom: 48px;
  margin-top: -32px;
}

.projects-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Project card ── */

.project-card {
  background: var(--card-bg);
  border: 1px solid var(--rule);
  padding: 28px;
  overflow: hidden;
  position: relative;
  transition: background 0.15s ease;
}

.project-card.app {
  background: #FAF2E4;
}

.project-card.lib {
  background: #F2F3F1;
}

.project-card.app::before,
.project-card.lib::before {
  position: absolute;
  top: 28px;
  right: 28px;
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.project-card.app::before {
  content: 'app';
  color: #8B6020;
}

.project-card.lib::before {
  content: 'lib';
  color: #5A6070;
}

.card-title         { margin-bottom: 16px; }
.project-card p     { margin-bottom: 16px; }
.project-card p:last-child { margin-bottom: 0; }

.card-title {
  font-family: 'Instrument Serif', serif;
  font-size: 26px;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  clear: both;
}

.card-logo {
  height: 32px;
  width: auto;
  flex-shrink: 0;
  margin-right: 10px;
}

a.card-title,
.card-title a {
  border-bottom: none;
}

a.card-title::after {
  align-self: flex-start;
}

/* ── Screenshot placeholders ── */

.card-screenshots {
  float: left;
  width: 320px;
  margin-right: 32px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

@media (max-width: 480px) {
  .card-screenshots {
    float: none;
    width: 100%;
    margin-right: 0;
  }
}

.card-screenshots img {
  display: block;
  width: 100%;
  background-color: var(--screenshot-bg);
  background-image:
    linear-gradient(var(--screenshot-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--screenshot-line) 1px, transparent 1px);
  background-size: 16px 16px;
  position: relative;
  overflow: hidden;
}

.card-screenshots img::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 45%, rgba(200, 57, 29, 0.04) 100%);
}

/* ── Links ── */

a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  transition: border-color 0.15s ease, color 0.15s ease;
}

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

/* ── External link icon ── */

a[href^="http"]::after {
  content: '↗';
  font-family: 'DM Mono', monospace;
  font-size: 0.65em;
  margin-left: 0.2em;
  vertical-align: super;
  opacity: 0.5;
}

/* ── Inline code ── */

code {
  font-family: 'DM Mono', monospace;
  font-size: 0.85em;
  background: var(--screenshot-bg);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

/* ── Card description ── */

.project-card p {
  font-size: 15px;
  line-height: 1.75;
  color: var(--muted);
}

/* ── Carousel ── */

.carousel-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 6px 0 0;
}

.carousel-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: 'DM Mono', monospace;
  font-size: 20px;
  color: var(--muted);
  line-height: 1;
  transition: color 0.15s ease;
}

.carousel-btn:hover {
  color: var(--accent);
}

.carousel-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.carousel-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--screenshot-line);
  border: none;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.carousel-dot.active {
  background: var(--muted);
}

/* ── Screenshot modal ── */

.card-screenshots img {
  cursor: zoom-in;
  height: auto;
}

#modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  justify-content: center;
  align-items: center;
  z-index: 100;
  cursor: zoom-out;
}

#modal-img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
}

/* ── Experiments section ── */

.experiments-section .projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.experiments-section .project-card {
  padding: 20px;
}

.experiments-section .card-title {
  font-size: 20px;
  margin-bottom: 10px;
}

.experiments-section .project-card p {
  font-size: 13px;
}

/* ── Footer ── */

.site-footer {
  border-top: 1px solid var(--rule);
  padding: 24px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-text {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
}

/* ── Responsive ── */

@media (max-width: 900px) {
  .header-meta {
    flex-direction: column;
    gap: 32px;
  }

  .header-details {
    margin-left: 0;
  }

  .detail-item {
    text-align: left;
  }

  .github-links {
    align-items: flex-start;
  }
}

@media (max-width: 600px) {
  .container {
    padding: 0 24px;
  }

  .experiments-section .projects-grid {
    grid-template-columns: 1fr;
  }
}
