/* ─── Design tokens ────────────────────────────────────────────── */
:root {
  /* Typography */
  --font-sans: 'IBM Plex Sans', system-ui, sans-serif;
  --font-serif: 'IBM Plex Serif', georgia, serif;

  /* Type scale */
  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: clamp(1.05rem, 2vw, 1.25rem);
  --text-lg:   clamp(1.1rem, 2.5vw, 1.375rem);
  --text-xl:   clamp(1.25rem, 3vw, 2rem);
  --text-2xl:  clamp(1.75rem, 4vw, 3rem);
  --text-3xl:  clamp(2.5rem, 7vw, 4.5rem);

  /* Line heights */
  --leading-tight:  1.1;
  --leading-snug:   1.3;
  --leading-normal: 1.6;
  --leading-loose:  1.8;

  /* Spacing (8px base) */
  --space-1:  0.5rem;
  --space-2:  1rem;
  --space-3:  1.5rem;
  --space-4:  2rem;
  --space-6:  3rem;
  --space-8:  clamp(2rem, 5vw, 4rem);
  --space-12: clamp(2.5rem, 6vw, 6rem);
  --space-16: clamp(3rem, 7vw, 8rem);
  --space-24: clamp(4rem, 10vw, 12rem);

  /* Colours */
  --color-bg:         #F7F6F3;
  --color-text:       #111;
  --color-text-body: #555;
  --color-text-muted: #888;
  --color-text-faint: #BBB;
  --color-border:     #E0DDD6;
  --color-accent:     #111;
  --color-moss:       #719466;
  --color-rose: #b37576;
  --color-blue:       #0B5A7A;

  /* Layout */
  --max-width:    900px;
  --page-padding: clamp(1.25rem, 6vw, 3rem);
}

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

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ─── Layout shell ─────────────────────────────────────────────── */
.page-header,
.page-footer {
  padding: var(--space-4) var(--page-padding);
  max-width: calc(var(--max-width) + var(--page-padding) * 2);
  margin-inline: auto;
}

main {
  max-width: calc(var(--max-width) + var(--page-padding) * 2);
  margin-inline: auto;
  padding-inline: var(--page-padding);
}

/* ─── Page header ──────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.header-id {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.header-name {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 17px;
  color: var(--color-text);
}

.header-title {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 17px;
  color: var(--color-text-muted);
}

.page-header .name {
  color: var(--color-text);
  font-weight: 500;
  text-decoration: none;
  display: inline-flex;
}

.name-logo {
  width: 120px;
  height: auto;
  display: block;
  overflow: visible;
}

.name-logo path {
  stroke: #1F2825;
  stroke-width: 16;
  fill: none;
  stroke-miterlimit: 10;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

/* per-letter draw delay, left → right */
.name-logo .p-j   { --d: 0ms; }
.name-logo .p-o   { --d: 70ms; }
.name-logo .p-h   { --d: 140ms; }
.name-logo .p-dot { --d: 140ms; }
.name-logo .p-a   { --d: 210ms; }
.name-logo .p-n   { --d: 280ms; }

.name-logo.draw-in path,
.name:hover .name-logo path {
  animation: logo-draw 0.6s ease both;
  animation-delay: var(--d);
}

