/* recipes.dins.dev base styles. Colors, type, spacing and motion come from assets/tokens.css. */

@font-face {
  font-family: "Fraunces";
  src: url("/assets/fonts/fraunces.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Instrument Sans";
  src: url("/assets/fonts/instrument-sans.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

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

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

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

h1,
h2,
h3 {
  margin: 0;
}

::selection {
  background: var(--color-accent-soft);
}

a {
  color: var(--color-accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
}

a:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Page frame */

.page {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 max(var(--gutter), env(safe-area-inset-right, 0px)) var(--space-9) var(--gutter);
}

.site-header {
  display: flex;
  align-items: center;
  height: 72px;
}

.home-link {
  display: block;
  border-radius: var(--radius-sm);
}

.lockup {
  display: block;
  height: 28px;
  width: auto;
}

.intro {
  margin: var(--space-7) 0 var(--space-6);
}

.intro .t-lead {
  margin: var(--space-3) 0 0;
}

@media (min-width: 768px) {
  .lockup {
    height: 32px;
  }

  .intro {
    margin: var(--space-8) 0 var(--space-7);
  }
}

/* Recipe cards: one column on phones, two on tablets, three on desktop. */

.recipes {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 640px) {
  .recipes {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .recipes {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-6);
  }
}

.card {
  --card-shadow: 0 0 0 1px var(--color-hairline), 0 1px 2px rgb(18 24 28 / 0.04), 0 12px 32px -16px rgb(18 24 28 / 0.22);
  --card-shadow-lifted: 0 0 0 1px var(--color-hairline), 0 2px 4px rgb(18 24 28 / 0.05), 0 24px 48px -20px rgb(18 24 28 / 0.30);
  display: block;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--card-shadow);
  color: var(--color-ink);
  text-decoration: none;
  transition:
    transform var(--motion-base) var(--motion-ease),
    box-shadow var(--motion-base) var(--motion-ease);
  -webkit-tap-highlight-color: transparent;
}

@media (prefers-color-scheme: dark) {
  .card {
    --card-shadow: 0 0 0 1px var(--color-hairline), 0 12px 32px -16px rgb(12 11 10 / 0.6);
    --card-shadow-lifted: 0 0 0 1px var(--color-hairline), 0 24px 48px -20px rgb(12 11 10 / 0.75);
  }
}

.card-image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  background: var(--color-hairline);
  transition: transform var(--motion-slow) var(--motion-ease);
}

.card-title {
  padding: var(--space-4) var(--space-5) var(--space-5);
  font-family: var(--font-display);
  font-size: var(--text-h3);
  line-height: var(--text-h3-lh);
  font-weight: var(--text-h3-weight);
  letter-spacing: var(--text-h3-tracking);
  font-optical-sizing: auto;
  font-variation-settings: "SOFT" 50, "WONK" 0;
  text-wrap: balance;
}

.card:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: var(--radius-lg);
}

@media (prefers-reduced-motion: no-preference) {
  @media (hover: hover) and (pointer: fine) {
    .card:hover {
      transform: translateY(-3px);
      box-shadow: var(--card-shadow-lifted);
    }

    .card:hover .card-image {
      transform: scale(1.03);
    }
  }

  /* Feedback on press, not release, and fast. */
  .card:active {
    transform: scale(0.98);
    box-shadow: var(--card-shadow);
    transition-duration: 100ms;
  }

  /* Content settles in once on load: the title first, then the cards in order. */
  .intro,
  .recipes > li {
    animation: rise 600ms var(--motion-ease) both;
  }

  .recipes > li:nth-child(1) { animation-delay: 80ms; }
  .recipes > li:nth-child(2) { animation-delay: 140ms; }
  .recipes > li:nth-child(3) { animation-delay: 200ms; }
  .recipes > li:nth-child(n + 4) { animation-delay: 260ms; }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

/* Recipe page */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  color: var(--color-muted);
  font-size: var(--text-small);
  text-decoration: none;
}

.back-link::before {
  content: "";
  width: 0.45em;
  height: 0.45em;
  border-left: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
}

.back-link:hover {
  color: var(--color-accent);
}

.recipe-top {
  display: grid;
  gap: var(--space-5);
  margin-top: var(--space-2);
}

.recipe-hero {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: 0 0 0 1px var(--color-hairline);
}

.recipe-head .t-lead {
  margin: var(--space-3) 0 0;
  max-width: 34rem;
}

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 var(--space-5);
  margin: var(--space-5) 0 0;
}

