/* ---- tokens ---- */
:root {
  --paper: #fdf6ec;
  --paper-deep: #f6ead6;
  --ink: #2b1f14;
  --chili: #a3271a;
  --turmeric: #dba11c;
  --pandan: #4a6b3a;
  --stone: #8c8073;
  --rule: rgba(43, 31, 20, 0.16);

  --display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --body: "Karla", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --measure: 62ch;
  --gutter: clamp(1.25rem, 5vw, 4rem);
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

/* Warp-weave paper texture, two offset hairline grids. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
  background-image:
    repeating-linear-gradient(
      90deg,
      rgba(43, 31, 20, 0.035) 0 1px,
      transparent 1px 7px
    ),
    repeating-linear-gradient(
      0deg,
      rgba(43, 31, 20, 0.028) 0 1px,
      transparent 1px 9px
    );
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 68rem;
  margin: 0 auto;
  padding: 0 var(--gutter) 5rem;
}

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

:focus-visible {
  outline: 2px solid var(--chili);
  outline-offset: 3px;
}

/* ---- type ---- */
h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 600;
  font-variation-settings:
    "SOFT" 40,
    "WONK" 1;
  letter-spacing: -0.015em;
  line-height: 1.05;
  margin: 0;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* ---- masthead ---- */
.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.75rem 0 0;
  font-size: 0.9375rem;
  color: var(--stone);
}

.masthead a {
  color: inherit;
  text-decoration: none;
}

.masthead a:hover {
  color: var(--chili);
}

.wordmark {
  font-family: var(--display);
  font-size: 1.125rem;
  font-variation-settings:
    "SOFT" 60,
    "WONK" 1;
  color: var(--ink);
}

/* ---- hero ---- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  padding: clamp(2.5rem, 7vw, 5rem) 0 clamp(2rem, 5vw, 3.5rem);
}

.hero h1 {
  font-size: clamp(2.75rem, 7.5vw, 5.25rem);
  font-weight: 700;
}

h1 .indo {
  display: block;
  font-size: 0.42em;
  font-weight: 400;
  font-style: italic;
  font-variation-settings:
    "SOFT" 80,
    "WONK" 1;
  color: var(--chili);
  margin-bottom: 0.35em;
}

.hero p {
  max-width: 34ch;
  margin: 1.5rem 0 0;
  color: #4d3b29;
}

.hero-figure {
  position: relative;
  aspect-ratio: 1;
}

.hero-figure svg {
  width: 100%;
  height: auto;
  display: block;
}

/* ---- recipe index ---- */
.index-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--ink);
}

.index-head h2 {
  font-size: 1.375rem;
}

.index-head span {
  font-size: 0.9375rem;
  color: var(--stone);
}

.recipe-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.recipe-list > li {
  border-bottom: 1px solid var(--rule);
}

.row {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(1rem, 3vw, 2rem);
  padding: 1.5rem 0;
  color: inherit;
  text-decoration: none;
}

.row img {
  width: 5.5rem;
  height: 5.5rem;
  display: block;
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.row h3 {
  font-size: 1.5rem;
}

.row p {
  margin: 0.3rem 0 0;
  max-width: 48ch;
  color: #5b4733;
  font-size: 0.9375rem;
}

.row-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.3rem;
}

.row-time {
  font-family: var(--display);
  font-size: 1.0625rem;
  font-variation-settings:
    "SOFT" 60,
    "WONK" 0;
  color: var(--stone);
  white-space: nowrap;
}

.row:hover h3,
.row:focus-visible h3 {
  color: var(--chili);
}

.row:hover img,
.row:focus-visible img {
  transform: rotate(-6deg) scale(1.06);
}

/* Heat scale: filled glyphs carry the reading, empties give the ceiling. */
.heat {
  display: inline-flex;
  gap: 0.15rem;
  vertical-align: -0.15em;
}

.heat svg {
  width: 0.85rem;
  height: 0.85rem;
  fill: var(--chili);
}

.heat svg.off {
  fill: rgba(43, 31, 20, 0.18);
}

.tag {
  font-size: 0.8125rem;
  color: var(--pandan);
}

/* ---- recipe page ---- */
.recipe-head {
  padding: clamp(2rem, 5vw, 3.5rem) 0 1.5rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 9rem;
  align-items: start;
  gap: 2rem;
}

.recipe-head h1 {
  font-size: clamp(2.25rem, 5.5vw, 3.5rem);
  font-weight: 700;
}

.recipe-head p {
  margin: 1rem 0 0;
  max-width: 46ch;
  color: #4d3b29;
}

.recipe-head img {
  width: 9rem;
  height: 9rem;
  display: block;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0 2rem;
  margin: 0 0 2.5rem;
  padding: 0.75rem 0;
  list-style: none;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  font-size: 0.9375rem;
  color: var(--stone);
}

.meta b {
  font-weight: 700;
  color: var(--ink);
}

.columns {
  display: grid;
  grid-template-columns: minmax(0, 19rem) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}

.panel {
  position: sticky;
  top: 1.5rem;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  padding: 1.5rem;
}

.panel h2,
.steps-col h2 {
  font-size: 1.1875rem;
  margin-bottom: 0.85rem;
}

.panel h2 + p {
  margin-top: -0.5rem;
  font-size: 0.875rem;
  color: var(--stone);
}