@keyframes logo-draw {
  from { stroke-dashoffset: 1; }
  to   { stroke-dashoffset: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .name-logo.draw-in path,
  .name:hover .name-logo path { animation: none; }
}

.page-header .email {
  color: var(--color-text-muted);
  text-decoration: none;
}

.page-header .email:hover {
  color: var(--color-text);
}

/* ─── Hero ─────────────────────────────────────────────────────── */
.hero {
  padding-top: var(--space-24);
  padding-bottom: var(--space-16);
  position: relative;
}

.scroll-cue {
  position: absolute;
  bottom: 0;
  left: 0;
  color: var(--color-text-faint);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.scroll-cue.is-visible {
  opacity: 1;
}

.scroll-cue.is-hidden {
  opacity: 0;
}

.scroll-cue-wheel {
  animation: scroll-cue-pulse 2.4s ease-in-out infinite;
}

@keyframes scroll-cue-pulse {
  0%, 55%, 100% { opacity: 1; transform: translateY(0); }
  25% { opacity: 0; transform: translateY(4px); }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-cue-wheel { animation: none; }
}

.hero-headline {
  font-size: var(--text-3xl);
  line-height: var(--leading-tight);
  margin-bottom: var(--space-8);
}

.hero-headline .line-sans {
  display: block;
  font-family: var(--font-sans);
  font-weight: 700;
}

.hero-headline .line-serif {
  display: block;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
}

.hero-bio {
  color: var(--color-text-body);
  line-height: var(--leading-loose);
}

.hero-bio p + p {
  margin-top: var(--space-4);
}

.hero-cta {
  display: inline-block;
  margin-top: var(--space-6);
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--color-text);
  text-decoration: none;
}

.hero-cta:hover {
  text-decoration: underline;
}

/* ─── Projects ─────────────────────────────────────────────────── */
.project-entry {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 0 var(--space-8);
  padding: var(--space-12) 0;
  align-items: start;
}

.project-left {
  padding-top: 0.8rem;
}

.project-logo {
  width: 120px;
  height: auto;
  display: block;
}

.project-logo--kin {
  width: auto;
  height: 30px;
  margin-left: 0;
}

.project-logo--alveole {
  width: 110px;
  height: auto;
}

.project-right {
  position: relative;
}

.project-entry--moss  { --project-wash: #FFD9D9; }
.project-entry--blue  { --project-wash: #FBF2CB; }
.project-entry--rose  { --project-wash: #E7F3FF; }

.project-subtitle {
  font-family: var(--font-sans);
  font-style: normal;
  font-weight: 500;
  font-size: var(--text-2xl);
  line-height: var(--leading-tight);
  color: var(--color-text);
  margin-bottom: var(--space-4);
  background: var(--project-wash);
  border-radius: 4px;
  padding: 0.15em 0.3em;
  display: inline-block;
}

.project-body p {
  font-size: var(--text-base);
  line-height: var(--leading-loose);
  color: var(--color-text-body);
  margin-bottom: var(--space-3);
}

.project-gallery {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  margin: var(--space-4) 0;
  grid-column: 1 / -1;
  margin-left: calc(-1 * var(--page-padding) - max(0px, 100vw - var(--max-width) - var(--page-padding) * 2) / 2);
  padding-left: calc(var(--page-padding) + max(0px, 100vw - var(--max-width) - var(--page-padding) * 2) / 2);
  margin-right: calc(-1 * var(--page-padding) - max(0px, 100vw - var(--max-width) - var(--page-padding) * 2) / 2);
  padding-right: calc(var(--page-padding) + max(0px, 100vw - var(--max-width) - var(--page-padding) * 2) / 2);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
  scroll-snap-type: x mandatory;
  scroll-padding-left: calc(var(--page-padding) + max(0px, 100vw - var(--max-width) - var(--page-padding) * 2) / 2);
}

.project-gallery:active {
  cursor: grabbing;
}

.project-gallery::-webkit-scrollbar { display: none; }

.project-gallery img,
.project-gallery video {
  height: 768px;
  width: auto;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  flex-shrink: 0;
  display: block;
  scroll-snap-align: start;
  -webkit-user-drag: none;
  user-select: none;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-top: var(--space-3);
}

.project-tags span {
  display: inline-block;
  font-size: var(--text-sm);
  color: var(--color-text-body);
  letter-spacing: 0.03em;
  border: 1px solid var(--color-text-faint);
  border-radius: 999px;
  padding: 0.25em 0.75em;
}

.project-meta {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: var(--space-3);
  padding-left: 0;
  grid-column: 2 / -1;
}

.meta-statement {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-snug);
  color: var(--color-text-body);
}

.meta-statement strong {
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--color-moss);
}

hr.project-divider {
  display: none;
}

/* ─── About ────────────────────────────────────────────────────── */
.section-label {
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  margin-bottom: var(--space-6);
}

#about {
  padding: var(--space-24) 0;
}

#about h2 {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: var(--text-2xl);
  line-height: var(--leading-tight);
  color: var(--color-text);
  margin-bottom: var(--space-4);
}

