/* ==========================================================================
   Portfolio — global styles (design tokens first)
   ========================================================================== */

:root {
 --bg: #f6efe7;

 --surface: rgba(255, 252, 248, 0.85);
 --surface-2: #f3eae0;
 --surface-3: #e9ded2;

 --text: #1a1412;
 --muted: #5a4a42;
 --muted-2: #8a776d;

 --line: rgba(0, 0, 0, 0.08);
 --line-strong: rgba(0, 0, 0, 0.14);

 /* your accents (kept, just slightly refined) */
 --accent: #7a1c17;
 --accent-2: #a21caf;
 --accent-soft: rgba(122, 28, 23, 0.10);
 --accent-soft-2: rgba(162, 28, 175, 0.12);

 --max: 1150px;

 --serif: 'Newsreader', Georgia, serif;
 --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
 --mono: 'Space Mono', monospace;

 --radius-lg: 28px;
 --radius-md: 20px;
 --radius-sm: 14px;

 --shadow: 0 14px 40px rgba(28, 20, 11, 0.06);
}

/* --------------------------------------------------------------------------
   Reset / base
   -------------------------------------------------------------------------- */

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--sans);
  background:
    radial-gradient(circle at top left, rgba(15, 107, 79, 0.07), transparent 24%),
    radial-gradient(circle at 85% 10%, rgba(15, 107, 79, 0.05), transparent 22%),
    var(--bg);
  color: var(--text);
  line-height: 1.75;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(15, 107, 79, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 107, 79, 0.03) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(circle at top center, rgba(0, 0, 0, 0.9), transparent 75%);
  opacity: 0.38;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

/* --------------------------------------------------------------------------
   Navigation
   -------------------------------------------------------------------------- */

nav {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px);
  background: rgba(246, 240, 231, 0.82);
  border-bottom: 1px solid rgba(128, 106, 84, 0.12);
}

.nav-inner {
  max-width: var(--max);
  margin: 0 auto;
  height: 72px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand {
  margin-right: auto;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.brand span {
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: 22px;
  list-style: none;
  flex-wrap: wrap;
}

.nav-links a {
  font-size: 14px;
  color: var(--muted);
  transition: color 140ms ease;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  padding: 9px 14px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  background: rgba(15, 107, 79, 0.1);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(15, 107, 79, 0.1);
  animation: glow 2s ease-in-out infinite;
}

@keyframes glow {

  0%,
  100% {
    box-shadow: 0 0 0 5px rgba(15, 107, 79, 0.1);
  }

  50% {
    box-shadow: 0 0 0 8px rgba(15, 107, 79, 0.3);
  }
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
  padding: 84px 0 54px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.88fr);
  gap: 34px;
  align-items: start;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin-bottom: 20px;
}

.kicker::before {
  content: "";
  width: 34px;
  height: 1px;
  background: rgba(15, 107, 79, 0.55);
}

#timestamp {
  font-size: 10px;
  text-transform: none;
  letter-spacing: 0;
  opacity: 0.8;
}

.hello {
  font-family: var(--serif);
  font-size: clamp(16px, 2vw, 20px);
  color: var(--accent);
  margin-bottom: 10px;
}

h1 {
  font-family: var(--serif);
  font-size: clamp(36px, 5vw, 48px);
  line-height: 0.95;
  letter-spacing: -0.05em;
  font-weight: 700;
  max-width: 9ch;
  margin-bottom: 26px;
}

.lead {
  font-size: clamp(15px, 1.8vw, 18px);
  line-height: 1.62;
  color: rgba(30, 26, 23, 0.94);
  max-width: 44rem;
  margin-bottom: 18px;
}

.lead strong {
  color: var(--accent);
  font-weight: 700;
}

.intro {
  max-width: 43rem;
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 30px;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  font-weight: 600;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.55);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: #0d5b45;
  border-color: #0d5b45;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 22px;
}

.chip {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.48);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  max-width: 50rem;
}

.stat {
  border-top: 1px solid var(--line-strong);
  padding-top: 14px;
}

.stat strong {
  display: block;
  font-size: 16px;
  color: var(--text);
  margin-bottom: 6px;
}

.stat span {
  display: block;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.65;
}

.profile-card {
  position: sticky;
  top: 96px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.66), rgba(255, 251, 245, 0.88));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.profile-top {
  padding: 18px 22px;
  border-bottom: 1px solid rgba(15, 107, 79, 0.12);
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(90deg, rgba(15, 107, 79, 0.06), rgba(15, 107, 79, 0.02));
}

