
:root{
  --bg:#eae7dd;
  --ink:#2f2a1f;
  --sage:#8d8f74;
  --cream:#f8f5ef;
  --accent:#b08e6a;
}
*{box-sizing:border-box}
body{margin:0;font-family: ui-serif, Georgia, 'Times New Roman', serif; color:var(--ink); background:var(--bg)}
a{color:inherit}
img{max-width:100%; display:block}

.site-header.compact{background:var(--cream); border-bottom:1px solid #e6dfd3}
.hero{max-width:1200px; margin:0 auto; padding:1rem; display:flex; align-items:center; gap:1rem}
.hero-text{flex:1 1 110px}
.hero-text h1{margin:.25rem 0; font-size:clamp(28px,4vw,44px)}
.hero-text .tagline{margin:.25rem 0 0; color:#5a584d; font-size:clamp(14px,1.8vw,18px)}
.hero-media{flex:0 1 50vw; display:flex; justify-content:flex-end}
.hero-img{max-width:min(50vw,640px); height:auto; border-radius:14px; border:3px double var(--accent); box-shadow:0 4px 24px rgba(0,0,0,.06)}

.content{padding:clamp(12px,2vw,24px)}

/* Link tiles */
.home-links{padding:clamp(8px,2vw,16px); max-width:900px; margin:0 auto}
.link-list{list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:.6rem}
.link-tile{display:flex; align-items:center; gap:.8rem; text-decoration:none; background:#fff; border:1px solid #e1ddd3; border-radius:16px; padding:.9rem 1rem; box-shadow:0 1px 8px rgba(0,0,0,.02); transition:transform .06s ease, box-shadow .12s ease}
.link-tile:hover{transform:translateY(-1px); box-shadow:0 6px 22px rgba(0,0,0,.06)}
.link-tile .icon{width:40px; height:40px; background:url('../img/yarn.svg') center/contain no-repeat; flex:0 0 40px}
.link-tile .text{display:flex; flex-direction:column}
.link-tile small{color:#666}

.about-blurb{max-width:800px; margin:1rem auto 2rem; text-align:center; color:#3d3a31}

/* Cards and grids (catalog/admin) */
.grid{display:grid; grid-template-columns:repeat(auto-fit, minmax(250px, 1fr)); gap:1rem}
.card{background:#fff; border:1px solid #e1ddd3; border-radius:12px; overflow:hidden; display:flex; flex-direction:column}
.card-body{padding:1rem; display:flex; flex-direction:column; gap:.5rem}
.price{font-weight:700}
.card form{display:flex; gap:.5rem; align-items:center; flex-wrap:wrap}
.card input[type=number]{width:90px}

.btn{background:var(--accent); color:#fff; border:0; padding:.65rem 1rem; border-radius:999px; cursor:pointer; text-decoration:none; display:inline-block}
.btn:hover{filter:brightness(.95)}
.btn.outline{background:transparent; color:var(--ink); border:1px solid var(--ink)}
.btn.big{font-size:1.1rem; padding:.8rem 1.2rem}

/* Forms */
.form-grid{display:grid; grid-template-columns:repeat(2,1fr); gap:.75rem; margin:1rem 0}
.form-grid label{display:flex; flex-direction:column; gap:.25rem; font-weight:600}
.form-grid input, .form-grid select, .form-grid textarea{padding:.6rem .7rem; border:1px solid #cfc8b9; border-radius:10px; font:inherit; background:#fff}
.form-grid .full{grid-column:1 / -1}

.alert{padding:.75rem 1rem; border-radius:12px; margin:1rem 0}
.alert.error{background:#ffecec; border:1px solid #f5b5b5}
.alert.success{background:#edffef; border:1px solid #b5f5c9}

/* Cart */
.cart-table{width:100%; border-collapse:collapse; background:#fff; border:1px solid #e1ddd3}
.cart-table th, .cart-table td{padding:.6rem .7rem; border-bottom:1px solid #eee}
.cart-table tfoot td{font-weight:700}
.cart-table .right{text-align:right}
.cart-table .total{font-size:1.1rem}
.cart .cart-actions{display:flex; gap:.5rem; margin-top:1rem; flex-wrap:wrap}

/* Checkout */
.checkout{display:grid; grid-template-columns: 1fr 320px; gap:1rem; align-items:start}
.checkout .order-summary{background:#fff; border:1px solid #e1ddd3; border-radius:12px; padding:1rem}
.checkout .order-summary ul{list-style:none; padding:0; margin:0}
.checkout .order-summary li{display:flex; justify-content:space-between; padding:.3rem 0; border-bottom:1px dashed #eee}
.checkout .order-summary p{display:flex; justify-content:space-between; margin:.4rem 0}
.checkout .order-summary p.total{font-size:1.1rem; font-weight:700}

/* Footer */
.site-footer{padding:1rem; background:var(--cream); border-top:1px solid #e6dfd3}
.footer-inner{max-width:1000px; margin:0 auto; display:flex; justify-content:space-between; align-items:center; gap:1rem; flex-wrap:wrap}

/* Responsive */
@media (max-width: 880px){
  .checkout{grid-template-columns:1fr}
}


/* Phone / narrow screens: reset the hero’s flex basis so no vertical gap is reserved */
@media (max-width: 600px) {
  .hero {
    flex-direction: column-reverse;  /* text above image */
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;         /* tighter padding */
    align-items: stretch;
  }

  /* CRITICAL: remove the 50vw flex-basis that becomes vertical on column layout */
  .hero-media {
    flex: 0 0 auto;                  /* no reserved height */
    width: 100%;
    align-self: stretch;
    justify-content: center;
  }

  /* Make the image truly fill width on portrait */
  .hero-img {
    width: 100% !important;          /* override desktop rule */
    max-width: none !important;
    height: auto;
    border-radius: 12px;
  }

  /* Trim heading spacing a bit for balance */
  .hero-text h1 { margin: 0.15rem 0; }
  .hero-text .tagline { margin: 0.15rem 0 0; }
}

/* Shared product grid for public + admin */

.products-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;      /* center cards when there are just 1–2 */
  gap: 1.5rem;
  margin: 1rem auto 2rem;
  max-width: 1200px;            /* prevent stretching super wide on large screens */
}

/* Standard card size */
.product-card {
  flex: 0 0 260px;              /* "column" width */
  max-width: 260px;
  box-sizing: border-box;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 0.75rem;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Keep images consistent height */
.product-card img {
  display: block;
  width: 100%;
  height: 220px;                /* fixed visual height */
  object-fit: cover;            /* crop nicely */
  border-radius: 6px;
  margin-bottom: 0.5rem;
}

/* Titles / price tidy */
.product-card h3 {
  font-size: 1rem;
  margin: 0 0 0.25rem;
}

.product-card .price {
  font-weight: bold;
  margin-bottom: 0.4rem;
}

/* Admin-specific tweaks (optional) */
.product-card--admin {
  background: #f8fafc;
  border-style: dashed;
}

/* Gallery */
.gallery-section.is-hidden { display: none; }

.gallery-section .section-inner{
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 16px 32px;
}

.gallery-grid{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.gallery-thumb{
  padding:0;
  border:0;
  background:none;
  cursor:pointer;
  border-radius: 10px;
  overflow:hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
}

.gallery-thumb img{
  width:100%;
  height: 120px;
  object-fit: cover;
  display:block;
}

.gallery-modal{
  position:fixed;
  inset:0;
  background: rgba(0,0,0,.92);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index: 9999;
}

.gallery-modal[hidden]{ display:none; }

#galleryModalImg{
  max-width: 96vw;
  max-height: 92vh;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}

.gallery-close{
  position:absolute;
  top: 12px;
  right: 16px;
  font-size: 38px;
  line-height: 1;
  padding: 6px 12px;
  border: 0;
  border-radius: 12px;
  background: rgba(255,255,255,.10);
  color: #fff;
  cursor: pointer;
}

.gallery-close:hover{ background: rgba(255,255,255,.18); }

.muted{ opacity: .75; }

.admin-head,.admin-toolbar,.order-card__top,.order-card__actions,.admin-head__actions{display:flex;justify-content:space-between;align-items:center;gap:1rem;flex-wrap:wrap}
.cards-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(320px,1fr));gap:1rem}
.order-card,.card-panel{background:#fff;border:1px solid #e1ddd3;border-radius:16px;padding:1rem;box-shadow:0 4px 18px rgba(0,0,0,.04)}
.order-card__meta,.order-card__grid{display:grid;gap:.45rem;margin:.75rem 0;color:#5a584d}
.order-card__grid{grid-template-columns:repeat(auto-fit,minmax(180px,1fr));padding-top:.75rem;border-top:1px solid #eee}
.order-badges{display:flex;gap:.5rem;flex-wrap:wrap}
.badge{display:inline-flex;align-items:center;padding:.3rem .6rem;border-radius:999px;font-size:.82rem;font-weight:700;background:#e9eef8;color:#243b5a}
.badge-soft{background:#f4efe6;color:#6c5431}
.badge-warn{background:#fff4dd;color:#8a5a00}
.status-new,.status-in_review,.status-quoted,.status-in_progress,.status-awaiting_customer,.status-ready,.status-completed,.status-archived{background:#eef4ea;color:#315434}
.status-awaiting_customer{background:#fff3dc;color:#7f5300}
.status-archived{background:#f0f0f0;color:#555}
.project-layout{display:grid;grid-template-columns:380px 1fr;gap:1rem;align-items:start}
.project-main{display:grid;gap:1rem}
.stack-form,.compact-form,.inline-form{display:grid;gap:.75rem}
.inline-form{grid-auto-flow:column;justify-content:start;align-items:end}
.stack-form input[type=text],.stack-form input[type=email],.stack-form input[type=password],.stack-form select,.stack-form textarea,.compact-form input,.inline-form select{padding:.65rem .75rem;border:1px solid #cfc8b9;border-radius:10px;font:inherit;background:#fff;width:100%}
.card-panel--nested{margin-top:1rem;background:#fcfbf8}
.thread-list{display:grid;gap:.85rem}
.thread-item{border:1px solid #e5dfd2;border-radius:14px;padding:.9rem;background:#faf8f3}
.thread-item.role-admin{background:#f3f7fb}
.thread-item.role-customer{background:#fffaf2}
.thread-item.role-system{background:#f6f6f6}
.thread-item.is-private{border-style:dashed}
.thread-item__meta{display:flex;gap:.75rem;align-items:center;flex-wrap:wrap;margin-bottom:.45rem;color:#5a584d;font-size:.92rem}
.thread-item__body{line-height:1.5;white-space:normal}
.thread-photo{display:inline-block;margin-top:.65rem}
.thread-photo img{width:min(100%,420px);max-height:320px;object-fit:cover;border-radius:12px;border:1px solid #ddd}
.project-thread-hero{margin-bottom:1rem}
@media (max-width: 960px){.project-layout{grid-template-columns:1fr}.public-project-layout{grid-template-columns:1fr}.inline-form{grid-auto-flow:row}}

/* Keep migrated forms and navigation usable at narrow widths. */
.foot-links{display:flex;flex-wrap:wrap;gap:.6rem 1rem;align-items:center}
.form-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
.form-grid input,.form-grid select,.form-grid textarea{min-width:0;max-width:100%;width:100%}
.form-grid input[type=checkbox]{width:auto}
.checkout>h2,.checkout>p,.checkout>.alert{grid-column:1/-1}
.grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,250px),1fr))}
.cards-list{grid-template-columns:repeat(auto-fit,minmax(min(100%,320px),1fr))}
.product-card{max-width:100%}
.project-sidebar,.project-main{min-width:0;overflow-wrap:anywhere}
.cart-table input{width:4rem;max-width:100%}
@media(max-width:600px){.form-grid{grid-template-columns:1fr}.cart-table th,.cart-table td{padding:.4rem}.hero-text .tagline{line-height:1.4}}

/* Home preview: continuous, uncropped images; full gallery retains its grid. */
.home-links { position: relative; }
.gallery-scroller[hidden] { display: none; }
.gallery-scroller {
  margin-top: .6rem;
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: 12px;
  background: var(--cream);
  border: 1px solid #e1ddd3;
}
.gallery-scroller:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.gallery-scroller-track { display: flex; align-items: stretch; width: max-content; }
.gallery-scroller .scroller-thumb { flex: 0 0 auto; border-radius: 0; box-shadow: none; }
.gallery-scroller .scroller-thumb img { width: auto; max-width: none; height: 180px; object-fit: contain; }
.scroller-thumb:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
@media (min-width: 960px) and (orientation: landscape) {
  .home-links.has-gallery-scroller .link-tile { padding-right: calc(34% + 1rem); }
  .gallery-scroller {
    position: absolute;
    top: 16px;
    right: 16px;
    bottom: 16px;
    width: 34%;
    margin: 0;
    z-index: 1;
    overflow-x: hidden;
    overflow-y: auto;
  }
  .gallery-scroller-track { display: block; width: 100%; }
  .gallery-scroller .scroller-thumb { display: block; width: 100%; }
  .gallery-scroller .scroller-thumb img { width: 100%; height: auto; }
}
