/* Closer to Korea — responsive hardening layer
   Load after css/styles.css.
   Keeps the existing brand, data rendering, menu behavior, and card markup intact. */

:root {
  --responsive-gutter: clamp(0.75rem, 3vw, 1.5rem);
  --tap-target: 48px;
}

/* Global overflow and intrinsic sizing safeguards */
html {
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-width: 0;
  overflow-x: clip;
}

*,
*::before,
*::after {
  min-width: 0;
}

img,
picture,
video,
canvas,
svg,
iframe {
  display: block;
  max-width: 100%;
  height: auto;
}

input,
select,
textarea,
button {
  max-width: 100%;
  font: inherit;
}

button,
a,
summary,
select,
input[type="checkbox"],
input[type="radio"] {
  touch-action: manipulation;
}

:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 3px solid #29272d;
  outline-offset: 3px;
}

/* Prevent long product names, URLs, and labels from forcing overflow */
:where(
  .brand,
  .hero-copy,
  .section,
  .product-card,
  .product-card-body,
  .context-grid,
  .editorial-cards,
  .guide-grid,
  .site-footer,
  .data-article-body,
  .data-product-layout
) {
  overflow-wrap: anywhere;
}

/* Stable page gutters across every viewport */
.header-inner,
.site-search,
.hero,
.section,
.site-footer,
.legal-page,
.data-article-page,
.data-product-page {
  width: min(var(--max, 1180px), calc(100% - (var(--responsive-gutter) * 2)));
  margin-inline: auto;
}

/* Header */
.site-header {
  isolation: isolate;
}

.header-inner {
  gap: 0.5rem;
}

.brand {
  max-width: 100%;
  line-height: 1;
}

.header-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 0.4rem;
}

.round-button,
.menu-button,
.jelly-button,
.shop-tools select,
.shop-tools button,
.site-search input,
.newsletter input,
.newsletter button {
  min-height: var(--tap-target);
}

.round-button {
  min-width: var(--tap-target);
  padding-inline: 0.75rem;
}