#about h2 em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
}

/* ─── About logo ───────────────────────────────────────────────── */
#about .name {
  display: block;
  margin-bottom: var(--space-6);
}

/* ─── About grid ───────────────────────────────────────────────── */
.about-grid {
  margin-top: var(--space-6);
}

.about-intro {
  margin-bottom: var(--space-8);
}

.about-intro::after {
  content: '';
  display: table;
  clear: both;
}

.about-photo {
  float: left;
  width: 340px;
  height: 340px;
  margin-right: var(--space-6);
  margin-bottom: 10px;
  border-radius: 8px;
  object-fit: cover;
}

.about-body p {
  font-size: var(--text-base);
  line-height: var(--leading-loose);
  color: var(--color-text-body);
  margin-bottom: var(--space-3);
}

/* ─── Timeline ─────────────────────────────────────────────────── */
.about-timeline {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.timeline-era {
  display: flex;
  align-items: flex-end;
}

.timeline-move {
  flex: 0 0 352px;
  display: flex;
  align-items: center;
  font-size: 14px;
  font-weight: 400;
  color: var(--color-text);
}

.timeline-move svg {
  flex-shrink: 0;
  color: var(--color-moss);
  overflow: visible;
}

.airplane-body {
  transition: transform 0.5s ease;
  transform-box: fill-box;
  transform-origin: center;
}

.timeline-move-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: default;
}

.timeline-move-label:hover .airplane-body {
  transform: translate(3px, -3px) scale(0.8);
}

.speed-line {
  opacity: 0;
  transition: opacity 0.15s ease;
}

.speed-line-1 { transition-delay: 0.1s; }
.speed-line-2 { transition-delay: 0.2s; }
.speed-line-3 { transition-delay: 0.3s; }

.timeline-move-label:hover .speed-line {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .airplane-body { transition: none; }
  .speed-line { transition: none; }
}

.timeline-entries {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.timeline-entry {
  display: flex;
  gap: 16px;
  align-items: baseline;
}

.timeline-year {
  font-size: 14px;
  font-weight: 400;
  line-height: normal;
  color: var(--color-text-body);
  white-space: nowrap;
  flex-shrink: 0;
}

.timeline-callout {
  display: block;
  flex: 1;
  min-width: 0;
}

.timeline-role,
.timeline-company,
.timeline-desc {
  font-size: 14px;
  font-weight: 400;
  line-height: normal;
  font-style: normal;
}

.timeline-role {
  display: inline;
  color: var(--color-text);
}

.timeline-company {
  display: inline;
  color: var(--color-text);
}

.timeline-company::before {
  content: ' – ';
}

.timeline-desc {
  display: block;
  margin-top: 4px;
  color: var(--color-text-body);
}

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

/* ─── Closing CTA ──────────────────────────────────────────────── */
#cta {
  padding: var(--space-24) 0;
}

#cta h2 {
  font-family: var(--font-sans);
  font-size: var(--text-3xl);
  font-weight: 700;
  line-height: var(--leading-tight);
  color: var(--color-text);
  margin-bottom: var(--space-4);
}

#cta h2 em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
}

#cta p {
  font-size: var(--text-base);
  line-height: var(--leading-loose);
  color: var(--color-text-body);
  margin-bottom: var(--space-6);
}

/* ─── Page footer ──────────────────────────────────────────────── */
.page-footer {
  padding-top: var(--space-12);
  padding-bottom: var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-sm);
  color: var(--color-text-faint);
  border-top: 1px solid var(--color-border);
}

.page-footer a {
  color: var(--color-text-muted);
  text-decoration: none;
}

.page-footer a:hover {
  color: var(--color-text);
}

