/* ==========================================================================
 *  Portfolio — Clean Minimal Monochrome Design
 * ========================================================================== */

:root {
  --bg: #FFFFFF;
  --bg-soft: #F5F5F5;
  --card: #FFFFFF;
  --line: #E5E5E5;
  --line-strong: #CCCCCC;
  --text: #111111;
  --text-soft: #555555;
  --text-faint: #888888;
  --badge: #111111;
  --badge-text: #FFFFFF;
  --white: #FFFFFF;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-badge: 4px;
  --maxw: 1120px;

  --serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { max-width: 100%; display: block; }

/* ===== Top bar ===== */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 60;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 1.25rem clamp(1.5rem, 5vw, 3rem);
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}
.topbar.scrolled { border-bottom-color: var(--line); }

.top-actions { display: flex; align-items: center; gap: 1.25rem; }

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  padding: 4px;
  border: none;
  background: none;
  color: var(--text);
  transition: opacity 0.2s ease;
}
.icon-btn:hover { opacity: 0.55; }
.icon-btn svg { display: block; }

.top-cv {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--white);
  background: var(--text);
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  transition: opacity 0.2s ease;
}
.top-cv:hover { opacity: 0.85; }
.top-cv svg { display: block; flex-shrink: 0; }

/* ===== Slides ===== */
.slide {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 100px clamp(24px, 6vw, 64px) 70px;
}
.slide-inner {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
}
.slide-inner.center {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.section-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 40px;
}
#about .section-title::after,
#education .section-title::after,
#projects .section-title::after {
  content: "";
  display: block;
  width: 64px;
  height: 3px;
  margin-top: 14px;
  background: var(--text);
}

#projects .section-title {
  font-size: clamp(2rem, 5vw, 3rem);
}

/* ===== Cover / Hero ===== */
#cover {
  position: relative;
  background: var(--bg);
}
.hero-inner { max-width: 780px; }

.hero-eyebrow {
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 16px;
}
.hero-name {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(3rem, 9vw, 5.5rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--text);
}
.hero-title {
  font-size: clamp(1.05rem, 2.4vw, 1.25rem);
  color: var(--text-soft);
  margin-top: 14px;
  font-weight: 400;
}
.hero-tagline {
  margin-top: 16px;
  max-width: 54ch;
  color: var(--text-soft);
  font-size: 1rem;
}
.hero-ctas {
  display: flex;
  gap: 14px;
  margin-top: 36px;
  flex-wrap: wrap;
}
.hero-scroll {
  position: absolute;
  bottom: 40px;
  left: clamp(24px, 6vw, 64px);
  color: var(--text-faint);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 6px;
}
.hero-scroll span { animation: bob 2.2s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(4px); } }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 28px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--white);
  background: var(--text);
  border: 1.5px solid var(--text);
  transition: opacity 0.2s ease, background 0.2s ease, color 0.2s ease;
}
.btn:hover { opacity: 0.88; }
.btn.ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--text);
}
.btn.ghost:hover { background: var(--text); color: var(--white); opacity: 1; }
.btn.big {
  padding: 16px 32px;
  font-size: 1rem;
  margin-top: 32px;
}
.btn.big svg { flex-shrink: 0; }

/* ===== Link arrow (project → GitHub) ===== */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text);
  border-bottom: 1.5px solid var(--text);
  padding-bottom: 2px;
  margin-top: auto;
  transition: opacity 0.2s ease;
}
.link-arrow:hover { opacity: 0.6; }
.link-arrow.disabled {
  color: var(--text-faint);
  border-bottom-color: var(--line);
  cursor: default;
  pointer-events: none;
}

/* ===== About ===== */
#about { background: var(--bg); }

.about-grid {
  display: grid;
  grid-template-columns: 1.35fr 0.9fr;
  gap: 56px;
  align-items: start;
}
.about-text p { max-width: 60ch; color: var(--text-soft); line-height: 1.75; }
.about-sub {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-top: 34px;
  margin-bottom: 16px;
}
.about-list li {
  position: relative;
  padding-left: 18px;
  margin-bottom: 10px;
  color: var(--text-soft);
}
.about-list li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--text-faint);
}
.about-photo {
  width: 100%;
  max-width: 340px;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  justify-self: end;
  transform: translateY(-58px);
}
.about-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ===== Education ===== */
#education { background: var(--bg); }

.timeline { position: relative; max-width: 720px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: var(--line-strong);
}
.tl-item { position: relative; padding: 0 0 34px 44px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot {
  position: absolute;
  left: 0;
  top: 6px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--text);
  border: 3px solid var(--bg);
}
.tl-degree { font-family: var(--serif); font-size: 1.3rem; font-weight: 600; }
.tl-school { color: var(--text-soft); font-weight: 500; margin-top: 2px; }
.tl-years {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--badge-text);
  background: var(--badge);
  border-radius: var(--radius-badge);
  padding: 3px 10px;
}
.tl-detail { color: var(--text-soft); margin-top: 10px; max-width: 58ch; }

/* ===== Projects grid ===== */
#projects { background: var(--bg); align-items: flex-start; padding-top: 120px; }

.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  column-gap: 28px;
  row-gap: 0;
}

.project-card {
  display: grid;
  grid-template-rows: subgrid;
  grid-row: span 5;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
  margin-bottom: 28px;
}
.project-card-title {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  padding-bottom: 14px;
  line-height: 1.25;
}
.project-card-desc {
  color: var(--text-soft);
  font-size: 0.95rem;
  line-height: 1.7;
  margin: 0;
  padding-bottom: 24px;
}
.project-card-footer {
  display: contents;
}
.project-card-footer .about-sub {
  margin: 0;
  padding-bottom: 12px;
}
.tech-row { margin: 0 !important; padding: 0 0 0 0; border-top: none; }
.tech-row .chip {
  display: inline-block;
  background: var(--badge);
  color: var(--badge-text);
  border-radius: var(--radius-badge);
  padding: 5px 12px;
  margin: 0 6px 6px 0;
  font-size: 0.8rem;
  font-weight: 500;
}
.project-card-footer .link-arrow { margin: 0; padding-top: 24px; }

/* Fallback when subgrid is unavailable */
@supports not (grid-template-rows: subgrid) {
  .project-card {
    grid-row: auto;
    grid-template-rows: none;
    display: flex;
    flex-direction: column;
  }
  .project-card-footer {
    display: block;
    margin-top: auto;
    padding-top: 0;
  }
}

/* ===== Contact ===== */
#contact {
  background: var(--bg);
  min-height: 80vh;
}
#contact .section-title {
  font-size: clamp(2.5rem, 6vw, 3.5rem);
  margin-bottom: 16px;
}
.section-sub {
  color: var(--text-soft);
  max-width: 42ch;
  font-size: 1.05rem;
  line-height: 1.65;
}

/* ===== Reveal on scroll ===== */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in { opacity: 1; transform: none; }

[hidden] { display: none !important; }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .about-grid { grid-template-columns: 1fr; gap: 32px; }
  .about-photo { justify-self: start; max-width: 280px; }
  .projects-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .slide { padding-top: 90px; }
  .top-actions { gap: 0.85rem; }
  .top-cv { padding: 8px 14px; font-size: 0.82rem; }
  .hero-ctas { flex-direction: column; align-items: flex-start; }
  .project-card { padding: 24px; }
}