.mobile-menu {
  max-height: calc(100dvh - 72px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.mobile-menu a {
  display: flex;
  align-items: center;
  min-height: var(--tap-target);
}

/* Search */
.site-search {
  padding-inline: 0;
}

.search-row {
  align-items: stretch;
}

.search-row input {
  width: 100%;
}

/* Hero */
.hero {
  grid-template-columns: minmax(0, 1fr);
}

.hero-copy,
.hero-collage {
  width: 100%;
}

.hero h1 {
  max-width: 11ch;
  font-size: clamp(2.7rem, 13vw, 6.8rem);
  text-wrap: balance;
}

.hero-copy > p {
  font-size: clamp(1rem, 2.5vw, 1.125rem);
  line-height: 1.65;
}

.hero-actions .jelly-button {
  text-align: center;
}

.hero-collage {
  min-height: auto;
  aspect-ratio: 10 / 9;
}

.hero-collage img {
  position: absolute;
  inset: 0.45rem;
  width: calc(100% - 0.9rem);
  height: calc(100% - 0.9rem);
}

.floating-note,
.camera-stamp {
  max-width: calc(100% - 2rem);
}

/* Sections and cards */
.section {
  padding-inline: 0;
}

.section-head {
  gap: 1rem;
}

.section-head > * {
  max-width: 100%;
}

.context-grid,
.editorial-cards,
.guide-grid,
.product-grid,
.collection-row {
  grid-template-columns: minmax(0, 1fr);
}

.product-card,
.compact-card,
.context-grid article,
.editorial-cards article,
.guide-grid > *,
.collection-card {
  min-width: 0;
}

.product-card img,
.compact-card img,
.collection-card img {
  width: 100%;
  object-fit: cover;
}

/* Horizontal preview rails remain intentional, but cannot create page overflow */
.preview-strip {
  width: 100%;
  max-width: 100%;
  grid-auto-columns: minmax(16rem, 88%);
  padding-inline: 0.125rem;
  scroll-padding-inline: 0.125rem;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

/* Category beads */
.bead-categories {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x proximity;
  padding-bottom: 0.75rem;
  -webkit-overflow-scrolling: touch;
}

.bead-categories a {
  flex: 0 0 auto;
  min-width: 76px;
  min-height: 76px;
  scroll-snap-align: start;
}

/* Shop filters */
.shop-tools {
  width: 100%;
}

.shop-tools label {
  min-width: 0;
}

.shop-tools select,
.shop-tools button {
  width: 100%;
}

.product-details summary {
  min-height: var(--tap-target);
  display: flex;
  align-items: center;
  cursor: pointer;
}

/* Forms */
.newsletter,
.newsletter form,
.footer-newsletter,
.footer-newsletter form {
  min-width: 0;
}

.newsletter input,
.footer-newsletter input {
  width: 100%;
  min-width: 0;
}

/* Tables from current or future editorial content */
.table-scroll,
.data-article-body table,
.legal-page table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}

table {
  border-collapse: collapse;
}

th,
td {
  min-width: 8rem;
  vertical-align: top;
}

/* Footer */
.site-footer {
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
}

.site-footer nav,
.site-footer .footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
}

/* 320px–430px phones */
@media (max-width: 479px) {
  :root {
    --responsive-gutter: 0.75rem;
  }

  .header-inner {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .brand {
    font-size: clamp(1.15rem, 6vw, 1.55rem);
  }

  .round-button {
    width: var(--tap-target);
    padding-inline: 0;
    font-size: 0;
  }

  .round-button::before {
    font-size: 1rem;
    line-height: 1;
  }

  [data-search-toggle]::before {
    content: "⌕";
  }

  [data-menu-toggle]::before {
    content: "☰";
  }

  [data-menu-toggle][aria-expanded="true"]::before {
    content: "×";
  }

  .search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.65rem;
  }

  .site-search input,
  .site-search button {
    width: 100%;
  }

  .hero {
    padding-top: 0.75rem;
    gap: 0.75rem;
  }

  .hero-copy {
    padding: 1.25rem;
    border-radius: 26px;
  }

  .hero-collage {
    border-radius: 26px;
    aspect-ratio: 1 / 1;
  }

  .hero-collage img {
    border-radius: 21px;
  }

  .hero h1 {
    margin-block: 0.65rem 0.9rem;
    font-size: clamp(2.55rem, 14vw, 4rem);
  }

  .patch-badge,
  .match-badge,
  .trust-chip {
    width: fit-content;
    font-size: 0.69rem;
    line-height: 1.3;
  }

  .hero-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-actions .jelly-button {
    width: 100%;
  }

  .camera-stamp {
    inset: 1rem 1rem auto;
  }

  .floating-note {
    font-size: 0.6rem;
  }

  .section {
    padding-block: 2.5rem;
  }

  .section h2 {
    font-size: clamp(2rem, 10vw, 3.1rem);
  }

  .section-head {
    align-items: flex-start;
  }

  .text-link {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap-target);
  }

  .preview-strip {
    grid-auto-columns: minmax(15rem, 92%);
    gap: 0.75rem;
  }

  .shop-tools {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.65rem;
  }

  .product-card h3 {
    font-size: clamp(1.3rem, 7vw, 1.65rem);
  }

  .context-grid,
  .editorial-cards {
    gap: 0.75rem;
  }

  .bead-categories a {
    min-width: 72px;
    min-height: 72px;
  }
}

/* Large phones and small tablets */
@media (min-width: 480px) and (max-width: 699px) {
  .search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.65rem;
  }

  .hero-actions .jelly-button {
    min-width: 12rem;
  }

  .shop-tools {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Tablets */
@media (min-width: 700px) {
  .hero {
    gap: 1.25rem;
  }

  .hero-collage {
    aspect-ratio: 16 / 10;
  }

  .context-grid,
  .guide-grid,
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .editorial-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .site-footer {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .preview-strip {
    grid-auto-flow: initial;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }
}

/* Desktop */
@media (min-width: 960px) {
  .hero {
    grid-template-columns: minmax(0, 1.05fr) minmax(22rem, 0.95fr);
    align-items: stretch;
  }

  .hero-collage {
    min-height: 34rem;
    aspect-ratio: auto;
  }

  .product-grid,
  .preview-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .site-footer {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  }
}

/* Wide desktop: avoid over-stretched text and cards */
@media (min-width: 1280px) {
  .hero-copy > p,
  .section-head p {
    max-width: 62ch;
  }
}

/* Coarse pointers: consistently accessible touch targets */
@media (pointer: coarse) {
  :where(a, button, input, select, textarea, summary) {
    min-height: var(--tap-target);
  }

  .desktop-nav a {
    padding-block: 0.75rem;
  }
}

/* Motion and data-saving preferences */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .preview-strip {
    scroll-snap-type: none;
  }
}

@media (prefers-reduced-data: reduce) {
  .cursor-sparkle,
  .sparkle-particle {
    display: none !important;
  }
}


/* Conversion, trust, and monetization refinements */
.hero {
  min-height: auto;
  padding-block: clamp(0.75rem, 2vw, 1.5rem);
}

.hero-copy {
  padding: clamp(1.4rem, 4vw, 3.1rem);
}

.hero h1 {
  max-width: 10ch;
  line-height: 0.94;
}

.hero-collage {
  min-height: clamp(25rem, 48vw, 32rem);
}

.hero-collage::before,
.hero-collage::after {
  opacity: 0.82;
}

.hero-actions .primary {
  box-shadow: 0 12px 30px rgba(255, 77, 148, 0.2);
}

.hero-actions .secondary {
  background: transparent;
  border-color: rgba(41, 39, 45, 0.22);
}

.trust-row {
  margin-top: 1rem;
}

.quick-categories {
  width: min(var(--max, 1180px), calc(100% - (var(--responsive-gutter) * 2)));
  margin: clamp(0.5rem, 2vw, 1.5rem) auto clamp(2.25rem, 5vw, 4.5rem);
  padding: clamp(1.2rem, 3vw, 2rem);
  border: 1px solid rgba(41, 39, 45, 0.1);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 18px 45px rgba(92, 70, 85, 0.08);
  backdrop-filter: blur(14px);
}

.quick-categories__head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.quick-categories__head h2 {
  margin: 0;
  max-width: 18ch;
  font-size: clamp(1.55rem, 4vw, 2.4rem);
}

.quick-category-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
}

