/* Tattoo Art Customs — tattoo-studio aesthetic: warm charcoal, cream paper,
   blood-red accent. High contrast, mobile-first, keyboard-focus visible. */
:root {
  --ink: #1c1a17;
  --paper: #f7f3ea;
  --paper-dim: #efe8d8;
  --accent: #a31621;
  --accent-dark: #7c0f18;
  --muted: #6b6257;
  --line: #ddd3c0;
  --ok: #2e7d32;
  --warn: #b26a00;
  --radius: 10px;
  /* Tinted panel wells (testers gold/join panels, raffle progress trough).
     Light values here = the classic face; dark.css re-points them on
     body.page-dark so the panels read as deep tinted wells there. */
  --panel-gold: #fdf6e0;
  --panel-join: #eef7ee;
  --well: #eee;
}
* { box-sizing: border-box; }
img { max-width: 100%; height: auto; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: Georgia, 'Times New Roman', serif; line-height: 1.6;
  font-size: 17px;
}
h1, h2, h3 { font-family: 'Arial Black', Arial, sans-serif; letter-spacing: .5px; line-height: 1.25; }
h1 { font-size: 2rem; margin: .5em 0; }
h2 { font-size: 1.4rem; margin-top: 1.5em; }
a { color: var(--accent); }
a:hover, a:focus { color: var(--accent-dark); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px;
}
.skip {
  position: absolute; left: -9999px; top: 0; background: var(--ink); color: #fff; padding: .5em 1em; z-index: 99;
}
.skip:focus { left: 0; }
.container { max-width: 1080px; margin: 0 auto; padding: 0 1rem; }
.site-header { background: var(--ink); color: var(--paper); position: sticky; top: 0; z-index: 50; }
.nav { max-width: 1080px; margin: 0 auto; padding: .6rem 1rem; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.brand { color: var(--paper); text-decoration: none; font-family: 'Arial Black', Arial, sans-serif; font-size: 1.2rem; }
.nav-links { display: flex; gap: .9rem; align-items: center; margin-left: auto; flex-wrap: wrap; }
.nav-links a { color: var(--paper); text-decoration: none; font-size: .95rem; }
.nav-links a:hover { text-decoration: underline; }
.nav-toggle { display: none; background: none; border: 1px solid var(--paper); color: var(--paper); font-size: 1.2rem; padding: .2em .5em; border-radius: 6px; margin-left: auto; cursor: pointer; }
.user-chip { display: inline-flex; align-items: center; gap: .5rem; color: var(--paper); text-decoration: none; }
.user-chip:hover { text-decoration: underline; }
.user-avatar { width: 2rem; height: 2rem; border-radius: 50%; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .95rem; flex: none; }
.user-avatar-img { width: 2rem; height: 2rem; border-radius: 50%; object-fit: cover; flex: none; }
.avatar-preview { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; }
.user-name { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .95rem; }
.btn {
  display: inline-block; background: var(--accent); color: #fff !important; border: none;
  padding: .75em 1.4em; border-radius: var(--radius); text-decoration: none; cursor: pointer; font-size: 1rem;
  min-height: 44px; line-height: 1.4;
}
.btn:hover, .btn:focus { background: var(--accent-dark); color: #fff; }
.btn-secondary, .btn.secondary { background: var(--ink); }
.btn-secondary:hover, .btn-secondary:focus,
.btn.secondary:hover, .btn.secondary:focus { background: #000; color: #fff; }
/* Standalone .secondary for buttons not using .btn (shop tools) */
button.secondary, input[type=submit].secondary { background: var(--ink); color: #fff; border: none; padding: .6em 1.1em; border-radius: var(--radius); cursor: pointer; font-size: .95rem; min-height: 44px; }
button.secondary:hover, button.secondary:focus { background: #000; }
button.secondary.danger, .btn.danger { background: #b3261e; }
button.secondary.danger:hover, .btn.danger:hover { background: #7c0f18; }
/* Inline forms: buttons side-by-side (shop inventory adjusters) */
form.form.inline { display: inline-block; max-width: none; margin-right: .5rem; vertical-align: middle; }
form.form.inline p { margin: 0; }
/* Low-stock highlight (shop inventory) */
.low-stock { border-left: 4px solid var(--warn); }

/* ---- Missing-class backfill (2026-10-09 responsive audit) ----
   Classes used across views that never had definitions. Mobile-first,
   matching the site design system. */
/* Buttons */
.btn-small { padding: .4em .9em; font-size: .85rem; min-height: 36px; }
.btn-big { padding: 1em 2em; font-size: 1.15rem; }
.btn-primary { background: var(--accent); }
.btn-quiet { background: transparent; color: var(--ink); border: 1px solid var(--line); padding: .5em 1em; min-height: 44px; border-radius: var(--radius); cursor: pointer; }
.btn-quiet:hover { background: var(--paper-dim); }
/* Forms */
.inline-form { display: inline-block; margin-right: .5rem; vertical-align: middle; }
/* Feedback */
.notice { background: #e8f0fe; border: 1px solid #b6cbe8; color: #1a3a6b; padding: .7em 1em; border-radius: var(--radius); margin: 1em 0; }
.error { background: #fdecea; border: 1px solid #f5c6c2; color: #7c0f18; padding: .7em 1em; border-radius: var(--radius); margin: 1em 0; }
/* Product / discount cards (aftercare, discounts, merch affiliate cards) */
.aftercare-products, .discount-grid, .design-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; margin: 1rem 0; }
.product-card, .discount-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; display: flex; flex-direction: column; gap: .5rem; }
.product-card h3, .discount-card h3 { margin: 0; }
.product-card .btn, .discount-card .btn { margin-top: auto; align-self: flex-start; }
.discount-badge { display: inline-block; background: var(--accent); color: #fff; font-weight: 700; font-size: .8rem; padding: .2em .8em; border-radius: 20px; text-transform: uppercase; letter-spacing: .5px; }
.discount-code { font-family: monospace; background: var(--paper-dim); border: 1px dashed var(--muted); border-radius: 6px; padding: .4em .8em; font-size: 1.1rem; letter-spacing: 1px; display: inline-block; }
.design-card-body { padding: .7rem; }
/* Booking slot picker */
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .5rem; margin: 1rem 0; }
.slot-grid button { min-height: 48px; padding: .6em; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; cursor: pointer; font-size: .95rem; }
.slot-grid button:hover, .slot-grid button.selected { background: var(--accent); color: #fff; border-color: var(--accent); }
/* Waiver signing */
.sigpad { border: 2px solid var(--line); border-radius: var(--radius); background: #fff; width: 100%; max-width: 600px; height: 220px; touch-action: none; cursor: crosshair; }
.legal-box { background: var(--paper-dim); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; max-height: 300px; overflow-y: auto; font-size: .9rem; margin: 1rem 0; }
/* Shop client tattoo entries */
.tattoo-entry { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin: .8rem 0; }
/* Photo grids (aftercare toolkit) */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .8rem; margin: 1rem 0; }
.photo-item img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); }
/* Membership pricing */
.price { font-size: 1.6rem; font-weight: 700; color: var(--accent); }
.tagline { color: var(--muted); font-style: italic; }
/* Misc */
.big { font-size: 1.25rem; }
.check { color: var(--ok); font-weight: 700; }
.current { font-weight: 700; color: var(--accent); }
.low { color: var(--warn); font-weight: 700; }
.respond { margin-top: 1rem; }
.flow-explain { background: var(--paper-dim); border-radius: var(--radius); padding: 1rem; margin: 1rem 0; font-size: .95rem; }
.muted-badge { display: inline-block; padding: .15em .7em; border-radius: 20px; font-size: .8rem; background: var(--paper-dim); color: var(--muted); }
.ad-direct { border: 2px solid var(--accent); }
.aftercare-promo { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin: 1rem 0; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 1rem 0; }
.sort, .filter { display: inline-flex; gap: .5rem; align-items: center; margin: .5rem .5rem .5rem 0; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: .8rem; }
.chips { display: flex; gap: .5rem; flex-wrap: wrap; margin: .5rem 0; }
.footer-newsletter, .newsletter-form { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.footer-newsletter input, .newsletter-form input { flex: 1; min-width: 200px; }
@media (max-width: 640px) {
  .aftercare-products, .discount-grid, .design-grid { grid-template-columns: 1fr 1fr; gap: .7rem; }
  .product-card, .discount-card { padding: .8rem; }
  .slot-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}
.flash {
  background: #fff3cd; border: 1px solid #e0c36a; color: #5c4a00;
  max-width: 1080px; margin: 1rem auto; padding: .7em 1em; border-radius: var(--radius);
}
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.2rem; margin: 1rem 0;
}
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.design-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.design-card img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: var(--paper-dim); }
.design-card .pad { padding: .7rem; }
.design-card h3 { margin: .2em 0; font-size: 1.05rem; }
.tag { display: inline-block; background: var(--paper-dim); border-radius: 20px; padding: .1em .7em; font-size: .8rem; margin: .15em; }
.sale-banner { background: var(--accent); color: #fff; padding: .8em 1em; border-radius: var(--radius); text-align: center; font-weight: bold; }
form.form { max-width: 560px; }
label { display: block; margin: .8em 0 .3em; font-weight: bold; }
input[type=text], input[type=email], input[type=password], input[type=url],
input[type=number], input[type=tel], input[type=file], input[type=date],
textarea, select {
  width: 100%; padding: .6em; border: 1px solid var(--line); border-radius: 6px; font-size: 1rem; background: #fff; color: var(--ink);
}
input[type=file] { padding: .5em; }
summary { cursor: pointer; padding: .6em 0; font-weight: bold; min-height: 44px; }
.hero .btn { margin: .25em .5em .25em 0; }
textarea { min-height: 120px; }
.hp { position: absolute; left: -9999px; } /* honeypot */
table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: .95rem; }
th, td { text-align: left; padding: .55em .6em; border-bottom: 1px solid var(--line); }
th { background: var(--paper-dim); }
.badge { display: inline-block; padding: .15em .7em; border-radius: 20px; font-size: .8rem; background: var(--paper-dim); }
.badge.ok { background: #d9ecd9; color: #1d5c22; }
.badge.warn { background: #f7e3c2; color: #7a4d00; }
.badge.bad { background: #f3cfcf; color: #7c0f18; }
.site-footer { background: var(--ink); color: var(--paper); margin-top: 3rem; padding: 2rem 0 1rem; }
.footer-grid { display: flex; gap: 2rem; justify-content: space-between; flex-wrap: wrap; }
.site-footer nav { display: flex; gap: 1rem; flex-wrap: wrap; }
.site-footer a { color: var(--paper); }
.fineprint { text-align: center; font-size: .8rem; color: #b9b0a0; margin-top: 1.5em; }
.detail-img { max-width: 520px; width: 100%; border: 1px solid var(--line); border-radius: var(--radius); }
/* Swipeable design viewer: prev/next arrows overlaid on the picture. */
.design-swipe { position: relative; max-width: 520px; }
.design-swipe .detail-img { display: block; }
.swipe-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(20, 16, 12, .5); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; line-height: 1; text-decoration: none;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.swipe-arrow.left { left: 10px; }
.swipe-arrow.right { right: 10px; }
.swipe-arrow:hover, .swipe-arrow:active { background: rgba(20, 16, 12, .75); color: #fff; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.5rem; }
.thread { list-style: none; padding: 0; }
.thread li { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .8em 1em; margin: .6em 0; }
.thread li.mine { background: #fdf6e8; margin-left: 2rem; }
.muted { color: var(--muted); font-size: .9rem; }
@media (max-width: 700px) {
  .two-col { grid-template-columns: 1fr; }
  .three-col { grid-template-columns: 1fr; }
  .nav-toggle { display: block; order: 2; margin-left: .5rem; }
  .nav-links { display: none; width: 100%; flex-direction: column; align-items: flex-start; order: 3; }
  .user-chip { order: 1; margin-left: auto; }
  .user-name { display: none; }
  .nav.open .nav-links { display: flex; }
  .nav.open .nav-links a { display: block; width: 100%; padding: .7em .2em; font-size: 1.05rem; }
  h1 { font-size: 1.5rem; }
}

/* Small screens: data tables become stacked cards. Cell labels come from
   data-label attributes, which layout.ejs fills in automatically from the
   table headers, so no per-view markup changes are needed. */
@media (max-width: 640px) {
  table, table tbody, table tr, table td, table th { display: block; width: 100%; }
  table thead { display: none; }
  table tr {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    margin: 0 0 .8em; padding: .4em .8em;
  }
  table td, table th { border: none; padding: .35em 0; text-align: left; overflow-wrap: break-word; }
  table td::before {
    content: attr(data-label); display: block;
    font-size: .75rem; font-weight: bold; text-transform: uppercase;
    letter-spacing: .5px; color: var(--muted);
  }
  table td:not([data-label])::before, table td:empty::before { content: none; }
  #cookie-banner { flex-wrap: wrap; }
}

/* Ad slots: direct-sold banners + AdSense fallback */
.ad-slot { margin: 1rem auto; text-align: center; max-width: 970px; }
.ad-slot img { max-width: 100%; height: auto; display: inline-block; border: 1px solid var(--line); border-radius: var(--radius); }

/* House ads: our own product/affiliate creatives (lib/houseAds.js) */
.house-ad { text-align: left; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface, #fff); padding: .6rem .9rem .8rem; }
.house-ad-label { display: inline-block; font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted, #666); border: 1px solid var(--line); border-radius: 999px; padding: .05rem .5rem; margin-bottom: .45rem; }
.house-ad-body { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.house-ad-text { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.house-ad-headline { font-size: 1.02rem; }
.house-ad-pitch { color: var(--muted, #555); font-size: .92rem; }
.house-ad-disclosure { color: var(--muted, #777); font-size: .75rem; }
.house-ad-cta { white-space: nowrap; }
@media (max-width: 560px) {
  .house-ad-body { flex-direction: column; align-items: stretch; }
  .house-ad-cta { text-align: center; }
}

/* Text-style button for secondary destructive actions (e.g. cancel order) */
.linklike { background: none; border: none; padding: 0; color: #b3261e; text-decoration: underline; cursor: pointer; font-size: .95rem; }
.linklike:disabled { color: var(--muted); cursor: default; }

/* Wishlist / favorites ([wishlist] feature) */
.design-card { position: relative; }
.fav-heart {
  position: absolute; top: .5rem; right: .5rem; z-index: 2;
  width: 2.4rem; height: 2.4rem; border-radius: 50%;
  background: rgba(255,255,255,.94); border: 1px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0;
}
.fav-heart svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: var(--ink); stroke-width: 2; }
.fav-heart:hover svg { stroke: var(--accent); }
.fav-heart.on svg { fill: var(--accent); stroke: var(--accent); }
.fav-heart-inline { position: static; vertical-align: middle; margin-left: .5rem; width: 2.2rem; height: 2.2rem; }
.nav-links [data-fav-count] { background: var(--accent); color: #fff; }

/* Like counts shown next to gallery hearts ([toploved] votes) */
.like-count {
  position: absolute; top: .5rem; right: 3.1rem; z-index: 2;
  font-size: .8rem; font-weight: 700; color: var(--ink);
  background: rgba(255,255,255,.94); border: 1px solid var(--line);
  border-radius: 999px; padding: .3rem .55rem; line-height: 1;
  pointer-events: none; white-space: nowrap;
}
.like-count-inline { position: static; margin-left: .25rem; vertical-align: middle; }

/* Guest sign-in nudge toast (likes require sign-in, owner rule 2026-10-11) */
#tac-signin-toast {
  position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%); z-index: 9999;
  background: var(--ink); color: #fff; border-radius: 999px; padding: .7rem 1.1rem;
  font-size: .9rem; box-shadow: 0 4px 16px rgba(0,0,0,.25);
  display: flex; gap: .6rem; align-items: center; cursor: pointer; max-width: 92vw;
}
#tac-signin-toast a { color: #fff; font-weight: 700; text-decoration: underline; white-space: nowrap; }

/* Top loved leaderboard */
.top-loved-badge {
  position: absolute; top: .5rem; left: .5rem; z-index: 2;
  font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  box-shadow: 0 1px 4px rgba(0,0,0,.18);
}
.love-count { font-size: 1.25rem; font-weight: 700; color: var(--accent); }

/* By-request character list */
.byrequest-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .5rem; }
.byrequest-list li { display: flex; align-items: center; gap: .5rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem .75rem; }
.byrequest-name { flex: 1; font-weight: 600; }

/* Living-picture idle animation (owner directive 2026-10-09): gentle breathe
   + soft sway, like a living profile photo. Transform-only (individual
   translate/rotate/scale properties) — art pixels are never altered.
   Breathe runs ~5s, sway runs ~6s; they compose because the properties are
   independent. NEVER apply to the coloring canvas or any interactive surface. */
@keyframes living-breathe {
  0%, 100% { translate: 0 0; scale: 1; }
  50% { translate: 0 -8px; scale: 1.025; }
}
@keyframes living-sway {
  0%, 100% { rotate: -0.8deg; }
  50% { rotate: 0.8deg; }
}
.living-picture {
  animation: living-breathe 5s ease-in-out infinite, living-sway 6s ease-in-out infinite;
  will-change: transform;
}
@media (prefers-reduced-motion: reduce) {
  .living-picture { animation: none; }
}

/* Living-picture atmosphere (owner directive 2026-10-09, revised): composited
   light motes drifting OVER the untouched art. The artwork pixels are never
   modified — motion lives only in this overlay + the gentle float underneath.
   Mote <i> elements are spawned by the layout script; never put content here. */
.living-frame { position: relative; display: inline-block; line-height: 0; border-radius: inherit; overflow: hidden; }
.living-atmosphere { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.living-atmosphere i {
  position: absolute; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.95) 0%, rgba(255,255,255,0) 70%);
  left: var(--x, 50%); top: 105%;
  width: var(--s, 5px); height: var(--s, 5px);
  opacity: 0;
  animation: living-rise var(--d, 9s) linear infinite, living-mote-sway var(--sd, 3s) ease-in-out infinite;
  animation-delay: var(--dl, 0s), var(--sdl, 0s);
}
@keyframes living-rise {
  0% { top: 105%; opacity: 0; }
  12% { opacity: var(--o, .6); }
  88% { opacity: var(--o, .6); }
  100% { top: -12%; opacity: 0; }
}
@keyframes living-mote-sway {
  0%, 100% { transform: translateX(calc(var(--sway, 18px) * -1)); }
  50% { transform: translateX(var(--sway, 18px)); }
}
@media (prefers-reduced-motion: reduce) {
  .living-atmosphere { display: none; }
}
