/* ==========================================================
   Projects: /projects, each project's page and the archive.
   Styled like the App Store: "Today" story cards on the index,
   an app page per project. The HTML is generated by
   tools/build_projects.py; this file only styles it.
   Builds on styles.css (tokens, .page, .label, .small).
   ========================================================== */

/* Component colours (dark values below) */
:root {
  --pj-blue: #0066cc;        /* link-blue text; passes 4.5:1 on the pill grey */
  --pj-pill: #eeeff2;        /* grey "View" / "Visit" pills */
  --pj-shot: #f2f2f5;        /* behind white-background screenshots */
}
:root[data-theme="dark"] {
  --pj-blue: #4ea1ff;
  --pj-pill: #2c2c31;
  --pj-shot: #e9e9ee;        /* stays light: the screenshots have white backgrounds */
}

/* Opening a project grows its icon into the big one on the next page
   (browsers without cross-page view transitions just load the page). */
@view-transition { navigation: auto; }
::view-transition-group(*) { animation-duration: .45s; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}

/* Apple's own interface, so Apple's font where there is one */
.pj { font-family: var(--font-system); }

.pj-eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Header ---------- */
.pj-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 20px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--line);
}
.pj-head > div { display: flex; flex-direction: column; gap: 4px; }
.pj-title { font-size: clamp(34px, 3.4vw, 44px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.05; }
.pj-avatar img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.pj-avatar { border-radius: 50%; transition: transform .2s; }
.pj-avatar:hover { transform: scale(1.06); }

/* ---------- Pills and buttons ---------- */
.pj-get {
  flex-shrink: 0;
  padding: 6px 16px;
  border-radius: 999px;
  background: var(--pj-pill);
  color: var(--pj-blue);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .02em;
}
a.pj-get:hover { filter: brightness(.96); }
.pj-btn {
  padding: 10px 24px;
  border-radius: 999px;
  background: var(--ss-select);
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  transition: filter .2s;
}
.pj-btn:hover { filter: brightness(1.1); }
.pj-btn--soft { background: var(--pj-pill); color: var(--pj-blue); font-weight: 600; }
.pj a:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }

