/* jonathanjakoby.com — site styles
   Exact design spec: DESIGN.md (desktop §1–13, phone §14). Phone rules live in the last block (max-width 700px). */

/* Archivo, self-hosted (SIL Open Font License, see assets/fonts/OFL.txt) */
@font-face {
  font-family: Archivo;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/archivo-400.woff2") format("woff2");
}

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

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

@font-face {
  font-family: Archivo;
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("fonts/archivo-800.woff2") format("woff2");
}

:root {
  --bg: #f8f6f1;
  --ink: #1a1a18;
  --mute: #6e6e6b;
  --cap: #4a4a47;
  --rule: #c5c3be;
  --red: #c02820;

  /* --mute was #8A8A87 (Braun grey, 3.2:1 on the page). #6E6E6B keeps the same hue at 4.7:1 so small text passes AA. */
  --pad: 40px;
  --max: 1400px;
  --nav: 64px;

  /* spacing scale (4-based): 4 8 12 16 24 32 40 48 64 96 128 */
  --gutter: 16px; /* one gutter for the card grid and the strips */
  --row: 40px; /* between card rows */
  --section: 128px; /* between sections */
  --head-gap: 24px; /* section heading to its content */
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

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

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

/* keyboard rings only after keyboard input; the page sets data-input on <html> */
html[data-input="mouse"] :focus-visible {
  outline: none !important;
}

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: Archivo, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
}

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

a {
  color: inherit;
  text-decoration: none;
}

/* ---------- nav ---------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav);
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
  z-index: 60;
}

.nav-in {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--pad);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.id {
  display: flex;
  align-items: baseline;
  gap: 16px;
  min-width: 0;
}

.id .line {
  font-size: 13px;
  color: var(--cap);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-left: 16px;
  border-left: 1px solid var(--rule);
  line-height: 1;
}

.right {
  display: flex;
  align-items: center;
  gap: 32px;
}

.id h1 {
  font-size: 14px;
  font-weight: 700;
  line-height: inherit;
}

.wordmark {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}

.links {
  display: flex;
  gap: 24px;
}

.links a {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding-bottom: 3px;
  border-bottom: 2px solid transparent;
}

.links a:hover {
  border-bottom-color: var(--rule);
}

.links a.active {
  border-bottom-color: var(--red);
}

/* ---------- shell ---------- */
main {
  max-width: var(--max);
  margin: 0 auto;
  padding: calc(var(--nav) + 48px) var(--pad) 0;
}

section[id] {
  scroll-margin-top: calc(var(--nav) + 32px);
}

.btn {
  all: unset;
  box-sizing: border-box;
  cursor: pointer;
  display: inline-block;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--red);
  padding: 12px 16px 11px;
  line-height: 1;
  transition: background 0.15s ease;
}

.btn:hover {
  background: #a3221b;
}

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

.head {
  margin-bottom: var(--head-gap);
}

.head h2 {
  font-size: 40px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.005em;
  line-height: 1;
}

.head .sub {
  font-size: 12px;
  color: var(--mute);
  margin-top: 10px;
}

#personal .head {
  max-width: 1112px;
  margin-left: auto;
  margin-right: auto;
}

.blockgap {
  height: var(--section);
}

/* ---------- Personal: gallery of cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--row) var(--gutter);
  max-width: 1112px;
  margin: 0 auto;
}

.card {
  cursor: pointer;
}

/* set cards are real buttons: clear the browser's button styling */
button.card {
  all: unset;
  display: block;
  cursor: pointer;
}

button.card:focus-visible,
.strip .frame:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
}

.card .im {
  display: block;
  position: relative;
  aspect-ratio: 2/3;
  overflow: hidden;
  background: #edeae3;
}

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

.card .shade {
  position: absolute;
  inset: 0;
  background: rgb(26 26 24 / 60%);
  opacity: 0;
  transition: opacity 0.25s ease;
  display: flex;
  align-items: flex-end;
  padding: 24px;
  color: var(--bg);
}

