/* Palette: paper, school-rule blue, ink navy, graphite, red pen */
:root {
  --paper: #fdfdfb;
  --rule: #d5e1ef;
  --margin-line: #efb3ae;
  --ink: #1b2a4a;
  --graphite: #59606d;
  --red-pen: #c8322b;
  --line: #e3e6ec;

  --font-body: "Atkinson Hyperlegible", system-ui, sans-serif;
  --font-hand: "Caveat", "Comic Sans MS", cursive;

  --measure: 64ch;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

a:focus-visible,
.button:focus-visible {
  outline: 3px solid var(--red-pen);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -3rem;
  background: var(--ink);
  color: var(--paper);
  padding: 0.5rem 0.75rem;
  z-index: 10;
}
.skip:focus { top: 1rem; }

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

.hero {
  max-width: 72rem;
  margin: 0 auto;
  padding: clamp(3rem, 8vw, 6.5rem) 1.5rem clamp(3rem, 6vw, 5rem);
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
}

.name {
  margin: 0 0 1rem;
  font-weight: 700;
  color: var(--graphite);
}

h1 {
  margin: 0 0 1.5rem;
  font-size: clamp(2rem, 4.2vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.015em;
  max-width: 20ch;
}

.lede {
  margin: 0 0 2rem;
  max-width: 52ch;
  font-size: 1.2rem;
  color: var(--graphite);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem 1.75rem;
  margin: 0;
}

.button {
  display: inline-block;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  font-weight: 700;
  padding: 0.8rem 1.4rem;
  border-radius: 6px;
}
.button:hover { background: #2a3d66; }

.text-link {
  font-weight: 700;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  text-decoration-color: var(--rule);
}
.text-link:hover { text-decoration-color: var(--ink); }

/* Hero photo */

.hero-photo { margin: 0; }

.hero-photo img,
.story-photo img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
}

.hero-photo figcaption {
  margin-top: 0.75rem;
  font-size: 0.95rem;
  color: var(--graphite);
}

/* Red-pen scores: the one bold element on the page */

.scores {
  display: flex;
  align-items: center;
  gap: 2rem;
  margin: 0.5rem 0 1.75rem 0.25rem;
  font-family: var(--font-hand);
  font-weight: 700;
  color: var(--red-pen);
  line-height: 1;
}

.old {
  font-size: 3.2rem;
  opacity: 0.75;
  text-decoration: line-through;
  text-decoration-thickness: 4px;
}

.new {
  position: relative;
  font-size: 4.4rem;
  padding: 0.2rem 1rem;
}

.circle {
  position: absolute;
  inset: -0.6rem -0.9rem;
  width: calc(100% + 1.8rem);
  height: calc(100% + 1.2rem);
  overflow: visible;
}

.circle path {
  fill: none;
  stroke: var(--red-pen);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-dasharray: 340;
  stroke-dashoffset: 0;
}

/* With JavaScript on, the circle starts hidden and draws once it scrolls into view */
.js .circle path { stroke-dashoffset: 340; }

.js .circle.drawn path { animation: draw 1.1s ease-out forwards; }

@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---------- Main content ---------- */

main {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  line-height: 1.2;
  margin: 0 0 2rem;
}

h3 {
  font-size: 1.45rem;
  line-height: 1.25;
  margin: 0 0 0.35rem;
}

.work {
  padding: clamp(3rem, 7vw, 5rem) 0;
  border-top: 1px solid var(--line);
}

.story {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 5vw, 4rem);
  align-items: start;
  padding: 2.5rem 0;
}

.story + .story { border-top: 1px solid var(--line); }

.story-text { max-width: var(--measure); }
.story-text p { margin: 0 0 1rem; }

.role {
  color: var(--graphite);
  font-size: 1rem;
}

.story-photo {
  margin: 0;
  max-width: 19rem;
  justify-self: center;
}

.story-photo--wide { max-width: none; justify-self: stretch; }

.story-photo--wide img { border: 1px solid var(--line); }

.next,
.contact {
  padding: clamp(3rem, 7vw, 5rem) 0;
  border-top: 1px solid var(--line);
  max-width: var(--measure);
}

.next p { margin: 0 0 1.25rem; }

.next ul {
  margin: 0;
  padding-left: 1.25rem;
}
.next li { margin-bottom: 0.75rem; }
.next li::marker { color: var(--red-pen); }

.contact p { margin: 0 0 1.25rem; }

.contact-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2rem;
  font-size: 1.25rem;
  font-weight: 700;
}

