@import url('./tokens.css');

/* ==============================================
   CSS CUSTOM PROPERTIES
============================================== */
:root {
  --content-width: 100%;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

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

/* ==============================================
   HEADER
============================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  border-bottom: 1px solid transparent;
  transition: background 0.2s, border-color 0.2s;
}

.site-header.scrolled {
  background: rgba(10, 10, 10, 0.9);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom-color: var(--divider);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  height: var(--header-height);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

@media (min-width: 64em) {
  .header-inner {
    padding-left: 0;
    padding-right: 0;
  }
}

/* Logo */
.header-logo {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: var(--size-base);
  letter-spacing: -0.02em;
  color: var(--text);
  transition: opacity 0.2s;
}

.header-logo:hover {
  opacity: 0.75;
}

/* Desktop nav */
.header-nav ul {
  display: none;
  list-style: none;
  align-items: center;
  gap: 0.125rem;
}

@media (min-width: 48em) {
  .header-nav ul {
    display: flex;
  }
}

.header-nav .nav-link {
  font-size: var(--size-sm);
  color: var(--text-muted);
  padding: 0.375rem 0.75rem;
  border-radius: 0.375rem;
  display: block;
  transition: color 0.2s, background 0.2s;
}

.header-nav .nav-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.header-nav .nav-item.active .nav-link {
  color: var(--text);
}

/* Hamburger button */
.menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  background: none;
  border: 1px solid var(--border-pill);
  border-radius: var(--radius-pill);
  cursor: pointer;
  padding: 0;
  color: var(--text);
}

@media (min-width: 48em) {
  .menu-btn {
    display: none;
  }
}

.menu-icon,
.menu-icon::before,
.menu-icon::after {
  display: block;
  width: 1.125rem;
  height: 1.5px;
  background: currentColor;
  transition: transform 0.25s, opacity 0.25s;
}

.menu-icon {
  position: relative;
}

.menu-icon::before,
.menu-icon::after {
  content: '';
  position: absolute;
  left: 0;
}

.menu-icon::before {
  top: -5px;
}

.menu-icon::after {
  bottom: -5px;
  top: auto;
}

.menu-btn[aria-expanded="true"] .menu-icon {
  background: transparent;
}

.menu-btn[aria-expanded="true"] .menu-icon::before {
  transform: translateY(5px) rotate(45deg);
}

.menu-btn[aria-expanded="true"] .menu-icon::after {
  transform: translateY(-5px) rotate(-45deg);
}

/* Mobile menu overlay */
.mobile-menu {
  display: none;
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  background: rgba(10, 10, 10, 0.95);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  padding: 1.5rem;
  flex-direction: column;
}

.mobile-menu.is-open {
  display: flex;
  animation: mobileMenuIn 0.2s ease-out;
}

@keyframes mobileMenuIn {
  from {
    opacity: 0;
    transform: scale(0.97);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.mobile-menu ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.mobile-menu a {
  display: block;
  font-size: var(--size-base);
  color: var(--text-muted);
  padding: 0.625rem 0.75rem;
  border-radius: 0.375rem;
  transition: color 0.2s, background 0.2s;
}

.mobile-menu a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

/* ==============================================
   WRAPPER / LAYOUT
============================================== */
.wrapper {
  flex: 1 0 auto;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 2rem 0;
  display: flex;
  flex-direction: column;
}

@media (min-width: 64em) {
  .wrapper {
    padding-left: 0;
    padding-right: 0;
  }
}

/* ==============================================
   MAIN CONTENT
============================================== */
.main {
  min-width: 0;
  width: 100%;
  margin-block: auto;
}

/* ==============================================
   PAGES (tab switching)
============================================== */
.page {
  display: none;
  min-height: 60vh;
}

.page.active {
  display: block;
}

/* ==============================================
   ABOUT — prose
============================================== */
.site-title {
  font-family: var(--font-display);
  color: var(--accent-mint);
  font-weight: 500;
  font-size: var(--size-display);
  letter-spacing: var(--track-display);
  line-height: 1.0;
  margin: 3rem 0 2rem;
}


@media (min-width: 48em) {
  .prose {
    width: var(--content-width);
  }
}

.prose p {
  font-family: var(--font-prose);
  font-size: var(--size-base);
  color: var(--prose-text);
  line-height: 1.8;
  margin-bottom: 1.5rem;
}

@media (min-width: 48em) {
  .prose p {
    font-size: var(--size-base);
  }
}

.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: opacity 0.2s;
}

.prose a:hover {
  opacity: 0.75;
}

/* ==============================================
   ABOUT — layout & portrait
============================================= */
.about-layout {
  display: flex;
  flex-direction: column-reverse;
  gap: 2.5rem;
}

.portrait-container {
  align-self: center;
  width: 100%;
  max-width: 240px;
  aspect-ratio: 340 / 720;
  overflow: hidden;
}

#portrait-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

@media (min-width: 48em) {
  .about-layout {
    display: grid;
    grid-template-columns: 1.25fr 0.75fr;
    gap: 3rem;
    align-items: start;
  }

  .portrait-container {
    max-width: 100%;
    align-self: start;
  }
}

/* ==============================================
   WRITING — article list
============================================== */
.article-list {
  list-style: none;
}

@media (min-width: 48em) {
  .article-list {
    width: var(--content-width);
  }
}

.article-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--divider);
}

