/* IceGiant — home and shared page composition. */

html { scroll-padding-top: 90px; }

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

.hero {
  padding-top: clamp(16px, 3vh, 40px);
  padding-bottom: clamp(72px, 8vw, 128px);
  overflow: hidden;
}
.hero-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--col-gap);
  align-items: start;
}
.hero-copy {
  grid-column: 1 / span 5;
  padding-top: clamp(24px, 5vh, 64px);
}
.hero-copy .display {
  margin-left: -0.055em;
}
.hero-copy .lede { margin-top: clamp(24px, 3vw, 36px); }
.hero-actions {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
  margin-top: clamp(28px, 3.4vw, 42px);
}

.hero-stage {
  grid-column: 6 / -1;
  margin-right: calc(var(--gutter) * -1);
  margin-top: clamp(120px, 26vh, 280px);
  padding: clamp(22px, 3.4vw, 52px);
  background: var(--surface-2);
  clip-path: polygon(clamp(40px, 5vw, 72px) 0, 100% 0, 100% 100%, 0 100%, 0 clamp(40px, 5vw, 72px));
}

/* The protocol stack: a real fragment of the product, at true size. */
.stack {
  display: grid;
  grid-template-columns: minmax(150px, 0.9fr) 1.6fr;
  gap: clamp(16px, 2.2vw, 32px);
  padding: clamp(18px, 2vw, 30px);
  background: #ffffff;
  color: var(--ink);
  min-height: 400px;
}
.stack-tabs {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-self: start;
}
.stack-tab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  transition: background-color 180ms var(--ease), color 180ms var(--ease);
}
.stack-tab:hover { background: var(--ground); color: var(--ink); }
.stack-tab.is-active { background: var(--ground); color: var(--ink); }
.stack-title {
  font-size: var(--step-small);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.015em;
}
.stack-bar {
  flex: 0 0 auto;
  width: 8px;
  height: 3px;
  background: var(--surface-3);
  transition: width 220ms var(--ease), background-color 220ms var(--ease);
}
.stack-tab.is-active .stack-bar { width: 22px; background: var(--accent); }

.stack-panel { display: grid; grid-template-columns: 1fr; gap: 18px; align-content: start; }
.stack-panel[hidden] { display: none; }
.stack-media { display: block; overflow: hidden; background: var(--surface); }
.stack-media img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: transform 900ms var(--ease);
}
.stack-media:hover img { transform: scale(1.03); }
.stack-text {
  font-size: var(--step-small);
  line-height: 1.5;
  color: var(--ink);
}

/* --- Features ----------------------------------------------------------- */

.features { padding-bottom: var(--section); }
.features-title {
  margin-bottom: clamp(36px, 5vw, 72px);
  font-size: clamp(24px, 3.8vw, 56px);
}

