/* ── Theme variables ─────────────────────── */

:root {
  --bg: #fff;
  --bg-subtle: #f7f7f7;
  --bg-faint: #f5f5f5;
  --text-strong: #222;
  --text: #333;
  --text-muted: #555;
  --text-faint: #888;
  --text-very-faint: #aaa;
  --text-ghost: #bbb;
  --accent: #6b6baa;
  --accent-strong: #5a5a99;
  --accent-highlight: #cccce8;
  --accent-highlight-open: #ddddf0;
  --border: #eee;
  --border-mid: #ddd;
  --border-strong: #ccc;
  --border-pfp: #e0e0e0;
  --timeline-line: #ccc;
  --timeline-dot: #bbb;
  --timeline-dot-year: #aaa;
}

[data-theme="dark"] {
  --bg: #111;
  --bg-subtle: #1a1a1a;
  --bg-faint: #161616;
  --text-strong: #e8e8e8;
  --text: #c8c8c8;
  --text-muted: #999;
  --text-faint: #666;
  --text-very-faint: #444;
  --text-ghost: #555;
  --accent: #9090c8;
  --accent-strong: #a0a0d8;
  --accent-highlight: rgba(100, 100, 180, 0.2);
  --accent-highlight-open: rgba(120, 120, 200, 0.15);
  --border: #1e1e1e;
  --border-mid: #272727;
  --border-strong: #333;
  --border-pfp: #2a2a2a;
  --timeline-line: #2a2a2a;
  --timeline-dot: #333;
  --timeline-dot-year: #3a3a3a;
}

/* ── Base ────────────────────────────────── */

html {
  font-size: 18px;
}

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

body {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  max-width: 760px;
  margin: 0 auto;
  padding: 4rem 2rem 3rem;
  animation: pageFadeIn 0.9s ease both;
  transition: background 0.2s, color 0.2s;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Visible focus for keyboard users only (mouse clicks unaffected) */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

::selection {
  background: var(--accent-highlight);
  color: var(--text-strong);
}

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Controls ────────────────────────────── */

.controls {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 1.2rem;
  margin-bottom: 2.5rem;
}

.lang-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ctrl-sep {
  color: var(--text-very-faint);
  font-size: 0.88rem;
  user-select: none;
}

.ctrl-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.88rem;
  color: var(--text-faint);
  letter-spacing: 0.08em;
  padding: 0;
  text-transform: uppercase;
  transition: color 0.15s;
}

.ctrl-btn.cursive {
  font-family: "Dancing Script", cursive;
  font-size: 1.1rem;
  text-transform: none;
  letter-spacing: 0;
}

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

.ctrl-btn.active {
  color: var(--text);
  font-weight: 700;
}

/* ── Header ───────────────────────────────── */

.hello {
  font-family: "Borel", cursive;
  font-size: clamp(1.3rem, 3.25vw, 1.7rem);
  color: var(--text-muted);
  line-height: 1.1;
  animation: helloAppear 1.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes helloAppear {
  from { opacity: 0; transform: translateY(10px); filter: blur(6px); }
  to   { opacity: 1; transform: translateY(0);    filter: blur(0);   }
}

.name-wrap {
  margin-top: -0.15rem;
  margin-bottom: 0.5rem;
  font-size: inherit;
  font-weight: inherit;
}

.name {
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(2rem, 4.8vw, 2.8rem);
  font-weight: 700;
  color: var(--text-strong);
  line-height: 1.1;
  background-image: linear-gradient(transparent 68%, var(--accent-highlight) 68%);
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.name::after {
  content: '|';
  color: var(--accent);
  font-weight: 300;
  animation: blink 0.7s step-end infinite;
}

.intro-role {
  font-size: 1.08rem;
  color: var(--accent);
  margin-bottom: 0.9rem;
}

.open-to {
  font-weight: 700;
  color: var(--accent-strong);
  background-image: linear-gradient(transparent 65%, var(--accent-highlight-open) 65%);
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.intro-bio {
  font-size: 0.95rem;
  font-family: Lora, Georgia, serif;
  color: var(--text);
  line-height: 1.65;
}

.about-tagline {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-strong);
}

/* ── Profile picture ─────────────────────── */

.pfp {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 2px solid var(--border-pfp);
  background: var(--bg-subtle);
  margin: 0 auto 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-ghost);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  overflow: hidden;
}

.pfp img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 72% 20%;
  border-radius: 50%;
}