/* ─── Responsive ───────────────────────────────────────────────── */
@media (width <= 680px) {
  /* Project layout — stack logo above content */
  .project-entry {
    grid-template-columns: 1fr;
    gap: var(--space-3) 0;
  }


  .project-logo {
    width: 90px;
  }

  /* Gallery — recalculate bleed for mobile padding */
  .project-gallery {
    margin-left: calc(-1 * var(--page-padding));
    padding-left: var(--page-padding);
    margin-right: calc(-1 * var(--page-padding));
    padding-right: var(--page-padding);
  }

  .project-gallery img,
  .project-gallery video {
    height: 480px;
  }

  /* Project meta — reset to full-width in single-column grid */
  .project-meta {
    grid-column: 1 / -1;
  }

  /* Header */
  header {
    padding-top: var(--space-4);
  }

  /* Section label */
  .section-label {
    margin-bottom: var(--space-4);
  }
}

/* ─── Pill buttons ─────────────────────────────────────────────── */
.hero-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: var(--space-6);
  flex-wrap: wrap;
}

.btn-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--color-moss);
  text-decoration: none;
  border: 1px solid var(--color-moss);
  border-radius: 100px;
  padding: 12px 26px;
  transition: background 0.2s ease, color 0.2s ease;
}

.btn-pill:hover {
  background: var(--color-moss);
  color: var(--color-bg);
}

.btn-copy {
  color: var(--color-text-body);
  border-color: var(--color-text-body);
}

.btn-copy:hover {
  background: var(--color-text-body);
  color: var(--color-bg);
}

.btn-linkedin {
  color: var(--color-blue);
  border-color: var(--color-blue);
}

.btn-linkedin:hover {
  background: var(--color-blue);
  color: var(--color-bg);
}

.btn-pill svg {
  flex-shrink: 0;
}

.btn-pill svg path,
.btn-pill svg rect {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

/* Icon draws itself in on hover — mirrors the logo */
.btn-pill:hover svg path,
.btn-pill:hover svg rect {
  animation: logo-draw 0.55s ease both;
}

.btn-pill:hover svg :nth-child(2) {
  animation-delay: 0.1s;
}

@media (prefers-reduced-motion: reduce) {
  .btn-pill:hover svg path,
  .btn-pill:hover svg rect { animation: none; }
}

.btn-copy .icon-check { display: none; }
.btn-copy.is-copied .icon-copy { display: none; }
.btn-copy.is-copied .icon-check { display: block; }

/* Check draws itself in reverse on copy */
.btn-copy.is-copied .icon-check path {
  animation: logo-draw-rev 0.45s ease both;
}

@keyframes logo-draw-rev {
  from { stroke-dashoffset: -1; }
  to   { stroke-dashoffset: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .btn-copy.is-copied .icon-check path { animation: none; }
}

/* Stack both labels so the button width never shifts between states */
.btn-label {
  display: inline-grid;
  justify-items: start;
}

.btn-label .lbl {
  grid-area: 1 / 1;
}
.lbl-copied { visibility: hidden; }
.btn-copy.is-copied .lbl-default { visibility: hidden; }
.btn-copy.is-copied .lbl-copied { visibility: visible; }

/* ─── Hero load + scroll fade ──────────────────────────────────── */
.hero-line-1,
.hero-line-2 {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.hero-line-2 {
  transition-delay: 0.18s;
}

.hero-loaded .hero-line-1,
.hero-loaded .hero-line-2 {
  opacity: 1;
  transform: translateY(0);
}

.fade-in {
  opacity: 0;
  transition: opacity 0.8s ease;
}

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

/* ─── Testimonials ─────────────────────────────────────────────── */
#testimonials {
  margin-top: var(--space-12);
}

.testimonials-grid {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  margin-top: var(--space-6);
  margin-left: calc(-1 * var(--page-padding) - max(0px, 100vw - var(--max-width) - var(--page-padding) * 2) / 2);
  padding-left: calc(var(--page-padding) + max(0px, 100vw - var(--max-width) - var(--page-padding) * 2) / 2);
  margin-right: calc(-1 * var(--page-padding) - max(0px, 100vw - var(--max-width) - var(--page-padding) * 2) / 2);
  padding-right: calc(var(--page-padding) + max(0px, 100vw - var(--max-width) - var(--page-padding) * 2) / 2);
  padding-bottom: 4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
  align-items: stretch;
  scroll-snap-type: x mandatory;
  scroll-padding-left: calc(var(--page-padding) + max(0px, 100vw - var(--max-width) - var(--page-padding) * 2) / 2);
}

.testimonials-grid::-webkit-scrollbar { display: none; }

.testimonial {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 32px;
  flex: 0 0 444px;
  scroll-snap-align: start;
  opacity: 0;
  transform: translateY(20px);
  transition: transform 0.5s cubic-bezier(0.34, 1.3, 0.64, 1), opacity 0.4s ease;
}

.testimonial.is-visible {
  transform: translateY(0);
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .testimonial { transform: none; opacity: 1; transition: none; }
}

blockquote {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-loose);
  color: var(--color-text);
  font-style: normal;
  margin: 0;
  quotes: none;
}

.testimonial-author {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: auto;
}

.testimonial-avatar-wrap {
  position: relative;
  flex-shrink: 0;
  display: inline-flex;
}

.testimonial-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--color-border);
}