.terminal-dots {
  display: flex;
  gap: 8px;
  align-items: center;
}

.terminal-dots span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: block;
}

.terminal-dots .r {
  background: #d67467;
}

.terminal-dots .y {
  background: #d7b258;
}

.terminal-dots .g {
  background: #55b884;
}

.profile-label {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted-2);
}

.profile-body {
  padding: 22px;
}

.profile-title {
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.02;
  letter-spacing: -0.045em;
  margin-bottom: 14px;
  max-width: none;
}

.profile-copy {
  color: var(--muted);
  margin-bottom: 18px;
}

.profile-grid {
  display: grid;
  gap: 16px;
}

.profile-row {
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: 14px;
}

.profile-row .key {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
}

.profile-row .value {
  color: var(--text);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Main & sections
   -------------------------------------------------------------------------- */

main {
  padding-bottom: 84px;
}

section {
  padding: 72px 0;
  border-top: 1px solid rgba(128, 106, 84, 0.12);
}

.section-head {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  margin-bottom: 30px;
}

.section-label {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  padding-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hand-drawn-icon {
  stroke-dasharray: 2, 1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.section-title {
  font-family: var(--serif);
  font-size: clamp(22px, 2.5vw, 30px);
  line-height: 1.06;
  letter-spacing: -0.045em;
  margin-bottom: 10px;
  max-width: none;
}

.section-copy {
  max-width: none;
  color: var(--muted);
  font-size: 14px;
}

/* --------------------------------------------------------------------------
   Components — cards, tags, grids
   -------------------------------------------------------------------------- */

.build-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.build-card,
.research-card,
.skill-card,
.note-card {
  background: rgba(255, 251, 245, 0.72);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: 0 8px 28px rgba(28, 20, 11, 0.03);
}

.research-list {
  margin: 14px 0 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.75;
}

.research-list li+li {
  margin-top: 6px;
}

.build-kicker,
.card-kicker,
.note-kicker {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 12px;
}

.build-card h3,
.research-card h3,
.skill-card h3,
.note-card h3 {
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: -0.03em;
  margin-bottom: 10px;
}

.build-card p,
.research-card p,
.note-card p,
.skill-card p {
  color: var(--muted);
  font-size: 14px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.tag {
  font-size: 12px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(15, 107, 79, 0.04);
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   Timeline
   -------------------------------------------------------------------------- */

.timeline {
  position: relative;
  padding-left: 40px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 20px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent);
  opacity: 0.3;
}

.entry {
  position: relative;
  padding: 22px 0 22px 0;
  margin-left: 20px;
}

.entry::before {
  content: '';
  position: absolute;
  left: -40px;
  top: 22px;
  width: 12px;
  height: 12px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid var(--bg);
}

.entry:first-child {
  padding-top: 0;
}

.entry:last-child {
  padding-bottom: 0;
}

.entry-time {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 6px;
}

.entry-place {
  color: var(--muted);
  font-weight: 600;
}

.entry h3 {
  font-size: 20px;
  letter-spacing: -0.03em;
  margin-bottom: 10px;
}

.entry p {
  color: var(--muted);
  margin-bottom: 12px;
  max-width: 50rem;
}

.entry ul {
  padding-left: 18px;
  color: var(--muted);
  display: grid;
  gap: 8px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.skills-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.skill-card ul {
  list-style: none;
  display: grid;
  gap: 10px;
  color: var(--muted);
}

.notes-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

/* --------------------------------------------------------------------------
   Contact
   -------------------------------------------------------------------------- */

.contact-box {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(255, 251, 245, 0.78), rgba(255, 255, 255, 0.54));
  box-shadow: var(--shadow);
  padding: 28px;
}

.contact-box h2 {
  font-family: var(--serif);
  font-size: clamp(20px, 2vw, 26px);
  line-height: 1.03;
  letter-spacing: -0.045em;
  margin-bottom: 14px;
  max-width: none;
}

.contact-box p {
  color: var(--muted);
  max-width: 44rem;
}

.contact-links {
  display: grid;
  gap: 12px;
  align-self: start;
}

.contact-link {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.4);
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.contact-link:hover {
  transform: translateY(-1px);
  border-color: rgba(15, 107, 79, 0.3);
  background: rgba(255, 255, 255, 0.7);
}

.contact-link span:first-child {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
}

.contact-link span:last-child {
  color: var(--text);
  font-weight: 600;
  text-align: right;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

footer {
  padding: 22px 0 42px;
  color: var(--muted-2);
  font-size: 13px;
}

@media (max-width: 980px) {

  .hero-grid,
  .contact-box,
  .entry,
  .section-head,
  .skills-columns,
  .build-grid,
  .grid-2,
  .notes-grid {
    grid-template-columns: 1fr;
  }

  .profile-card {
    position: static;
  }

  .section-head {
    gap: 10px;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .profile-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

@media (max-width: 780px) {
  .nav-inner {
    height: auto;
    padding-top: 14px;
    padding-bottom: 14px;
    flex-wrap: wrap;
  }

  .brand {
    margin-right: 0;
    width: 100%;
  }

  .nav-links {
    gap: 16px;
  }

  .hero {
    padding-top: 56px;
  }

  .contact-link {
    flex-direction: column;
    align-items: flex-start;
  }

  .contact-link span:last-child {
    text-align: left;
  }
}

/* --------------------------------------------------------------------------
   Projects
   -------------------------------------------------------------------------- */

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

.project-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.project-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.project-links:empty {
  display: none;
}

.icon-link {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.52);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.icon-link:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.85);
  color: var(--accent);
}

#projects .build-kicker {
  margin-bottom: 0;
}

#projects .build-card h3 {
  margin-bottom: 10px;
}

@media (max-width: 980px) {
  .projects-grid {
    grid-template-columns: 1fr;
  }
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

/* --------------------------------------------------------------------------
   Gallery triggers (beyond work)
   -------------------------------------------------------------------------- */

.gallery-trigger {
  position: relative;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  transform: translateY(-10px);
  /* moves it a little above */
}

.gallery-stack {
  position: relative;
  width: 64px;
  height: 52px;
}

.gallery-stack img {
  position: absolute;
  width: 42px;
  height: 52px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.06);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

/* deck of small stamp-like cards */
.gallery-stack img:nth-child(1) {
  top: 4px;
  left: 0;
  z-index: 1;
  opacity: 0.9;
  transform: rotate(-10deg);
}

.gallery-stack img:nth-child(2) {
  top: 1px;
  left: 8px;
  z-index: 2;
  opacity: 0.96;
  transform: rotate(-2deg);
}

.gallery-stack img:nth-child(3) {
  top: 3px;
  left: 16px;
  z-index: 3;
  transform: rotate(8deg);
}

.gallery-trigger:hover .gallery-stack img:nth-child(1) {
  transform: rotate(-14deg) translateY(-2px);
}

.gallery-trigger:hover .gallery-stack img:nth-child(2) {
  transform: rotate(-2deg) translateY(-3px);
}

.gallery-trigger:hover .gallery-stack img:nth-child(3) {
  transform: rotate(12deg) translateY(-2px);
}

/* --------------------------------------------------------------------------
   Media modal / lightbox
   -------------------------------------------------------------------------- */

.media-modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 9999;
}

.media-modal.open {
  display: block;
}

.media-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, 0.62);
  backdrop-filter: blur(6px);
}

.media-dialog {
  position: relative;
  width: min(960px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  margin: 16px auto;
  background: #f7f3eb;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 18px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
}

.media-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
  z-index: 2;
}

.media-stage {
  height: min(68vh, 700px);
  border-radius: 18px;
  overflow: hidden;
  background: #e9e3d9;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.media-location {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  padding: 5px 14px;
  border-radius: 20px;
  white-space: nowrap;
  pointer-events: none;
  backdrop-filter: blur(6px);
}

.media-stage img,
.media-stage video {
  max-width: 100%;
  max-height: 100%;
  display: block;
  border-radius: 14px;
}

.media-stage video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.media-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.media-nav {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: white;
  cursor: pointer;
  font-size: 18px;
}

.media-meta {
  flex: 1;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.media-thumbs {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.media-thumb {
  width: 84px;
  height: 62px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: white;
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}

.media-thumb.active {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.media-thumb img,
.media-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@media (max-width: 720px) {
  .media-dialog {
    width: calc(100vw - 16px);
    margin: 8px auto;
    padding: 14px;
    border-radius: 20px;
  }

  .media-stage {
    height: 52vh;
  }
}
