/* The home page. Nav, footer, buttons, the demo's frame and the code block come
   from landing.css; this file is what only the home page has. */

:root {
  /* The logo's warm neutrals: a drawing here is the logo at house scale. */
  --plan-ink: #faf9f5;
  --plan-line: #c2c0b6;
  --plan-poche: #30302e;
  --plan-glass: #7fb3e8;
  --plan-floor: #141413;
  --plan-furniture: #a9a79e;
  --plan-swing: #6f6d66;
}

.home-text {
  font-size: 17px;
  color: var(--text-secondary);
  max-width: 34em;
}

.home-section {
  padding-top: 112px;
  padding-bottom: 112px;
}

.home-heading {
  max-width: 640px;
}

.home-heading .section-title {
  margin-bottom: 12px;
}

/* ---- Hero ---- */

/* The red glow's centre, in the hero's own box: the glow is drawn about it,
   and the ornament fades as it nears it. */
.home-hero {
  --glow-x: calc(110% - 450px);
  --glow-y: calc(450px - 30%);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  min-height: min(100vh, 940px);
  padding: 112px 32px 56px;
}

.home-hero::before {
  content: "";
  position: absolute;
  top: calc(var(--glow-y) - 450px);
  left: calc(var(--glow-x) - 450px);
  width: 900px;
  height: 900px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 65%);
  pointer-events: none;
}

.home-hero-inner {
  position: relative;
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 7fr);
  gap: 56px;
  align-items: center;
}

.home-eyebrow {
  margin-bottom: 20px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent-text);
}