.testimonial-badge {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: #fff;
  padding: 3px;
  object-fit: contain;
  box-shadow: 0 1px 4px rgb(17, 17, 17, 0.15);
}

.testimonial-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--color-text);
  text-decoration: none;
  margin: 0;
}

.name-arrow {
  flex-shrink: 0;
}

.name-arrow path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.testimonial-name:hover .name-arrow path {
  animation: logo-draw 0.55s ease both;
}

@media (prefers-reduced-motion: reduce) {
  .testimonial-name:hover .name-arrow path {
    animation: none;
    stroke-dashoffset: 0;
  }
}

.testimonial-role {
  font-size: var(--text-sm);
  color: var(--color-text-body);
  letter-spacing: 0.03em;
  margin: 0;
}

.testimonials-pagination {
  display: none;
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: transparent;
  color: var(--color-text-body);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.pagination-btn svg {
  display: block;
}

.pagination-btn:hover {
  border-color: var(--color-text);
  color: var(--color-text);
  background: var(--color-border);
}

@media (width <= 800px) {
  .testimonial {
    flex: 0 0 280px;
  }

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

  /* Timeline — stack era vertically on mobile, move label after entries */
  .timeline-era {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .timeline-move {
    flex: 0 0 auto;
    width: 100%;
    order: 2;
  }

  .timeline-entries {
    order: 1;
  }

  .about-photo {
    width: 100%;
    height: 260px;
    float: none;
    margin-right: 0;
    margin-bottom: var(--space-4);
  }
}

/* Transitions.dev — Number pop-in */
:root {
  --digit-dur: 500ms;
  --digit-distance: 8px;
  --digit-stagger: 70ms;
  --digit-blur: 2px;
  --digit-ease: cubic-bezier(0.34, 1.45, 0.64, 1);
  --digit-dir-x: 0;
  --digit-dir-y: 1;
}

@keyframes t-digit-pop-in {
  0% {
    transform: translate(
      calc(var(--digit-distance) * var(--digit-dir-x)),
      calc(var(--digit-distance) * var(--digit-dir-y))
    );
    opacity: 0;
    filter: blur(var(--digit-blur));
  }
  100% { transform: translate(0, 0); opacity: 1; filter: blur(0); }
}

.t-digit-group {
  display: inline-flex;
  align-items: baseline;
}

.t-digit {
  display: inline-block;
  will-change: transform, opacity, filter;
}

.t-digit-group.is-animating .t-digit {
  animation: t-digit-pop-in var(--digit-dur) var(--digit-ease) both;
}

.t-digit-group.is-animating .t-digit[data-stagger="1"] {
  animation-delay: var(--digit-stagger);
}

.t-digit-group.is-animating .t-digit[data-stagger="2"] {
  animation-delay: calc(var(--digit-stagger) * 2);
}

@media (prefers-reduced-motion: reduce) {
  .t-digit-group .t-digit { animation: none !important; }
}
