/* Page layout for the KKUMHOUSE prototype. Components come from the design system (ds/components/bundle.css). */
:root { --kk-logo: url("/ds/logo.png"); }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
html, body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--font-sans); }
.wrap { max-width: 1280px; margin: 0 auto; padding-left: max(var(--space-6), env(safe-area-inset-left, 0px)); padding-right: max(var(--space-6), env(safe-area-inset-right, 0px)); box-sizing: border-box; }
.kk-pin__head::after { pointer-events: none; } /* the ping ring is decoration, it must not widen a pin's hit area */

/* ---------- Tooltip: every icon-only control says what it does ---------- */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip); position: absolute; right: calc(100% + 12px); top: 50%; transform: translateY(-50%) translateX(4px); z-index: 60;
  padding: 6px 10px; border-radius: var(--radius-control); background: var(--night); color: var(--on-night); box-shadow: var(--shadow-2);
  font-family: var(--font-sans); font-size: 12px; line-height: 16px; font-weight: 500; white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity 160ms var(--kk-ease-out), transform 160ms var(--kk-ease-out);
}
[data-tip][data-tip-pos="bottom"]::after { right: auto; left: 50%; top: calc(100% + 12px); transform: translateX(-50%) translateY(-4px); }
[data-tip][data-tip-pos="top"]::after { right: auto; left: 50%; top: auto; bottom: calc(100% + 12px); transform: translateX(-50%) translateY(4px); }
[data-tip]:focus-visible::after { opacity: 1; transform: translateY(-50%); }
[data-tip][data-tip-pos]:focus-visible::after { transform: translateX(-50%); }
@media (hover: hover) and (pointer: fine) {
  [data-tip]:hover::after { opacity: 1; transform: translateY(-50%); transition-delay: 350ms; }
  [data-tip][data-tip-pos]:hover::after { transform: translateX(-50%); }
}

/* ---------- Stage: the sa bàn ---------- */
.stage { position: relative; width: 100%; height: 100dvh; min-height: 560px; overflow: hidden; background: var(--night); }
#map { position: absolute; inset: 0; }
#map .maplibregl-canvas { outline: none; }
.maplibregl-ctrl-attrib { font-family: var(--font-sans); font-size: 11px; }
.maplibregl-cooperative-gesture-screen { font-family: var(--font-sans); font-size: 16px; }
/* A soft vignette so the glass controls and the headline stay readable over imagery. */
.stage::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1; background: linear-gradient(to top, rgba(0, 13, 33,0.55), transparent 34%), linear-gradient(to right, rgba(0, 13, 33,0.5), transparent 46%); transition: opacity 600ms var(--kk-ease-fluid); }
.stage.is-close::after { opacity: 0.3; }
.stage > .hero, .stage > .dock, .stage > .tools, .stage > .panel-slot, .stage > .state { z-index: 2; }

.maplibregl-marker.kk-pin { transition: opacity 400ms var(--kk-ease-fluid), visibility 0s; pointer-events: none; }
.maplibregl-marker.kk-pin > * { pointer-events: auto; animation: pin-drop 700ms var(--kk-ease-fluid) both; animation-delay: calc(var(--kk-i, 0) * 70ms); }
.maplibregl-marker.kk-pin.is-off { opacity: 0; visibility: hidden; transition: opacity 400ms var(--kk-ease-fluid), visibility 0s 400ms; }
.maplibregl-marker.kk-pin.is-compact .kk-pin__label { display: none; }
.is-waiting .maplibregl-marker.kk-pin > * { animation-play-state: paused; }
@keyframes pin-drop { from { opacity: 0; transform: translateY(-36px); } to { opacity: 1; transform: none; } }