.ingredients {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ingredients li {
  position: relative;
  padding: 0.45rem 0 0.45rem 1.6rem;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  transition: opacity 0.25s ease;
}

.ingredients li:last-child {
  border-bottom: 0;
}

.ingredients li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.85rem;
  width: 0.7rem;
  height: 0.7rem;
  border: 1.5px solid var(--stone);
  border-radius: 50%;
  transition:
    background 0.25s ease,
    border-color 0.25s ease;
}

.ingredients li::after {
  content: "";
  position: absolute;
  left: 1.6rem;
  right: 0;
  top: 1.2rem;
  height: 1.5px;
  background: var(--chili);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.ingredients li.is-done {
  opacity: 0.45;
}

.ingredients li.is-done::before {
  background: var(--chili);
  border-color: var(--chili);
}

.ingredients li.is-done::after {
  transform: scaleX(1);
}

.steps-col > * + h2 {
  margin-top: 2.75rem;
}

.steps {
  counter-reset: step;
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: var(--measure);
}

.steps li {
  counter-increment: step;
  position: relative;
  padding: 0 0 1.5rem 3.25rem;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -0.15rem;
  font-family: var(--display);
  font-size: 1.5rem;
  font-variation-settings:
    "SOFT" 70,
    "WONK" 1;
  color: var(--turmeric);
}

.steps li::after {
  content: "";
  position: absolute;
  left: 1.05rem;
  top: 2rem;
  bottom: 0.35rem;
  width: 1.5px;
  background: var(--rule);
}

.steps li:last-child::after {
  display: none;
}

.notes {
  max-width: var(--measure);
  margin: 0;
  padding: 0;
  list-style: none;
}

.notes li {
  padding: 0.5rem 0 0.5rem 1.25rem;
  border-left: 2px solid var(--turmeric);
  margin-bottom: 0.75rem;
  font-size: 0.9375rem;
  color: #4d3b29;
}

.sambal-block {
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
  margin-top: 2.5rem;
}

.sambal-block h2 {
  font-size: 1.625rem;
}

.sambal-block > p:first-of-type {
  max-width: var(--measure);
  margin-top: 0.4rem;
  color: #5b4733;
}

.sambal-block .columns {
  grid-template-columns: minmax(0, 17rem) minmax(0, 1fr);
}

.sambal-block .panel h2:first-child {
  font-size: 1rem;
}

.sambal-block .meta {
  margin: 1rem 0 1.5rem;
}

.back {
  display: inline-block;
  margin: 2.5rem 0 0;
  color: var(--chili);
  font-size: 0.9375rem;
}

footer {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 4rem;
  padding-top: 1.25rem;
  border-top: 2px solid var(--ink);
  font-size: 0.875rem;
  color: var(--stone);
}

footer .wordmark {
  font-size: 1rem;
  color: var(--ink);
  text-decoration: none;
}

footer .wordmark:hover {
  color: var(--chili);
}

/* ---- not found ---- */
.notfound {
  padding: clamp(4rem, 14vh, 9rem) 0;
  max-width: 34ch;
}

.notfound h1 {
  font-size: clamp(2.5rem, 7vw, 4rem);
}

.notfound p {
  color: #4d3b29;
}

/* ---- motion ---- */
[data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 0.6s ease,
    transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

[data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

/* One orchestrated load sequence: the mortar arrives, then what goes in it. */
.hero-figure .settle {
  opacity: 0;
  animation: settle 0.9s cubic-bezier(0.2, 0.9, 0.2, 1) forwards;
}

.hero-figure .settle-1 {
  animation-delay: 0.15s;
}
.hero-figure .settle-2 {
  animation-delay: 0.45s;
}
.hero-figure .settle-3 {
  animation-delay: 0.65s;
}
.hero-figure .settle-4 {
  animation-delay: 0.85s;
}

@keyframes settle {
  from {
    opacity: 0;
    transform: translateY(-22px) rotate(-14deg);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.steam {
  opacity: 0;
  animation: steam 5.5s ease-in-out 1.2s infinite;
}

.steam-b {
  animation-delay: 2.6s;
}

@keyframes steam {
  0% {
    opacity: 0;
    transform: translateY(6px) scaleX(0.85);
  }
  35% {
    opacity: 0.5;
  }
  100% {
    opacity: 0;
    transform: translateY(-26px) scaleX(1.25);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .hero-figure .settle,
  [data-reveal] {
    opacity: 1;
    transform: none;
  }

  .steam {
    display: none;
  }
}

/* ---- narrow ---- */
@media (max-width: 56rem) {
  .hero {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .hero-figure {
    max-width: 17rem;
  }

  .columns {
    grid-template-columns: 1fr;
  }

  .panel {
    position: static;
  }

  .recipe-head {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .recipe-head img {
    width: 7rem;
    height: 7rem;
  }
}

@media (max-width: 34rem) {
  .row {
    grid-template-columns: 3.5rem minmax(0, 1fr);
    row-gap: 0.5rem;
  }

  .row img {
    width: 3.5rem;
    height: 3.5rem;
  }

  .row-meta {
    grid-column: 2;
    flex-direction: row;
    align-items: center;
    gap: 0.6rem;
  }
}
