/* Guy Faraché: single-page site
   One light theme by design (black on warm white). */

:root {
  --bg: #f6f5f1;
  --ink: #141312;
  --muted: #5c5852;
  --rule: #141312;
  --rule-soft: #d6d3cc;

  --font: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;

  --gutter: clamp(16px, 4vw, 48px);
  --max: 1320px;
  --col-gap: clamp(16px, 2vw, 32px);
  --nav-h: 56px;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }

a { color: inherit; }

::selection { background: var(--ink); color: var(--bg); }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: 8px;
  z-index: 20;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--bg);
  text-decoration: none;
  font-size: 0.875rem;
  transform: translateY(-160%);
}
.skip-link:focus { transform: none; }

.wrap {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- Navigation ---------- */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--rule-soft);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--nav-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 800;
  font-size: 0.9375rem;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.site-nav ul {
  display: flex;
  gap: clamp(4px, 2.2vw, 32px);
}

.site-nav nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: 6px;
  font-size: 0.8125rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 160ms ease;
}

.site-nav nav a[aria-current="true"],
.site-nav nav a:focus-visible { color: var(--ink); }

.site-nav nav a[aria-current="true"] {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 6px;
}

@media (hover: hover) and (pointer: fine) {
  .site-nav nav a:hover { color: var(--ink); }
}

/* ---------- Hero ---------- */

.hero {
  padding-top: clamp(3rem, 9vh, 6rem);
  padding-bottom: clamp(4rem, 12vh, 8rem);
}

.hero-name {
  font-size: clamp(2.25rem, 5vw, 4.25rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.hero-contact {
  list-style: none;
  margin: 0.9rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.5rem;
  font-family: var(--font);
  font-feature-settings: "calt" 0, "liga" 0;
  font-size: 0.875rem;
  color: var(--muted);
}
.hero-contact a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--rule-soft);
  text-underline-offset: 0.2em;
  transition: color 160ms var(--ease-out), text-decoration-color 160ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .hero-contact a:hover { color: var(--ink); text-decoration-color: var(--ink); }
}

.hero-body {
  margin-top: clamp(1.75rem, 4vh, 2.5rem);
  padding-top: clamp(1.5rem, 3vh, 2rem);
  border-top: 1px solid var(--rule);
}
.hero-body > * { max-width: 62rem; }

.typeline {
  font-size: clamp(1.125rem, 2.3vw, 1.75rem);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

/* The ghost reserves the final size of the line so typing never shifts layout. */
.type-stage {
  position: relative;
  display: block;
}
.type-ghost { visibility: hidden; display: block; }
.type-live {
  position: absolute;
  inset: 0;
}

.prompt {
  color: var(--muted);
  margin-right: 0.6em;
}

.caret {
  display: none;
  width: 0.55em;
  height: 1.05em;
  margin-left: 0.08em;
  vertical-align: -0.16em;
  background: var(--ink);
}

.is-typing .caret,
.is-done .caret { display: inline-block; }

.is-done .caret {
  animation: caret-blink 1.1s steps(1, end) 4 forwards;
}

@keyframes caret-blink {
  0%   { opacity: 1; }
  50%  { opacity: 0; }
  100% { opacity: 0; }
}

.hero-intro {
  margin-top: 1.5rem;
  max-width: 60ch;
  color: var(--muted);
  font-size: clamp(0.9375rem, 1.2vw, 1.0625rem);
}

.hero-cta { margin-top: 2rem; }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  min-height: 44px;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 6px;
  transition: text-underline-offset 200ms var(--ease-out);
}
.link-arrow span[aria-hidden] {
  display: inline-block;
  transition: transform 200ms var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .link-arrow:hover { text-underline-offset: 9px; }
  .link-arrow:hover span[aria-hidden] { transform: translateX(3px); }
}

.link-arrow:active span[aria-hidden] { transform: translateX(1px); }

/* ---------- Sections ---------- */

.section {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--col-gap);
  padding-top: clamp(1.25rem, 2vw, 1.75rem);
  padding-bottom: clamp(5rem, 11vw, 9rem);
  position: relative;
}

/* The divider lives inside the padded wrap so it aligns with the text edge. */
.section::before {
  content: "";
  position: absolute;
  top: 0;
  left: var(--gutter);
  right: var(--gutter);
  border-top: 1px solid var(--rule);
}

