/* Cube House final alignment and responsive UX layer. Existing font families remain untouched. */

:root {
  --cube-touch-size: 46px;
  --cube-mobile-radius: 18px;
}

body {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Storefront product-card rhythm. */
.ph-products-grid {
  align-items: stretch;
}

.ph-products-grid > .ph-card {
  display: flex;
  height: 100%;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
}

.ph-products-grid > .ph-card .ph-card-thumb-wrap {
  flex: 0 0 auto;
}

.ph-products-grid > .ph-card .ph-card-body {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  flex-direction: column;
  height: 100%;
}

.ph-products-grid > .ph-card .ph-card-title {
  display: flex;
  min-height: 2.84em !important;
  align-items: center;
  line-height: 1.42;
  word-break: keep-all;
  overflow-wrap: break-word;
  text-wrap: pretty;
}

.ph-products-grid > .ph-card .ph-spec-chips {
  align-content: flex-start;
}

.ph-products-grid > .ph-card .ph-card-price-row {
  margin-top: auto;
}

.ph-card-actions,
.ph-card-dual-actions {
  align-items: stretch;
}

.ph-card-actions :where(a, button),
.ph-card-dual-actions :where(a, button),
.ph-btn-naver-pay,
.ph-btn-toss-card,
.ph-btn-quickview {
  display: inline-flex;
  min-height: var(--cube-touch-size);
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.35;
  white-space: normal;
}

/* Quote workspace alignment. */
.tp-intro > *,
.tp-card,
.tp-card-heading > div,
.tp-status-card > div,
.tp-privacy-card > div,
.tp-switch-row > span,
.tp-next > div {
  min-width: 0;
}

.tp-intro h1,
.tp-card-heading h2,
.tp-next h2 {
  text-wrap: balance;
}

.tp-intro-copy,
.tp-section-copy,
.tp-status-card p,
.tp-privacy-card p,
.tp-next p {
  text-wrap: pretty;
}

.tp-process li {
  align-content: center;
  align-items: center;
}

.tp-process strong,
.tp-process small {
  min-width: 0;
  white-space: normal;
  text-overflow: clip;
}

.tp-card-heading {
  align-items: center;
}

.tp-analysis-row {
  align-items: stretch;
}

.tp-status-card,
.tp-privacy-card {
  height: 100%;
  align-items: center;
}

.tp-status-card p,
.tp-privacy-card p {
  margin-top: 5px;
}

.tp-option-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) !important;
  min-height: 86px;
  place-content: center;
  justify-items: center;
  gap: 4px;
  text-align: center;
}

.tp-option-card strong {
  grid-row: auto !important;
}

.tp-option-card small {
  max-width: 100%;
  text-align: center;
  white-space: normal;
}

.tp-segmented label,
.tp-field select,
.tp-quantity,
.tp-switch-row,
.tp-button {
  min-height: var(--cube-touch-size);
}

.tp-field select,
.tp-quantity input {
  font-variant-numeric: tabular-nums;
}

.tp-model-metrics div,
.tp-prusa-result dl div,
.tp-breakdown div {
  min-width: 0;
}

.tp-model-metrics dd,
.tp-prusa-result dd,
.tp-breakdown dd {
  overflow-wrap: anywhere;
}

.tp-next {
  align-items: center;
}

@media (hover: none) {
  .ph-card:hover,
  .tp-button:hover:not(:disabled) {
    transform: none;
  }

  .ph-card:hover {
    box-shadow: var(--ph-shadow-card);
  }

  .ph-card:hover .ph-card-thumb {
    transform: none;
  }
}

@media (max-width: 1023px) {
  .ph-navbar-wrap {
    box-shadow: 0 10px 32px rgba(68, 83, 76, .08);
  }

  .ph-mobile-drawer.open {
    display: grid;
    gap: 4px;
    padding: 10px 14px 18px;
    border-top: 1px solid var(--ph-border-subtle);
    background: color-mix(in srgb, var(--ph-bg-surface) 96%, transparent);
    box-shadow: 0 20px 40px rgba(68, 83, 76, .1);
  }

  .ph-mobile-nav-btn {
    display: flex;
    min-height: 50px;
    align-items: center;
    border-radius: 12px;
    padding: 0 14px;
  }

  .tp-mobile-consult {
    min-height: 50px;
    margin-top: 6px;
  }
}

