/* cliffordcoulter.com: black ink on paper, a red surname, hand-drawn edges.
   Colours are tokens; dark mode and the orange switch only change tokens. */

:root {
  --paper: #ffffff;
  --ink: #111111;
  --muted: #5c5c5c;
  --accent: #e8180c; /* the red in "Coulter" */
  --line: #111111;
  --soft: #f3f1ec; /* card wash */
  --dash: #8a8a8a; /* empty slot boxes */
  --btn-ink: #ffffff;
  --art-paper: transparent; /* behind colour drawings */
  --orange: #e8502a;
  --sans: 'Helvetica Neue', Helvetica, Arial, system-ui, sans-serif;
  --hand: 'Caveat', 'Bradley Hand', 'Segoe Print', cursive;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --paper: #141413;
    --ink: #ecebe6;
    --muted: #a3a29c;
    --accent: #ff5a4a;
    --line: #ecebe6;
    --soft: #1e1e1c;
    --dash: #7c7b76;
    --btn-ink: #141413;
    --art-paper: #efece4;
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --paper: #141413;
  --ink: #ecebe6;
  --muted: #a3a29c;
  --accent: #ff5a4a;
  --line: #ecebe6;
  --soft: #1e1e1c;
  --dash: #7c7b76;
  --btn-ink: #141413;
  --art-paper: #efece4;
  color-scheme: dark;
}

/* The old page's orange switch, in both light and dark. */
:root[data-orange] {
  --paper: #e8502a;
  --ink: #000000;
  --muted: #3a1308;
  --accent: #ffffff;
  --line: #000000;
  --soft: #ef6a47;
  --dash: #4a1a0c;
  --btn-ink: #e8502a;
  color-scheme: light;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 200ms, color 200ms;
}

a {
  color: inherit;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}
a:hover {
  color: var(--accent);
}
:focus-visible {
  outline: 2px dashed var(--accent);
  outline-offset: 3px;
}

h1,
h2,
h3 {
  font-family: var(--sans);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin: 0;
}

p {
  margin: 0 0 10px;
}

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

.wrap {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 16px;
}
@media (min-width: 720px) {
  .wrap {
    padding: 0 40px;
  }
}

.coulter {
  color: var(--accent);
}
.hand {
  font-family: var(--hand);
  font-weight: 500;
  letter-spacing: 0;
}
.muted {
  color: var(--muted);
}

/* A hand-drawn rule: the original page's 3px black line, wobbled. */
.rule {
  height: 3px;
  background: var(--line);
  border-radius: 2px;
  filter: url(#wobble-line);
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 20px;
  padding-top: 18px;
  padding-bottom: 18px;
}
.wordmark {
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.02em;
  text-decoration: none;
}
.topnav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 16px;
}
.topnav a {
  text-decoration: none;
}
.topnav a:hover {
  text-decoration: underline;
}
@media (max-width: 520px) {
  .topnav > a {
    display: none;
  }
}

/* EN / NO */
.lang {
  display: inline-flex;
  border: 1.5px solid currentColor;
  border-radius: 999px;
  overflow: hidden;
}
.lang button,
.lang a {
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: inherit;
  background: transparent;
  border: 0;
  padding: 3px 9px;
  cursor: pointer;
}
.lang a {
  text-decoration: none;
}
.lang a:hover {
  color: inherit;
  text-decoration: underline;
}
.lang button[aria-pressed='true'],
.lang a[aria-current='page'] {
  background: var(--ink);
  color: var(--paper);
}
.lang button:focus-visible,
.lang a:focus-visible {
  outline: 2px dashed var(--accent);
  outline-offset: -4px;
}

/* the toggle, as on the old page */
.toggle {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.toggle input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.track {
  display: block;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 25%, transparent);
  position: relative;
  transition: background 200ms;
}
.track::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--paper);
  top: 3px;
  left: 3px;
  transition: transform 200ms;
}
.toggle input:checked + .track {
  background: var(--orange);
}
:root[data-orange] .toggle input:checked + .track {
  background: #000;
}
.toggle input:checked + .track::after {
  transform: translateX(16px);
}
.toggle input:focus-visible + .track {
  outline: 2px dashed var(--accent);
  outline-offset: 3px;
}

/* ---------- sections ---------- */
section {
  padding: 28px 0 36px;
  scroll-margin-top: 16px;
}
.heading {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: 4px 14px;
  margin-bottom: 22px;
}
.heading h2 {
  font-size: clamp(30px, 5vw, 44px);
}
.heading .note {
  font-size: 24px;
  color: var(--muted);
  transform: rotate(-2deg);
  justify-self: start;
}
.heading .rule {
  grid-column: 1 / -1;
  margin-top: 8px;
}