.article-item:first-child {
  border-top: 1px solid var(--divider);
}

.article-item a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  width: 100%;
  gap: 1rem;
}

.article-title {
  font-weight: 700;
  font-size: var(--size-base);
  color: var(--text);
  transition: opacity 0.2s;
}

.article-item a:hover .article-title {
  opacity: 0.65;
}

.article-date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ==============================================
   PROJECTS — filter + grid
============================================== */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
}

.filter-label {
  font-size: var(--size-sm);
  color: var(--text-muted);
  margin-right: 0.25rem;
}

.filter-btn {
  font-family: var(--font-ui);
  font-size: var(--size-sm);
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  padding: 0.4rem 1rem;
  cursor: pointer;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.filter-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.09);
}

.filter-btn.active {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
}

.filter-btn.active:hover {
  background: var(--accent);
  opacity: 0.9;
}

.filter-btn.active::after {
  content: "\00d7";
  margin-left: 0.45rem;
  font-size: 1.05em;
  line-height: 0;
  vertical-align: middle;
}

.filter-btn:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
}

.project-grid {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.project-card {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 1.25rem;
  cursor: pointer;
  transition: opacity 0.2s;
  text-decoration: none;
}

.project-card:hover {
  opacity: 0.7;
}

.project-card.is-hidden {
  display: none;
}

.project-thumb {
  width: 120px;
  height: 120px;
  flex-shrink: 0;
  background: var(--divider);
  border-radius: 0.25rem;
  overflow: hidden;
  display: none;
  /* thumbnails hidden until final imagery lands */
}

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

.project-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0.25rem 0;
}

.project-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.project-brand {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3.5vw, 1.5rem);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.05;
  color: var(--text);
  margin-bottom: 0.875rem;
}

.project-brand .sep {
  margin: 0 0.3rem;
  color: var(--text-dim);
  font-weight: 400;
}

.project-logo {
  width: 2rem;
  height: 2rem;
  background: var(--divider);
  border-radius: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--size-xs);
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 0.625rem;
  flex-shrink: 0;
}

.project-logos {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.875rem;
}

.project-logos .project-logo {
  margin-bottom: 0;
}

.project-logos img {
  height: 1.125rem;
  width: auto;
  display: block;
  /* force any source logo to a single grey */
  filter: brightness(0) invert(0.78);
}

.project-logos .logo-x {
  font-size: calc(var(--size-xs) * 2);
  color: var(--text-dim);
  line-height: 1;
  margin: 0 -0.667rem;
  /* pull the × closer to the logos either side */
}

/* compact lockups need extra height to keep their wordmark legible */
.project-logos img.logo-tall {
  height: 1.625rem;
}

.project-desc {
  font-family: var(--font-prose);
  font-size: var(--size-lg);
  color: var(--prose-text);
  line-height: 1.8;
  margin-bottom: 1.5rem;
}

@media (min-width: 48em) {
  .project-desc {
    font-size: var(--size-base);
  }
}

.project-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  order: 2;
  /* mobile: categories sit below the logos + description */
}

@media (min-width: 48em) {
  .project-info {
    flex-direction: row;
    gap: 2rem;
  }

  .project-cats {
    /* desktop: categories form a right rail (order 2 inherited from base) */
    flex: 0 0 11rem;
    align-content: flex-start;
    justify-content: flex-end;
  }
}

.project-cats span {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: var(--track-label);
  color: var(--text-muted);

  padding: 0.25rem 0.625rem;
}

/* ==============================================
   BREADCRUMB
============================================== */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  color: var(--text-dim);
  margin-bottom: 3rem;
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--text-muted);
  transition: color 0.2s;
}

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

.breadcrumb [aria-current="page"] {
  color: var(--text);
}

.breadcrumb-sep {
  user-select: none;
}

/* ==============================================
   FOOTER
============================================== */
.site-footer {
  width: 100%;
  margin-top: 4rem;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  height: var(--header-height);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--size-sm);
  color: var(--text-muted);
}

@media (min-width: 64em) {
  .footer-inner {
    padding-left: 0;
    padding-right: 0;
  }
}

.social-icons {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.social-icons a {
  color: var(--text-dim);
  display: flex;
  align-items: center;
  transition: opacity 0.2s;
}

.social-icons a:hover {
  opacity: 0.8;
}

.social-icons svg {
  width: 1.125rem;
  height: 1.125rem;
  fill: currentColor;
}