/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=Barlow:wght@300;400;500;600;700&family=Space+Mono:wght@400;700&display=swap');

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

/* ——— Design Tokens ——— */
:root {
  --color-bg:        #141919;
  --color-text:      #b7b4ae;
  --color-text-dim:  rgba(183, 180, 174, 0.5);
  --color-white:     #ffffff;
  --color-border:    rgba(183, 180, 174, 0.15);

  --font-sans:  'Space Grotesk', sans-serif;
  --font-serif: 'Barlow', sans-serif;
  --font-mono:  'Space Mono', monospace;

  --nav-height: 72px;
  --container:  1200px;
  --gutter:     48px;

  /* Code colors (keep for notes) */
  --color-code-comment: #a9aaad;
  --color-code-red:     #d16464;
  --color-code-orange:  #de935f;
  --color-code-yellow:  #f0c674;
  --color-code-green:   #a7bd68;
  --color-code-aqua:    #8abeb7;
  --color-code-blue:    #7e9abf;
  --color-code-purple:  #b294bb;
}

/* ——— Base ——— */
html {
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--color-text);
  background: var(--color-bg);
  /* custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: var(--color-text) transparent;
  /* always show scrollbar → prevents layout shift on navigation */
  overflow-y: scroll;
}

html::-webkit-scrollbar { width: 3px; height: 3px; }
html::-webkit-scrollbar-track { background: transparent; }
html::-webkit-scrollbar-thumb { background: var(--color-text); }

body {
  padding-top: var(--nav-height);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main {
  flex: 1;
}

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

li { list-style: none; }

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

a:hover {
  opacity: 0.75;
}

button {
  font: inherit;
  background: none;
  border: 0;
  color: currentColor;
  cursor: pointer;
}

strong, b { font-weight: 600; }

small {
  font-size: inherit;
  color: var(--color-text-dim);
}

/* ——— Container ——— */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ——— Fixed Header / Nav ——— */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--color-bg);
  display: flex;
  align-items: stretch;
  height: var(--nav-height);
  border-bottom: 1px solid rgba(183, 180, 174, 0.3);
}

.header-inner {
  width: 100%;
  max-width: 1920px;
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 28px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text);
  line-height: 1;
}

.logo:hover { opacity: 1; }

.menu {
  display: flex;
  align-items: center;
  gap: 32px;
}

.menu a {
  font-size: 16px;
  font-weight: 400;
  line-height: 1;
  padding: 8px 0;
  color: var(--color-text);
  position: relative;
  white-space: nowrap;
}

.menu a[aria-current]::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--color-text);
}

.menu a:hover { opacity: 0.75; }

/* ——— Section Label ——— */
.section-label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--color-text);
  text-align: center;
  padding: 24px 0;
}

/* ——— Divider ——— */
.divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 0;
}

/* ——— Section ——— */
.section {
  padding: 3rem 0;
}

/* ——— Grid ——— */
.grid {
  --columns: 12;
  --gutter: 3rem;
  display: grid;
  grid-gap: var(--gutter);
  grid-template-columns: 1fr;
}

.grid > .column {
  margin-bottom: var(--gutter);
}

@media screen and (min-width: 60rem) {
  .grid {
    grid-template-columns: repeat(12, 1fr);
  }
  .grid > .column {
    grid-column: span var(--columns);
  }
}

.autogrid {
  --gutter: 3rem;
  --min: 10rem;
  display: grid;
  grid-gap: var(--gutter);
  grid-template-columns: repeat(auto-fit, minmax(var(--min), 1fr));
  grid-auto-flow: dense;
}

/* ——— Typography ——— */
h1, h2, h3, h4, h5, h6 {
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
}

/* ——— Text / Rich Content ——— */
.text {
  line-height: 1.6em;
  font-size: 14px;
  color: var(--color-text);
}

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

.text a:hover { opacity: 0.75; }

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

.text p,
.text ul,
.text ol {
  margin-bottom: 1.5rem;
}

.text ul,
.text ol {
  margin-left: 1rem;
}

.text ul p,
.text ol p { margin-bottom: 0; }

.text ul > li { list-style: disc; }
.text ol > li { list-style: decimal; }

