/* =====================================================================
   HOME PAGE in the cartoon look of the EtherLocked and False Sun pages.
   Loaded after styles.css and etherlocked-cartoon.css; the body carries
   .ether-page (tokens, header, menu drawer, buttons, footer, scroll-up)
   and .home-page (everything below).

   1. Hero (text left, robot right)
   2. Featured work (one framed card per project)
   3. Other work (slider)
   4. Small screens
   ===================================================================== */

/* ───────────── 1. HERO ─────────────
   The introduction on the left; the robot peeks up from the bottom-right
   corner, partly past the right edge, and says hi in a speech bubble.
   On small screens the text is centred and the robot sits under it.
   Kept quiet on purpose: the name is the one loud thing, everything else
   (greeting, tags, text, robot) steps back in size or colour. */
.home-page .home.section {
  /* robot height (used by the robot and the padding that keeps it clear) */
  --robot-h: min(58vh, 500px, 34vw);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  height: auto;
  /* a little taller than the screen, so the line along its bottom edge sits
     just below the first view */
  min-height: calc(100vh + var(--stroke-thick) + 2px);
  min-height: calc(100svh + var(--stroke-thick) + 2px);
  padding: calc(var(--header-height) + var(--space-xl))
    max(var(--page-gutter), calc((100vw - 1200px) / 2)) 0;
  /* one flat colour, a shade darker than the page, so its bottom edge is
     the ground the robot peeks over */
  background: var(--night);
  /* a straight pencil line along the bottom: the edge the robot peeks over */
  border-bottom: var(--stroke-thick) solid var(--pencil);
  /* no stacking context of its own (styles.css gives it z-index 0 on wide
     screens), so the robot can rise above the page's paper grain */
  z-index: auto;
}

.home-page .home-container {
  position: relative;
  top: auto;
  /* above the robot (9999), so on short screens the robot never covers the
     text or buttons */
  z-index: 10000;
  width: auto;
  max-width: 600px;
  margin: 0;
  padding: 0 0 var(--space-xl);
  text-align: left;
}

.home-page .home-subtitle {
  margin-bottom: var(--space-2xs);
  font-size: clamp(1.3rem, 2vw, 1.75rem);
  line-height: 1;
  color: var(--text);
  opacity: 0.75;
}

.home-page .home-title {
  padding-bottom: var(--space-m);
  font-family: var(--cartoon-font);
  font-weight: 900;
  font-size: var(--fs-display);
  line-height: var(--lh-display);
  letter-spacing: 0.02em;
  text-align: left;
  text-transform: uppercase;
  color: var(--orange);
  -webkit-text-stroke: 0;
  text-shadow: none;
  cursor: inherit;
}

/* role tags under the name: the coloured boxes of the gameplay loop diagram
   on the project pages (moss with an olive outline, teal with a sage one) */
.home-page .home-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs);
  margin-bottom: var(--space-m);
}

.home-page .home-tags .tag {
  padding: var(--space-3xs) var(--space-xs);
  font-family: var(--cartoon-font);
  font-weight: 400;
  font-size: var(--fs-small);
  line-height: var(--lh-tight);
  white-space: nowrap;
  color: var(--text);
  border: var(--stroke) solid var(--text);
  border-radius: var(--wobble-sm);
}

.home-page .home-desc {
  max-width: 32em;
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--text);
  opacity: 0.85;
}

.home-page .home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-s);
  margin-top: var(--space-l);
}

.home-page .hand-arrow--down {
  transform: rotate(90deg);
}

/* robot: upright in the bottom-right corner, leaning in towards the text
   and partly past the right edge. The picture is cut off under the eyes;
   that cut sits just below the hero's bottom edge, so it peeks over it. */
.home-page .home-image {
  --robot-h: inherit;
  position: absolute;
  inset: auto 0 0 auto;
  left: auto;
  display: block;
  width: auto;
  height: var(--robot-h);
  transform: translate(14%, 9%) rotate(-7deg);
  transform-origin: 50% 100%;
  pointer-events: none;
  /* above the paper grain that covers the page (etherlocked-cartoon.css,
     z-index 9998), so the robot keeps its clean colours */
  z-index: 9999;
}

.home-page .home-image img {
  display: block;
  width: auto;
  max-width: none;
  height: 100%;
}

/* speech bubble: a cream card with a pencil outline and a tail drawn as two
   stacked triangles (pencil outline under, cream fill on top) */
.home-page .home-bubble {
  position: absolute;
  top: -17%;
  left: 26%;
  padding: 0.2em 0.6em 0.25em;
  font-family: var(--cartoon-font);
  font-weight: 900;
  font-size: clamp(1.3rem, 2vw, 1.8rem);
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--ink);
  background: var(--text);
  border: var(--stroke-thick) solid var(--pencil);
  border-radius: 22px 26px 20px 28px / 26px 20px 28px 22px;
  transform: rotate(4deg);
}