.card .shade span {
  font-size: 19px;
  line-height: 1.2;
}

.card:hover .shade {
  opacity: 1;
}

/* label under each card: thin rule across the card, red marker, name */
.card .cc {
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--rule);
  margin-top: 12px;
  padding-top: 12px;
}

.card .cc .mk {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
}

.card .cc .c {
  font-size: 17px;
  font-weight: 500;
  color: var(--cap);
  letter-spacing: 0.005em;
}

.card .cc .va {
  margin-left: auto;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mute);
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
}

.card:hover .cc .va {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

/* title cards */
.card.title {
  cursor: default;
}

.card.title .im {
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px;
  text-align: center;
}

.card.title .s {
  font-size: 13px;
  color: var(--mute);
  letter-spacing: 0.02em;
}

.card.title .h {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1.2;
  color: var(--red);
}

.card.title .cc {
  visibility: hidden;
}

.card.title .fg {
  all: unset;
  cursor: pointer;
  margin-top: 12px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  padding: 4px 0;
  border-bottom: 1px solid transparent;
}

.card.title .fg:hover {
  border-bottom-color: var(--ink);
}

.card.title .fg:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
}

/* ---------- Commissioned: strips ---------- */
.sb {
  border-top: 1px solid var(--rule);
  padding-top: 12px;
}

.sb + .sb {
  margin-top: 48px;
}

.sb .sh {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 12px;
}

.sb .ttl {
  display: inline-block;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
}

.sb .all {
  all: unset;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  padding: 4px 0;
  border-bottom: 1px solid transparent;
}

.sb .all:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.sb .ttl:hover {
  box-shadow: inset 0 -1px 0 var(--ink);
}

.strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--gutter);
}

.strip .frame {
  all: unset;
  display: block;
  aspect-ratio: 2/3;
  overflow: hidden;
  background: #edeae3;
  cursor: pointer;
}

.strip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.strip img:hover {
  opacity: 0.85;
}

/* ---------- About ---------- */
.prose {
  max-width: 620px;
}

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 620px) minmax(0, 1fr);
  column-gap: 64px;
  align-items: start;
}

.about-grid .portrait {
  justify-self: end;
  width: min(100%, 460px);
  margin: 0;
}

.about-grid .portrait img {
  display: block;
  width: 100%;
  height: auto;
  background: #edeae3;
}

.prose h3 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 56px 0 14px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
}

.prose p {
  margin-bottom: 16px;
}

.tlink {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 2px;
  margin-top: 8px;
}

.tlink:hover {
  border-bottom-color: var(--ink);
}

.pairs {
  margin-top: 8px;
}

.pair .tlink {
  margin-top: 0;
}

.pair {
  display: flex;
  gap: 24px;
  padding: 14px 0;
  border-top: 1px solid var(--rule);
  font-size: 15px;
}

.pair .k {
  width: 120px;
  flex: none;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mute);
  padding-top: 2px;
}

/* ---------- footer ---------- */
footer {
  max-width: calc(var(--max) - 2 * var(--pad));
  margin: var(--section) auto 0;
  padding: 24px 0 48px;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--mute);
}

@media (width <= 1400px) {
  footer {
    margin-left: var(--pad);
    margin-right: var(--pad);
  }
}

footer .r {
  display: flex;
  gap: 22px;
}

footer a:hover {
  color: var(--ink);
}

/* ---------- Work with me panel ---------- */
.wm {
  position: fixed;
  inset: 0;
  background: rgb(26 26 24 / 45%);
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.wm.on {
  display: flex;
}

.wm-box {
  background: var(--bg);
  width: min(460px, 100%);
  padding: 26px 28px 14px;
}

.wm-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 18px;
}

.wm-top span {
  font-size: 20px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.005em;
  line-height: 1;
}

.wm-x {
  all: unset;
  cursor: pointer;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mute);
}

.wm-x:hover {
  color: var(--ink);
}

