@import url('variables.css');

h1,
h2,
h3,
h4,
p,
ul,
figure {
  margin-top: var(--space-md);
  margin-bottom: var(--space-md);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding: 120px;
}

.content-wrapper {
  max-width: 1280px;
  margin: auto;
}

.note-wrapper {
  max-width: 1280px;
  margin: auto;
  margin-top: var(--space-lg);
  padding: 0 var(--space-sm) var(--space-sm) var(--space-sm);
}

.now-wrapper {
  margin-top: var(--space-lg);
}

@media (max-width: 1280px) {
  .content-wrapper {
    padding: 0 var(--space-sm) var(--space-sm) var(--space-sm);
  }
}

/* Dividers */

.medium-divider {
  height: var(--space-md);
}

.large-divider {
  height: var(--space-lg);
}

hr.solid {
  border: 1px solid var(--color-border-thin);
}

/* Navigation */

.navbar {
  width: 100%;
  background: var(--color-background);
  padding: 0 1rem;
  top: 0;
  z-index: 3;
  position: sticky;
  border-bottom: 1px solid var(--color-border-thin);
}

.nav-container {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-family: sans-serif;
}

.nav-logo {
  flex-shrink: 0;
}

.nav-logo a {
  font-weight: 400;
  font-size: var(--font-size-large-p);
  color: inherit;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 0;
  /* Last item's side border would otherwise push the links inward */
  margin: 0 -0.5rem 0 0;
  padding: 0;
  min-width: 0;
  /* Scrolls sideways on very narrow screens instead of wrapping */
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}

.nav-links::-webkit-scrollbar {
  display: none;
}

.nav-links li {
  margin-bottom: 0;
}

.nav-links li a {
  display: block;
  text-decoration: none;
  padding: 0.4rem;
  /* Transparent border widens the tap area to the full menu height and
     closes the gaps between items; the hover background stays the old pill */
  border: solid transparent;
  border-width: 1.1rem 0.5rem;
  background-clip: padding-box;
  /* Matches the old inline link, so the hover pill keeps its height */
  line-height: 1.3;
  font-weight: 400;
  font-size: var(--font-size-p);
  color: inherit;
  /* 12px visible radius on the padding box, plus the border widths */
  border-radius: calc(12px + 0.5rem) / calc(12px + 1.1rem);
  transition: color 1s ease, background-color 1s ease;
}

.nav-links li a.active {
  text-decoration: underline;
  text-decoration-thickness: 0.05rem;
  text-underline-offset: 0.2rem;
  text-decoration-color: color-mix(in srgb, currentColor 20%, transparent);
}

.nav-links li a:hover {
  background-color: var(--color-background-subtle);
  transition: none;
}

/* Section Styles */

section {
  margin-top: 2rem;
  margin-bottom: 4rem;
}

.note-section {
  margin-bottom: 6rem;
}

/* Text styles */

body {
  font-family: "Source Serif 4", serif;
  line-height: clamp(1.66, 2vw, 1.75);
  margin: auto;
  color: var(--color-text);
}

hgroup {
  margin: var(--space-lg) 0 var(--space-lg) 0;
}

h1 {
  font-family: "Source Serif 4", serif;
  font-weight: 500;
  font-size: var(--font-size-h1);
  line-height: 1.4;
  padding-bottom: 5px;
  margin-top: 0;
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
}

h2 {
  font-family: 'Instrument Sans', Helvetica, sans-serif;
  font-weight: 400;
  font-size: var(--font-size-h2);
  margin-top: 0;
  margin-bottom: 1.2rem;
  text-decoration-thickness: 50%;
  letter-spacing: -0.02em;
}