.text ul ol,
.text ul ul,
.text ol ul,
.text ol ol { margin-bottom: 0; }

.text h1, .h1 {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 3rem;
  line-height: 1.25em;
  color: var(--color-text);
}

.text h2, .h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}

.text h3, .h3 { font-weight: 600; }

.text .codeblock { display: grid; }

.text code {
  font-family: var(--font-mono);
  font-size: 1em;
  background: rgba(183, 180, 174, 0.1);
  padding: 0 .5rem;
  display: inline-block;
  color: var(--color-text);
}

.text pre {
  margin: 3rem 0;
  background: rgba(255,255,255,0.05);
  color: var(--color-text);
  padding: 1.5rem;
  overflow-x: scroll;
  overflow-y: hidden;
  line-height: 1.5rem;
  border-radius: 4px;
}

.text pre code {
  padding: 0;
  background: none;
  color: inherit;
}

.text hr { margin: 6rem 0; }

.text dt { font-weight: 600; }

.text blockquote {
  font-size: 1.25rem;
  line-height: 1.325em;
  border-left: 2px solid var(--color-border);
  padding-left: 1rem;
  margin: 3rem 0;
  max-width: 25rem;
}

.text blockquote footer {
  font-size: .875rem;
  font-style: italic;
}

.text figure {
  margin: 3rem 0;
}

.text figcaption {
  padding-top: .75rem;
  color: var(--color-text-dim);
}

.text figure ul {
  line-height: 0;
  display: grid;
  gap: 1.5rem;
  margin: 0;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
}

.text figure ul li { list-style: none; }

/* ——— Page Intro (used in subpages) ——— */
.page-intro {
  padding: 4rem var(--gutter);
  max-width: var(--container);
  margin: 0 auto;
}

.page-intro h1 {
  font-size: clamp(2rem, 6vw, 4rem);
  font-weight: 600;
  line-height: 1.1;
  margin-bottom: 1rem;
}

.page-intro p {
  font-size: 16px;
  color: var(--color-text-dim);
}

/* ——— Image / Video ——— */
.img,
.video {
  position: relative;
  display: block;
  --w: 1;
  --h: 1;
  padding-bottom: calc(100% / var(--w) * var(--h));
  background: rgba(255,255,255,0.03);
}

.img img,
.video iframe {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 0;
}

.img[data-contain] img { object-fit: contain; }

.img-caption,
.video-caption {
  padding-top: .75rem;
  line-height: 1.5em;
  color: var(--color-text-dim);
  font-size: 13px;
}

/* ——— Arrow link ——— */
.arrow-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  line-height: 1;
  color: var(--color-text);
  margin-top: 8px;
}

.arrow-link:hover { opacity: 0.75; }

/* ——— Projects Divider (shared: home + project pages) ——— */
.projects-section {
  padding: 0 0 136px;
}

.projects-divider {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 24px 0;
  margin: 0 0 40px;
}

.projects-divider-line {
  flex: 1;
  height: 1px;
  background: rgba(183, 180, 174, 0.3);
}

.projects-label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--color-text);
  white-space: nowrap;
}

/* ——— Project Grid (shared: home + project pages) ——— */
.projects-grid {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px 24px;
}