.wm-row {
  display: grid;
  grid-template-columns: 92px 1fr auto;
  gap: 12px;
  align-items: baseline;
  padding: 14px 0;
  border-top: 1px solid var(--rule);
}

.wm-row .k {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mute);
  display: flex;
  align-items: center;
  gap: 8px;
}

.wm-row .k::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
}

.wm-row .v {
  font-size: 15px;
  overflow-wrap: anywhere;
}

.wm-row a.v:hover {
  box-shadow: inset 0 -1px 0 var(--ink);
}

.acts {
  display: flex;
  gap: 8px;
}

.wm-b {
  all: unset;
  cursor: pointer;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 7px 10px 6px;
  border: 1px solid var(--ink);
  line-height: 1;
}

.wm-b:hover {
  background: var(--ink);
  color: var(--bg);
}

/* ---------- set view: every frame of a set as a grid ---------- */
.sv {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 100;
  display: none;
  overflow-y: auto;
}

.sv.on {
  display: block;
}

.vbar {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}

.vbar-in {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--pad);
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 32px;
}

.vbar .t {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.vbar .n {
  margin-left: auto;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--mute);
  font-variant-numeric: tabular-nums;
}

.vbtn {
  all: unset;
  cursor: pointer;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 0;
  border-bottom: 1px solid var(--rule);
}

.vbtn:hover {
  border-bottom-color: var(--ink);
}

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

.sv-grid {
  max-width: var(--max);
  margin: 0 auto;
  padding: 40px var(--pad) 24px;
}

.svn {
  max-width: calc(var(--max) - 2 * var(--pad));
  margin: 24px auto 96px;
  border-top: 1px solid var(--rule);
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
}

.svn:empty {
  display: none;
}

@media (width <= 1400px) {
  .svn {
    margin-left: var(--pad);
    margin-right: var(--pad);
  }
}

.svn button {
  all: unset;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.svn .nx {
  margin-left: auto;
  text-align: right;
  align-items: flex-end;
}

.svn .k {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mute);
}

.svn .v {
  font-size: 17px;
  font-weight: 500;
  color: var(--ink);
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
}

.svn button:hover .v {
  border-bottom-color: var(--ink);
}

.svn button:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 4px;
}

.jr {
  display: flex;
  gap: var(--gutter);
  margin-bottom: var(--gutter);
}

.jr button {
  all: unset;
  cursor: pointer;
  flex: none;
  display: block;
  background: #edeae3;
}

.jr button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.15s ease;
}

.jr button:hover img {
  opacity: 0.85;
}

.jr button:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
}

/* ---------- single view: one frame, big ---------- */
.lv {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 110;
  display: none;
  grid-template-rows: 64px 1fr;
}

.lv.on {
  display: grid;
}

.lv .stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 112px 40px;
  min-height: 0;
}

.lv .stage img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.lv .arw {
  all: unset;
  cursor: pointer;
  position: absolute;
  top: 0;
  bottom: 0;
  width: 112px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--mute);
}

.lv .arw:hover {
  color: var(--ink);
}

.lv .arw svg {
  width: 28px;
  height: 28px;
}

.lv .prev {
  left: 0;
}

.lv .next {
  right: 0;
}

/* =====================================================================
   PHONE LAYOUT (v11) — applies only below 700px wide; desktop is untouched.
   Decisions (Jonathan, 14 Oct): two-row nav with the line under the name;
   Personal 2 per row with full-width group headings; card label = name + arrow;
   Commissioned strips swipe sideways; About = smaller portrait (240px) above the bio; swipe in single view.
   ===================================================================== */