.section-label {
  grid-column: 1 / span 3;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--muted);
}
.section-label::before {
  content: "~/" / "";
  color: var(--rule-soft);
  color: color-mix(in srgb, var(--muted) 55%, var(--bg));
}

.section-body {
  grid-column: 4 / -1;
  min-width: 0;
}

.lead {
  font-size: clamp(1.375rem, 2.6vw, 2.25rem);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.025em;
  max-width: 34ch;
  text-wrap: pretty;
}

.about-grid {
  margin-top: clamp(2rem, 4vw, 3rem);
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 4fr);
  column-gap: clamp(1.5rem, 4vw, 4rem);
  align-items: start;
}

.prose {
  display: grid;
  gap: 1.25rem;
  color: var(--muted);
}
.prose p { max-width: 52ch; }

/* ---------- Current work ---------- */

.roles {
  margin-top: clamp(2.5rem, 5vw, 4rem);
  border-top: 1px solid var(--rule-soft);
}

.role {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 5fr);
  column-gap: var(--col-gap);
  align-items: start;
  padding-block: clamp(1.75rem, 3vw, 2.5rem);
  border-bottom: 1px solid var(--rule-soft);
}
.role:last-child { border-bottom: 0; }
.role > .role-desc {
  grid-column: 2;
  grid-row: 1 / span 2;
  margin-top: 0.35rem;
}

.role-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.role-org {
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
}
.role-org-note {
  font-weight: 500;
  color: var(--muted);
  letter-spacing: -0.01em;
}

.role-dates {
  flex: none;
  font-size: 0.8125rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.role-title {
  margin-top: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 700;
}

.role-desc {
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.9375rem;
  max-width: 52ch;
}

/* ---------- Photos ---------- */

.photo {
  grid-column: 1 / -1;
  margin: clamp(1.5rem, 3vw, 2.25rem) 0 0;
  overflow: hidden;
}
.photo img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: var(--ratio, 2 / 1);
  object-fit: cover;
  background: var(--ink);
  filter: grayscale(1) contrast(1.06);
}
.photo--portrait { margin-top: 0; grid-column: auto; }
.photo-pair {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--col-gap);
  margin-top: clamp(1.5rem, 3vw, 2.25rem);
}
.photo-pair .photo { margin: 0; grid-column: auto; }
.photo-pair .photo img { --ratio: 3 / 2; }
.photo--portrait img { --ratio: 3 / 4; }
.photo--lead { margin: 0 0 clamp(2rem, 4vw, 3rem); }
.photo--lead img { --ratio: 21 / 9; object-position: 50% 40%; }
.photo figcaption {
  margin-top: 0.625rem;
  font-size: 0.75rem;
  color: var(--muted);
}

@media (prefers-reduced-motion: no-preference) {
  .js .photo img {
    clip-path: inset(6% 0 6% 0);
    transform: scale(1.04);
    transition:
      clip-path 900ms var(--ease-out),
      transform 1200ms var(--ease-out),
      filter 500ms ease;
  }
  .js .photo.is-in img {
    clip-path: inset(0 0 0 0);
    transform: none;
  }
}

@media (hover: hover) and (pointer: fine) {
  .photo img { transition: filter 500ms ease; }
  .photo:hover img { filter: grayscale(0.15) contrast(1.02); }
}

/* ---------- Timeline ---------- */

.timeline {
  margin-top: clamp(2.5rem, 5vw, 4rem);
  position: relative;
}

.tl-item {
  display: grid;
  grid-template-columns: minmax(8.5rem, 2fr) 7fr;
  column-gap: var(--col-gap);
  position: relative;
  padding-bottom: clamp(2.5rem, 4vw, 3.5rem);
}
.tl-item:last-child { padding-bottom: 0; }

.tl-years {
  font-size: 0.9375rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.6;
}

.tl-body {
  position: relative;
  padding-left: 2rem;
  border-left: 1px solid var(--rule);
}
.tl-item:last-child .tl-body { border-left-color: var(--rule-soft); }

/* Square marker on the line, aligned to the first line of the role title */
.tl-body::before {
  content: "";
  position: absolute;
  left: -4px;
  top: 0.55em;
  width: 7px;
  height: 7px;
  background: var(--ink);
}