.home-page .home-bubble::before,
.home-page .home-bubble::after {
  content: "";
  position: absolute;
  clip-path: polygon(0 0, 100% 0, 78% 100%);
}

/* outline of the tail */
.home-page .home-bubble::before {
  top: 100%;
  left: 0.75em;
  width: 0.62em;
  height: 0.62em;
  background: var(--pencil);
}

/* fill of the tail: covers the bubble's border where the two meet */
.home-page .home-bubble::after {
  top: calc(100% - var(--stroke-thick));
  left: calc(0.75em + var(--stroke-thick) + 1px);
  width: calc(0.62em - var(--stroke-thick) * 2 - 2px);
  height: calc(0.62em - var(--stroke-thick) - 2px);
  background: var(--text);
}

/* ───────────── 2. FEATURED WORK ─────────────
   One card per project, without an outline: text on one side, the
   screenshot filling the other, sides alternating. */
.home-page .featured-heading {
  padding: var(--section-gap) var(--page-gutter) 0;
  scroll-margin-top: var(--header-height);
}

.home-page .featured-title {
  font-family: var(--cartoon-font);
  font-weight: 900;
  font-size: var(--fs-h1);
  line-height: var(--lh-display);
  letter-spacing: 0.01em;
  text-align: center;
  text-transform: uppercase;
  color: var(--orange);
}

.home-page .work.section {
  display: block;
  padding: var(--space-xl) var(--page-gutter) 0;
  overflow: visible;
}

/* more room between one project and the next (the first card keeps the
   smaller gap under the "Featured work" heading) */
.home-page .work.section + .work.section {
  padding-top: var(--space-3xl);
}

.home-page .feature {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr);
  grid-template-areas: "body img";
  max-width: 1200px;
  margin-inline: auto;
  padding: 0;
  overflow: hidden;
  background: var(--paper-2);
  border-radius: var(--wobble);
}

.home-page .feature--flip {
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr);
  grid-template-areas: "img body";
}

.home-page .feature__img {
  grid-area: img;
  width: 100%;
  height: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}

/* the version of a project that the current order does not use
   (see assets/js/project-order.js) */
.home-page [data-project][hidden] {
  display: none !important;
}

/* pixel-art screenshots stay crisp when scaled up */
.home-page .feature__img--pixel {
  image-rendering: pixelated;
}

.home-page .feature__body {
  grid-area: body;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: var(--card-pad);
}

/* card order: title, tags, description, buttons */
.home-page .work__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs);
  margin: var(--space-2xs) 0 var(--space-m);
}

/* project tags: the same coloured boxes as the Developer / Designer tags in
   the hero (colours from the shared tag palette in etherlocked-cartoon.css) */
.home-page .work__tags .tag,
.home-page .card-upper .badge {
  padding: var(--space-3xs) var(--space-xs);
  font-family: var(--cartoon-font);
  font-weight: 400;
  font-size: var(--fs-small);
  line-height: var(--lh-tight);
  white-space: nowrap;
  color: var(--text);
  border: var(--stroke) solid var(--text);
  border-radius: var(--wobble-sm);
}

/* tags and badges: outlined chips */
.home-page .tag,
.home-page .badge {
  padding: var(--space-3xs) var(--space-xs);
  font-size: var(--fs-small);
  color: var(--text);
  background: rgba(30, 17, 9, 0.55);
  border: var(--stroke) solid color-mix(in srgb, var(--pencil) 50%, transparent);
  border-radius: var(--wobble-sm);
}

.home-page .feature__title {
  margin-bottom: var(--space-xs);
  font-family: var(--cartoon-font);
  font-weight: 900;
  font-size: var(--fs-h2);
  line-height: var(--lh-display);
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--orange);
}

.home-page .feature__desc {
  max-width: 30em;
  margin-bottom: var(--space-l);
  font-size: var(--fs-body-s);
  line-height: var(--lh-body);
  color: var(--text);
}

/* buttons: the hero button in orange, and a quiet outlined one beside it */
.home-page .work__buttons {
  flex-wrap: wrap;
  gap: var(--space-s);
}

.home-page .work-cta {
  color: #fff;
  background: var(--orange);
  border-color: var(--orange-hi);
}

.home-page .work-cta--ghost {
  color: #fff;
  background: transparent;
  border-color: var(--pencil);
}

.home-page .work-cta:hover,
.home-page .work-cta:focus-visible {
  background: var(--mustard);
  border-color: var(--mustard);
}

