/* The Cozy Crochet Corner. Palette sampled from María's logo. */

/* Fallback for devices without Apple's Chalkboard SE (Windows, Android, Linux); Apple devices never download it.
   Comic Neue © The Comic Neue Project Authors, SIL Open Font License 1.1. */
@font-face { font-family: "Comic Neue"; src: url(comic-neue-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Comic Neue"; src: url(comic-neue-700.woff2) format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --cream: #FCF9E8;  /* badge background */
  --paper: #FFFDF6;  /* cards and panels */
  --ink: #61402E;    /* outlines and lettering */
  --ink-2: #4E3324;
  --muted: #7D5D49;
  --fur: #C39F85;
  --muzzle: #EBD5C2;
  --pink: #F0ACBF;   /* yarn */
  --lilac: #D5CDFC;  /* yarn */
  --mint: #CBEEAB;   /* yarn */
  --band: #FDF9D4;   /* yarn label */
  --focus: #8E80E0;
  --error: #9C3349;
  --radius: 22px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Chalkboard SE", "Chalkboard", "Comic Neue", "Comic Sans MS", cursive;
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--cream) radial-gradient(rgb(195 159 133 / .17) 1.3px, transparent 1.6px) 0 0 / 22px 22px;
}

main { flex: 1; width: min(1100px, 100% - 32px); margin: 0 auto; padding: 8px 0 48px; }

h1, h2, h3 { margin: 0 0 .5em; line-height: 1.2; font-weight: 700; }
h1, h2 { text-wrap: balance; }
h1 { font-size: clamp(1.7rem, 4.5vw, 2.6rem); }
h2 { font-size: clamp(1.35rem, 3.2vw, 1.8rem); }
p { margin: 0 0 1em; }
a { color: inherit; text-decoration-color: var(--pink); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--ink); }
img { display: block; max-width: 100%; height: auto; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }

/* Header */
.top {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  width: min(1100px, 100% - 32px); margin: 0 auto; padding: 14px 0;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 1.25rem; font-weight: 700; text-decoration: none; }
.brand img { width: 52px; height: 52px; }
.brand .short { display: none; }
nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
nav form { margin: 0; }
nav a, nav .link { padding: 8px 12px; border-radius: 999px; font-weight: 700; text-decoration: none; }
nav a:hover, nav .link:hover { background: var(--band); }
nav .cart-link { background: var(--paper); border: 2px dashed var(--fur); }
.count {
  display: inline-grid; place-items: center; min-width: 1.6em; height: 1.6em; padding: 0 .4em;
  border-radius: 999px; background: var(--pink); font-size: .85em;
}
@media (max-width: 560px) {
  .brand .long { display: none; }
  .brand .short { display: inline; }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  padding: .65em 1.4em; border: 2px solid var(--ink); border-radius: 999px;
  font: inherit; font-weight: 700; color: var(--cream); background: var(--ink);
  text-decoration: none; cursor: pointer; transition: transform .15s, background-color .15s;
}
.btn:hover { background: var(--ink-2); transform: translateY(-1px) rotate(-1deg); }
.btn.ghost { color: var(--ink); background: transparent; }
.btn.ghost:hover { background: var(--band); }
.btn.small { padding: .35em .95em; font-size: .95rem; }
.btn.danger { background: var(--error); border-color: var(--error); }
.link {
  padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer;
  text-decoration: underline 2px var(--pink); text-underline-offset: 3px;
}
.link.danger { color: var(--error); }

/* Hero */
.hero { display: grid; gap: 28px 56px; align-items: center; justify-items: center; padding: 20px 0 48px; text-align: center; }
.hero-logo {
  width: min(300px, 72vw); margin: 11px; border-radius: 50%; /* margin keeps the dashed ring inside the page */
  outline: 3px dashed var(--fur); outline-offset: 8px;
  filter: drop-shadow(0 12px 18px rgb(97 64 46 / .16));
}
.hero p { max-width: 32em; margin: 0 auto 1.3em; font-size: 1.15rem; }
@media (min-width: 800px) {
  .hero { grid-template-columns: auto 1fr; justify-items: start; text-align: left; }
  .hero p { margin-left: 0; }
}

/* Section title with a stitched underline */
.stitched { display: inline-block; margin-bottom: 24px; padding-bottom: 6px; border-bottom: 4px dashed var(--pink); }

/* Product grid */
.grid {
  display: grid; gap: 22px; margin: 0; padding: 0; list-style: none;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
}
.card a {
  display: block; height: 100%; padding: 10px 10px 14px; text-decoration: none;
  background: var(--paper); border: 2px dashed var(--fur); border-radius: var(--radius);
  transition: transform .2s, box-shadow .2s;
}
.card a:hover { transform: translateY(-3px) rotate(-.6deg); box-shadow: 0 10px 22px rgb(97 64 46 / .14); }
.card:nth-child(even) a:hover { transform: translateY(-3px) rotate(.6deg); }
.card img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: calc(var(--radius) - 8px); background: var(--muzzle); }
.card h3 { margin: 12px 4px 6px; font-size: 1.1rem; }
.card .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 4px; }
.price, .sub, .total strong, .items strong { white-space: nowrap; }
.price { display: inline-block; padding: 2px 12px; border-radius: 999px; font-weight: 700; background: var(--pink); }
.card:nth-child(3n+2) .price { background: var(--lilac); }
.card:nth-child(3n) .price { background: var(--mint); }
.soldout img { filter: grayscale(.6) opacity(.75); }
.tag {
  display: inline-block; padding: 1px 10px; border: 1.5px solid var(--fur); border-radius: 999px;
  font-size: .85rem; font-weight: 700; background: var(--band);
}
.tag.big { padding: 4px 14px; font-size: 1rem; }
.empty { padding: 32px; text-align: center; background: var(--paper); border: 2px dashed var(--fur); border-radius: var(--radius); }