.tl-role {
  font-size: clamp(1.125rem, 1.7vw, 1.375rem);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.tl-org {
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.tl-body p:last-child {
  margin-top: 1rem;
  max-width: 60ch;
  color: var(--muted);
  font-size: 0.9375rem;
}

/* ---------- Speaking & writing ---------- */

.speaking {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  column-gap: var(--col-gap);
  row-gap: 3.5rem;
}
.talks { grid-column: 1 / span 4; }
.writing { grid-column: 5 / -1; }

.sub-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  padding-bottom: 0.875rem;
  border-bottom: 1px solid var(--rule-soft);
}

.talk { padding-block: 1.5rem; }
.talk + .talk { border-top: 1px solid var(--rule-soft); }

.talk-when {
  font-size: 0.8125rem;
  color: var(--muted);
}
.talk-where {
  margin-top: 0.25rem;
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.015em;
}
.talk-what {
  margin-top: 0.5rem;
  font-size: 0.9375rem;
  color: var(--muted);
}

.articles li + li { border-top: 1px solid var(--rule-soft); }

.article {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 1.5rem;
  padding-block: 1.5rem;
  text-decoration: none;
}
.article-outlet {
  grid-column: 1;
  font-size: 0.8125rem;
  color: var(--muted);
}
.article-title {
  grid-column: 1;
  margin-top: 0.25rem;
  font-size: clamp(1.0625rem, 1.6vw, 1.3125rem);
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.02em;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
  transition: text-decoration-color 200ms ease;
}
.article-arrow {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  font-size: 1.25rem;
  transition: transform 200ms var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .article:hover .article-title { text-decoration-color: currentColor; }
  .article:hover .article-arrow { transform: translate(2px, -2px); }
}
.article:focus-visible .article-title { text-decoration-color: currentColor; }

/* ---------- Education ---------- */

.edu-row {
  display: grid;
  grid-template-columns: 5fr 4fr auto;
  column-gap: var(--col-gap);
  align-items: baseline;
  padding-block: 1.25rem;
}
.edu-row + .edu-row { border-top: 1px solid var(--rule-soft); }
.edu-row:first-child { padding-top: 0; }

.edu dt {
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.45;
}
.edu-degree {
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.5;
}
.edu-years {
  font-size: 0.8125rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.edu-lang {
  margin-top: 1.5rem;
  font-size: 0.875rem;
  color: var(--muted);
}

/* ---------- Contact ---------- */

.contact-email {
  margin-top: clamp(2rem, 4vw, 3rem);
  font-size: clamp(1.25rem, 5.4vw, 4.5rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.045em;
}
.contact-email li + li { margin-top: 0.15em; }
.contact-email a {
  display: inline-block;
  padding-block: 0.1em;
  text-decoration: underline;
  text-decoration-thickness: 0.04em;
  text-underline-offset: 0.16em;
  transition: text-underline-offset 220ms var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .contact-email a:hover { text-underline-offset: 0.24em; }
}

.contact-alt { margin-top: 1.5rem; }

/* ---------- Closing ---------- */

.closing {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--col-gap);
  position: relative;
  padding-top: clamp(3rem, 6vw, 5rem);
  padding-bottom: clamp(4rem, 9vw, 7rem);
}
.closing::before {
  content: "";
  position: absolute;
  top: 0;
  left: var(--gutter);
  right: var(--gutter);
  border-top: 1px solid var(--rule);
}
.closing-body { grid-column: 4 / -1; }
.closing-text {
  max-width: 44ch;
  font-size: clamp(1.125rem, 1.9vw, 1.5rem);
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: -0.015em;
  text-wrap: pretty;
}
.closing-text strong { font-weight: 800; }
.closing .photo img { --ratio: 16 / 9; }
.closing .photo { margin-top: clamp(2rem, 4vw, 3rem); }

/* ---------- Footer ---------- */

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.25rem;
  padding-bottom: 2.5rem;
  font-size: 0.8125rem;
  color: var(--muted);
  position: relative;
}
.site-footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: var(--gutter);
  right: var(--gutter);
  border-top: 1px solid var(--rule-soft);
}

/* ---------- Scroll reveal (progressive; content is visible without JS) ---------- */

@media (prefers-reduced-motion: no-preference) {
  .js [data-reveal] .section-body {
    opacity: 0;
    transform: translateY(16px);
    transition:
      opacity 700ms var(--ease-out),
      transform 700ms var(--ease-out);
  }
  .js [data-reveal].is-in .section-body {
    opacity: 1;
    transform: none;
  }
}