/* ── Language colors ─────────────────────── */

.l-rust   { color: #b7410e; }
.l-ts     { color: #3178c6; }
.l-python { color: #3776ab; }
.l-cpp    { color: #00599c; }
.l-nextjs { color: #000;    }

/* ── Section label ───────────────────────── */

.section-label {
  font-size: 1.2rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text);
  margin-bottom: 0.75rem;
}

/* ── Social ──────────────────────────────── */

.social-section {
  margin-top: 3.5rem;
}

.social-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.social-list a {
  font-size: 0.93rem;
}

/* ── Timeline ────────────────────────────── */

.projects-section {
  margin-top: 3rem;
}

.timeline {
  margin-top: 0.5rem;
  margin-left: 0.4rem;
  padding-left: 1.6rem;
  border-left: 2px solid var(--timeline-line);
  position: relative;
}

.timeline-year {
  font-size: 0.78rem;
  color: var(--text-faint);
  margin-top: 0.35rem;
  margin-bottom: 1rem;
  position: relative;
}

.timeline-year:first-child {
  margin-top: 0;
}

.timeline-entry + .timeline-year {
  margin-top: 2rem;
}

.timeline-year::before {
  content: '';
  position: absolute;
  left: calc(-1.6rem - 1px);
  top: 50%;
  transform: translate(-50%, -50%);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--timeline-dot-year);
}

.timeline-end {
  font-size: 0.78rem;
  color: var(--text-faint);
  position: relative;
  margin-top: 0.4rem;
  padding-bottom: 0.25rem;
}

.timeline-end::before {
  content: '';
  position: absolute;
  left: calc(-1.6rem - 1px);
  top: 50%;
  transform: translate(-50%, -50%);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--timeline-dot-year);
}

.timeline-entry {
  margin-bottom: 1.6rem;
  position: relative;
}

.timeline-entry::before {
  content: '';
  position: absolute;
  left: calc(-1.6rem - 1px);
  top: 0.45rem;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--timeline-dot);
}

.project-name {
  font-size: 1.1rem;
  font-weight: 600;
  font-family: Georgia, serif;
  margin-bottom: 0.1rem;
}

.project-name a {
  color: var(--text);
}

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

.project-tags {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.project-desc {
  font-size: 0.88rem;
  font-family: Lora, Georgia, serif;
  color: var(--text);
  line-height: 1.55;
}

/* ── Experience extras ───────────────────── */

.exp-company {
  font-size: 0.95rem;
  color: var(--accent);
  margin-bottom: 0.1rem;
}

.exp-meta {
  font-size: 0.78rem;
  color: var(--text-faint);
  margin-bottom: 0.3rem;
}

/* ── Certificates ────────────────────────── */

.cert-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.cert-entry + .cert-entry {
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
}

.cert-name {
  font-size: 0.95rem;
  font-weight: 600;
  font-family: Georgia, serif;
  color: var(--text-strong);
  margin-bottom: 0.15rem;
}

.cert-name a {
  color: var(--text-strong);
}

.cert-name a:hover {
  color: var(--accent);
  text-decoration: none;
}

.cert-meta {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-very-faint);
}

/* ── Contact ─────────────────────────────── */

.contact-heading {
  font-size: 1.05rem;
  font-weight: 600;
  font-family: 'Playfair Display', Georgia, serif;
  color: var(--text-strong);
  margin-bottom: 0.3rem;
}

.contact-sub {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.8rem;
}

/* ── Contact list ────────────────────────── */

.contact-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.25rem;
}