/* ───────────── 3. OTHER WORK ───────────── */
/* the same width and side gutters as the featured cards above, and no
   extra space at the bottom: the footer brings its own gap */
.home-page .other.section {
  padding: var(--section-gap) var(--page-gutter) 0;
}

.home-page .other-works {
  max-width: 1200px;
  padding-inline: 0;
}

.home-page .other-work-subtitle {
  /* the same gap as under "Featured work" (the card wrapper adds the rest) */
  margin-bottom: calc(var(--space-xl) - var(--space-2xs));
  font-family: var(--cartoon-font);
  font-weight: 900;
  font-size: var(--fs-h1);
  line-height: var(--lh-display);
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--orange);
}

/* room for the tilt on hover and the keyboard focus outline */
.home-page .card-wrapper {
  padding: var(--space-2xs) 0;
}

.home-page .card-list .card-item .card-link {
  padding: var(--card-pad);
  color: var(--text);
  border: 0;
  border-radius: var(--wobble);
  transition: transform 0.2s ease;
}

.home-page .card-list .card-item .card-link:focus-visible {
  outline: var(--stroke-thick) solid var(--orange);
  outline-offset: 3px;
}

.home-page .card-list .card-item .card-link:hover,
.home-page .card-list .card-item .card-link:focus-visible {
  transform: rotate(-1deg) translateY(-3px);
}

/* a flat dark wash over the picture, heavier at the top where the text sits */
.home-page .card-list .card-item .card-link::after {
  background: linear-gradient(to bottom, rgba(30, 17, 9, 0.85) 0%, rgba(30, 17, 9, 0.35) 100%);
  opacity: 1;
}

.home-page .card-list .card-item .card-link:hover::before {
  filter: brightness(0.7);
  transform: none;
}

.home-page .card-list .card-link .card-title {
  font-family: var(--cartoon-font);
  font-weight: 900;
  font-size: var(--fs-h3);
  line-height: var(--lh-display);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text);
}

.home-page .card-desc {
  font-size: var(--fs-small);
  line-height: var(--lh-snug);
  color: var(--text);
}

/* arrow chip in the corner: same chip as the scroll-up button */
/* arrow button: the same chip as the scroll-up button in the corner (size,
   outline, colours); on hover it fills yellow and tilts */
.home-page .card-list .card-link .card-button {
  width: 3.25rem;
  height: 3.25rem;
  color: var(--orange-hi);
  background: var(--paper-3);
  border: var(--stroke-thick) solid var(--pencil);
  border-radius: var(--wobble-sm);
  box-shadow: none;
  transition: transform 0.2s ease, color 0.2s ease, border-color 0.2s ease,
    background-color 0.2s ease;
}

.home-page .card-button .hand-arrow {
  width: 0.72rem;
}

.home-page .card-list .card-link:hover .card-button,
.home-page .card-list .card-link:focus-visible .card-button {
  color: var(--ink);
  background: var(--mustard);
  border-color: var(--mustard);
  transform: rotate(-6deg);
}

/* ───────────── 4. SMALL SCREENS ───────────── */
@media (max-width: 1100px) {
  /* hero: text centred, vertically in the space above the robot, which
     peeks up from the bottom-right corner. --robot-h is set here so the
     bottom padding can keep that space clear. */
  .home-page .home.section {
    --robot-h: min(38vh, 400px);
    align-items: center;
    padding-top: calc(var(--header-height) + var(--space-l));
    padding-bottom: calc(var(--robot-h) * 0.4);
  }

  .home-page .home-container {
    justify-self: center;
    text-align: center;
  }

  .home-page .home-title {
    text-align: center;
  }

  .home-page .home-tags,
  .home-page .home-actions {
    justify-content: center;
  }

  .home-page .home-image {
    transform: translate(16%, 9%) rotate(-7deg);
  }

  /* bubble over the robot's right side, clear of the buttons above */
  .home-page .home-bubble {
    left: 58%;
    font-size: 1.25rem;
  }
}

/* phones: a smaller robot */
@media (max-width: 600px) {
  .home-page .home.section {
    --robot-h: min(30vh, 250px);
    /* keep the robot and its bubble clear of the buttons */
    padding-bottom: calc(var(--robot-h) * 1.1);
  }

  .home-page .home-bubble {
    left: 22%;
  }
}

@media (max-width: 900px) {
  /* featured: screenshot on top, text underneath */
  .home-page .feature,
  .home-page .feature--flip {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "img" "body";
  }

}

@media (prefers-reduced-motion: reduce) {
  .home-page .card-list .card-item .card-link:hover,
  .home-page .card-list .card-item .card-link:focus-visible,
  .home-page .card-list .card-link:hover .card-button {
    transform: none;
  }
}