.contact-links a {
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}

footer {
  max-width: 72rem;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  border-top: 1px solid var(--line);
  color: var(--graphite);
  font-size: 0.95rem;
}
footer p { margin: 0; }

/* ---------- Small screens ---------- */

@media (max-width: 760px) {
  .hero,
  .story { grid-template-columns: 1fr; }

  .new { font-size: 3.8rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .circle path,
  .js .circle.drawn path {
    animation: none;
    stroke-dashoffset: 0;
  }
}

/* ---------- Project details ---------- */

h4 {
  margin: 1.4rem 0 0.3rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--graphite);
}

.story-text .role + h4 { margin-top: 1rem; }

.built-with {
  margin-top: 1.4rem;
  font-size: 1rem;
  color: var(--graphite);
}

.built-with strong {
  color: var(--ink);
  margin-right: 0.4rem;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

.footer-links {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
}

.footer-links a { color: var(--graphite); }

/* ---------- Simple pages (privacy policy, support) ---------- */

.page {
  max-width: 44rem;
  margin: 0 auto;
  padding: clamp(2.5rem, 7vw, 5rem) 1.5rem 4rem;
}

.page .back {
  display: inline-block;
  margin-bottom: 2.5rem;
  font-weight: 700;
}

.page h1 {
  font-size: clamp(2rem, 4vw, 2.6rem);
  max-width: none;
}

.page p { margin: 0 0 1.25rem; }

.page iframe {
  display: block;
  width: 100%;
  min-height: 1460px;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-top: 1rem;
}

.story--text-only { grid-template-columns: minmax(0, 1fr); }
.story--text-only .story-text { max-width: 40rem; }

.logo {
  display: block;
  width: 56px;
  height: auto;
  margin-bottom: 0.9rem;
}

/* ---------- Key points + "Read the full story" disclosure ---------- */

.key-points {
  margin: 0.9rem 0 1.1rem;
  padding-left: 1.15rem;
}
.key-points li { margin-bottom: 0.5rem; }
.key-points li::marker { color: var(--red-pen); }

.story-text .links { margin-top: 1.25rem; margin-bottom: 0; }

.more { margin-top: 1.5rem; }

.more > summary {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  font-weight: 700;
  color: var(--ink);
  list-style: none;
}
.more > summary::-webkit-details-marker,
.more > summary::marker { display: none; content: ""; }

.more > summary .open-label,
.more > summary .close-label {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  text-decoration-color: var(--rule);
}
.more > summary:hover .open-label,
.more > summary:hover .close-label { text-decoration-color: var(--ink); }

.more > summary:focus-visible {
  outline: 3px solid var(--red-pen);
  outline-offset: 3px;
  border-radius: 2px;
}

.more .close-label { display: none; }
.more[open] .open-label { display: none; }
.more[open] .close-label { display: inline; }

.more > summary .chevron {
  width: 0.55em;
  height: 0.55em;
  border-right: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  transform: rotate(45deg);
  margin-top: -0.3em;
  transition: transform 0.18s ease;
  flex: none;
}
.more[open] > summary .chevron {
  transform: rotate(-135deg);
  margin-top: 0.15em;
}

.more-content {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px dashed var(--line);
}
.more-content > h4:first-child { margin-top: 0; }

@media (prefers-reduced-motion: reduce) {
  .more > summary .chevron { transition: none; }
}

/* On small screens, show the project photo above its summary */
@media (max-width: 760px) {
  .story-photo { order: -1; }
}