.hero { position: absolute; left: max(var(--space-6), env(safe-area-inset-left, 0px)); bottom: 136px; max-width: min(620px, calc(100% - 48px)); display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-6); transition: opacity 500ms var(--kk-ease-fluid), transform 500ms var(--kk-ease-fluid); }
.hero.is-off { opacity: 0; transform: translateY(16px); pointer-events: none; visibility: hidden; transition: opacity 500ms var(--kk-ease-fluid), transform 500ms var(--kk-ease-fluid), visibility 0s 500ms; }
.hero__title { font-size: clamp(34px, 4.6vw, 62px); line-height: 1.08; color: #F0F2F2; text-shadow: 0 2px 24px rgba(0, 13, 33,0.5); }

.dock { position: absolute; left: 0; right: 0; bottom: calc(var(--space-6) + env(safe-area-inset-bottom, 0px)); display: flex; justify-content: center; pointer-events: none; padding: 0 var(--space-4); }
.dock > * { pointer-events: auto; }
.tools { position: absolute; right: max(var(--space-6), env(safe-area-inset-right, 0px)); top: 50%; transform: translateY(-50%); }
.tools button svg { pointer-events: none; }
.tools button[aria-pressed="true"] { background: var(--ink); color: var(--ground); }
.kk-locator, .kk-controls { -webkit-backdrop-filter: blur(20px) saturate(160%); backdrop-filter: blur(20px) saturate(160%); }

.panel-slot { position: absolute; right: calc(max(var(--space-6), env(safe-area-inset-right, 0px)) + 76px); top: 50%; transform: translateY(-50%); max-height: calc(100% - 200px); overflow: auto; padding: var(--space-6); margin: calc(var(--space-6) * -1); scrollbar-width: none; }
.panel-slot .kk-panel { transform-origin: 100% 50%; animation: panel-in 500ms var(--kk-ease-fluid) both; }
@keyframes panel-in { from { opacity: 0; transform: translateX(16px) scale(0.97); } to { opacity: 1; transform: none; } }
.panel__lead { display: flex; align-items: baseline; gap: var(--space-2); }
.panel__lead b { font-size: 56px; line-height: 56px; font-weight: 700; letter-spacing: -0.02em; color: var(--red-text); font-variant-numeric: tabular-nums; }
.panel__lead span { font-size: 13px; color: var(--muted); }
.panel__towers { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.panel__towers .kk-btn[aria-pressed="true"] { background: var(--ink); color: var(--ground); }
.state { position: absolute; inset: 0; display: grid; place-items: center; background: var(--ground); }

/* ---------- Content bands ---------- */
.band { padding-block: var(--space-26); }
.band--sand { background: var(--sand); }
.band--night { background: var(--night); color: var(--on-night); padding-bottom: var(--space-10); }
.band__title { font-size: clamp(30px, 3.6vw, 52px); line-height: 1.1; margin-bottom: var(--space-10); }
.band__head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-4) var(--space-10); margin-bottom: var(--space-10); }
.band__head .band__title { margin-bottom: 0; }

.about { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--space-10) var(--space-16); align-items: start; }
.about .band__title { margin: 0; position: sticky; top: 104px; }
.about__body { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-10); }
.about__lead { margin: 0; font-size: 22px; line-height: 34px; max-width: 34ch; text-wrap: pretty; }
.about__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-6); }
.about__list li { display: flex; gap: var(--space-4); align-items: flex-start; }
.about__list li > span { color: var(--red-text); margin-top: 2px; }
.about__list strong { font-size: 18px; line-height: 26px; }
.about__list p { margin: 2px 0 0; font-size: 16px; line-height: 26px; color: var(--muted); max-width: 52ch; }

.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-6); }
.project-grid .kk-card { max-width: none; cursor: pointer; border: 0; text-align: left; font: inherit; }
.project-grid .kk-card__plan { aspect-ratio: 4 / 3; background: var(--clay); }

.blog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: var(--space-10) var(--space-6); margin-bottom: var(--space-10); }
.post { display: flex; flex-direction: column; gap: var(--space-3); color: var(--ink); text-decoration: none; }
.post__cover { display: block; padding: var(--space-bezel); border-radius: var(--radius-shell); background: var(--bezel); box-shadow: inset 0 0 0 1px var(--bezel-ring); transition: transform 600ms var(--kk-ease-fluid); }
.post__cover > span { display: block; aspect-ratio: 1; border-radius: var(--radius-inner); overflow: hidden; background: var(--clay); box-shadow: var(--shadow-highlight), var(--shadow-1); transition: box-shadow 600ms var(--kk-ease-fluid); }
.post__cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 900ms var(--kk-ease-fluid); }
.post__meta { display: flex; justify-content: space-between; gap: var(--space-3); padding: 0 var(--space-2); font-size: 13px; line-height: 18px; color: var(--muted); font-variant-numeric: tabular-nums; }
.post__meta b { color: var(--ink); font-weight: 700; }
.post__title { margin: 0; padding: 0 var(--space-2); font-size: 16px; line-height: 24px; font-weight: 700; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; transition: color 300ms var(--kk-ease-fluid); }
.post:focus-visible { outline: none; }
.post:focus-visible .post__cover { box-shadow: var(--shadow-focus); }
.post:active .post__cover { transform: scale(0.985); transition-duration: 120ms; }
@media (hover: hover) and (pointer: fine) {
  .post:hover .post__cover { transform: translateY(-4px); }
  .post:hover .post__cover > span { box-shadow: var(--shadow-highlight), var(--shadow-2); }
  .post:hover .post__cover img { transform: scale(1.04); }
  .post:hover .post__title { color: var(--red-text); }
}
.blog-grid .kk-skeleton { aspect-ratio: 1; border-radius: var(--radius-shell); }
.blog-empty { grid-column: 1 / -1; }
#blog-filter { flex-wrap: wrap; }