@media screen and (max-width: 900px) {
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

.project-tile {
  display: flex;
  flex-direction: column;
}

.project-tile-link {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.project-tile-link:hover { opacity: 1; }

.project-tile-link:hover .project-tile-image-wrapper img {
  transform: scale(1.04);
}

.project-tile-link:hover .project-tile-arrow {
  transform: translateX(6px);
}

.project-tile-image-wrapper {
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  background: rgba(255,255,255,0.04);
  aspect-ratio: 16 / 10;
}

.project-tile-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.project-tile-tag-wrapper {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1;
}

.project-tile-tag-text {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: var(--color-text);
  background: rgba(20, 25, 25, 0.75);
  padding: 6px 10px;
  border-radius: 4px;
}

.project-tile-headline {
  font-size: 24px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--color-text);
  margin: 16px 0 8px;
}

.project-tile-description {
  font-size: 16px;
  font-weight: 300;
  line-height: 1.4;
  color: var(--color-text);
  margin-bottom: 0;
  flex: 1;
}

.project-tile-arrow {
  display: block;
  width: 40px;
  height: auto;
  margin-top: 8px;
  transition: transform 0.3s ease;
}

/* ——— Footer ——— */
.footer {
  border-top: 1px solid rgba(183, 180, 174, 0.3);
  padding: 50px var(--gutter);
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 40px;
}

.footer a {
  font-size: 16px;
  font-weight: 400;
  color: var(--color-text);
  text-decoration: none;
}

.footer-email {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.footer-links {
  display: flex;
  gap: 40px;
}

/* ——— Utility ——— */
.color-grey   { color: var(--color-text-dim); }
.align-center { text-align: center; }

.margin-s  { margin-bottom: .75rem; }
.margin-m  { margin-bottom: 1.5rem; }
.margin-l  { margin-bottom: 3rem; }
.margin-xl { margin-bottom: 4.5rem; }
.margin-xxl{ margin-bottom: 6rem; }

hr {
  border: 0;
  background: var(--color-border);
  height: 1px;
  margin: 3rem 0;
}

/* ——— Pagination ——— */
.pagination {
  display: flex;
  padding-top: 6rem;
}

.pagination > span {
  color: var(--color-text-dim);
}

.pagination > * {
  padding: .5rem;
  width: 3rem;
  text-align: center;
  border: 1px solid var(--color-border);
  margin-right: 1rem;
}

.pagination > a:hover {
  background: var(--color-text);
  color: var(--color-bg);
  border-color: var(--color-text);
}

/* ——— Note Excerpts ——— */
.note-excerpt {
  line-height: 1.6em;
}

.note-excerpt header {
  margin-bottom: 1.5rem;
}

.note-excerpt figure {
  margin-bottom: .5rem;
}

.note-excerpt-title {
  font-weight: 600;
}

.note-excerpt-date {
  color: var(--color-text-dim);
  font-size: 13px;
}

/* ——— Tags ——— */
.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--color-text);
  background: rgba(183, 180, 174, 0.12);
  padding: 3px 8px;
  border-radius: 2px;
}

/* ——— Map ——— */
.map {
  --w: 2;
  --h: 1;
  padding-bottom: calc(100% / var(--w) * var(--h));
  position: relative;
  overflow: hidden;
  background: rgba(255,255,255,0.03);
}

.map iframe {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ——— Contact ——— */
.contact {
  padding: 6rem var(--gutter);
  max-width: var(--container);
  margin: 0 auto;
}

.contact h2 {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 3rem;
}

.contact h3 {
  font-weight: 600;
  margin-bottom: .75rem;
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--color-text-dim);
}

/* ——— Responsive ——— */
@media screen and (max-width: 60rem) {
  :root {
    --gutter: 24px;
  }

  .logo {
    font-size: 20px;
  }

  .menu {
    gap: 20px;
  }

  .menu a {
    font-size: 14px;
  }
}

@media screen and (max-width: 600px) {
  :root {
    --gutter: 16px;
    --nav-height: 54px;
  }

  .header-inner {
    padding: 0 16px;
  }

  .logo {
    font-size: 15px;
    letter-spacing: 0;
    flex-shrink: 0;
  }

  .menu {
    gap: 16px;
    flex-wrap: nowrap;
    flex-shrink: 0;
  }

  .menu a {
    font-size: 13px;
  }

  .footer {
    padding: 40px 16px;
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }

  .footer-email {
    font-size: 18px;
    font-weight: 500;
  }

  .footer-links {
    display: flex;
    gap: 32px;
  }
}

/* ——— Scroll-to-top button ——— */
.scroll-top {
  position: fixed;
  bottom: 20px;
  right: 10px;
  z-index: 100;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  pointer-events: none;
  transform: translateY(75px);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

.scroll-top.is-visible {
  pointer-events: auto;
  transform: translateY(0px);
}

.scroll-top img {
  display: block;
}

@media (max-width: 768px) {
  .scroll-top {
    right: 20px;
  }

  .scroll-top img {
    width: 19px;
    height: 35px;
  }
}
