/* --- Apfel Grotezk (similar to Apfel Grotesk) --- */
@font-face {
  font-family: 'Apfel Grotezk';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url('https://cdn.jsdelivr.net/npm/@fontsource/apfel-grotezk@5.2.5/files/apfel-grotezk-latin-400-normal.woff2') format('woff2'),
       url('https://cdn.jsdelivr.net/npm/@fontsource/apfel-grotezk@5.2.5/files/apfel-grotezk-latin-400-normal.woff') format('woff');
}

@font-face {
  font-family: 'Apfel Grotezk';
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url('https://cdn.jsdelivr.net/npm/@fontsource/apfel-grotezk@5.2.5/files/apfel-grotezk-latin-700-normal.woff2') format('woff2'),
       url('https://cdn.jsdelivr.net/npm/@fontsource/apfel-grotezk@5.2.5/files/apfel-grotezk-latin-700-normal.woff') format('woff');
}

/* --- Page transition (index ↔ portfolio) --- */
@view-transition {
  navigation: auto;
}

::view-transition-old(root) {
  animation: page-out 0.3s ease-out forwards;
}

::view-transition-new(root) {
  animation: page-in 0.35s ease-out 0.05s both;
}

@keyframes page-out {
  to {
    opacity: 0;
  }
}

@keyframes page-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* --- Reset & base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-height, 4rem);
}

/* --- Scroll animations --- */
.scroll-animate {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

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


/* --- Loader --- */
.loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f8f7f4;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loader.loader--hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

body.loading {
  overflow: hidden;
}

.loader-logo {
  height: 3rem;
  width: auto;
  object-fit: contain;
}

@media (prefers-color-scheme: dark) {
  .loader {
    background-color: #13141a;
  }

  .loader-logo {
    filter: invert(1) brightness(1.1);
  }
}

body {
  margin: 0;
  padding-top: var(--header-height);
  font-family: 'Apfel Grotezk', system-ui, -apple-system, sans-serif;
  background-color: #f8f7f4;
  color: #1a1a1a;
  line-height: 1.5;
}

/* --- Sticky header --- */
:root {
  --header-height: 4rem;
}

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background-color: rgba(248, 247, 244, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  transition: transform 0.3s ease;
}

.header.header--hidden {
  transform: translateY(-100%);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 100%;
  padding: 1rem 1.5rem;
  position: relative;
}

.logo {
  display: block;
  text-decoration: none;
  flex-shrink: 0;
  line-height: 0;
  background: transparent;
}

.logo img {
  display: block;
  height: 2rem;
  width: auto;
  object-fit: contain;
  background: transparent;
}

.logo:hover img {
  opacity: 0.85;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.nav-links a {
  color: #666666;
  text-decoration: none;
  font-size: 0.9375rem;
  letter-spacing: 0.02em;
}

.nav-links a:hover {
  text-decoration: underline;
}

.btn-cta {
  display: inline-flex;
  align-items: center;
  height: 2.5rem;
  flex-shrink: 0;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: #333333;
  background-color: #d9d9d9;
  padding: 0;
  border-radius: 9999px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: box-shadow 0.2s, opacity 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.btn-cta:hover {
  opacity: 0.92;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12);
}

.btn-cta-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
  background-color: #f07e4c;
  border-radius: 50%;
  color: #fff;
}

.btn-cta-icon svg {
  display: block;
  margin: 0 auto;
}

.btn-cta-text {
  padding: 0 1rem 0 0.875rem;
}

/* --- Ticker carousel --- */
.ticker {
  width: 100%;
  overflow: hidden;
  padding: 1.5rem 0 0;
}

.ticker-track {
  display: flex;
  width: max-content;
  animation: ticker-scroll 80s linear infinite;
  will-change: transform;
  backface-visibility: hidden;
}

.ticker--scrolling .ticker-track {
  animation-playback-rate: 2.2;
}

.ticker-track a {
  display: block;
  flex-shrink: 0;
  line-height: 0;
  width: 400px;
  min-width: 400px;
  height: 400px;
  overflow: hidden;
}

.ticker-track a img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ticker-track img {
  display: block;
  width: 400px;
  height: 400px;
  min-width: 400px;
  object-fit: cover;
  flex-shrink: 0;
}

.ticker-track .ticker-embed {
  flex-shrink: 0;
  width: 400px;
  min-width: 400px;
  height: 400px;
  overflow: hidden;
  display: block;
}

.ticker-track .ticker-embed iframe {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: auto;
}

@keyframes ticker-scroll {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-50%, 0, 0); }
}

