@font-face {
  font-family: CraigScratch-Regular;
  src: url(../assets/fonts/CraigScratch-Regular.otf) format("truetype");
}

:root {
  --color-bg: #f5f5f7;
  --color-card: #ffffff;
  --color-border: #e0e0e6;
  --color-text: #222222;
  --color-text-muted: #555555;

  --accent-lavender: #caa8d9;
  --accent-yellow: #fbcd82;
  --accent-blue: #b8d0e8;

  --radius-large: 20px;
  --radius-medium: 14px;
  --shadow-soft: 0 12px 24px rgba(0, 0, 0, 0.08);
  --shadow-tiny: 0 2px 6px rgba(0, 0, 0, 0.08);

  --color-border-strong: #7b5a90;
  --color-card-bg: #ffffff;
  --radius-card: 20px;
  --color-text-main: #222222;
  --color-orange: #fbcd82;
}

/* Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
}

body>header,
body>main,
body>footer {
  width: 100%;
}

body>main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

header {
  background-color: #ac7bc4;
  padding: 0.75rem 0.85rem 1rem;
  border-bottom: 3px solid var(--color-border-strong);
  font-family: CraigScratch-Regular, sans-serif;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

div.logo {
  display: flex;
  flex-direction: column;
  height: fit-content;
  align-items: center;
  gap: 0.4rem;
}

header .logo img {
  width: 60px;
  height: auto;
  border-radius: 999px;
  border: 3px solid var(--color-border-strong);
  background-color: var(--color-card-bg);
}

/* Inner header (title + nav + socials) */
header .header {
  max-width: 960px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

header h1 {
  max-width: fit-content;
  font-size: 2rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0;
}

header nav ul {
  list-style: none;
  padding: 0;
  margin: 0.2rem 0 0.4rem;
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  justify-content: center;
}

header nav a {
  font-size: clamp(1.05rem, 4.5vw, 2rem);
  font-weight: 600;
  padding: 0.35rem 0.7rem;
  border: 2px solid #ffffff;
  border-radius: 999px;
  background-color: rgba(255, 255, 255, 0.55);;
  color: var(--color-text-main);
  text-decoration: none;
  transition: filter 0.12s ease, transform 0.08s ease;
}

header nav a:hover,
header nav a:focus-visible {
  filter: brightness(1.05);
  transform: translateY(1px);
}

.socials-header {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6rem;
  align-items: center;
}

.socials-header a img {
  width: clamp(26px, 8vw, 50px);
  height: clamp(26px, 8vw, 50px);
  background-color: var(--accent-yellow);
  border: 2px solid var(--color-border-strong);
  padding: 0.25rem;
  border-radius: 8px;
}

.content-card {
  background: var(--color-card);
  border-radius: var(--radius-large);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-soft);
  padding: 1.5rem;
  margin: 1.75rem auto;
}

/* Headings & text */

h1,
h2,
h3 {
  margin: 0 0 0.75rem;
  font-weight: 700;
}

h1 {
  font-size: 1.6rem;
}

h2 {
  font-size: 1.3rem;
}

h3 {
  font-size: 1.1rem;
}

p {
  margin: 0 0 0.75rem;
  line-height: 1.6;
  color: var(--color-text-muted);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.hidden {
  display: none !important;
}

a,
a:visited,
a:hover,
a:active,
a:focus-visible {
  color: #000;
}

.button-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 1.2rem;
}

.btn-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.24);
  background: var(--accent-yellow);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  color: #222;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.15s ease;
}

.btn-pill:hover {
  background: #ffd698;
}

.btn-pill:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}

footer {
  border-top: 1px solid var(--color-border);
  padding: 1rem 1rem 1.5rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  text-align: center;
  margin-top: auto;
}

.detail-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.75rem 1rem 3rem;
}

.detail-page section {
  background: var(--color-card);
  border-radius: var(--radius-large);
  border: 1px solid var(--color-border);
  padding: 1.5rem;
}

.download-list {
  list-style: none;
  padding: 0;
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.download-list a {
  padding: 0.45rem 0.9rem;
  background: var(--accent-lavender);
  border-radius: 999px;
  font-weight: 600;
  color: #222;
  text-decoration: none;
}

.download-list a:hover {
  background: var(--accent-blue);
}

#worksheet-image img {
  border: 3px solid var(--color-border);
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  background: #eee;
  object-fit: cover;
}

.detail-page img {
  width: 100%;
  height: auto;
  border-radius: 16px;
}