.cells {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 8px;
}
.cell--a { grid-column: span 7; }
.cell--b { grid-column: span 5; }
.cell--c { grid-column: span 5; }
.cell--d { grid-column: span 7; }
.cell {
  --cell-pad: clamp(22px, 3vw, 44px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: clamp(28px, 4vw, 48px);
  min-height: clamp(380px, 34vw, 480px);
  padding: var(--cell-pad);
  background: var(--surface);
  overflow: hidden;
}
.cell--b,
.cell--c {
  flex-direction: column-reverse;
  background: var(--surface-2);
}
.cell-text { max-width: 44ch; }
.cell-text p {
  margin-top: 14px;
  font-size: var(--step-body);
  line-height: 1.55;
  color: var(--ink);
}
.cell-art { display: flex; align-items: flex-end; justify-content: flex-end; }
.cell-art img {
  width: clamp(170px, 20vw, 290px);
  height: auto;
  transition: transform 700ms var(--ease);
}
.cell:hover .cell-art img { transform: translateY(-6px); }
.cell--a .cell-art,
.cell--d .cell-art { margin: 0 calc(var(--cell-pad) * -1) calc(var(--cell-pad) * -1) 0; }
.cell--b .cell-art,
.cell--c .cell-art { justify-content: flex-start; margin: calc(var(--cell-pad) * -1) 0 0 calc(var(--cell-pad) * -1); }
.cell--b .cell-art img,
.cell--c .cell-art img { width: clamp(190px, 23vw, 330px); }

/* --- Projects ----------------------------------------------------------- */

.projects {
  position: relative;
  padding-block: clamp(64px, 7vw, 112px);
  background: var(--dark);
  color: var(--dark-ink);
  overflow: hidden;
}
.projects-ambient {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.55;
}
.projects-scrim {
  position: absolute;
  inset: 0;
  background: rgba(6, 24, 43, 0.86);
}
.projects-head,
.rail { position: relative; z-index: 1; }
.projects-head { margin-bottom: clamp(28px, 3.4vw, 44px); }
.projects-head .h2 { color: var(--dark-ink); }

.rail {
  display: flex;
  gap: clamp(12px, 1.4vw, 20px);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-inline: max(var(--gutter), calc((100vw - var(--page-max)) / 2 + var(--gutter)));
  padding-bottom: 8px;
  scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.rail:focus-visible { outline-offset: -4px; }

.rail-item {
  flex: 0 0 min(440px, 84vw);
  scroll-snap-align: center;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  color: var(--ink);
  transition: background-color 260ms var(--ease);
}
.rail-item.is-active { background: #ffffff; }
.rail-media { display: block; overflow: hidden; }
.rail-media img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  transition: transform 900ms var(--ease);
}
.rail-item:hover .rail-media img { transform: scale(1.03); }
.rail-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: clamp(22px, 2.2vw, 30px);
}
.rail-title { font-size: clamp(20px, 1.7vw, 26px); }
.rail-text { font-size: var(--step-small); line-height: 1.5; }

/* --- News --------------------------------------------------------------- */

.news { padding-top: var(--section); }
.news > .wrap > .h2 { margin-bottom: clamp(28px, 4vw, 56px); }
.news-row { padding-block: clamp(32px, 4vw, 56px); }
.news-row:nth-child(even) { background: var(--surface); }
.news-inner {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--col-gap);
  align-items: center;
}
.news-media { grid-column: 1 / span 5; overflow: hidden; }
.news-media img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  transition: transform 900ms var(--ease);
}
.news-media:hover img { transform: scale(1.03); }
.news-body { grid-column: 7 / span 6; }
.news-body p {
  margin-top: 16px;
  max-width: 58ch;
  font-size: var(--step-body);
  line-height: 1.55;
}
.news-body .h3 a { transition: color 160ms var(--ease); }
.news-body .h3 a:hover { color: var(--accent); }
.news-row--flip .news-media { grid-column: 8 / span 5; grid-row: 1; }
.news-row--flip .news-body { grid-column: 1 / span 6; grid-row: 1; }

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

@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-copy { grid-column: 1 / -1; padding-top: 0; }
  .hero-stage {
    grid-column: 1 / -1;
    margin-right: calc(var(--gutter) * -1);
    margin-left: calc(var(--gutter) * -1);
    margin-top: clamp(28px, 5vw, 48px);
    clip-path: polygon(48px 0, 100% 0, 100% 100%, 0 100%, 0 48px);
  }
  .cells { grid-template-columns: 1fr; row-gap: clamp(40px, 7vw, 56px); }
  .cell--a, .cell--b, .cell--c, .cell--d { grid-column: 1 / -1; }
  .cell {
    min-height: 0;
    padding: 0;
    background: transparent;
  }
  .cell--b,
  .cell--c { background: transparent; }
  .cell--a .cell-art,
  .cell--d .cell-art { margin: 0; }
  .cell--b .cell-art,
  .cell--c .cell-art { margin: 0; }
  .rail {
    display: block;
    overflow: visible;
    padding-inline: var(--gutter);
    padding-bottom: 0;
  }
  .rail-item {
    flex-basis: auto;
    width: 100%;
    scroll-snap-align: none;
  }
  .rail-item + .rail-item { margin-top: 12px; }
  .cell--b,
  .cell--c { flex-direction: column; }
  .cell--b .cell-art,
  .cell--c .cell-art { justify-content: flex-end; margin: 0; }
  .news-inner { grid-template-columns: 1fr; }
  .news-media,
  .news-row--flip .news-media { grid-column: 1 / -1; grid-row: auto; }
  .news-body,
  .news-row--flip .news-body { grid-column: 1 / -1; grid-row: auto; margin-top: 24px; }
}

@media (max-width: 620px) {
  .stack { grid-template-columns: 1fr; min-height: 0; padding: 16px; }
  .stack-tabs { gap: 0; }
  .stack-tab { min-height: 48px; padding: 8px 10px; }
  .stack-title { font-size: 14px; }
  .stack-media img { aspect-ratio: 16 / 10; }
  .hero-actions { gap: 20px; }
  .cell-art img { width: 160px; }
  .cell--b .cell-art img,
  .cell--c .cell-art img { width: 180px; }
}

:lang(zh) .cell-text p,
:lang(zh) .news-body p,
:lang(zh) .rail-text,
:lang(zh) .stack-text { line-height: 1.8; }