.quick-category-grid a {
  display: grid;
  align-content: center;
  min-height: 128px;
  padding: 1rem;
  border: 1px solid rgba(41, 39, 45, 0.1);
  border-radius: 22px;
  background: #fff;
  color: inherit;
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.quick-category-grid a:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 77, 148, 0.35);
  box-shadow: 0 14px 28px rgba(92, 70, 85, 0.1);
}

.quick-category-grid a:focus-visible {
  outline: 3px solid #29272d;
  outline-offset: 3px;
}

.quick-category-grid span {
  margin-bottom: 0.55rem;
  font-size: 1.7rem;
}

.quick-category-grid strong {
  font-size: 1rem;
}

.quick-category-grid small {
  margin-top: 0.25rem;
  color: rgba(41, 39, 45, 0.66);
}

.ad-slot {
  display: none;
  width: min(970px, calc(100% - (var(--responsive-gutter) * 2)));
  min-height: 120px;
  margin: clamp(1.5rem, 4vw, 3rem) auto;
  place-items: center;
  border-top: 1px solid rgba(41, 39, 45, 0.08);
  border-bottom: 1px solid rgba(41, 39, 45, 0.08);
  background: rgba(255,255,255,0.42);
  color: rgba(41, 39, 45, 0.48);
}

.ads-enabled .ad-slot {
  display: grid;
}

.ad-slot > span {
  align-self: start;
  margin-top: 0.6rem;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ad-slot__mount {
  width: 100%;
  min-height: 90px;
}

.site-footer nav {
  max-width: 34rem;
}

.site-footer nav a {
  min-height: 44px;
}

.legal-page {
  padding-block: clamp(2rem, 6vw, 5rem);
}

.legal-page .legal-card {
  max-width: 780px;
  margin-inline: auto;
  padding: clamp(1.25rem, 4vw, 3rem);
  border: 1px solid rgba(41, 39, 45, 0.1);
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(92, 70, 85, 0.08);
}

.legal-page h1 {
  max-width: 15ch;
  font-size: clamp(2.4rem, 7vw, 4.8rem);
  line-height: 0.98;
}

.legal-page h2 {
  margin-top: 2rem;
  font-size: clamp(1.35rem, 3vw, 1.9rem);
}

.legal-page li + li {
  margin-top: 0.55rem;
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

@media (max-width: 799px) {
  .quick-category-grid {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    padding-bottom: 0.6rem;
    overscroll-behavior-inline: contain;
  }

  .quick-category-grid a {
    flex: 0 0 min(75vw, 230px);
    min-height: 112px;
    scroll-snap-align: start;
  }

  .hero-collage {
    min-height: auto;
  }
}

@media (max-width: 479px) {
  .hero-copy {
    padding: 1.2rem;
  }

  .hero h1 {
    font-size: clamp(2.4rem, 13vw, 3.65rem);
  }

  .quick-categories {
    border-radius: 22px;
    padding: 1rem;
  }

  .quick-categories__head {
    display: block;
  }

  .quick-categories__head .eyebrow {
    margin-bottom: 0.35rem;
  }

  .quick-category-grid a {
    flex-basis: min(82vw, 215px);
  }
}
