/* ── Reset & Base ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f3ecda;
  --ink: #1a1a18;
  --accent: #9d580f;
  --accent-dark: #7a4209;
  --muted: #6b6358;
  --border: #d9cdb8;
  --card-bg: #faf6ee;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg);
  color: var(--ink);
  font-family: Georgia, 'Times New Roman', serif;
  line-height: 1.7;
  min-height: 100vh;
}

/* Subtle dot-grid background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, #bfb49a 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}

/* ── Container ── */
.container {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  padding: 60px 32px 100px;
}

/* ── Nav ── */
nav {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 32px;
  max-width: 760px;
  margin: 0 auto;
}

nav .site-name {
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
}

nav ul {
  list-style: none;
  display: flex;
  gap: 28px;
}

nav ul li a {
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  position: relative;
  transition: color 0.2s;
}

nav ul li a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.25s ease;
}

nav ul li a:hover {
  color: var(--accent);
}

nav ul li a:hover::after {
  width: 100%;
}

/* ── Hero ── */
.hero {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 48px;
  align-items: start;
  padding-top: 20px;
  padding-bottom: 56px;
  border-bottom: 1px solid var(--border);
}

.hero-text h1 {
  font-size: 2.8rem;
  font-weight: normal;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 20px;
  color: var(--ink);
}

.hero-text p {
  max-width: 380px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.75;
}

.hero-photo {
  position: relative;
}

.hero-photo img {
  width: 100%;
  aspect-ratio: 4/5;
  object-fit: cover;
  display: block;
  filter: sepia(8%);
  transition: filter 0.4s;
}

.hero-photo img:hover {
  filter: sepia(0%);
}

.hero-photo::after {
  content: '';
  position: absolute;
  inset: 6px -6px -6px 6px;
  border: 1px solid var(--accent);
  pointer-events: none;
  z-index: -1;
}

/* ── Section ── */
section {
  padding: 52px 0;
  border-bottom: 1px solid var(--border);
}

section:last-child {
  border-bottom: none;
}

section h2 {
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 28px;
}

/* ── Project Cards ── */
.projects-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.project-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  padding: 24px;
  text-decoration: none;
  color: inherit;
  display: block;
  position: relative;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.project-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 2px;
  height: 0;
  background: var(--accent);
  transition: height 0.25s ease;
}

.project-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.07);
  border-color: var(--accent);
}

.project-card:hover::before {
  height: 100%;
}

.project-card h3 {
  font-size: 1rem;
  font-weight: normal;
  margin-bottom: 6px;
  color: var(--ink);
}

.project-card p {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}

.project-card .arrow {
  display: inline-block;
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--accent);
  transition: transform 0.2s;
}

.project-card:hover .arrow {
  transform: translateX(4px);
}

/* ── Skills ── */
.skills-group {
  margin-bottom: 20px;
}

.skills-group:last-child {
  margin-bottom: 0;
}

.skills-label {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}

.skills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skill-tag {
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  padding: 5px 14px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: transparent;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  cursor: default;
}

.skill-tag:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ── Contact ── */
.contact-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.contact-links a {
  color: var(--ink);
  text-decoration: none;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color 0.2s;
}

.contact-links a:hover {
  color: var(--accent);
}

/* ── Bio block ── */
.bio-block {
  max-width: 400px;
}

.bio-static {
  font-size: 1.05rem;
  line-height: 1.9;
  color: var(--muted);
  margin-bottom: 0;
}

/* ── Hyper-text about paragraph ── */
.about-paragraph {
  font-size: 1.05rem;
  line-height: 1.9;
  color: var(--muted);
}

.about-word {
  position: relative;
  display: inline-block;
  white-space: nowrap;
  transition:
    transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity   0.2s ease,
    filter    0.2s ease,
    color     0.2s ease;
  z-index: 1;
  cursor: default;
}

.about-word.highlightable {
  font-family: 'Courier New', Courier, monospace;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
}

.about-word.hovered {
  transform: scale(1.12) translateY(-4px);
  color: #fff !important;
  z-index: 20;
}

.about-word.dimmed {
  opacity: 0.25;
  filter: blur(1.5px);
}

/* Animated pill background */
.word-bg {
  position: absolute;
  inset: -7px -9px;
  border-radius: 8px;
  background: #1a1a18;
  z-index: -1;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.18s ease, transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 10px 28px -5px rgba(157, 88, 15, 0.45), 0 4px 10px rgba(0,0,0,0.15);
}