/* ---------- Closing call to action ---------- */
.talk { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--space-16); align-items: start; padding-bottom: var(--space-26); }
.talk__title { font-size: clamp(34px, 4.6vw, 64px); line-height: 1.06; margin-bottom: var(--space-6); color: var(--on-night); }
.talk__form { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-6); }
.talk__form .kk-field { width: 100%; max-width: 560px; }
.talk__form .kk-field label { color: var(--on-night); font-size: 16px; }
.talk__form .kk-field input { height: 56px; background: transparent; color: var(--on-night); box-shadow: inset 0 -1px 0 var(--on-night-muted); border-radius: 0; padding: 0; font-size: 18px; }
.talk__form .kk-field input::placeholder { color: var(--on-night-muted); }
.talk__form .kk-field input:focus-visible { box-shadow: inset 0 -2px 0 var(--on-night); }
.talk__form .kk-field.is-error input { box-shadow: inset 0 -2px 0 #FF6A5C; }
.talk__form .kk-field.is-error .kk-field__help { color: #FF6A5C; }
.talk__result { width: 100%; max-width: 560px; }
.talk__side { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-6); padding-top: var(--space-2); }
.talk__side .kk-logo { width: 168px; }
.talk__side .kk-link { color: var(--on-night); }
.talk__side .kk-link__orb { background: rgba(255,255,255,0.14); }
.talk__address { font-style: normal; font-size: 14px; line-height: 22px; color: var(--on-night-muted); max-width: 34ch; }
.legal { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-3) var(--space-10); font-size: 14px; line-height: 20px; color: var(--on-night-muted); }
.legal a { color: var(--on-night); text-decoration: underline; text-underline-offset: 3px; }
.legal a:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

/* ---------- Consultation dialog ---------- */
#consult { z-index: 40; }
.consult { gap: var(--space-6); padding: var(--space-10); }
.consult__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); }
.consult__head .kk-panel__title { font-size: 34px; line-height: 1.15; }
#consult-form { display: flex; flex-direction: column; gap: var(--space-4); }
#consult-form .kk-field { max-width: none; }
#consult-form .kk-btn { align-self: flex-start; margin-top: var(--space-2); }
.consult__done { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-6); }

