* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  list-style-type: none;
}

:root {
  /* Fixed page background on every screen — the device's dark/light preference is
     deliberately ignored, so the text and border tokens stay pinned to it below.
     This hex is the sRGB equivalent of the oklch() value applied further down. */
  --background-color: #151617;
  --color: #eee;
  --border: rgba(255, 255, 255, 0.2);
  --padding: clamp(16px, 6vw, 48px);
  --type-size: 16px;
  --large-type-size: clamp(16px, 4vw, 32px);
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --gutter: 24px;
  /* The text column's original allocation. The column itself renders at 90% of
     this, while the image column is still sized off the full value, so narrowing
     the text widens the gap instead of the images. */
  --text-column: max(25%, 400px);
}

/* Custom properties are not validated when they are declared, so writing the
   oklch() value straight into the token would overwrite the hex even in browsers
   that cannot parse it — var() would then resolve to garbage, the declaration
   would be thrown away, and the page would render on a transparent (white)
   background. Safari before 16.4 does exactly that. Gating on real support keeps
   the oklch value for browsers that have it and the hex everywhere else. */
@supports (background-color: oklch(0.2 0.003 240)) {
  :root {
    --background-color: oklch(0.2 0.003 240);
  }
}

body {
  font-family: var(--font-family);
  font-size: var(--type-size);
  line-height:  1.6;
  background-color: var(--background-color);
  color: var(--color);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  text-size-adjust: none;
}

.container {
  width: 100%;
  display: flex;
  flex-direction: column;
  margin: 0 auto;
}

.navigation {
  column-gap: var(--padding);
  padding: var(--padding) var(--padding) 0;
  display: flex;
  flex-direction: row;
}

.infoToggle {
  margin-left: auto;
  font-family: var(--font-family);
  font-size: var(--type-size);
  line-height:  1.6;
  display: flex;
  column-gap: 4px;
  background-color: transparent;
  border: none;
  outline: none;
  font-weight: 500;
  cursor: pointer;
  align-items: center;
  color: var(--color);
}

.infoToggle:active {
  opacity: 0.7;
}

h1, h2 {
  font-weight: 500;
  font-size: var(--type-size);
}

/* Even out ragged line breaks in the short project blurbs. The info page is left
   to wrap naturally. Ignored by browsers without support (Safari < 17.5). */
.projectInfo h2,
.projectInfo p {
  text-wrap: balance;
}

p {
  margin-bottom: calc((var(--type-size) * 1.6) / 2);
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: inherit;
  text-decoration: none;
  width: fit-content;
  border-bottom: 1px solid var(--border);
}

a:active {
  opacity: 0.7;
}

.projects {
  width: 100%;
  display: flex;
  flex-direction: column;
}

.project {
  width: 100%;
  display: flex;
  flex-direction: row;
  margin: 0 auto;
  column-gap: var(--padding);
}

.projectInfo {
  height: fit-content;
  padding: var(--padding);
  padding-right: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: sticky;
  top: 0;
  width: calc(var(--text-column) * 0.9);
  flex-shrink: 0;
}

.attachments {
  /* Sized off the full --text-column, so it matches what it rendered at before
     the text column was narrowed; margin-left absorbs the freed 10%. */
  width: calc(100% - var(--text-column) - var(--padding));
  flex: 0 0 auto;
  margin-left: auto;
  padding: var(--padding);
  padding-left: 0;
}

.media {
  width: 100%;
  position: relative;
  display: block;
  border-radius: 8px;
  overflow: hidden;
  border-bottom: none;
}

.media::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 1px solid var(--border);
  pointer-events: none;
  z-index: 1;
  border-radius: inherit;
}

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

hr {
  outline: none;
  border: none;
  height: 1px;
  background-color: var(--border);
}

.information {
  padding: var(--padding);
  font-size: var(--large-type-size);
}

.information p {
  margin-bottom: calc((var(--large-type-size) * 1.6) / 2);
}

/* Masonry grid — single ordered column by default, script.js splits it into
   two balanced columns when there is room (replaces the masonic component). */
.masonry {
  display: flex;
  flex-direction: column;
  gap: var(--gutter);
  align-items: flex-start;
}

.masonry.cols-2 {
  flex-direction: row;
}

.masonryColumn {
  display: flex;
  flex-direction: column;
  gap: var(--gutter);
  flex: 1 1 0;
  min-width: 0;
}

/* Replaces the framer-motion cross-fade between the two views. */
.projects,
.information {
  animation: fadeIn 0.3s ease both;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .projects,
  .information {
    animation: none;
  }
}

/* Nav items are links here rather than buttons, so drop the underline. */
.navigation a {
  border-bottom: none;
}

.projectInfo a:hover,
.information a:hover {
  border-bottom: 1px solid;
}

@media (max-width: 900px) {
  .project {
    flex-direction: column;
    row-gap: var(--padding);
  }

  .projectInfo {
    width: 100%;
    padding-right: var(--padding);
    padding-bottom: 0;
    position: relative;
    top: unset !important;
    min-width: unset;
    min-height: unset;
  }

  .attachments {
    width: 100%;
    margin-left: 0;
    padding-left: var(--padding);
    padding-top: 0;
  }
}