.ticker--reverse .ticker-track {
  animation: ticker-scroll-reverse 80s linear infinite;
}

@keyframes ticker-scroll-reverse {
  0% { transform: translate3d(-50%, 0, 0); }
  100% { transform: translate3d(0, 0, 0); }
}

/* --- About section --- */
.about {
  background-color: #f8f7f4;
  padding: 0.5rem 1.5rem 4rem;
}

.about-inner {
  width: 50%;
  max-width: 720px;
  min-width: 280px;
}

.about-title {
  font-family: 'Apfel Grotezk', system-ui, -apple-system, sans-serif;
  font-size: 150px;
  font-weight: 400;
  margin: 0 0 0.5rem;
  letter-spacing: -0.05em;
}

.about-text {
  font-family: 'Apfel Grotezk', system-ui, -apple-system, sans-serif;
  font-size: 20px;
  margin: 0 0 1.5rem;
  line-height: 1.6;
  text-indent: 0;
  color: #444;
}

.about-text:last-child {
  margin-bottom: 0;
}

.about-resume-link {
  color: #fff;
  text-decoration: underline;
}

.about-resume-link:hover {
  opacity: 0.9;
}

/* --- Hero (fixed window behind curtain) --- */
.hero--window {
  position: fixed;
  top: var(--header-height, 4rem);
  left: 0;
  right: 0;
  height: 80vh;
  z-index: 3;
  padding: 0 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: left;
  background-color: #f8f7f4;
}

.hero-spacer {
  height: 80vh;
  position: relative;
  z-index: 2;
  margin: 0;
  background-color: #f8f7f4;
}

@media (prefers-color-scheme: dark) {
  .hero-spacer {
    background-color: #13141a;
  }
}

/* --- Main content --- */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: left;
}

.hero-content {
  width: max-content;
  max-width: 100%;
}

.hero h1 {
  font-size: 40px;
  font-weight: 400;
  margin: 0 0 0.5rem;
}

.rotating-word {
  display: inline-block;
  min-width: 10.15ch;
  padding: 0.08em 0.28em;
  font-family: 'Fira Code', 'SF Mono', 'Consolas', 'Monaco', monospace;
  font-weight: 300;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.rotating-cursor {
  display: inline-block;
  width: 2px;
  height: 0.9em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background-color: currentColor;
  animation: rotating-cursor-blink 1s step-end infinite;
}

@keyframes rotating-cursor-blink {
  50% { opacity: 0; }
}

.hero p {
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: 0.02em;
  margin: 0;
  color: #444;
}

@media (prefers-color-scheme: dark) {
  body {
    background-color: #13141a;
    color: #e8e8e8;
  }

  .hero--window {
    background-color: #13141a;
  }

  .logo img {
    filter: invert(1) brightness(1.1);
  }

  .header {
    background-color: rgba(19, 20, 26, 0.92);
    border-bottom-color: rgba(255, 255, 255, 0.08);
  }

  .nav-links a {
    color: #b0b0b0;
  }

  .btn-cta {
    color: #e0e0e0;
    background-color: #2a2b32;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  }

  .btn-cta:hover {
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
  }

  .hero p {
    color: #a0a0a0;
  }

  .rotating-word {
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  }

  .about {
    background-color: #13141a;
  }

  .about-title {
    color: #e8e8e8;
  }

  .about-text {
    color: #a0a0a0;
  }
}

/* --- Curtain (covers hero & reveals footer) --- */
.curtain {
  position: relative;
  z-index: 4;
  margin: 0;
  padding: 0;
  background-color: #f8f7f4;
  min-height: 100vh;
}

.curtain > .ticker:first-child {
  padding-top: 0;
  margin-top: 0;
}

@media (prefers-color-scheme: dark) {
  .curtain {
    background-color: #13141a;
  }
}

.footer-spacer {
  height: 2rem;
  flex-shrink: 0;
  min-height: 2rem;
  background-color: inherit;
}

/* --- Footer (fixed at bottom, revealed underneath second ticker from bottom up; opposite of hero) --- */
.footer-reveal-trigger {
  height: 1px;
  width: 100%;
  pointer-events: none;
}

.footer-placeholder {
  height: 60vh;
  width: 100%;
}

.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 3;
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  background-color: #13141a;
  color: #e8e8e8;
  transform: translateY(100%);
  transition: transform 0.5s ease-out;
}

body.footer-revealed .footer {
  transform: translateY(0);
}

body.footer-always-visible .footer {
  position: relative;
  transform: none;
  margin-top: auto;
}

.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
  padding: 3rem 1.5rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.footer-brand {
  flex-shrink: 0;
}

.footer-brand-name {
  font-size: 1.25rem;
  font-weight: 400;
  margin: 0 0 0.25rem;
  letter-spacing: 0.02em;
}

.footer-brand-url {
  font-size: 0.9375rem;
  font-weight: 400;
  margin: 0;
  opacity: 0.9;
}

.footer-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1.5rem;
}