@media (width <= 700px) {
  :root {
    --pad: 16px;
    --gutter: 12px;
    --row: 24px;
    --section: 96px;
    --head-gap: 20px;
    --nav: 92px;
  }

  /* nav: row 1 = name (+ line under it) and the red button; row 2 = the three links */
  .nav {
    height: auto;
  }

  .nav-in {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px 12px;
    padding: 10px var(--pad) 0;
    height: auto;
  }

  .right {
    display: contents;
  }

  .id {
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
  }

  .id .line {
    font-size: 11px;
    padding-left: 0;
    border-left: 0;
    line-height: 1.2;
    max-width: 100%;
  }

  .wordmark {
    font-size: 13px;
  }

  .id h1 {
    font-size: 13px;
  }

  .btn {
    font-size: 11px;
    padding: 10px 12px 9px;
    grid-column: 2;
    grid-row: 1;
  }

  .links {
    grid-column: 1 / -1;
    grid-row: 2;
    gap: 22px;
  }

  .links a {
    font-size: 11px;
    padding: 8px 0 7px;
  }

  main {
    padding-top: calc(var(--nav) + 32px);
  }

  .head h2 {
    font-size: 32px;
  }

  /* Personal: 2 per row; group titles become full-width heading lines */
  #personal .head {
    max-width: none;
  }

  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: none;
  }

  .card.title {
    grid-column: 1 / -1;
  }

  .card.title .im {
    aspect-ratio: auto;
    display: grid;
    grid-template-columns: auto 1fr;
    place-items: baseline start;
    gap: 6px 12px;
    padding: 0;
    text-align: left;
  }

  .card.title .h {
    font-size: 18px;
  }

  .card.title .s {
    font-size: 12px;
  }

  .card.title .fg {
    grid-column: 1 / -1;
    margin-top: 2px;
    font-size: 12px;
    padding: 6px 0;
  }

  .card.title .cc {
    display: none;
  }

  .cards .card.title:not(:first-child) {
    margin-top: 24px;
  }

  .card .cc {
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
  }

  .card .cc .c {
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }

  .card .cc .va {
    font-size: 0;
    line-height: 0;
    letter-spacing: 0;
    border: 0;
    padding: 0;
    flex: none;
    align-self: center;
  }

  .card .cc .va::before {
    content: "\2192";
    display: block;
    font-size: 15px;
    line-height: 1;
    color: var(--mute);
  }

  .card:hover .shade {
    opacity: 0;
  }

  /* Commissioned: the 5 frames swipe sideways, running to the screen edge */
  .sb .sh {
    align-items: baseline;
  }

  .sb .ttl {
    font-size: 15px;
    min-width: 0;
  }

  .sb .all {
    font-size: 12px;
    flex: none;
    padding: 6px 0;
  }

  .strip {
    display: flex;
    gap: var(--gutter);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    margin-right: calc(-1 * var(--pad));
    padding-right: var(--pad);
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .strip::-webkit-scrollbar {
    display: none;
  }

  .strip .frame {
    flex: 0 0 calc((100% - 2 * var(--gutter)) / 2.3);
    scroll-snap-align: start;
  }

  /* About: text first, then the portrait full width */
  .about-grid {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 24px;
  }

  .about-grid .portrait {
    order: -1;
    justify-self: start;
    width: min(100%, 240px);
  }

  .pair .k {
    width: 96px;
  }

  footer {
    flex-direction: column;
    gap: 10px;
  }

  /* Work with me panel: label on its own line, value + buttons under it */
  .wm-box {
    padding: 22px 18px 10px;
  }

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

  .wm-row .v {
    overflow-wrap: normal;
  }

  /* viewers */
  .vbar-in {
    gap: 16px;
  }

  .vbar .t {
    font-size: 12px;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .vbar .n {
    flex: none;
    white-space: nowrap;
  }

  .vbtn {
    flex: none;
    padding: 12px 0 10px;
  }

  .sv-grid {
    padding: 20px var(--pad) 16px;
  }

  .svn {
    margin: 16px var(--pad) 72px;
  }

  .svn .v {
    font-size: 15px;
  }

  .lv .stage {
    padding: 16px 44px 24px;
  }

  .lv .arw {
    width: 44px;
  }

  .lv .arw svg {
    width: 22px;
    height: 22px;
  }
}
