/* Colors live here so they're easy to change. */
:root {
  --paper: #f7f3ea;
  --card: #fffdf7;
  --ink: #26231e;
  --muted: #6b6457;
  --line: #d9d1c0;
  --accent: #b5481f;      /* rusty orange */
  --accent-soft: #f3dccd;
  --highlight: #fff1a8;   /* highlighter yellow */
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  --body: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background-color: var(--paper);
  /* faint graph-paper grid */
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 28px 28px;
  background-position: -1px -1px;
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.05rem;
  line-height: 1.6;
}

/* the grid is subtle on purpose: wash it out a lot */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: var(--paper);
  opacity: 0.72;
  z-index: -1;
}

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

:focus-visible {
  outline: 3px dashed var(--accent);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  background: var(--ink);
  color: var(--paper);
  padding: 0.4rem 0.8rem;
  font-family: var(--mono);
  z-index: 10;
}
.skip-link:focus { top: 1rem; }

/* ---------- intro ---------- */

.intro,
main,
footer {
  max-width: 60rem;
  margin: 0 auto;
  padding: 0 1rem;
}

.intro {
  padding-top: 4rem;
  padding-bottom: 1.5rem;
  max-width: 40rem;
  margin-left: max(1rem, calc((100% - 60rem) / 2));
}

.hello {
  font-family: var(--mono);
  color: var(--muted);
  margin: 0;
}

h1 {
  font-family: var(--mono);
  font-size: clamp(2rem, 6vw, 2.8rem);
  line-height: 1.1;
  margin: 0.2rem 0 1rem;
  letter-spacing: -0.02em;
}

/* highlighter swipe under the title */
h1 {
  display: inline-block;
  background: linear-gradient(transparent 60%, var(--highlight) 60%, var(--highlight) 92%, transparent 92%);
  padding: 0 0.2em;
  margin-left: -0.2em;
  transform: rotate(-1deg);
}

.aside {
  color: var(--muted);
  font-style: italic;
  font-size: 0.95rem;
}

/* ---------- projects ---------- */

.projects-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 1.5rem 0 1.25rem;
}

h2 {
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: normal;
  margin: 0;
  color: var(--muted);
}
h2::before { content: "// "; }

#random-project {
  font-family: var(--mono);
  font-size: 0.95rem;
  background: var(--card);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 6px;
  padding: 0.4rem 0.9rem;
  box-shadow: 3px 3px 0 var(--ink);
  cursor: pointer;
}
#random-project:hover { background: var(--highlight); }
#random-project:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}

.project-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17.5rem), 1fr));
  gap: 1.5rem;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  padding: 1.4rem 1.25rem 1.1rem;
  box-shadow: 4px 4px 0 var(--line);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

/* cards sit a tiny bit crooked, like they were pinned up by hand */
.card:nth-child(3n + 1) { transform: rotate(-0.6deg); }
.card:nth-child(3n + 2) { transform: rotate(0.4deg); }
.card:nth-child(3n)     { transform: rotate(-0.2deg); }

.card:hover,
.card:focus-within {
  transform: rotate(0deg) translateY(-2px);
  box-shadow: 6px 6px 0 var(--accent-soft);
}

/* a strip of tape on top of each card */
.card::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 50%;
  width: 70px;
  height: 20px;
  margin-left: -35px;
  background: rgba(240, 220, 150, 0.75);
  border: 1px solid rgba(0, 0, 0, 0.06);
  transform: rotate(-2deg);
}
.card:nth-child(even)::before { transform: rotate(3deg); left: 40%; }

.card h3 {
  font-family: var(--mono);
  font-size: 1.15rem;
  line-height: 1.3;
  margin: 0;
}

.domain {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0.2rem 0 0.8rem;
  word-break: break-all;
}

.description {
  margin: 0 0 1rem;
  flex-grow: 1;
}

.try-it {
  align-self: flex-start;
  font-family: var(--mono);
  font-weight: bold;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 2px solid var(--accent);
  padding: 0.1rem 0;
}
.try-it:hover {
  background: var(--accent-soft);
}

/* the potato floats */
.doodle {
  display: inline-block;
  animation: float 4s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-8deg); }
  50%      { transform: translateY(-5px) rotate(8deg); }
}

/* wiggle when picked by the random button */
.card.picked {
  animation: wiggle 0.6s ease;
  outline: 3px solid var(--highlight);
  outline-offset: 4px;
}
@keyframes wiggle {
  0%, 100% { translate: 0 0; }
  20% { translate: -4px 0; }
  40% { translate: 4px 0; }
  60% { translate: -2px 0; }
  80% { translate: 2px 0; }
}

/* fallback if JavaScript is off */
.fallback-list {
  font-family: var(--mono);
  line-height: 2;
}

/* ---------- footer ---------- */

footer {
  margin-top: 4rem;
  padding-bottom: 3rem;
  text-align: center;
  font-family: var(--mono);
}
footer p { margin: 0.3rem 0; }
footer .small {
  font-size: 0.8rem;
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  .doodle,
  .card.picked { animation: none; }
  .card,
  .card:hover { transition: none; }
}