.nav-toggle {
  max-width: fit-content;
  display: none;
  border: 2px solid var(--color-border, #222);
  background: rgba(255, 255, 255, 0.35);
  border-radius: 14px;
  padding: 0.55rem 0.6rem;
  cursor: pointer;
  box-shadow: var(--shadow-tiny, 0 2px 6px rgba(0, 0, 0, 0.08));
}

.nav-toggle__bar {
  display: block;
  width: 26px;
  height: 3px;
  margin: 5px 0;
  background: var(--color-border, #222);
  border-radius: 999px;
  transition: transform 180ms ease, opacity 180ms ease;
}

header.nav-open .nav-toggle__bar:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

header.nav-open .nav-toggle__bar:nth-child(2) {
  opacity: 0;
}

header.nav-open .nav-toggle__bar:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

.tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.tag-chip {
  border: 1px solid var(--color-border);
  background: var(--accent-blue);
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.2;
}

.tag-chip--static {
  cursor: default;
}

#recipe-box {
  background-color: var(--accent-lavender);
  border-radius: var(--radius-large);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-soft);
  margin: 1.75rem auto;
  max-width: 900px;
  background: color-mix(in srgb, var(--accent-lavender) 90%, white);
}

#recipe-title {
  text-align: center;
  margin-bottom: 1rem;
}

.recipe-sections {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.recipe-section {
  background: var(--accent-lavender);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: var(--shadow-tiny);
}

.recipe-section h3,
.recipe-section p,
.recipe-section li {
  color: #000;
}


#recipe-image img {
  width: 100%;
  border-radius: 12px;
  border: 2px solid #000;
}

.recipe-section h3 {
  margin-bottom: 0.5rem;
}

.recipe-section ul {
  margin: 0;
  padding-left: 1.1rem;
}

.recipe-extra-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.recipe-extra-grid img {
  border-radius: 12px;
  border: 1px solid var(--color-border);
}

.site-nav {
  width: 100%;
}

.btn {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  border-radius: 12px;
  background: #f1eaff;
  border: 2px solid #fff;
  color: #6b4bbd;
  text-decoration: none;
  font-weight: 600;
  margin-bottom: 1rem;
}

.btn:hover {
  background: #e6dcff;
}

.detail-page .btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1.25rem;
  border-radius: 12px;
  background: var(--accent-yellow);
  border: 2px solid #e8b95f;
  color: #4a2c00;
  text-decoration: none;
  font-weight: 700;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-tiny);
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.12s ease;
}

.detail-page .btn:hover {
  background: #ffdfa3;
  transform: translateY(1px);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.recipe-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.recipe-actions #random-recipe-button {
  margin-left: auto;
}

@media (min-width: 900px) {
  header {
    justify-content: center;
  }
}

@media (max-width: 820px) {
  .nav-toggle {
    display: inline-block;
  }

  .socials-header {
    gap: 2rem;
  }

  header nav ul {
    align-self: center;
  }

  header nav a {
    /* background-color: #c08adb; */
    background-color: rgba(255, 255, 255, 0);
     border: none;
  }

  /* Hide nav by default on mobile */
  .site-nav {
    display: none;
    width: 100%;
    margin-top: 0.75rem;
    padding: 0.75rem;
    border: 2px solid var(--color-border, #222);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.55);
    box-shadow: var(--shadow-small, 0 10px 22px rgba(0, 0, 0, 0.10));
  }

  /* Comic navigation: mobile-proof layout */
  .comic-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    margin: 0.75rem 0;
  }

  .comic-nav a,
  .comic-nav button {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  header.nav-open .site-nav {
    display: block;
  }

  header.nav-open nav ul {
    flex-direction: column;
    align-items: center;
    gap: 1.1rem;
  }
}

@media (max-width: 700px) {
  header {
    align-items: flex-start;
  }

  header .logo img {
    width: 58px;
  }

  header .header {
    gap: 0.35rem;
  }

  header nav ul {
    gap: 0.75rem;
  }
}

@media (max-width: 600px) {
  body>main {
    padding-inline: 0.75rem;
  }

  .content-card {
    border-radius: 16px;
    padding: 1.25rem;
  }

  .detail-page {
    padding: 1.25rem 0.9rem 2.5rem;
  }

  div.logo {
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
  }

  header h1 {
    margin-top: 0.7rem;
    font-size: 2.5rem;
  }
}

@media (max-width: 420px) {
  header {
    padding: 0.6rem 0.75rem 0.85rem;
  }

  header nav ul {
    justify-content: flex-start;
  }

  .socials-header {
    gap: 2rem;
  }
}

@media (min-width: 320px) and (max-width: 380px) {
  header h1 {
    font-size: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nav-toggle__bar {
    transition: none;
  }
}