.note-wrapper h2 {
  font-family: 'Instrument Sans', Helvetica, sans-serif;
  text-transform: uppercase;
  font-weight: 400;
  font-size: var(--font-size-h4);
  color: var(--color-text-subheading);
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

h3 {
  font-weight: 600;
  font-size: var(--font-size-p);
  margin-top: 0;
  margin-bottom: 0;
}

h4 {
  font-weight: 500;
  font-size: var(--font-size-h4);
  margin-top: 0;
  margin-bottom: 0.3rem;
}

h2,
h3,
h4 {
  scroll-margin-top: 5rem;
}

:is(p, ul, figure)+ :is(h2, h3, h4) {
  margin-top: var(--space-lg);
}

p {
  font-family: "Source Serif 4", serif;
  font-optical-sizing: auto;
  font-size: var(--font-size-p);
  margin-block-start: 1em;
  margin-block-end: 0.5em;
  letter-spacing: 0.01em;
  line-height: 1.4;
}

.large-p {
  font-size: var(--font-size-large-p);
  line-height: 1.6;
}

small {
  color: var(--color-text-subtle);
  font-size: var(--font-size-small);
  font-weight: 400;
  font-family: 'Instrument Sans', Helvetica, sans-serif;
  letter-spacing: 0.03em;
}

.subheader {
  font-family: 'Instrument Sans', Helvetica, sans-serif;
  font-weight: 400;
  font-size: var(--font-size-h3);
  margin-top: 0;
  margin-bottom: 0.5rem;
  line-height: 1.66;
  letter-spacing: -0.01em;
}

.subheader-small {
  font-weight: 400;
  font-size: var(--font-size-h4);
  margin-top: 0;
  margin-bottom: 1.5rem;
  color: var(--color-text-subheading);
}

ul {
  font-family: "Source Serif 4", serif;
  font-size: var(--font-size-p);
  font-weight: 400;
  margin-top: calc(1rem - var(--space-md));
  line-height: 1.6;
  list-style: disc outside;
  padding-inline-start: 1.5em;
}

ul li::marker {
  font-size: 0.6em;
  color: var(--color-text-subtle);
}

ol {
  font-family: "Source Serif 4", serif;
  font-size: var(--font-size-p);
  font-weight: 400;
  margin-top: calc(1rem - var(--space-md));
  line-height: 1.6;
  list-style-position: outside;
  padding-inline-start: 1.5em;
}


li {
  font-size: var(--font-size-p);
  font-weight: 400;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

/* Images */

img {
  max-width: 100%;
  height: auto;
  display: block;
}

figcaption {
  color: var(--color-text-subtle);
  font-family: 'Instrument Sans', Helvetica, sans-serif;
  text-align: left;
  font-size: var(--font-size-small);
  margin-top: 0.5rem;
}

figcaption a {
  font-weight: 500;
  max-width: 100%;
  color: inherit;
}

.post-image {
  border: 1px solid var(--color-border-subtle);
  border-radius: 1rem;
  box-shadow: 0 2px 8px var(--color-shadow);
}

.no-bg-image {
  max-width: 100%;
}

.figure-half {
  max-width: 50%;
}

@media (max-width: 600px) {
  .figure-half {
    max-width: 100%;
  }
}

.small-grid-image {
  height: 200px;
  width: auto;
}

.inline-icon {
  display: inline;
  margin: 0 0.125em;
  padding: 0;
  vertical-align: text-bottom;
  height: 24px;
}

/* Links */

a {
  transition: text-decoration 0.2s;
  font-weight: 400;
  text-decoration: underline;
  text-decoration-thickness: 0.05rem;
  text-underline-offset: 0.2rem;
  /* Underline is the link colour at 20% opacity */
  text-decoration-color: color-mix(in srgb, currentColor 20%, transparent);
  color: var(--color-link);
  border-radius: 4px;
}

a:hover {
  color: var(--color-text);
  transition: none;
}

figure {
  display: flex;
  flex-direction: column;
  padding-bottom: var(--space-lg);
  margin-inline-start: 0;
  margin-inline-end: 0;
}

mark {
  background-color: var(--color-background-accent);
}

/* Footnotes */

.footnote-ref {
  color: var(--color-text-accent);
  font-size: 0.9rem;
  font-weight: 400;
  text-decoration: none;
  vertical-align: super;
  position: relative;
}

.footnotes {
  font-size: var(--font-size-p);
  color: var(--color-text-subheading);
  margin-top: 3rem;
}

.footnotes ol {
  padding-left: 1.5rem;
}

.footnotes li {
  margin-bottom: 0.5rem;
}

.backlink {
  font-size: var(--font-size-p);
  text-decoration: none;
  margin-left: 0.3rem;
  color: var(--color-text);
}

h1 .footnote-ref,
h2 .footnote-ref,
h3 .footnote-ref,
h4 .footnote-ref {
  font-size: 1.4rem;
  font-weight: 400;
  line-height: 0.5;
  vertical-align: baseline;
  position: relative;
  top: -0.5em;
  text-decoration: none;
  color: var(--color-text-accent);
}

[id^="ref-"],
[id^="footnote-"] {
  scroll-margin-top: 7rem;
}

/* Utility text classes */

.big {
  font-size: var(--font-size-large-p);
  line-height: 1.6;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.centered {
  text-align: center;
}

/* Blocks */

.framed {
  background-color: var(--color-background-framed);
  border-color: var(--color-border-subtle);
  border-style: solid;
  border-width: 0.5px;
  border-radius: 0.5rem;
  color: var(--color-text);
  padding: 1.2rem 1.6rem 1.6rem 1.2rem;
  margin-bottom: 2rem;
  box-shadow: 0px 2px 8px 0 rgba(119, 119, 119, 0.2);
}

.post-note {
  background-color: var(--color-background);
  border-radius: 0.75rem;
  border: 1px solid var(--color-border-subtle);
  color: var(--color-text);
  margin: auto;
  text-align: center;
  padding: 1.5rem 0 3rem 0;
  box-shadow: 0 2px 8px var(--color-shadow);
}

.disclaimer {
  background-color: var(--color-background);
  border-radius: 0.5rem;
  border: 1px solid var(--color-border-subtle);
  color: var(--color-text);
  margin: 2.6rem auto;
  width: 75%;
  text-align: center;
  padding: 1.5rem;
  box-shadow: 0 2px 8px var(--color-shadow);
}

.disclaimer h2 {
  color: var(--color-text-negative);
}

@media (max-width: 820px) {
  .post-note {
    width: 100%;
  }

  .disclaimer {
    width: 100%;
  }
}

blockquote {
  font-family: "Source Serif 4", serif;
  font-size: var(--font-size-p);
  padding-left: var(--space-sm);
  border-left: 3px solid var(--color-border-subtle);
  margin-bottom: 2rem;
}

/* Footer */

footer p {
  margin: 0;
}

footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--color-background);
  border-top: 1px solid var(--color-border-thin);
  margin-top: var(--space-md);
  padding: 1.5rem 1rem;
  top: 0;
  color: var(--color-text);
  position: sticky;
}

@media (max-width: 768px) {
  footer {
    flex-direction: column-reverse;
    align-items: center;
    text-align: center;
  }

  footer>* {
    margin-bottom: 1rem;
  }

  footer>*:last-child {
    margin-bottom: 0;
  }
}

.contact-links {
  display: flex;
  flex-direction: row;
  gap: 1rem;
}

.contact-links a {
  text-decoration: none;
}

/* Tags */

.word-tag {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

.tag {
  background-color: var(--color-background-subtle);
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.05rem;
  font-weight: 400;
  color: var(--color-text);
  transition: color 1s ease, background-color 1s ease;
  font-size: var(--font-size-small);
  font-family: 'Instrument Sans', Helvetica, sans-serif;
}

.tag:hover {
  background-color: #e3e3ff;
  color: var(--color-text-accent);
  transition: none;
}

/* Notes Grid */

.notes-grid {
  columns: 3;
  gap: var(--space-md);
  margin-top: 2rem;
  margin-bottom: 3rem;
}

.notes-grid>.note-card {
  break-inside: avoid;
  margin-bottom: 1.5rem;
}

@media (max-width: 1024px) {
  .notes-grid {
    columns: 2;
  }
}

@media (max-width: 600px) {
  .notes-grid {
    columns: 1;
  }
}

/* Note Entry */

.note-card div {
  display: flex;
  flex-direction: row;
}

.note-card h3 {
  margin-bottom: 0.2rem;
  font-size: var(--font-size-h4);
}

.note-card small {
  font-size: var(--font-size-small);
  color: var(--color-text-subtle);
}

.note-card a {
  text-decoration: none;
}

.note-card a:hover {
  text-decoration: underline;
  text-decoration-thickness: 0.05rem;
  text-decoration-color: color-mix(in srgb, currentColor 20%, transparent);
}

/* Note subheader */

.entry-data {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  border-bottom: 1px solid var(--color-border-thin);
  padding-top: 1rem;
  padding-bottom: 1rem;
  color: var(--color-text);
}

/* Case Cards */

.case-card-link {
  text-decoration: none;
  display: block;
}

.case-card-static {
  display: block;
  cursor: default;
}

.case-card-link:hover,
.case-card-link:focus,
.case-card-link:visited,
.case-card-link:active {
  color: inherit;
  text-decoration: none;
  background: none;
}

/* Case Grid — two independent columns */

.case-columns {
  display: flex;
  gap: var(--space-lg);
  align-items: flex-start;
  margin-bottom: 3rem;
}

.case-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: calc(var(--space-lg) * 1.5);
}

@media (max-width: 600px) {
  .desktop-only {
    display: none;
  }
}

@media (min-width: 601px) {
  .mobile-only {
    display: none;
  }
}

/* Large card — image on top, content below */

.case-card-large {
  color: var(--color-text);
}

.case-card-large-image {
  overflow: hidden;
  border-radius: 2px;
}

.case-card-large-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 2px;
  transition: transform 0.2s ease-in;
}