/* Product page */
.back { margin-bottom: 14px; }
.notice { padding: 8px 14px; background: var(--band); border: 2px dashed var(--fur); border-radius: 14px; }
.product { display: grid; gap: 28px; }
.gallery { min-width: 0; }
.slides {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  background: var(--paper); border: 2px dashed var(--fur); border-radius: var(--radius);
}
.slides img { flex: 0 0 100%; width: 100%; aspect-ratio: 1; object-fit: contain; scroll-snap-align: start; }
.thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; }
.thumbs img { width: 64px; height: 64px; object-fit: cover; border: 2px solid var(--fur); border-radius: 12px; }
.price.big { padding: 4px 18px; font-size: 1.5rem; }
.desc { white-space: pre-line; }
.buy { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin: 22px 0; }
.buy input { width: 5.5em; }
.note { color: var(--muted); font-size: .95rem; }
@media (min-width: 800px) {
  .product { grid-template-columns: 1.1fr 1fr; align-items: start; }
}

/* Forms */
label { display: grid; gap: 6px; font-weight: 700; }
input, textarea, select {
  width: 100%; padding: .6em .8em; border: 2px solid var(--muzzle); border-radius: 14px;
  font: inherit; font-weight: 400; color: var(--ink); background: #fff;
}
input:focus, textarea:focus, select:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px rgb(142 128 224 / .35); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.check input { width: 1.2em; height: 1.2em; accent-color: var(--ink); }
fieldset { margin: 0; padding: 0; border: 0; }
legend { margin-bottom: 8px; font-weight: 700; }
.panel {
  display: grid; gap: 14px; padding: clamp(16px, 4vw, 28px);
  background: var(--paper); border: 2px dashed var(--fur); border-radius: var(--radius);
}
.panel p, .panel h2 { margin: 0; }
.narrow { max-width: 420px; margin: 24px auto; }
.hint { margin-top: -6px !important; color: var(--muted); font-size: .95rem; }
.error {
  margin: 0 0 14px; padding: 10px 14px; border: 2px solid #F3C3CE; border-radius: 14px;
  font-weight: 700; color: var(--error); background: #FDECEF;
}
.panel .error { margin: 0; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--muted); font-weight: 400; }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.bar > h1, .bar > h2 { margin: 0 auto 0 0; }
main > .bar { margin-bottom: 20px; }

/* Cart */
.lines { display: grid; gap: 12px; margin: 0 0 12px; padding: 0; list-style: none; }
.lines li {
  display: grid; align-items: center; gap: 8px 14px; padding: 10px 14px;
  grid-template-columns: 64px 1fr auto; grid-template-areas: "img what sub" "img qty remove";
  background: var(--paper); border: 2px dashed var(--fur); border-radius: var(--radius);
}
.lines img { grid-area: img; width: 64px; height: 64px; object-fit: cover; border-radius: 12px; }
.lines .what { grid-area: what; display: grid; }
.lines .qty { grid-area: qty; display: flex; align-items: center; gap: 8px; }
.lines .qty input { width: 4.5em; }
.lines .remove { grid-area: remove; justify-self: end; }
.lines .sub { grid-area: sub; justify-self: end; }
@media (min-width: 700px) {
  .lines li { grid-template-columns: 72px 1fr auto auto 6em; grid-template-areas: "img what qty remove sub"; }
  .lines img { width: 72px; height: 72px; }
}
.total { margin: 8px 0 28px; font-size: 1.3rem; text-align: right; }
.order { max-width: 640px; }

/* Admin */
.admin-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.admin-list li {
  display: flex; align-items: center; gap: 12px; padding: 8px 12px;
  background: var(--paper); border: 2px dashed var(--fur); border-radius: 18px;
}
.admin-list img { width: 56px; height: 56px; object-fit: cover; border-radius: 12px; }
.admin-list .what { display: grid; flex: 1; min-width: 0; }
.edit { max-width: 720px; }
.photos { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.photos img { width: 100%; aspect-ratio: 1; margin-bottom: 6px; object-fit: cover; border-radius: 14px; }
.preview { display: flex; flex-wrap: wrap; gap: 8px; }
.preview:empty { display: none; }
.preview img { width: 84px; height: 84px; object-fit: cover; border: 2px solid var(--lilac); border-radius: 12px; }
.danger-zone { margin-top: 28px; }
.order-card { margin-bottom: 18px; gap: 10px; }
.order-card h2 { font-size: 1.3rem; }
.order-card .who { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.order-card .total { margin: 0; font-size: 1.1rem; text-align: left; }
.items { margin: 0; padding-left: 1.2em; }
.status { text-transform: capitalize; }
.st-nuevo { border-style: solid; border-color: var(--pink); }
.st-nuevo .status { background: var(--pink); }
.st-confirmado .status { background: var(--lilac); }
.st-entregado .status { background: var(--mint); }
.st-cancelado { opacity: .7; }
.inline { display: flex; align-items: center; gap: 8px; }
.inline select { width: auto; }

/* Thanks / not found */
.center { display: grid; justify-items: center; gap: 4px; padding: 32px 0; text-align: center; }

/* Footer */
.foot { padding: 24px 16px 32px; text-align: center; font-size: .95rem; color: var(--muted); }
.foot p { margin: 0; }
.yarn { display: inline-flex; gap: 4px; margin-right: 6px; vertical-align: -1px; }
.yarn i { width: 12px; height: 12px; border: 1.5px solid var(--ink); border-radius: 50%; background: var(--pink); }
.yarn i:nth-child(2) { background: var(--lilac); }
.yarn i:nth-child(3) { background: var(--mint); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