.about-word.hovered .word-bg {
  opacity: 1;
  transform: scale(1);
}

/* Corner dots */
.word-dot {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  z-index: 25;
  transform: scale(0);
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.about-word.hovered .word-dot {
  transform: scale(1);
}

.word-dot-tr {
  top: -4px;
  right: -4px;
  background: #d97706;
}

.word-dot-bl {
  bottom: -4px;
  left: -4px;
  background: #ec4899;
}

/* Inner text layer (sits above the pill) */
.word-text {
  position: relative;
  z-index: 10;
  padding: 0 2px;
}

/* ── Blog pages ── */
.blog-wrap {
  position: relative;
  z-index: 1;
  max-width: 700px;
  margin: 0 auto;
  padding: 0 32px 120px;
}

/* Back nav */
.blog-topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 0 52px;
}

.blog-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}

.blog-back:hover { color: var(--accent); }

/* Header */
.blog-header {
  padding-bottom: 36px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}

.blog-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}

.blog-tag {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid rgba(157,88,15,0.3);
  padding: 3px 10px;
  border-radius: 4px;
}

.blog-tag--paused {
  color: var(--muted);
  border-color: var(--border);
}

.blog-tag--paused::before {
  content: '· ';
  opacity: 0.5;
}

.blog-title {
  font-size: 2.1rem;
  font-weight: normal;
  letter-spacing: -0.02em;
  line-height: 1.18;
  margin-bottom: 14px;
  color: var(--ink);
}

.blog-subtitle {
  font-size: 0.97rem;
  color: var(--muted);
  line-height: 1.7;
  max-width: 520px;
}

/* Meta row */
.blog-meta {
  display: flex;
  gap: 36px;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.blog-meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.blog-meta-label {
  font-size: 0.63rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(107,99,88,0.55);
}

.blog-meta-value {
  font-size: 0.85rem;
  color: var(--ink);
  font-family: 'Courier New', monospace;
}

/* Images */
.blog-images {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 52px;
}

.blog-images.single {
  grid-template-columns: 1fr;
}

.blog-images img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
  filter: sepia(6%);
  transition: filter 0.4s;
}

.blog-images img:hover { filter: sepia(0%); }

.blog-images.natural img {
  object-fit: contain;
  aspect-ratio: unset;
  max-height: 420px;
  width: auto;
  margin: 0 auto;
  background: transparent;
}

/* Body */
.blog-body {
  color: var(--muted);
  line-height: 1.85;
  font-size: 1rem;
}

.blog-body p {
  margin-bottom: 22px;
}

.blog-body p:last-child { margin-bottom: 0; }

.blog-section-label {
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 44px 0 14px;
  display: block;
}

/* Footer nav */
.blog-footer {
  margin-top: 80px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.blog-footer-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-decoration: none;
}

.blog-footer-link .bf-label {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(107,99,88,0.5);
}

.blog-footer-link .bf-title {
  font-size: 0.9rem;
  color: var(--muted);
  transition: color 0.2s;
}

.blog-footer-link:hover .bf-title { color: var(--accent); }

.blog-footer-link.next { text-align: right; }


/* ── Case studies (within a single blog page) ── */
.case-study {
  margin-bottom: 0;
}

.case-study-label {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 28px;
}

.case-num {
  font-family: 'Courier New', monospace;
  font-size: 0.72rem;
  color: var(--accent);
  letter-spacing: 0.08em;
  flex-shrink: 0;
}

.case-title {
  font-size: 1.15rem;
  color: var(--ink);
  font-weight: normal;
}

.case-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 60px 0;
}

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

/* ── Smooth transitions on blurable elements ── */
nav, #projects, #skills, #contact {
  transition: filter 0.35s ease, opacity 0.35s ease;
}

/* ── Non-hero content dims when overlay is open ── */
body.overlay-active nav {
  filter: blur(4px);
  opacity: 0.45;
  pointer-events: none;
}

body.overlay-active #projects,
body.overlay-active #skills,
body.overlay-active #contact {
  filter: blur(4px);
  opacity: 0.35;
  pointer-events: none;
}