/* hero */
.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  align-items: center;
  padding-top: 24px;
}
@media (min-width: 820px) {
  .hero {
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: 56px;
    padding-top: 48px;
  }
}
.hello {
  font-size: 30px;
  color: var(--muted);
  margin: 0 0 2px;
  transform: rotate(-3deg);
  transform-origin: left;
}
.hero h1 {
  font-size: clamp(48px, 10vw, 104px);
  margin-bottom: 22px;
  overflow-wrap: anywhere;
}
.lede {
  font-size: clamp(19px, 2.3vw, 23px);
  max-width: 34ch;
  margin-bottom: 24px;
}
.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.hero-art {
  width: 100%;
  max-width: 380px;
  justify-self: center;
}

.btn {
  display: inline-block;
  padding: 9px 16px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--btn-ink);
  font-weight: 700;
  font-size: 16px;
  text-decoration: none;
  border: 2px solid var(--ink);
  overflow-wrap: anywhere;
}
.btn:hover {
  color: var(--btn-ink);
  background: var(--accent);
  border-color: var(--accent);
}
:root[data-orange] .btn:hover {
  color: #000;
}
.btn.ghost {
  background: transparent;
  color: var(--ink);
}
.btn.ghost:hover {
  color: var(--accent);
  background: transparent;
}

/* about */
.prose {
  max-width: 68ch;
}
.prose p {
  margin-bottom: 14px;
}

/* what I do */
.skills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 24px 32px;
}
.skill h3 {
  font-size: 22px;
  margin-bottom: 8px;
}
.skill h3::after {
  content: '';
  display: block;
  width: 44px;
  height: 3px;
  margin-top: 8px;
  background: var(--accent);
  border-radius: 2px;
  filter: url(#wobble-line);
}
.skill p {
  font-size: 17px;
  color: var(--muted);
}

/* project cards: a rough pencil border round each */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 28px;
}
@media (min-width: 900px) {
  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 14px;
  background: var(--soft);
  border-radius: 12px;
}
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid var(--line);
  border-radius: 12px;
  filter: url(#wobble);
  pointer-events: none;
}
.card-body {
  padding: 14px 4px 4px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.card h3 {
  font-size: 26px;
  margin-bottom: 8px;
}
.card p {
  font-size: 17px;
}
.stack {
  color: var(--muted);
  font-size: 15px !important;
}
.card-link {
  margin-top: auto;
  font-weight: 700;
  align-self: flex-start;
}
.soon {
  margin-top: auto;
  font-size: 24px;
  color: var(--muted);
  transform: rotate(-2deg);
  align-self: flex-start;
}

/* gallery */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 24px;
}
.gallery {
  align-items: start;
}
.gallery figure {
  margin: 0;
}
.gallery figcaption {
  margin-top: 8px;
  font-size: 16px;
  color: var(--muted);
}
.gallery figcaption strong {
  color: var(--ink);
}
.gentle {
  font-size: 28px;
  color: var(--muted);
  margin: 0;
}

/* gallery pins: photos and GIFs, YouTube thumbnails, link cards */
.pin-img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  background: var(--soft);
}
.pin-video-link {
  position: relative;
  display: block;
  border-radius: 8px;
  overflow: hidden;
}
.pin-video-blank {
  display: block;
  aspect-ratio: 16 / 9;
  background: var(--soft);
}
.play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.play svg {
  width: 64px;
  height: 64px;
  filter: url(#wobble);
}
.play circle {
  fill: var(--paper);
  stroke: var(--ink);
  stroke-width: 2.5;
}
.play path {
  fill: var(--accent);
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linejoin: round;
}
.pin-video-link:hover .play svg,
.pin-video-link:focus-visible .play svg {
  transform: scale(1.08);
}
.link-card {
  position: relative;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  background: var(--soft);
  border-radius: 12px;
  overflow: hidden;
}
.link-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid var(--line);
  border-radius: 12px;
  filter: url(#wobble);
  pointer-events: none;
}
.link-card .pin-img {
  border-radius: 0;
}
.link-card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px 14px;
}
.link-card-title {
  font-weight: 700;
  font-size: 18px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.link-card-host {
  font-size: 15px;
  color: var(--muted);
}
.link-card:hover .link-card-title {
  color: var(--accent);
  text-decoration: underline;
}
.pin-link figcaption {
  margin-top: 8px;
}

/* writing: the list on the front page */
.writing-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 68ch;
}
.writing-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 16px;
  align-items: baseline;
  padding: 12px 0 14px;
  border-bottom: 1px dashed color-mix(in srgb, var(--ink) 30%, transparent);
}
.writing-list li:first-child {
  padding-top: 0;
}
.writing-title {
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.01em;
  line-height: 1.25;
  text-decoration: none;
}
.writing-title:hover {
  text-decoration: underline;
}
.writing-date {
  font-family: var(--hand);
  font-size: 22px;
  color: var(--muted);
  white-space: nowrap;
}
.writing-summary {
  grid-column: 1 / -1;
  margin: 2px 0 0;
  font-size: 17px;
  color: var(--muted);
}
@media (max-width: 520px) {
  .writing-list li {
    grid-template-columns: 1fr;
  }
}