/* ---------- Cookie consent ---------- */
.cookie { position: fixed; z-index: 45; left: max(var(--space-6), env(safe-area-inset-left, 0px)); bottom: calc(var(--space-6) + env(safe-area-inset-bottom, 0px)); width: min(420px, calc(100% - 48px)); animation: cookie-in 600ms var(--kk-ease-fluid) both; }
.cookie .kk-bezel { background: var(--glass); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); box-shadow: inset 0 0 0 1px var(--bezel-ring), var(--shadow-3); }
.cookie__core { padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-3); }
.cookie__title { font-size: 18px; line-height: 26px; }
.cookie p { margin: 0; font-size: 14px; line-height: 22px; color: var(--muted); }
.cookie__actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); margin-top: var(--space-2); }
@keyframes cookie-in { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

/* ---------- Opening: locate, logo, sa bàn ---------- */
.opening { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: var(--ground); cursor: pointer; transition: opacity 800ms var(--kk-ease-fluid); }
.opening > * { grid-area: 1 / 1; }
.opening__locate { display: flex; flex-direction: column; align-items: center; gap: var(--space-10); transition: opacity 500ms var(--kk-ease-fluid), transform 500ms var(--kk-ease-fluid); }
/* The target is the O of HOUSE in the logo: a ring with the red dot at its centre. */
.opening__target { position: relative; width: 96px; height: 96px; border-radius: var(--radius-pin); box-shadow: inset 0 0 0 14px var(--ink); animation: target-in 900ms var(--kk-ease-fluid) both; }
.opening__target::before { content: ""; position: absolute; inset: 34px; border-radius: var(--radius-pin); background: var(--kk-red); animation: dot-drop 700ms var(--kk-ease-fluid) 500ms both; }
.opening__target::after { content: ""; position: absolute; inset: -18px; border-radius: var(--radius-pin); box-shadow: inset 0 0 0 1px var(--kk-red); animation: kk-ping 1400ms var(--kk-ease-out) 1100ms 2 both; opacity: 0; }
@keyframes target-in { from { opacity: 0; transform: scale(1.6); } to { opacity: 1; transform: none; } }
@keyframes dot-drop { from { opacity: 0; transform: translateY(-64px) scale(0.6); } to { opacity: 1; transform: none; } }
.opening__words { font-size: clamp(28px, 5vw, 60px); line-height: 1.1; text-align: center; padding: 0 var(--space-6); }
.opening__words span { display: inline-block; opacity: 0; transform: translateY(24px); animation: word-in 600ms var(--kk-ease-fluid) both; }
.opening__words span:nth-child(1) { animation-delay: 700ms; } .opening__words span:nth-child(2) { animation-delay: 880ms; }
.opening__words span:nth-child(3) { animation-delay: 1060ms; } .opening__words span:nth-child(4) { animation-delay: 1240ms; }
@keyframes word-in { to { opacity: 1; transform: none; } }
.opening__logo { width: min(300px, 60vw); opacity: 0; transform: scale(0.92); transition: opacity 600ms var(--kk-ease-fluid), transform 900ms var(--kk-ease-fluid); }
.opening.is-logo .opening__locate { opacity: 0; transform: scale(0.94); }
.opening.is-logo .opening__logo { opacity: 1; transform: none; transition-delay: 250ms; }
.opening.is-leaving { opacity: 0; pointer-events: none; }
.opening.is-leaving .opening__logo { transform: scale(1.06); }

@media (max-width: 860px) {
  .about, .talk { grid-template-columns: 1fr; gap: var(--space-10); }
  .about .band__title { position: static; }
}
@media (max-width: 760px) {
  .hero { bottom: 128px; left: var(--space-4); }
  .tools { top: 96px; transform: none; right: var(--space-4); }
  .tools #zoom-in, .tools #zoom-out { display: none; }
  .panel-slot { left: 0; right: 0; top: auto; bottom: 112px; transform: none; margin: 0; padding: var(--space-4); max-height: 46%; }
  .panel-slot .kk-panel { width: 100%; }
  .kk-locator { grid-auto-columns: minmax(92px, 1fr); }
  .band { padding-block: var(--space-16); }
  .cookie { left: var(--space-4); width: calc(100% - 32px); }
  [data-tip]::after { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .maplibregl-marker.kk-pin > *, .panel-slot .kk-panel, .cookie, .opening__target, .opening__target::before, .opening__target::after, .opening__words span { animation: none; opacity: 1; transform: none; }
  .opening, .opening__logo, .opening__locate, .hero { transition-duration: 1ms; }
}

/* ---------- Project imagery on the sa bàn ---------- */
/* Pin label with a thumbnail: label radius 12 with 6px padding, so the thumbnail radius is 6. */
.kk-pin__label:has(.kk-pin__thumb:not([hidden])) { display: grid; grid-template-columns: 48px auto; column-gap: 10px; align-items: center; padding: 6px 14px 6px 6px; }
.kk-pin__label:has(.kk-pin__thumb:not([hidden])) .kk-pin__meta { align-self: start; }
.kk-pin__thumb { grid-row: 1 / span 2; width: 48px; height: 48px; object-fit: cover; border-radius: 6px; display: block; }
.panel__cover { margin: calc(var(--space-6) * -1) calc(var(--space-6) * -1) 0; aspect-ratio: 16 / 10; overflow: hidden; border-radius: var(--radius-inner) var(--radius-inner) 0 0; background: var(--clay); }
.panel__cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
