/*
 * SSHEN — homepage styles
 * Rebuilt from the Cargo site (sshen.info). All sizes are in rem, and the
 * root font-size scales with the viewport the same way Cargo's does:
 *   375px → 9.6px · 1024px → 11.06px · 1440px → 12.96px · 1920px → 14.4px
 */

/* ABC Diatype Edu (Dinamo, educational license). License terms forbid public
 * repositories and public servers for the font files: keep this repo private. */

@font-face {
  font-family: "ABC Diatype";
  src: url("/fonts/ABCDiatypeEdu-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "ABC Diatype";
  src: url("/fonts/ABCDiatypeEdu-RegularItalic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "ABC Diatype";
  src: url("/fonts/ABCDiatypeEdu-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "ABC Diatype";
  src: url("/fonts/ABCDiatypeEdu-MediumItalic.woff2") format("woff2");
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "ABC Diatype";
  src: url("/fonts/ABCDiatypeEdu-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "ABC Diatype";
  src: url("/fonts/ABCDiatypeEdu-BoldItalic.woff2") format("woff2");
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

:root {
  --font: "ABC Diatype", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --ink: rgba(0, 0, 0, 0.85);
  --ink-strong: #000;
  --muted: #9c9c9c;
  --hover: #9370db;
  --bg: #fff;

  --pad: 2.5rem;  /* page padding */
  --gap: 2.5rem;  /* column gutter */
  --row-gap: 2.6rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: min(calc(6.38px + 0.457vw), calc(8.64px + 0.3vw));
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.2rem;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
p {
  margin: 0;
}

img {
  -webkit-user-drag: none;
  -webkit-touch-callout: none; /* no "Save Image" long-press on iOS */
  user-select: none;
  display: block;
  max-width: 100%;
  height: auto;
  border: 0;
  margin-bottom: 0.5em;
}

a {
  color: var(--ink);
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover,
a:hover .title {
  color: var(--hover);
}

/* the image link itself shouldn't tint anything */
a.image-link:hover {
  color: inherit;
}

/* ---------- layout ---------- */

.container {
  width: 99%;
  margin: 0 auto;
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gap);
  align-items: start;
}

.span-1  { grid-column: span 1; }
.span-2  { grid-column: span 2; }
.span-3  { grid-column: span 3; }
.span-4  { grid-column: span 4; }
.span-5  { grid-column: span 5; }
.span-6  { grid-column: span 6; }
.span-7  { grid-column: span 7; }
.span-8  { grid-column: span 8; }
.span-9  { grid-column: span 9; }
.span-10 { grid-column: span 10; }
.span-11 { grid-column: span 11; }
.span-12 { grid-column: span 12; }

/* ---------- type ---------- */

.heading {
  font-family: var(--font);
  font-size: 3rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.04rem;
  color: var(--ink);
}

.small {
  font-size: 1.2rem;
  font-weight: 400;
  line-height: 1.6;
  color: var(--ink-strong);
}

.arrow {
  font-weight: 300;
  margin-left: 0.1em;
}

/* ---------- header ---------- */

.site-header {
  padding: var(--pad) var(--pad);
}

.site-header .heading a {
  color: var(--ink);
}

.site-header .heading a:hover {
  color: var(--hover);
}

/* ---------- main ---------- */

main {
  padding: var(--pad) var(--pad) 0;
}

.intro .links {
  margin-top: 1.6em;
}

.intro .links a {
  display: block;
  width: fit-content;
}

.intro p + p {
  margin-top: 1.6em;
}

.hero-image img {
  width: 100%;
  margin-bottom: 0;
}

/* section headings — spacing mirrors the live site per section */
.section-title {
  margin-top: var(--before, 6.5rem);
  margin-bottom: var(--after, 1.8rem);
}

.row + .row {
  margin-top: var(--row-gap);
}

/* ---------- project card ---------- */

.project .title {
  display: block;
  transition: color 0.3s ease;
}

.project .desc {
  margin-top: 1.8rem;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1.5;
}

.project .media {
  margin-top: 1.8rem;
}

.project .media {
  display: block;
}

.project .media img {
  width: 100%;
  margin-bottom: 0;
}

/* ---------- project pages (converted Cargo content) ---------- */

/* Cargo's default page margin is 2rem; some pages override it (see <main>) */
.cargo {
  --page-pad: 2rem;
  padding: var(--page-pad);
}

/* pages with a black content area (text colours come inline from Cargo) */
.cargo.dark {
  background: #000;
}

.cargo.loose small {
  line-height: 1.8;
}

/* Cargo's grid: columns separated by the row's pad, adjacent rows by min(pad) */
.cargo .row {
  --pad: 0rem;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--pad);
  align-items: start;
  margin-top: var(--top, 0);
}

.cargo .row.auto {
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
}

.cargo .col {
  min-width: 0;
}

/* images sit inline in the text flow, like Cargo */
.cargo img {
  display: inline;
  width: 100%;
  height: auto;
  vertical-align: baseline;
  margin-bottom: 0.5em;
}

/* an inline-block <small> shrink-wraps, so a 100%-wide image inside it collapses */
.cargo small:has(img) {
  display: inline;
}

.cargo small {
  display: inline-block;
  font-size: 1.2rem;
  font-weight: 400;
  line-height: 1.6;
  color: var(--ink-strong);
}

.cargo h2 {
  margin: 0;
  font-size: 2.4rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--ink);
}

.cargo hr {
  height: 1px;
  border: 0;
  background: rgba(0, 0, 0, 0.5);
  margin: 0.5em 0;
}

.cargo ol,
.cargo ul {
  margin: 0;
  padding: 0 0 0 2.5em;
}

.cargo iframe {
  border: 0;
}

/* ---------- footer ---------- */

.site-footer {
  margin-top: 4.2rem;
  padding: 0 2rem 3rem;
}

.site-footer a + a,
.site-footer span {
  margin-left: 2.4em;
}

/* ---------- mobile (Cargo's mobile layout) ---------- */

@media (max-width: 767px) {
  html {
    font-size: 9.6px;
  }

  :root {
    --pad: 2rem;
  }

  .container {
    width: 100%;
  }

  .grid {
    grid-template-columns: minmax(0, 1fr);
    row-gap: var(--gap);
  }

  [class*="span-"] {
    grid-column: 1 / -1;
  }

  .cargo {
    padding: var(--pad);
  }

  .cargo .row.responsive {
    grid-template-columns: minmax(0, 1fr);
    row-gap: var(--pad);
  }

  .cargo .row.responsive > .col {
    grid-column: 1 / -1;
  }

  .cargo .row.responsive > .col.empty {
    display: none;
  }

  /* empty spacer columns only exist to keep desktop rows aligned */
  .grid > :empty {
    display: none;
  }

  .row + .row {
    margin-top: var(--gap);
  }

  .site-footer {
    padding: 0 1.6rem 2.4rem;
  }

  .site-footer span {
    display: block;
    margin: 0.4em 0 0;
  }
}