/* ---------- App icons ---------- */
.pj-icon {
  --size: 44px;
  width: var(--size);
  height: var(--size);
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: calc(var(--size) * .24);
  background: var(--pj-icon-bg);
  color: var(--pj-icon-ink);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .07);
  font-size: calc(var(--size) * .5);
  font-weight: 800;
  line-height: 1;
  overflow: hidden;
}
.pj-icon--lg { --size: 168px; }
.pj-icon img { max-width: 76%; max-height: 70%; width: auto; height: auto; }
/* NoCode's puzzle logo: NO / CO / DE */
.pj-icon--grid {
  grid-template-columns: repeat(2, 1fr);
  align-content: center;
  padding: 0 calc(var(--size) * .22);
  row-gap: 2px;
  font-size: calc(var(--size) * .2);
  text-align: center;
}
/* fiilo's wordmark, in its two colours */
.pj-wordmark { font-family: var(--font); font-weight: 800; font-size: calc(var(--size, 44px) * .3); letter-spacing: -0.03em; }
.pj-wordmark span:first-child { color: #43824e; }   /* fiilo's green and blue, a shade deeper to read on white */
.pj-wordmark span:last-child { color: #207da4; }

/* ---------- Today: story cards ---------- */
.pj-stories {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: 500px;
  gap: 24px;
}
.pj-story {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--pj-bg);
  color: var(--pj-ink);
  box-shadow: 0 0 0 1px var(--dark-tile-edge);
  transition: transform .3s ease, box-shadow .3s ease;
}
.pj-story:hover {
  transform: translateY(-4px);
  box-shadow: 0 0 0 1px var(--hover-ring), 0 24px 40px -20px var(--shadow);
}
.pj-story--wide { grid-column: span 2; }
.pj-story-img { position: absolute; transition: transform .6s ease; }
.pj-story:hover .pj-story-img { transform: scale(1.03); }
/* cover: the picture fills the card */
.pj-story--cover .pj-story-img { inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* inset: a white-background screenshot sits on the card's colour */
.pj-story--inset .pj-story-img { right: -30px; bottom: 64px; width: min(620px, 70%); height: auto; mix-blend-mode: multiply; }
/* band: the text on top, the picture filling the space below it (and running
   under the frosted strip), so a longer headline pushes the picture down */
.pj-story--band .pj-story-img { position: relative; order: 1; flex: 1; min-height: 0; width: 100%; object-fit: cover; }
.pj-story-text { position: relative; display: flex; flex-direction: column; gap: 8px; padding: var(--tile-pad); max-width: 440px; }
.pj-story .pj-eyebrow { color: inherit; opacity: .9; }
.pj-story-title { font-size: clamp(26px, 2.3vw, 32px); font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; }
.pj-story--inset .pj-story-text { max-width: 380px; }

/* The frosted app strip along the bottom of a card */
.pj-strip {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--text);
}
.pj-strip-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pj-strip-text strong { font-size: 15px; font-weight: 600; }
.pj-strip-text span { font-size: 13px; color: var(--body-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* The archive card: a list, like an App Store collection */
.pj-collection { --pj-bg: var(--tile); --pj-ink: var(--text); gap: 4px; }
.pj-collection .pj-story-text { padding-bottom: 12px; }
.pj-collection .pj-eyebrow { color: var(--muted); opacity: 1; }
.pj-collection .pj-story-title { font-size: clamp(22px, 2vw, 26px); }
.pj-mono-list { padding: 0 var(--tile-pad) var(--tile-pad); overflow: hidden; }
.pj-mono-list li { display: flex; align-items: center; gap: 12px; padding: 5px 0; border-top: 1px solid var(--line); }
.pj-mono {
  width: 30px; height: 30px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--pj-icon-bg);
  color: var(--pj-icon-ink);
  font-size: 12px;
  font-weight: 700;
}
.pj-mono--lg { width: 56px; height: 56px; border-radius: 14px; font-size: 18px; }
.pj-mono-text { min-width: 0; display: flex; flex-direction: column; }
.pj-mono-text strong { font-size: 14px; font-weight: 600; }
.pj-mono-text span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Sections ---------- */
.pj-section { display: flex; flex-direction: column; gap: 14px; margin-top: 48px; }
.pj-section h2 { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.pj-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.pj-section-head span { font-size: 14px; color: var(--muted); }
.pj-h2-gap { margin-top: 20px; }

/* Where I've built product */
.pj-work { border-top: 1px solid var(--line); padding-top: 28px; }
.pj-work-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 32px; }
.pj-work-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.pj-work-icon {
  width: 64px; height: 64px;
  flex-shrink: 0;
  border-radius: 15px;
  object-fit: cover;
  box-shadow: 0 0 0 1px var(--line);
}
.pj-work-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pj-work-text strong { font-size: 16px; font-weight: 600; }
.pj-work-text span { font-size: 13px; color: var(--muted); }
.pj-work-actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; text-align: center; }

/* ---------- A project's page ---------- */
.pj-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 24px;
  font-size: 16px;
  color: var(--pj-blue);
}
.pj-back:hover { text-decoration: underline; text-underline-offset: 3px; }
.pj-app-head { display: flex; align-items: center; gap: 32px; }
.pj-app-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pj-app-text h1 { font-size: clamp(34px, 3.4vw, 44px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.05; }
.pj-app-sub { font-size: 20px; line-height: 1.35; color: var(--body-text); }
.pj-app-meta { font-size: 14px; color: var(--muted); }
.pj-app-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }

/* The strip of facts under the header, like ratings and age on the App Store */
.pj-facts {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-top: 32px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.pj-facts > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  text-align: center;
}
.pj-facts > div + div { border-left: 1px solid var(--line); }
.pj-facts dt { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.pj-fact-value { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; color: var(--body-text); }
.pj-fact-note { font-size: 12px; color: var(--muted); }

/* Preview: screenshots and design details */
.pj-preview { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 16px; height: 300px; }
.pj-shot { border-radius: 24px; overflow: hidden; background: var(--pj-shot); display: grid; place-items: center; }
.pj-shot img { width: 94%; height: 94%; object-fit: contain; mix-blend-mode: multiply; }
.pj-shot--fill img { width: 100%; height: 100%; object-fit: cover; mix-blend-mode: normal; }
.pj-swatch {
  border-radius: 24px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  background: var(--pj-bg);
  color: var(--pj-ink);
  box-shadow: 0 0 0 1px var(--line);
}
.pj-swatch .pj-eyebrow { color: inherit; opacity: .9; }   /* any fainter fails contrast */
.pj-swatch code { display: block; font: 700 clamp(28px, 2.6vw, 38px)/1.1 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: -0.02em; }
.pj-swatch p { font-size: 14px; line-height: 1.45; margin-top: 4px; opacity: .85; }
.pj-swatch--logo { align-items: flex-start; }
.pj-swatch--logo > :is(.pj-logo-grid, .pj-wordmark, .pj-logo-img) { align-self: center; }
.pj-logo-grid {
  display: grid;
  grid-template-columns: repeat(2, 44px);
  row-gap: 2px;
  text-align: center;
  font-size: 44px;
  font-weight: 800;
  line-height: 1;
  color: var(--pj-accent);
}
.pj-wordmark--big { --size: 200px; }
.pj-logo-img { height: 110px; width: auto; }

/* About + Version history | Notes from the maker */
.pj-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 48px; }
.pj-prose { display: flex; flex-direction: column; gap: 14px; font-size: 16px; line-height: 1.6; color: var(--body-text); }
.pj-prose a { color: var(--text); text-decoration: underline; text-decoration-color: var(--outline); text-underline-offset: 3px; }
.pj-prose a:hover { text-decoration-color: var(--text); }
.pj-history { list-style: none; }
.pj-history li { padding: 14px 0; border-top: 1px solid var(--line); }
.pj-history div { display: flex; justify-content: space-between; gap: 12px; }
.pj-history strong { font-size: 16px; font-weight: 600; }
.pj-history span { font-size: 14px; color: var(--muted); white-space: nowrap; }
.pj-history p { margin-top: 2px; font-size: 15px; color: var(--body-text); }
.pj-note { display: flex; flex-direction: column; gap: 6px; padding: 20px 22px; border-radius: 20px; background: var(--tile); }
.pj-note div { display: flex; justify-content: space-between; gap: 12px; }
.pj-note strong { font-size: 16px; font-weight: 700; }
.pj-note span { font-size: 13px; color: var(--muted); white-space: nowrap; }
.pj-note p { font-size: 15px; line-height: 1.5; color: var(--body-text); }

