/* ---------------------------------------------------------------
   Kenneth Máximo Schultz
   Paper, ink, and a little shadow.
   --------------------------------------------------------------- */

/* The site is set in Helvetica Neue, which Macs and iPhones already have.
   Everyone else gets TeX Gyre Heros, a free Helvetica lookalike
   (GUST Font License, see fonts/GUST-FONT-LICENSE.txt), trimmed to Latin
   characters. Browsers only download it when Helvetica Neue is missing. */
@font-face {
  font-family: "Heros Web";
  src: url("/fonts/heros-web-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Heros Web";
  src: url("/fonts/heros-web-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  --paper: #fcfbf8;
  --ink: #26231f;
  --ink-soft: #6f675e;
  --rule: #ddd6cb;
  --accent: #a3412c;
  --highlight: #f7a24b;
  --highlight-soft: #fde2c4;
  --shadow: 0 1px 2px rgba(90, 45, 10, 0.16), 0 4px 10px rgba(90, 45, 10, 0.16);
  --font: "Helvetica Neue", "Heros Web", Helvetica, Arial, sans-serif;

  /* The one spacing unit: page edges, the gaps between columns,
     and the gap under the name all use it, so they always match. */
  --gap: 2rem;

  /* Width of the photo, and of the text lined up under it. */
  --column: 31rem;
}

* { box-sizing: border-box; }

/* Every size on the page is measured from this one number.
   It grows a little on wide screens so big monitors don't feel empty. */
html {
  font-size: clamp(18px, 1.6vw, 22px);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: var(--gap);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  display: grid;
  /* The left column is exactly as wide as the name needs. */
  grid-template-columns: max-content minmax(0, 1fr);
  column-gap: var(--gap);
}

/* Faint paper grain over everything. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Trim the empty space above capital letters so the first line of text
   sits exactly on the same top edge as the photo. */
.name,
.bio,
h2 {
  text-box: trim-both cap alphabetic;
}

/* ---------- Links: an orange slip lifts when you touch it ---------- */

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  padding: 0.2em 0.45em;
  margin: 0 -0.45em;
  border-radius: 3px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  transition: box-shadow 0.2s ease, background-color 0.2s ease,
              text-decoration-color 0.2s ease;
}

a:hover,
a:focus-visible {
  background-color: var(--highlight);
  box-shadow: var(--shadow);
  text-decoration-color: transparent;
  outline: none;
}

a:active {
  box-shadow: 0 1px 2px rgba(90, 45, 10, 0.2);
}

/* ---------- Section labels: side links and headings share one style ---------- */

h2,
.sidebar nav a {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ---------- Sidebar ---------- */

.sidebar {
  position: sticky;
  top: var(--gap);
  align-self: start;
}

.name {
  margin: 0 0 var(--gap);
  font-size: 1.2rem;
  font-weight: 400;
  line-height: 1.2;
  white-space: nowrap; /* always one line */
  color: var(--accent);
}

.name a {
  text-decoration: none;
  padding: 0;
  margin: 0;
}

.name a:hover,
.name a:focus-visible {
  background: none;
  box-shadow: none;
  color: var(--ink);
}

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

.sidebar li + li { margin-top: 0.7rem; }

.sidebar nav a {
  text-decoration: none;
}

.sidebar nav a:hover,
.sidebar nav a:focus-visible,
.sidebar nav a[aria-current] {
  color: var(--ink);
}

/* "You are here": a paler slip than the hover one. */
.sidebar nav a[aria-current]:not(:hover) {
  background-color: var(--highlight-soft);
}

/* ---------- Main column ---------- */

main { min-width: 0; }

section { scroll-margin-top: var(--gap); }

section + section { margin-top: calc(var(--gap) * 2); }

h2 {
  margin: 0 0 var(--gap);
  line-height: 1.2;
}

p { margin: 0 0 1rem; }

i { font-style: italic; }

/* Everything in the main column shares one width, so the photo,
   the bio and the lists all end on the same right edge. */
.home,
.works {
  max-width: var(--column);
}

/* Home: the photo, with the bio set close underneath like a caption. */
.home {
  display: grid;
  gap: calc(var(--gap) * 0.5);
}

.print {
  margin: 0;
  padding: 0.35rem;
  background: #fff;
  box-shadow: 0 1px 2px rgba(40, 30, 20, 0.08), 0 6px 18px rgba(40, 30, 20, 0.09);
}

.print img {
  display: block;
  width: 100%;
  height: auto;
}

.bio { margin: 0; }

/* Writing */
.works {
  list-style: none;
  margin: 0;
  padding: 0;
}

.works li + li { margin-top: 1.1rem; }

.works .source {
  display: block;
  font-size: 0.75rem;
  color: var(--ink-soft);
}

/* Contact */
.contact {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.5rem var(--gap);
  margin: 0;
}

.contact dt {
  font-size: 0.75rem;
  line-height: 1.6rem;
  color: var(--ink-soft);
}

.contact dd { margin: 0; }

footer {
  margin-top: calc(var(--gap) * 2);
  font-size: 0.7rem;
  color: var(--ink-soft);
}

footer p { margin: 0; }

/* ---------- Phones and narrow windows ---------- */

@media (max-width: 760px) {
  :root { --gap: 1.25rem; }

  html { font-size: 16px; }

  body {
    display: block;
    padding: 0;
  }

  .sidebar {
    top: 0;
    z-index: 5;
    padding: var(--gap) var(--gap) 0.9rem;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
  }

  /* Shrinks with the screen so it still fits on one line. */
  .name {
    margin-bottom: 0.9rem;
    font-size: min(1.2rem, 5.6vw);
  }

  .sidebar ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.5rem;
  }

  .sidebar li + li { margin-top: 0; }

  main { padding: var(--gap); }

  section { scroll-margin-top: 5.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  a { transition: none; }
}