.contact-item {
  display: flex;
  align-items: baseline;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.contact-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-very-faint);
  min-width: 4.5rem;
}

/* ── Footer ──────────────────────────────── */

footer {
  font-size: 0.8rem;
  color: var(--text-ghost);
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  margin-top: 3.5rem;
}

/* ── Entrance animation ──────────────────── */

@keyframes pageFadeIn {
  from { opacity: 0; filter: blur(6px); }
  to   { opacity: 1; filter: blur(0);   }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ── Project page ────────────────────────── */

.back-nav {
  margin-bottom: 3rem;
}

.back-nav a {
  font-size: 0.88rem;
  color: var(--text-faint);
}

.back-nav a:hover {
  color: var(--accent);
  text-decoration: none;
}

.project-hero-title {
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(1.9rem, 4.5vw, 2.8rem);
  font-weight: 700;
  color: var(--text-strong);
  line-height: 1.15;
  margin-bottom: 0.5rem;
}

.project-hero-tags {
  font-size: 0.85rem;
  color: var(--text-faint);
  margin-bottom: 1.2rem;
}

.project-links {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  font-size: 0.83rem;
  font-family: Georgia, serif;
  color: var(--text);
  border: 1px solid var(--border-mid);
  padding: 0.35rem 0.85rem;
  border-radius: 3px;
}

.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.project-body p {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 0.9rem;
}

.screenshot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 0.5rem;
}

.screenshot-slot {
  aspect-ratio: 16 / 10;
  background: var(--bg-faint);
  border: 1px dashed var(--border-mid);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  color: var(--text-ghost);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.screenshot-grid img {
  width: 100%;
  display: block;
  border-radius: 4px;
  border: 1px solid var(--border-mid);
}

/* ── Carousel ────────────────────────────── */

.carousel {
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  border: 1px solid var(--border-mid);
  margin-top: 0.75rem;
  background: #0a0a0a;
  aspect-ratio: 16 / 9;
}

.carousel-track {
  display: flex;
  height: 100%;
  transition: transform 0.32s ease;
}

.carousel-track img {
  min-width: 100%;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.45);
  border: none;
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  padding: 0.35rem 0.65rem 0.45rem;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s;
  user-select: none;
}

.carousel-btn:hover {
  background: rgba(0, 0, 0, 0.7);
}

.carousel-prev { left: 0.65rem; }
.carousel-next { right: 0.65rem; }

.carousel-dots {
  position: absolute;
  bottom: 0.7rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.45rem;
  align-items: center;
}

.carousel-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
  border: none;
  padding: 0;
}

.carousel-dot.active {
  background: #fff;
  transform: scale(1.25);
}

/* ── Projects index ──────────────────────── */

.plist {
  margin-top: 2rem;
}

.plist-year {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-very-faint);
  margin-top: 2.5rem;
  margin-bottom: 1.2rem;
}

.plist-year:first-child {
  margin-top: 0;
}

.plist-entry {
  margin-bottom: 2rem;
  padding-left: 2.5rem;
}

.plist-name {
  display: block;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-strong);
  margin-bottom: 0.15rem;
}

.plist-name:hover {
  color: var(--accent);
  text-decoration: none;
}

.plist-sub {
  font-size: 0.8rem;
  color: var(--text-faint);
  margin-bottom: 0.1rem;
}

.plist-repo {
  display: inline-block;
  font-size: 0.78rem;
  font-family: monospace;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.plist-repo:hover {
  text-decoration: underline;
}

.plist-desc {
  font-family: Lora, Georgia, serif;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ── Section indent ──────────────────────── */

.section-indent {
  padding-left: 2rem;
}

/* ── Mobile ──────────────────────────────── */

@media (max-width: 520px) {
  html { font-size: 16px; }
  body { padding: 2.5rem 1.25rem 2.5rem; }
  .section-indent { padding-left: 1rem; }
  .plist-entry { padding-left: 1.5rem; }
  .contact-item { flex-direction: column; gap: 0.2rem; }
  .contact-item a { overflow-wrap: break-word; }
}
