/* thefloyds.org shared foundation
   Tokens, base type and controls used by every page on the site. Page-specific
   styles live next to each page. The look is defined by the style guide:
   cool pale page, one heavy dark "mass" per page, warm color used sparingly. */

:root {
  /* Palette */
  --haze: #edeff1;
  --sky: #c8d5e4;
  --mist: #e1e7ec;
  --cliff: #23241b;
  --slate: #4a5159;
  --sea: #5f8896;
  --deep-sea: #2c5b6a;
  --denim: #3f5573;
  --bark: #9a4e36;
  --sand: #d3bc9c;
  --amber: #e59a3a;

  /* Roles, light */
  --bg: var(--haze);
  --surface: var(--mist);
  --ink: var(--cliff);
  --ink-2: var(--slate);
  --line: #c5ced6;
  --action: var(--deep-sea);
  --on-action: var(--haze);
  --accent: var(--bark);
  --on-accent: var(--haze);
  --soft: var(--sand);
  --on-soft: var(--cliff);
  --mass: var(--cliff);
  --mass-2: #33342a;
  --on-mass: #e6eaec;
  --on-mass-2: #b4bec4;
  --mass-action: var(--sand);
  --on-mass-action: var(--cliff);

  /* Type */
  --font-display: "Young Serif", Georgia, "Times New Roman", serif;
  --font-body: "Albert Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Shape and motion */
  --r-photo: 2px;
  --r-control: 6px;
  --r-pill: 999px;
  --ease: cubic-bezier(0.2, 0.6, 0.2, 1);
  --t-press: 120ms;
  --t-state: 240ms;
  --t-reveal: 900ms;

  /* Layout */
  --wide: 72.5rem;
  --measure: 38rem;

  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .5  0 0 0 0 .5  0 0 0 0 .5  0 0 0 .9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1d16;
    --surface: #26271e;
    --ink: #e6eaec;
    --ink-2: #a9b4bb;
    --line: #3a3c30;
    --action: #8fb4c0;
    --on-action: #1c1d16;
    --accent: #d8a387;
    --on-accent: #1c1d16;
    --soft: #4b4130;
    --on-soft: #efe3d0;
    --mass: #121310;
    --mass-2: #1f2019;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem / 1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-wrap: pretty;
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
dl,
figure {
  margin: 0;
}

h1,
h2 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.4rem, 1.6rem + 3.4vw, 4.25rem);
  line-height: 1.04;
}

h2 {
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  line-height: 1.1;
}

h3,
h4 {
  font: 600 1.2rem / 1.3 var(--font-body);
}

img,
video {
  display: block;
  max-width: 100%;
}

a {
  color: var(--action);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

a:hover {
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--action);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.wrap {
  width: min(100% - 2.5rem, var(--wide));
  margin-inline: auto;
}

.lede {
  max-width: 60ch;
  font-size: 1.2rem;
  line-height: 1.55;
  color: var(--ink-2);
}

.small {
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--ink-2);
}

.num {
  font-variant-numeric: tabular-nums;
}

/* Wordmark above each page's title */
.site-name {
  margin-bottom: 1.5rem;
  font: 400 1.35rem / 1 var(--font-display);
}

.site-name a {
  color: var(--ink);
  text-decoration: none;
}

.site-name a:hover {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
}

/* The one heavy dark section on a page, with film grain and a headland edge */
.mass {
  position: relative;
  isolation: isolate;
  background: var(--mass);
  color: var(--on-mass);
}

.mass::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: var(--grain);
  opacity: 0.07;
  mix-blend-mode: screen;
  pointer-events: none;
}

.mass h1,
.mass h2,
.mass h3 {
  color: var(--on-mass);
}

.mass .small,
.mass .lede {
  color: var(--on-mass-2);
}

.mass :focus-visible {
  outline-color: var(--sand);
}

.mass a {
  color: var(--sand);
}

.headland {
  clip-path: polygon(0 clamp(28px, 5vw, 64px), 100% 0, 100% 100%, 0 100%);
}

.section {
  padding-block: clamp(3.5rem, 9vw, 7rem);
}

.section + .section {
  border-top: 1px solid var(--line);
}

/* Buttons: primary is filled, secondary is an outline, text is low weight */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.75rem 1.2rem;
  border: 1.5px solid transparent;
  border-radius: var(--r-control);
  background: var(--action);
  color: var(--on-action);
  font: 600 1rem / 1 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    background-color var(--t-state) var(--ease),
    color var(--t-state) var(--ease),
    border-color var(--t-state) var(--ease),
    transform var(--t-press) var(--ease);
}