/* ── Ambient background tint (no backdrop-filter so hero stays crisp) ── */
.word-overlay {
  position: fixed;
  inset: 0;
  z-index: 5;
  background: rgba(243, 236, 218, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.word-overlay.active {
  opacity: 1;
}

/* ── Cards — positioned by JS to the right of the hovered word ── */
.overlay-card {
  position: fixed;
  z-index: 300;
  width: 400px;
  max-width: calc(100vw - 32px);
  background: #1a1a18;
  border: 1px solid rgba(157, 88, 15, 0.3);
  border-radius: 16px;
  padding: 30px 34px;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.04) inset,
    0 28px 64px rgba(0,0,0,0.45),
    0 0 40px rgba(157, 88, 15, 0.1);
  opacity: 0;
  transform: translateY(calc(-50% + 14px)) scale(0.96);
  transition: opacity 0.24s ease, transform 0.3s cubic-bezier(0.34, 1.4, 0.64, 1);
  pointer-events: none;
}

.overlay-card.visible {
  opacity: 1;
  transform: translateY(-50%) scale(1);
  pointer-events: auto;
}

/* ── X close button ── */
.overlay-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  color: rgba(255,255,255,0.35);
  width: 26px;
  height: 26px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}

.overlay-close:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border-color: rgba(255,255,255,0.3);
}

/* Eyebrow label */
.overlay-eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
}

.overlay-eyebrow svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  flex-shrink: 0;
}

/* GitHub card specifics */
.overlay-repo-path {
  font-family: 'Courier New', monospace;
  font-size: 1rem;
  color: rgba(255,255,255,0.55);
  margin-bottom: 12px;
}

.overlay-repo-path strong {
  color: #fff;
  font-weight: 600;
}

.overlay-desc {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.5);
  line-height: 1.65;
  margin-bottom: 20px;
}

.overlay-meta-row {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 28px;
}

.lang-badge {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.5);
  display: flex;
  align-items: center;
  gap: 5px;
}

.lang-badge::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.lang-badge.python::before { background: #3572A5; }

.meta-item {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.3);
}

.overlay-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-family: 'Courier New', monospace;
  letter-spacing: 0.04em;
  color: var(--accent);
  text-decoration: none;
  padding: 10px 18px;
  border: 1px solid rgba(157, 88, 15, 0.4);
  border-radius: 8px;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.overlay-cta:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.cta-arrow {
  transition: transform 0.2s;
}

.overlay-cta:hover .cta-arrow {
  transform: translateX(4px);
}

/* Hardware card */
.hw-image-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 16px;
  border-radius: 6px;
  overflow: hidden;
}

.hw-image-strip img {
  width: 100%;
  aspect-ratio: 3/2;
  object-fit: cover;
  display: block;
  filter: sepia(10%) brightness(0.9);
  transition: filter 0.3s;
}

.hw-image-strip img:hover {
  filter: sepia(0%) brightness(1);
}

.hw-title {
  font-size: 0.88rem;
  color: rgba(255,255,255,0.75);
  margin-bottom: 8px;
  font-family: 'Courier New', monospace;
}

/* Software separator */
.sw-separator {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 16px;
  font-size: 0.63rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.22);
  white-space: nowrap;
}

.sw-separator::before,
.sw-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,0.07);
}

/* Technology card */
.tech-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.tech-chip {
  font-size: 0.78rem;
  font-family: 'Courier New', monospace;
  color: rgba(255,255,255,0.6);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  padding: 5px 12px;
  transition: border-color 0.2s, color 0.2s;
}

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

/* Projects card */
.overlay-project-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.overlay-project-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  text-decoration: none;
  color: rgba(255,255,255,0.6);
  font-size: 0.92rem;
  transition: color 0.2s, padding-left 0.2s;
}

.overlay-project-item:last-child {
  border-bottom: none;
}

.overlay-project-item:hover {
  color: #fff;
  padding-left: 4px;
}

.op-tag {
  font-size: 0.68rem;
  font-family: 'Courier New', monospace;
  color: rgba(255,255,255,0.25);
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.op-arrow {
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  color: var(--accent);
  font-size: 0.85rem;
}

.overlay-project-item:hover .op-arrow {
  opacity: 1;
  transform: translateX(3px);
}

.overlay-project-item:hover .op-tag {
  color: rgba(255,255,255,0.45);
}

/* ── Fade-in on scroll ── */
.fade-in {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: none;
}

/* ── Mobile overlay ── */
@media (hover: none) {
  .overlay-card {
    width: calc(100vw - 48px);
    max-height: 80vh;
    overflow-y: auto;
    border-radius: 16px;
  }

  .overlay-card.visible {
    transform: translate(-50%, -50%) scale(1);
  }

  .word-overlay.active {
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.45);
  }

  .hw-image-strip {
    display: none;
  }
}

/* ── Loom embed ── */
.loom-embed {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  margin: 32px 0;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.loom-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 8px;
}