/* writing: a post's page */
.post {
  padding-top: 16px;
  padding-bottom: 48px;
}
.post article {
  max-width: 68ch;
}
.post-back {
  margin-bottom: 18px;
}
.post-back a {
  font-size: 24px;
  color: var(--muted);
  text-decoration: none;
  display: inline-block;
  transform: rotate(-2deg);
}
.post-back a:hover {
  color: var(--accent);
}
.post h1 {
  font-size: clamp(36px, 6.5vw, 60px);
  margin-bottom: 12px;
  overflow-wrap: anywhere;
}
.post-meta {
  color: var(--muted);
  font-size: 16px;
  margin-bottom: 18px;
}
.post-summary {
  max-width: none;
  margin-bottom: 22px;
}
.post > article > .rule {
  margin-bottom: 28px;
}
.post-body h2,
.post-body h3,
.post-body h4 {
  margin: 32px 0 12px;
  line-height: 1.15;
}
.post-body h2 {
  font-size: 30px;
}
.post-body h3 {
  font-size: 24px;
}
.post-body h4 {
  font-size: 20px;
}
.post-body ul,
.post-body ol {
  margin: 0 0 14px;
  padding-left: 24px;
}
.post-body li {
  margin-bottom: 4px;
}
.post-body blockquote {
  margin: 0 0 14px;
  padding: 2px 0 2px 18px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}
.post-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: var(--soft);
  padding: 1px 5px;
  border-radius: 4px;
}
.post-body pre {
  margin: 0 0 16px;
  padding: 14px 16px;
  background: var(--soft);
  border-radius: 8px;
  overflow-x: auto;
  line-height: 1.45;
}
.post-body pre code {
  background: none;
  padding: 0;
}
.post-rule {
  margin: 28px 0;
  opacity: 0.5;
}
.post-figure {
  margin: 24px 0;
}
.post-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  background: var(--soft);
}
.post-figure figcaption {
  margin-top: 6px;
  font-family: var(--hand);
  font-size: 22px;
  color: var(--muted);
}
.post-after {
  margin-top: 32px;
}

/* freelance */
.pitch-head {
  font-size: clamp(24px, 3.4vw, 34px);
  max-width: 26ch;
  margin-bottom: 26px;
}
.offers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
  gap: 24px 36px;
}
.col-title {
  font-weight: 700;
  margin-bottom: 8px;
}
.offers ul,
.offers ol {
  margin: 0;
  padding-left: 20px;
  font-size: 17px;
}
.offers li {
  margin-bottom: 4px;
}
.pricing p {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 17px;
  margin-bottom: 4px;
  border-bottom: 1px dashed color-mix(in srgb, var(--ink) 30%, transparent);
  padding-bottom: 4px;
}

/* contact */
.contact-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: center;
}
@media (min-width: 760px) {
  .contact-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 360px);
  }
}
.contact-say {
  font-size: 30px;
  margin: 0;
  transform: rotate(-2deg);
  transform-origin: left;
}
.contact-email {
  font-weight: 700;
  font-size: clamp(22px, 4.6vw, 40px);
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
  margin-bottom: 12px;
}
.contact-art {
  width: 100%;
}

/* footer */
.footer {
  padding-bottom: 28px;
}
.footer-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding-top: 14px;
  font-size: 15px;
  color: var(--muted);
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
}

/* 404 */
.lost {
  text-align: center;
  padding-top: 32px;
  padding-bottom: 48px;
  min-height: 60vh;
}
.lost-art {
  max-width: 420px;
  margin: 0 auto 24px;
}
.lost h1 {
  font-size: clamp(36px, 7vw, 64px);
  margin-bottom: 8px;
}
.lost .gentle {
  margin-bottom: 24px;
}

/* ---------- art ---------- */
.art {
  position: relative;
  width: 100%;
  color: var(--ink);
}
.art-fill {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
img.art-fill {
  object-fit: contain;
}
/* Colour drawings keep their own inks, so in dark mode they sit on paper. */
.art-color {
  background: var(--art-paper);
  border-radius: 8px;
}
.art-mask {
  background: currentColor;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
}

/* Published art fades in once seen; with a line file it is drawn first. */
.art .art-mask,
.art img.art-fill {
  opacity: 0;
  transition: opacity 600ms ease;
}
.art.is-done .art-mask,
.art.is-done img.art-fill {
  opacity: 1;
}
.art-line path {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation-name: draw-on;
  animation-timing-function: ease-in-out;
  animation-fill-mode: forwards;
}
@keyframes draw-on {
  to {
    stroke-dashoffset: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .art .art-mask,
  .art img.art-fill {
    transition: none;
  }
}

/* Empty slot: a dashed, slightly wobbly box with the slot's label written in it. */
.art-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10%;
  text-align: center;
}
.art-empty-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: url(#wobble);
}
.art-empty-frame rect {
  fill: none;
  stroke: var(--dash);
  stroke-width: 2.5;
  stroke-dasharray: 10 8;
  stroke-linecap: round;
}
.art-empty-label {
  font-family: var(--hand);
  font-size: clamp(20px, 2.4vw, 28px);
  line-height: 1.15;
  color: var(--muted);
  transform: rotate(-2deg);
}