.btn:hover {
  background: color-mix(in srgb, var(--action) 86%, var(--ink));
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled,
.btn[aria-busy="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn svg {
  width: 1.25em;
  height: 1.25em;
  flex: none;
}

.btn-secondary {
  border-color: var(--action);
  background: transparent;
  color: var(--action);
}

.btn-secondary:hover {
  background: color-mix(in srgb, var(--action) 12%, transparent);
}

.btn-text {
  min-height: 2.75rem;
  padding-inline: 0.5rem;
  border-radius: var(--r-photo);
  background: transparent;
  color: var(--action);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.btn-text:hover {
  background: transparent;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
}

.btn-small {
  min-height: 2.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.9375rem;
}

.btn-danger,
.danger {
  background: var(--accent);
  color: var(--on-accent);
}

.btn-danger:hover,
.danger:hover {
  background: color-mix(in srgb, var(--accent) 86%, var(--ink));
}

/* On dark: sand takes the place of deep sea */
.mass .btn {
  background: var(--mass-action);
  color: var(--on-mass-action);
}

.mass .btn:hover {
  background: color-mix(in srgb, var(--mass-action) 86%, white);
}

.mass .btn-secondary {
  border-color: var(--sand);
  background: transparent;
  color: var(--sand);
}

/* Fields */
.field input,
.field textarea,
.field select,
.request input {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid var(--line);
  border-radius: var(--r-control);
  background: var(--surface);
  color: var(--ink);
  font: 400 1rem / 1.4 var(--font-body);
}

.field input:hover,
.field textarea:hover,
.request input:hover {
  border-color: var(--sea);
}

.field input:focus-visible,
.field textarea:focus-visible,
.request input:focus-visible {
  outline: 3px solid var(--action);
  outline-offset: 1px;
  border-color: var(--action);
}

label {
  font-weight: 500;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* Top bar: wordmark left, sections right. Current page gets a bark underline. */
.sitebar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.sitebar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  min-height: 3.5rem;
}

/* The logo lockup, painted in a flat colour through a mask so each bar can recolour it.
   The words stay in the link for screen readers. */
.sitebar .mark {
  display: block;
  width: 7.2rem;
  height: 1.46rem;
  overflow: hidden;
  background-color: var(--ink);
  -webkit-mask: url("/logo/lockup.svg") left center / contain no-repeat;
  mask: url("/logo/lockup.svg") left center / contain no-repeat;
  text-indent: 200%;
  white-space: nowrap;
}

.sitebar nav {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.sitebar nav::-webkit-scrollbar {
  display: none;
}

.sitebar nav a {
  padding: 0.55rem 0.7rem;
  border-radius: var(--r-control);
  box-shadow: inset 0 -2px 0 transparent;
  color: var(--ink-2);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--t-state) var(--ease);
}

.sitebar nav a:hover {
  color: var(--ink);
}

.sitebar nav a[aria-current="page"] {
  color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--accent);
}

/* On a photo or other dark page the bar floats, with no fill */
.sitebar-over {
  position: absolute;
  inset: 0 0 auto;
  border-bottom: 0;
  background: transparent;
}

.sitebar-over .mark {
  background-color: #f6f7f8;
}

.sitebar-over nav a,
.sitebar-over nav a:hover,
.sitebar-over nav a[aria-current="page"] {
  color: #f6f7f8;
}

.sitebar-over nav a[aria-current="page"] {
  box-shadow: inset 0 -2px 0 var(--sand);
}

@media (max-width: 420px) {
  .sitebar-inner {
    gap: 0.5rem;
  }

  .sitebar nav a {
    padding-inline: 0.5rem;
  }
}

/* Motion ------------------------------------------------------------------
   Kept small: pages ease in, pictures fade in over a quiet placeholder,
   recipe cards rise in. Everything animated sits inside no-preference, so
   people who ask for less motion get none of it. */

:root {
  --shimmer: rgba(255, 255, 255, 0.55);
}

@media (prefers-color-scheme: dark) {
  :root {
    --shimmer: rgba(255, 255, 255, 0.06);
  }
}

/* A picture still loading: its frame shows a soft sweep. Set by motion.js. */
:is(.poster, .tag-photo):has(img[data-loading]),
.thumb:has(img[data-loading]) {
  background-image: linear-gradient(100deg, transparent 30%, var(--shimmer) 50%, transparent 70%);
  background-size: 250% 100%;
  background-repeat: no-repeat;
  background-position: 120% 0;
}

.thumb:has(img[data-loading]) {
  --shimmer: rgba(255, 255, 255, 0.12);
}

@media (prefers-reduced-motion: no-preference) {
  /* Each page eases in under the top bar. Opacity only: a transform here
     would break fixed and sticky pieces inside the page. */
  body > :not(.sitebar, script, dialog, .frame, .cook, .hero, .stage) {
    animation: page-in 320ms var(--ease) both;
  }

  img {
    transition: opacity var(--t-reveal) var(--ease);
  }

  img[data-loading] {
    opacity: 0;
  }

  :is(.poster, .tag-photo):has(img[data-loading]),
  .thumb:has(img[data-loading]) {
    animation: shimmer 1.6s ease-in-out infinite;
  }

  .recipe-grid > li {
    animation: rise 480ms var(--ease) backwards;
    animation-delay: min(calc(sibling-index() * 40ms), 400ms);
  }

  @keyframes page-in {
    from {
      opacity: 0;
    }
  }

  @keyframes rise {
    from {
      opacity: 0;
      transform: translateY(10px);
    }
  }

  @keyframes shimmer {
    to {
      background-position: -120% 0;
    }
  }
}