.footer-cta {
  display: inline-flex;
  align-items: center;
  height: 2.5rem;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: #fff;
  background-color: #2a2b32;
  padding: 0;
  border-radius: 9999px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s, box-shadow 0.2s;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.footer-cta:hover {
  opacity: 0.92;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
}

.footer-cta-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
  background-color: #f07e4c;
  border-radius: 50%;
  color: #fff;
}

.footer-cta-icon svg {
  display: block;
}

.footer-cta-text {
  padding: 0 1rem 0 0.875rem;
}

.footer-columns {
  display: flex;
  gap: 3rem;
}

.footer-col {
  text-align: left;
}

.footer-col-title {
  font-size: 0.875rem;
  font-weight: 400;
  margin: 0 0 0.75rem;
  letter-spacing: 0.02em;
}

.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-links li {
  margin: 0 0 0.5rem;
}

.footer-links li:last-child {
  margin-bottom: 0;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.9);
  opacity: 0.5;
  text-decoration: none;
  font-size: 0.9375rem;
  letter-spacing: 0.02em;
}

.footer-links a:hover {
  text-decoration: underline;
  opacity: 1;
}

.footer-bottom {
  display: flex;
  justify-content: center;
  padding: 2rem 1.5rem 2.5rem;
}

.footer-logo {
  display: block;
  line-height: 0;
}

.footer-logo img {
  display: block;
  height: 2rem;
  width: auto;
  object-fit: contain;
  filter: invert(1) brightness(1.1);
}

.footer-logo:hover img {
  opacity: 0.85;
}

@media (max-width: 768px) {
  .footer-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer-right {
    align-items: flex-start;
  }

  .footer-columns {
    flex-direction: column;
    gap: 2rem;
  }
}

@media (max-width: 768px) {
  .hero h1 {
    font-size: 32px;
  }

  .hero-line-break {
    display: none;
  }
}

/* --- Portfolio page --- */
.portfolio-page {
  height: calc(100vh - var(--header-height));
  overflow: hidden;
  margin: 0;
  padding: 0;
}

.portfolio-scroll {
  width: 100%;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.portfolio-scroll::-webkit-scrollbar {
  height: 6px;
}

.portfolio-scroll::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.06);
}

.portfolio-scroll::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

@media (prefers-color-scheme: dark) {
  .portfolio-scroll::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.06);
  }
  .portfolio-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.25);
  }
}

.portfolio-grid {
  display: grid;
  grid-template-rows: 1fr;
  grid-auto-columns: 95vw;
  grid-auto-flow: column;
  height: 100%;
  width: max-content;
}

.portfolio-grid > * {
  min-width: 0;
  min-height: 0;
}

.portfolio-grid img,
.portfolio-grid iframe {
  width: 100%;
  height: 100%;
  display: block;
}

.portfolio-grid img {
  object-fit: cover;
}