/* Read the story: links to Writing */
.pj-read li a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.pj-read-title { font-size: 17px; font-weight: 600; }
.pj-read li a:hover .pj-read-title { text-decoration: underline; text-decoration-color: var(--outline); text-underline-offset: 3px; }
.pj-read-meta { font-size: 14px; color: var(--muted); white-space: nowrap; }

/* You might also like */
.pj-more { border-top: 1px solid var(--line); padding-top: 28px; }
.pj-more-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.pj-mini {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: 20px;
  background: var(--tile);
  transition: transform .25s ease;
}
.pj-mini:hover { transform: translateY(-2px); }
.pj-mini .pj-icon { --size: 60px; }

/* ---------- The archive ---------- */
.pj-archive { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.pj-archive-item { display: flex; flex-direction: column; gap: 16px; padding: var(--tile-pad); border-radius: var(--radius); background: var(--tile); }
.pj-archive-item header { display: flex; align-items: center; gap: 14px; }
/* The old site's picture: screenshots fill the frame (top edge kept), logos sit on the project's colour */
.pj-archive-pic { aspect-ratio: 16 / 8; border-radius: calc(var(--radius) - 12px); overflow: hidden; display: grid; place-items: center; }
.pj-archive-pic--screenshot { background: var(--pj-shot); box-shadow: 0 0 0 1px var(--line); }
.pj-archive-pic--screenshot img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.pj-archive-pic--logo { background: var(--pj-bg); }
.pj-archive-pic--logo img { max-width: 62%; max-height: 58%; width: auto; height: auto; }
.pj-archive-item h2 { font-size: 20px; font-weight: 700; }
.pj-archive-item header p { font-size: 14px; color: var(--muted); }
.pj-archive-item > p { font-size: 16px; line-height: 1.6; color: var(--body-text); }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .pj-stories { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 460px; }
  .pj-work-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pj-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 16px; }
  .pj-facts > div:nth-child(3n + 1) { border-left: 0; }
  .pj-preview { grid-template-columns: repeat(2, minmax(0, 1fr)); height: auto; grid-auto-rows: 240px; }
  .pj-preview > :first-child { grid-column: span 2; height: 300px; }
  .pj-cols { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .pj-more-row { grid-template-columns: minmax(0, 1fr); gap: 10px; }
}

@media (max-width: 640px) {
  .pj-head { margin-bottom: 20px; }
  .pj-stories { grid-template-columns: minmax(0, 1fr); grid-auto-rows: auto; gap: 16px; }
  .pj-story { min-height: 440px; }
  .pj-story--wide { grid-column: auto; }
  .pj-story--inset .pj-story-img { right: -20px; width: 110%; bottom: 72px; }
  .pj-collection { min-height: 0; }
  .pj-work-list { grid-template-columns: minmax(0, 1fr); }
  .pj-app-head { flex-direction: column; align-items: flex-start; gap: 20px; }
  .pj-icon--lg { --size: 112px; }
  .pj-app-sub { font-size: 18px; }
  .pj-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pj-facts > div:nth-child(3n + 1) { border-left: 1px solid var(--line); }
  .pj-facts > div:nth-child(odd) { border-left: 0; }
  .pj-fact-value { font-size: 22px; }
  .pj-preview { grid-template-columns: minmax(0, 1fr); grid-auto-rows: 220px; }
  .pj-preview > :first-child { grid-column: auto; height: 240px; }
  .pj-archive { grid-template-columns: minmax(0, 1fr); }
}