@media (max-width: 768px) {
  .ph-announcement-content {
    justify-content: center;
    text-align: center;
  }

  .ph-announcement-item:first-child {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .ph-navbar {
    min-height: 64px;
  }

  .ph-brand-name {
    line-height: 1.1;
  }

  .ph-hamburger-btn {
    display: grid;
    place-items: center;
  }

  .ph-hamburger-btn svg {
    width: 21px;
    height: 21px;
  }

  .ph-store-hero-card,
  .ph-catalog-controls,
  .ph-card,
  .tp-card {
    border-radius: var(--cube-mobile-radius);
  }

  .ph-products-grid > .ph-card .ph-card-title {
    min-height: 0 !important;
  }

  .ph-products-grid > .ph-card .ph-card-price-row {
    margin-top: 16px;
  }

  .ph-card-actions,
  .ph-card-dual-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ph-card-actions > :only-child,
  .ph-card-dual-actions > :only-child,
  .ph-btn-naver-pay {
    grid-column: 1 / -1;
  }

  .tp-intro {
    gap: 20px;
    padding-top: 32px;
    padding-bottom: 24px;
  }

  .tp-eyebrow {
    margin-bottom: 12px;
  }

  .tp-intro h1 {
    font-size: clamp(31px, 9vw, 41px);
    line-height: 1.16;
    letter-spacing: -.04em;
    word-break: keep-all;
    overflow-wrap: break-word;
  }

  .tp-intro-copy {
    max-width: 42rem;
    margin-top: 15px;
    font-size: 14px;
    line-height: 1.72;
  }

  .tp-process li {
    grid-template-columns: 42px minmax(0, 1fr);
    min-height: 78px;
    padding: 15px 17px;
  }

  .tp-process strong {
    font-size: 15px;
  }

  .tp-workspace {
    gap: 14px;
  }

  .tp-card-heading {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .tp-card-heading h2 {
    line-height: 1.2;
    word-break: keep-all;
    overflow-wrap: break-word;
  }

  .tp-file-types,
  .tp-service-status {
    max-width: 100%;
    white-space: normal;
    text-align: center;
    line-height: 1.35;
  }

  .tp-empty-state > span {
    max-width: 270px;
    text-wrap: pretty;
  }

  .tp-model-summary {
    gap: 14px;
  }

  .tp-model-metrics div {
    padding: 10px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--ph-bg-surface-elevated) 72%, transparent);
  }

  .tp-analysis-row {
    gap: 10px;
  }

  .tp-status-card,
  .tp-privacy-card {
    min-height: 92px;
  }

  .tp-material-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .tp-option-card {
    min-height: 74px;
    padding: 11px 8px;
  }

  .tp-prusa-actions {
    width: 100%;
  }

  .tp-prusa-actions .tp-button,
  .tp-next .tp-button {
    min-height: 50px;
  }

  .tp-next {
    align-items: stretch;
  }

  .tp-next .tp-button {
    width: 100%;
  }

  .ph-footer-grid {
    align-items: start;
  }

  .ph-footer-link {
    min-height: 44px;
  }
}

@media (max-width: 520px) {
  .ph-container {
    padding-inline: 12px;
  }

  .ph-brand-logo {
    gap: 7px;
  }

  .ph-brand-symbol {
    flex-basis: 34px;
    width: 34px;
    height: 34px;
  }

  .ph-brand-name {
    font-size: 13px;
  }

  .ph-navbar .ph-btn-kakao-nav {
    display: none;
  }

  .ph-nav-actions {
    gap: 5px;
  }

  .ph-hamburger-btn {
    flex-basis: 42px;
    width: 42px;
    height: 42px;
  }

  .ph-card-body {
    padding: 17px 15px;
  }

  .ph-card-title {
    font-size: 18px;
  }

  .ph-card-actions,
  .ph-card-dual-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .ph-card-actions > *,
  .ph-card-dual-actions > *,
  .ph-btn-naver-pay {
    grid-column: 1;
    width: 100%;
  }

  .tp-intro h1 {
    font-size: clamp(29px, 9.5vw, 37px);
  }

  .tp-viewer-card,
  .tp-prusa-card,
  .tp-quote-card {
    padding: 16px;
  }

  .tp-card-heading {
    margin-bottom: 14px;
  }

  .tp-drop-zone,
  .tp-canvas-wrap,
  #model-canvas {
    min-height: clamp(245px, 72vw, 315px);
    height: clamp(245px, 72vw, 315px);
  }

  .tp-empty-state {
    padding-inline: 12px;
  }

  .tp-model-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .tp-status-card,
  .tp-privacy-card {
    padding: 15px;
  }

  .tp-field-row,
  .tp-prusa-result dl {
    grid-template-columns: minmax(0, 1fr);
  }

  .tp-price-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .tp-price-row strong {
    font-size: 27px;
  }

  .tp-breakdown {
    padding: 14px;
  }

  .tp-breakdown div {
    gap: 10px;
  }

  .tp-next {
    margin-bottom: 42px;
    padding: 20px 17px;
  }
}

@media (max-width: 390px) {
  .ph-brand-sub {
    display: none;
  }

  .tp-process li {
    grid-template-columns: 38px minmax(0, 1fr);
    padding-inline: 14px;
  }

  .tp-material-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .tp-option-card {
    min-height: 64px;
  }

  .tp-card-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .tp-file-types,
  .tp-service-status {
    width: fit-content;
  }
}