/* ---------- Tablet ---------- */

@media (max-width: 1024px) {
  .section-label { grid-column: 1 / span 12; margin-bottom: 1.75rem; }
  .section-body { grid-column: 1 / -1; }
  .closing-body { grid-column: 1 / -1; }
  .speaking { grid-template-columns: 1fr 1fr; }
  .talks { grid-column: 1; }
  .writing { grid-column: 2; }
}

/* ---------- Mobile ---------- */

@media (max-width: 767px) {
  :root { --nav-h: 52px; }

  body { font-size: 0.9375rem; }

  .site-nav ul { gap: 0; }
  .site-nav nav a { font-size: 0.75rem; padding-inline: 5px; }
  .site-nav nav li:last-child a { padding-right: 0; }

  .hero { padding-top: 2rem; padding-bottom: 4.5rem; }
  .hero-body { margin-top: 2rem; }

  .about-grid { grid-template-columns: 1fr; row-gap: 2rem; }
  .photo--portrait { max-width: 22rem; }
  .photo-pair { grid-template-columns: 1fr; }
  .photo--lead img { --ratio: 4 / 3; }

  .role { grid-template-columns: 1fr; }
  .role > .role-desc { grid-column: 1; grid-row: auto; margin-top: 1rem; }
  .role-head { flex-direction: column; gap: 0.25rem; }
  .role-dates { order: -1; }

  .tl-item { grid-template-columns: 1fr; }
  .tl-years {
    padding-left: 2rem;
    border-left: 1px solid var(--rule);
    padding-bottom: 0.25rem;
  }
  .tl-item:last-child .tl-years { border-left-color: var(--rule-soft); }
  .tl-years { position: relative; }
  .tl-years::before {
    content: "";
    position: absolute;
    left: -4px;
    top: 0.62em;
    width: 7px;
    height: 7px;
    background: var(--ink);
  }
  .tl-body::before { display: none; }

  .speaking { grid-template-columns: 1fr; }
  .talks,
  .writing { grid-column: 1; }

  .edu-row { grid-template-columns: 1fr; row-gap: 0.25rem; }
  .edu-years { order: -1; }

  .contact-email { font-size: calc((100vw - 2 * var(--gutter)) / 12); }

  .contact-email { font-size: calc((100vw - 2 * var(--gutter)) / 12); }

  .site-footer { flex-direction: column; gap: 0.25rem; }
}

@media (max-width: 359px) {
  .brand { display: none; }
  .nav-inner { justify-content: flex-end; }
}

/* ---------- Type pairing: Instrument Sans for reading, mono for meta ---------- */

.brand, .site-nav, .skip-link, .typeline, .section-label, .sub-label,
.role-dates, .tl-years, .tl-org, .talk-when, .article-outlet, .article-arrow,
.edu-years, .photo figcaption, .site-footer, .contact-email, .link-arrow,
.role-title {
  font-family: var(--font);
  font-feature-settings: "calt" 0, "liga" 0;
}

.hero-name { letter-spacing: -0.04em; font-weight: 600; }
.lead { letter-spacing: -0.02em; font-weight: 500; line-height: 1.2; }
.role-org { font-weight: 600; letter-spacing: -0.025em; }
.tl-role, .talk-where, .article-title, .edu dt { font-weight: 600; letter-spacing: -0.01em; }
.role-desc, .tl-body p:last-child, .talk-what, .edu-degree, .hero-intro, .prose { font-size: 1.0625rem; }
.closing-text { letter-spacing: -0.01em; line-height: 1.45; }
.closing-text strong { font-weight: 700; }

.contact-or {
  font-size: 0.3em;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--muted);
  vertical-align: middle;
  margin-right: 0.4em;
}

.role-title { font-size: 0.875rem; font-weight: 500; letter-spacing: 0; }

.role-logo { display: block; height: clamp(1.75rem, 2.6vw, 2.25rem); width: auto; margin-block: 0.15em; }
.closing-logo { display: block; height: clamp(3.5rem, 6vw, 5rem); width: auto; margin-bottom: clamp(1.25rem, 2.5vw, 2rem); }
.role-logo--duv { height: clamp(2rem, 3vw, 2.5rem); margin-bottom: 0.5rem; }
.role-org-name { display: block; }