.facts div {
  padding: var(--space-3) 0;
  border-top: 1px solid var(--color-hairline);
}

.facts dt {
  font-family: var(--font-mono);
  font-size: var(--text-label);
  letter-spacing: var(--text-label-tracking);
  text-transform: uppercase;
  color: var(--color-muted);
}

.facts dd {
  margin: var(--space-1) 0 0;
  font-weight: 500;
}

@media (min-width: 1024px) {
  .recipe-top {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    gap: var(--space-8);
    align-items: center;
  }

  .facts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.recipe-body {
  display: grid;
  gap: var(--space-7);
  margin-top: var(--space-7);
}

@media (min-width: 900px) {
  .recipe-body {
    grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
    gap: var(--space-8);
    align-items: start;
    margin-top: var(--space-8);
  }
}

/* Keep the ingredients in view beside the method, but only on screens tall enough
   to show the whole list; otherwise its last items would hide below the fold. */
@media (min-width: 900px) and (min-height: 1040px) {
  .ingredients {
    position: sticky;
    top: var(--space-5);
  }
}

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

.ingredients {
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: 0 0 0 1px var(--color-hairline);
}

.ingredients h3 {
  margin: var(--space-5) 0 var(--space-1);
}

.ingredients h2 + h3 {
  margin-top: var(--space-4);
}

.ingredients label {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  min-height: 44px;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-hairline);
  cursor: pointer;
}

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

.ingredients input {
  flex: none;
  width: 1.15rem;
  height: 1.15rem;
  margin: 0.2em 0 0;
  accent-color: var(--color-accent);
}

.ingredients b {
  font-weight: 600;
}

.ingredients input:checked + span {
  color: var(--color-muted);
  text-decoration: line-through;
  text-decoration-color: var(--color-muted);
}

.ingredients input:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.recipe .steps {
  counter-reset: step;
  margin-top: var(--space-5);
}

.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 3rem;
}

.steps li + li {
  margin-top: var(--space-6);
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -0.1em;
  font-family: var(--font-display);
  font-size: var(--text-h3);
  line-height: 1;
  font-variation-settings: "SOFT" 50, "WONK" 0;
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--color-accent);
}

.steps h3 {
  font-size: var(--text-h4);
  line-height: var(--text-h4-lh);
  font-weight: 600;
}

.step-time {
  display: inline-block;
  margin-left: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-data);
  font-weight: 400;
  color: var(--color-muted);
}

.steps p {
  margin: var(--space-2) 0 0;
  max-width: var(--measure);
}

.why,
.notes {
  margin-top: var(--space-8);
}

.why ul {
  display: grid;
  gap: var(--space-5);
  margin-top: var(--space-5);
}

.why li {
  padding-top: var(--space-4);
  border-top: 2px solid var(--color-accent);
}

.why b {
  display: block;
  margin-bottom: var(--space-1);
  font-weight: 600;
}

@media (min-width: 640px) {
  .why ul {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-6);
  }
}

@media (min-width: 1024px) {
  .why ul {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.notes ul {
  margin-top: var(--space-4);
  max-width: var(--measure);
}

.notes li {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-hairline);
}

.notes b {
  font-weight: 600;
}

.printable {
  display: grid;
  gap: var(--space-5);
  margin-top: var(--space-8);
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: 0 0 0 1px var(--color-hairline);
}

.printable-preview {
  display: block;
  width: 100%;
  max-width: 180px;
  height: auto;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 1px var(--color-hairline), 0 8px 24px -12px rgb(18 24 28 / 0.25);
}

.printable p {
  margin: var(--space-2) 0 var(--space-5);
  color: var(--color-muted);
}

@media (min-width: 640px) {
  .printable {
    grid-template-columns: 180px minmax(0, 1fr);
    gap: var(--space-6);
    align-items: center;
  }
}

.button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--space-5);
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  color: var(--color-paper);
  font-weight: 600;
  text-decoration: none;
  transition: transform var(--motion-fast) var(--motion-ease);
}

.button:active {
  transform: scale(0.97);
  transition-duration: 100ms;
}

.site-footer {
  margin-top: var(--space-9);
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-hairline);
  font-size: var(--text-small);
}