.case-card-link:hover .case-card-large-image img {
  transform: scale(1.03);
}

.case-card-large-content {
  padding-top: var(--space-sm);
}

.case-card-large-content h2,
.case-card-small-content h2 {
  margin-top: 0;
  margin-bottom: 0.25rem;
  font-size: calc(var(--font-size-h2) * 0.8);
}

.case-card-large-content p {
  font-family: 'Instrument Sans', Helvetica, sans-serif;
  margin-block-start: 0.5em;
}

/* Small card — image left, text right */

.case-card-small {
  display: flex;
  flex-direction: row;
  gap: 1rem;
  color: var(--color-text);
}

.case-card-small-image {
  flex: 0 0 58%;
  overflow: hidden;
  border-radius: 2px;
  aspect-ratio: 1 / 1;
}

.case-card-small-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.case-card-small-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Meta row: tag + year */

.case-card-meta {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

/* Case study body */

@media (min-width: 821px) {

  .case-body>h2,
  .case-body>h3,
  .case-body>h4,
  .case-body>p,
  .case-body>ul,
  .case-body>ol,
  .case-body>blockquote,
  .case-body .note-section>h2,
  .case-body .note-section>h3,
  .case-body .note-section>h4,
  .case-body .note-section>p,
  .case-body .note-section>ul,
  .case-body .note-section>ol,
  .case-body .note-section>blockquote,
  .case-body .note-section>.brief,
  .case-body .disclaimer>h2,
  .case-body .disclaimer>p {
    /* 8 of 12 grid columns */
    max-width: calc((100% - 11 * var(--space-md)) / 12 * 8 + 7 * var(--space-md));
  }
}

.case-header {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  align-items: center;
  column-gap: var(--space-md);
  margin-bottom: 3rem;
}

.case-header h1 {
  font-size: var(--font-size-h1);
  font-family: 'Instrument Sans', Helvetica, sans-serif;
  font-weight: 400;
  line-height: 1.2;
}

.case-header>div {
  grid-column: span 4;
}

.case-main-image {
  grid-column: span 8;
  width: 100%;
}

.case-header .subheader {
  font-size: var(--font-size-h4);
  line-height: 1.4;
  margin-top: 2rem;
}

.case-header .tag {
  pointer-events: none;
}

@media (max-width: 820px) {
  .case-header {
    grid-template-columns: 1fr;
  }

  .case-header>div,
  .case-main-image {
    grid-column: 1;
  }
}

.case-ui-video-frame {
  margin-bottom: 6rem;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.case-ui-video-frame h3 {
  font-family: 'Instrument Sans', Helvetica, sans-serif;
  font-weight: 400;
  font-size: var(--font-size-h2);
  margin-top: 0;
  margin-bottom: 1.2rem;
  text-decoration-thickness: 50%;
  letter-spacing: -0.02em;
}

.case-ui-video-box {
  margin: auto;
  height: 100%;
}

.case-ui-video {
  border-radius: 36px;
  max-height: 600px;
}

.case-ui-copy {
  width: 30%;
  border-radius: 40px;
}

@media (max-width: 600px) {
  .case-ui-video-frame {
    flex-direction: column;
  }

  .case-ui-copy {
    width: 100%;
  }
}

/* Project brief */

.brief-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin-top: 1rem;
}

.brief ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* 2-col image grid */

.masonry-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.masonry-2 figure {
  margin: 0;
}

@media (max-width: 600px) {
  .masonry-2 {
    grid-template-columns: 1fr;
  }
}

/* Grids */

.two-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.three-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

@media (max-width: 600px) {
  .two-grid {
    grid-template-columns: 1fr;
  }

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

/* Tables */

table {
  text-align: left;
  border-spacing: 0;
  table-layout: fixed;
}

th,
td {
  font-weight: 400;
  vertical-align: top;
  padding: 0 2rem 0 0;
  border-color: var(--color-border-gray);
  border-style: solid;
  border-width: 0.75px 0 0 0;
}

.list-plain {
  list-style: none;
  padding-inline-start: 1.5em;
}

/* 12-column page grid */

.grid-12 {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: var(--space-md);
}

.col-text {
  grid-column: 3 / 11;
}

.col-full {
  grid-column: 1 / -1;
}

.home-intro {
  display: grid;
  grid-template-columns: subgrid;
  align-items: center;
  row-gap: 1rem;
}

.home-intro .home-photo {
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 50%;
}

.home-intro h1 {
  grid-column: 3 / 11;
  grid-row: 1;
  margin: 0;
  padding: 0;
}

.home-intro .subheader {
  grid-column: 3 / 11;
  grid-row: 2;
  margin: 0;
}

@media (max-width: 1024px) {
  .col-text {
    grid-column: 2 / 12;
  }

  .home-intro .home-photo {
    grid-column: 2 / 4;
    width: 120px;
  }

  .home-intro h1,
  .home-intro .subheader {
    grid-column: 2 / 12;
  }

  .home-intro h1 {
    grid-row: 2;
  }

  .home-intro .subheader {
    grid-row: 3;
  }
}

@media (max-width: 600px) {
  .grid-12 {
    grid-template-columns: 1fr;
  }

  .col-text,
  .col-full,
  .home-intro .home-photo,
  .home-intro h1,
  .home-intro .subheader {
    grid-column: 1;
  }

  .home-intro .home-photo {
    width: 120px;
  }
}