.home-hero h1 {
  font-size: clamp(36px, 4vw, 56px);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.03em;
  margin-bottom: 32px;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.home-more {
  color: var(--text-primary);
  text-decoration: underline;
  text-decoration-color: var(--accent-text);
  text-underline-offset: 3px;
}

.home-more:hover {
  color: #fff;
  text-decoration-color: #fff;
}

/* The ćilim over the hero (home/ornament.ts): a border of cross-stitched
   diamonds, red outlines round gray stars and sown fields, on a lattice as
   faint as /whoami/'s grid. Drawn 1:1 in pixels and centred on the hero, it
   fades three ways: down the hero, as it nears the red glow, and past the
   middle, toward the drawing of the house. */
.home-ornament {
  --ornament-scale: 1;
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  -webkit-mask-image:
    linear-gradient(to bottom, #000 24%, transparent 70%),
    radial-gradient(
    circle 820px at var(--glow-x) var(--glow-y),
    transparent 30%,
    #000 100%
  ),
    linear-gradient(
    to right,
    #000 calc(50% - 100px),
    transparent calc(50% + 300px)
  );
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to bottom, #000 24%, transparent 70%),
    radial-gradient(
    circle 820px at var(--glow-x) var(--glow-y),
    transparent 30%,
    #000 100%
  ),
    linear-gradient(
    to right,
    #000 calc(50% - 100px),
    transparent calc(50% + 300px)
  );
  mask-composite: intersect;
  animation: home-fade 1.8s ease 0.1s both;
}

.home-ornament svg {
  position: absolute;
  top: 0;
  left: 50%;
  width: calc(3200px * var(--ornament-scale));
  height: calc(1000px * var(--ornament-scale));
  margin-left: calc(-1600px * var(--ornament-scale));
  fill: none;
  stroke-width: calc(1 / var(--ornament-scale));
}

.ornament-lattice {
  stroke: var(--plan-line);
  stroke-opacity: 0.035;
}

/* Set on each cell's <use>, and inherited by the stitches it draws. */
.ornament-outline {
  stroke: var(--accent-text);
  stroke-opacity: 0.5;
  stroke-dasharray: 3 3;
}

.ornament-motif {
  stroke: var(--plan-line);
  stroke-opacity: 0.4;
}

.ornament-joint {
  stroke: var(--accent-text);
  stroke-opacity: 0.5;
}

/* The border's cells come in one after another, left to right, as stitched. */
.ornament-cell {
  animation: home-fade 0.9s ease calc(0.5s + var(--i) * 0.12s) both;
}

@keyframes home-fade {
  from {
    opacity: 0;
  }
}

.home-plan {
  min-width: 0;
}

.plan-stages {
  display: flex;
  margin-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.plan-stages button {
  flex: 1 1 0;
  margin-top: -1px;
  padding: 12px 0 4px;
  background: none;
  border: 0;
  border-top: 1px solid transparent;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 1px;
  text-align: left;
  text-transform: uppercase;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.25s ease, border-color 0.25s ease;
}

.plan-stages button span {
  margin-right: 8px;
  color: var(--text-muted);
}

.plan-stages button:hover {
  color: var(--text-secondary);
}

.plan-stages button[aria-pressed="true"] {
  color: var(--text-primary);
  border-top-color: var(--accent-text);
}

.plan-stages button[aria-pressed="true"] span {
  color: var(--accent-text);
}

/* ---- The drawing ---- */

.plan {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.plan-grid {
  fill: none;
  stroke: var(--plan-line);
  stroke-opacity: 0.22;
  stroke-width: 1;
  stroke-dasharray: 1 6;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.plan-room {
  fill: var(--plan-floor);
}

/* The day side of a house in the brand's red, the night side in the logo's
   neutrals: the split a plan is judged on, readable at a glance. Every room
   stays well under the walls' poche, so the walls read as walls once the
   furniture is in. */
.plan-room--living,
.plan-room--dining,
.plan-room--kitchen {
  fill: #1d0f10;
}

.plan-room--bedroom {
  fill: #161615;
}

.plan-room--bathroom,
.plan-room--laundry {
  fill: #1b1b1a;
}

.plan-room--hallway,
.plan-room--entry {
  fill: #111110;
}

.plan-wall-edge {
  fill: var(--plan-ink);
}

.plan-wall-fill {
  fill: var(--plan-poche);
}

.plan-leaf {
  fill: none;
  stroke: var(--plan-ink);
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
}

.plan-swing {
  fill: none;
  stroke: var(--plan-swing);
  stroke-width: 0.8;
  vector-effect: non-scaling-stroke;
}

.plan-panes path {
  fill: none;
  stroke: var(--plan-glass);
  stroke-width: 0.8;
  vector-effect: non-scaling-stroke;
}

.plan-piece {
  color: var(--plan-furniture);
  fill: none;
  stroke: currentColor;
}

.plan-body {
  fill: #000;
  fill-opacity: 0.28;
  stroke: none;
}

.plan-outline {
  fill: none;
  stroke: var(--accent-text);
  stroke-width: 4;
  stroke-linejoin: round;
  opacity: 0;
}

.plan text {
  font-family: var(--font-mono);
  fill: var(--plan-line);
  stroke: none;
}

.plan-labels text {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-anchor: middle;
  fill: var(--plan-ink);
  paint-order: stroke;
  stroke: var(--plan-floor);
  stroke-width: 7;
  stroke-linejoin: round;
}

.plan-labels .plan-label-size {
  font-size: 16px;
  font-weight: 400;
  fill: var(--plan-line);
}

.plan-dims path {
  fill: none;
  stroke: var(--plan-swing);
  stroke-width: 0.8;
  vector-effect: non-scaling-stroke;
}

.plan-dims text {
  font-size: 19px;
  text-anchor: middle;
}

.plan-entry circle {
  fill: var(--accent-text);
}

.plan-entry text {
  font-size: 17px;
  fill: var(--plan-ink);
}

/* The stages. A rule below hides what a stage has not reached; each part fades
   back in on the delay its --i gives it, so the rooms come up in the order the
   model placed them and the furniture one piece at a time. */
.plan-room,
.plan-label {
  transition: opacity 0.4s ease calc(var(--i) * 150ms);
}

.plan-walls,
.plan-doors,
.plan-panes {
  transition: opacity 0.6s ease 0.8s;
}

.plan-piece {
  transition: opacity 0.3s ease calc(var(--i) * 55ms);
}

.home-plan .plan-outline {
  transition: opacity 0.6s ease 1.2s;
}

.home-plan:is([data-stage="ready"], [data-stage="outline"]) .plan-room,
.home-plan:is([data-stage="ready"], [data-stage="outline"]) .plan-label,
.home-plan:is([data-stage="ready"], [data-stage="outline"]) .plan-walls,
.home-plan:is([data-stage="ready"], [data-stage="outline"]) .plan-doors,
.home-plan:is([data-stage="ready"], [data-stage="outline"]) .plan-panes,
.home-plan:is([data-stage="ready"], [data-stage="outline"]) .plan-piece,
.home-plan[data-stage="rooms"] .plan-piece {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.home-plan[data-stage="outline"] .plan-outline {
  opacity: 1;
  stroke-dasharray: 1;
  animation: plan-trace 1.2s ease-in-out both;
  transition: none;
}

@keyframes plan-trace {
  from {
    stroke-dashoffset: 1;
  }
  to {
    stroke-dashoffset: 0;
  }
}

/* Each room starts in the brand's red and settles, as it is placed. */
.home-plan[data-stage="rooms"] .plan-room,
.home-plan[data-stage="furniture"] .plan-room,
.home-plan[data-stage="model"] .plan-room {
  animation: plan-room-in 1s ease calc(var(--i) * 150ms) backwards;
}

@keyframes plan-room-in {
  from {
    fill: #8b0000;
  }
}

/* The last stage: the house stands up (ui/homeModel.ts). Its labels go first;
   then the flat drawing gives way to the model, which starts lying exactly on
   it. Box tops go from the plan's cut walls to the bright tops of a model as it
   rises. */
.plan-labels,
.plan-dims,
.plan-entry {
  transition: opacity 0.25s ease;
}

.home-plan[data-stage="model"] .plan-labels,
.home-plan[data-stage="model"] .plan-dims,
.home-plan[data-stage="model"] .plan-entry {
  opacity: 0;
}

.plan-model {
  visibility: hidden;
}

.home-plan[data-standing] .plan-model {
  visibility: visible;
}

.home-plan[data-standing] .plan-flat {
  visibility: hidden;
}

.plan-box polygon {
  stroke-linejoin: round;
}

.plan-box--wall .plan-box-top {
  fill: var(--plan-ink);
  fill: color-mix(
    in srgb,
    var(--plan-ink) calc(var(--plan-rise, 0) * 92%),
    var(--plan-poche)
  );
}

.plan-box--wall .plan-box-south {
  fill: #6d6b64;
}

.plan-box--wall .plan-box-east {
  fill: #45443f;
}

.plan-box--sill .plan-box-top {
  fill: #7c8a94;
}

.plan-box--sill .plan-box-south {
  fill: #5d5c56;
}

.plan-box--sill .plan-box-east {
  fill: #3d3c38;
}

.plan-box--door .plan-box-top {
  fill: #b39a78;
}

.plan-box--door .plan-box-south {
  fill: #8a7559;
}

.plan-box--door .plan-box-east {
  fill: #6d5c46;
}

/* The model's doors stand: their leaves leave the floor it shares with the plan. */
.home-plan[data-standing] .plan-leaf {
  stroke: none;
}

.plan-box--piece {
  color: var(--plan-furniture);
}

.plan-box--piece .plan-box-top {
  fill: #1b1b19;
  fill-opacity: calc(var(--plan-rise, 0) * 0.95);
  stroke: currentColor;
  stroke-opacity: calc(var(--plan-rise, 0) * 0.6);
  stroke-width: 0.6;
  vector-effect: non-scaling-stroke;
}

.plan-box--piece .plan-box-south {
  fill: #2c2c29;
}

.plan-box--piece .plan-box-east {
  fill: #232321;
}

.plan-box-icon {
  fill: none;
  stroke: currentColor;
}

/* ---- Band under the hero ---- */

/* The hero ends on a rule, as every section after it starts on one. */
.home-hero + .demo {
  border-top: 1px solid var(--border-subtle);
}

/* Last on the page: the footer's top rule closes it. */
.home-band {
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
}

.home-band-inner {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 16px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 32px;
  font-size: 14px;
  color: var(--text-secondary);
}

.home-band-inner a {
  color: var(--text-primary);
}

/* ---- Tags: where Arka works, in the band ---- */

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
}

.tag {
  padding: 4px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.tag--now {
  border-color: var(--border-accent);
  color: var(--text-primary);
}

.tag small {
  font-size: 11px;
  color: var(--text-muted);
}

/* ---- Three points, under the demo ---- */

.home-points {
  padding-bottom: 0;
  border-top: 1px solid var(--border-subtle);
}

.home-point-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 48px;
  list-style: none;
}

.home-point-list h3 {
  margin-bottom: 8px;
  font-size: 18px;
  font-weight: 600;
}

.home-point-list p {
  font-size: 15px;
  color: var(--text-secondary);
}

/* ---- Where it runs ---- */

.home-where-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px;
  margin-top: 48px;
}

.home-where-part {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 32px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
}

.home-where-part h3 {
  margin-bottom: 4px;
  font-size: 20px;
  font-weight: 600;
}

.home-where-part .home-text {
  font-size: 15px;
  margin-bottom: 20px;
}

.home-where-part .home-more {
  margin-top: auto;
  padding-top: 20px;
  font-size: 15px;
}

.hosts {
  width: 100%;
  list-style: none;
}

.host {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 16px;
  padding: 12px 0;
  border-top: 1px solid var(--border-subtle);
  text-decoration: none;
  transition: border-color 0.2s;
}

.host-name {
  font-weight: 600;
  color: var(--text-primary);
}

.host-status {
  font-size: 13px;
  color: var(--text-muted);
}

.host-status--now {
  color: var(--text-primary);
}

.host-runs {
  grid-column: 1 / -1;
  font-size: 13px;
  color: var(--text-muted);
}

.host:hover .host-name {
  text-decoration: underline;
  text-decoration-color: var(--accent-text);
  text-underline-offset: 3px;
}

.home-code {
  width: 100%;
}

/* ---- Try it: right under the band, whose border it shares; no heading,
   so the frame starts at the section's top ---- */

.home-section.demo .demo-frame-wrapper {
  margin-top: 0;
  aspect-ratio: 3 / 2;
  min-height: 600px;
}

/* A phone stacks the demo's drawing over its panel: give it the height. */
@media (max-width: 760px) {
  .home-section.demo .demo-frame-wrapper {
    aspect-ratio: auto;
    height: min(860px, 150vw);
    min-height: 640px;
  }
}

/* ---- What it costs ---- */

.home-costs {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
}

.home-cost-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  margin-top: 40px;
}

.home-cost {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 28px;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  font-size: 14px;
  color: var(--text-secondary);
}

.home-cost h3 {
  margin-bottom: 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
}

.home-cost-price {
  margin-bottom: 12px;
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1.1;
  color: var(--text-primary);
}

.home-cost-price span,
.home-cost-price small {
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--text-muted);
}

.home-cost-soon {
  font-size: 28px;
  line-height: 44px;
  letter-spacing: -0.5px;
}

.home-seats {
  margin-top: 8px;
  color: var(--text-muted);
}

.home-seats strong {
  color: var(--accent-text);
  font-weight: 600;
}

.home-seats a {
  color: var(--text-primary);
}

.home-cost .home-more {
  margin-top: auto;
  padding-top: 20px;
}

.home-costs-all {
  margin-top: 24px;
  font-size: 15px;
}

.home-costs-all a {
  color: var(--text-primary);
  text-decoration: underline;
  text-decoration-color: var(--accent-text);
  text-underline-offset: 3px;
}

/* ---- Closing ---- */

.home-closing {
  padding-top: 88px;
  padding-bottom: 96px;
  text-align: center;
}

.home-closing h2 {
  margin: 8px 0 28px;
  font-size: clamp(30px, 4vw, 40px);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.home-closing .home-actions {
  justify-content: center;
}

.hero-logo {
  display: block;
  width: clamp(200px, 22vw, 280px);
  height: auto;
  margin: 0 auto;
  opacity: 0.95;
}

/* landing.ts swaps the <img> for the live room (ui/roomLogo.ts), which draws
   itself in. Until the script arrives the <img> waits unseen: a finished logo
   that vanished and redrew would read as a glitch, and it fades in by itself if
   the script never comes. */
img.hero-logo {
  animation: hero-logo-fallback 0.5s ease 1.2s both;
}

@keyframes hero-logo-fallback {
  from {
    opacity: 0;
  }
}

svg.hero-logo {
  overflow: visible;
  -webkit-tap-highlight-color: transparent;
}

/* ---- Responsive ---- */

@media (max-width: 960px) {
  .home-hero {
    min-height: 0;
  }

  .home-hero-inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 48px;
  }

  .home-hero-copy {
    max-width: 640px;
  }

  /* One column: the border, smaller, runs across the top clear of the nav,
     and the words start under it. It only fades down, gone before the house. */
  .home-hero {
    padding-top: 228px;
  }

  .home-ornament {
    --ornament-scale: 0.7;
    -webkit-mask-image: linear-gradient(
      to bottom,
      #000 180px,
      transparent 400px
    );
    mask-image: linear-gradient(to bottom, #000 180px, transparent 400px);
  }

  .home-ornament svg {
    top: 16px;
  }
}

@media (max-width: 860px) {
  .home-cost-grid,
  .home-where-grid,
  .home-point-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .home-point-list {
    gap: 28px;
  }
}

@media (max-width: 768px) {
  /* The top is the ornament's border (≤ 960px above). */
  .home-hero {
    padding: 228px 16px 40px;
  }

  /* The headline on one line, down to a small phone. */
  .home-hero h1 {
    font-size: clamp(28px, 9vw, 48px);
  }

  .home-section,
  .home-closing {
    padding-left: 16px;
    padding-right: 16px;
    padding-top: 72px;
    padding-bottom: 72px;
  }

  .home-points {
    padding-bottom: 0;
  }

  .home-band {
    padding: 0 16px;
  }

  .home-where-part {
    padding: 24px 20px;
  }

  .plan-stages button {
    font-size: 11px;
    letter-spacing: 0.5px;
  }

  .plan-stages button span {
    margin-right: 5px;
  }

  /* A room's name at this width would be a few pixels tall. */
  .home-plan .plan-labels,
  .home-plan .plan-dims text {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .plan-room,
  .plan-label,
  .plan-walls,
  .plan-doors,
  .plan-panes,
  .plan-piece,
  .home-plan .plan-outline {
    transition: none;
    animation: none !important;
  }

  img.hero-logo,
  .home-ornament,
  .ornament-cell {
    animation: none;
  }
}
