/* RESTARY homepage: one full-screen stage, a drifting card field and almost no
   copy. Light and dark share the same layout through a small token set. */

:root {
  color-scheme: dark;
  --bg: #0a1116;
  --bg-soft: #0f181e;
  --fg: #f2efe6;
  --fg-soft: rgba(242, 239, 230, 0.62);
  --fg-dim: rgba(242, 239, 230, 0.36);
  --line: rgba(242, 239, 230, 0.14);
  --scrim: rgba(10, 17, 22, 0.72);
  --accent: #d8a94a;
  --ring: #5edfd4;
  --card-face: #f4efe2;
  --card-ink: #16232b;
  --card-back: #0d1f29;
  --shadow-card: 0 30px 60px rgba(0, 0, 0, 0.44);
  --vignette: rgba(0, 0, 0, 0.5);
  --stage-halo: rgba(10, 17, 22, 0.92);
  --top-height: 64px;
  --font-ui: "Segoe UI Variable Text", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  --font-display: "Bahnschrift SemiBold", "Segoe UI Variable Display", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei UI", sans-serif;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f2efe6;
  --bg-soft: #e9e5da;
  --fg: #16232b;
  --fg-soft: rgba(22, 35, 43, 0.64);
  --fg-dim: rgba(22, 35, 43, 0.4);
  --line: rgba(22, 35, 43, 0.16);
  --scrim: rgba(242, 239, 230, 0.78);
  --shadow-card: 0 24px 48px rgba(22, 35, 43, 0.18);
  --vignette: rgba(22, 35, 43, 0.14);
  --stage-halo: rgba(242, 239, 230, 0.94);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--fg);
  background: var(--bg);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::after {
  position: fixed;
  inset: 0;
  z-index: 4;
  content: "";
  background: radial-gradient(ellipse at 50% 44%, transparent 42%, var(--vignette) 100%);
  pointer-events: none;
}

h1,
p {
  margin: 0;
}

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 3px;
}

/* ------------------------------------------------------------------ topbar */

.top {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--top-height);
  padding: 0 32px;
  background: linear-gradient(180deg, var(--scrim), transparent);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}

.brand span {
  color: var(--fg);
}

.brand__mark {
  width: 22px;
  height: 22px;
}

.top__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top__link {
  padding: 8px 10px;
  color: var(--fg-soft);
  font-size: 13px;
  text-decoration: none;
  transition: color 160ms ease;
}

.top__link:hover {
  color: var(--fg);
}

.theme-toggle {
  display: grid;
  width: 34px;
  aspect-ratio: 1;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}

.theme-toggle:hover {
  border-color: var(--fg-dim);
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle__moon {
  display: none;
}

html[data-theme="light"] .theme-toggle__sun {
  display: none;
}

html[data-theme="light"] .theme-toggle__moon {
  display: block;
}

.top__enter {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--fg);
  color: var(--bg);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 160ms ease;
}

.top__enter:hover {
  opacity: 0.86;
}

/* ------------------------------------------------------------------- stage */

.stage {
  position: relative;
  display: grid;
  min-height: 94vh;
  min-height: 94svh;
  padding: calc(var(--top-height) + 12px) 24px 40px;
  place-items: center;
  overflow: hidden;
}

.card-field {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.card-layer {
  position: absolute;
  inset: -6%;
  transform: translate3d(
    calc(var(--px, 0) * var(--depth) * 22px),
    calc(var(--py, 0) * var(--depth) * 16px),
    0
  );
  transition: transform 700ms cubic-bezier(0.2, 0.7, 0.2, 1);
  will-change: transform;
}

.card-layer--far {
  --depth: 0.45;
}

.card-layer--mid {
  --depth: 0.8;
}

.card-layer--near {
  --depth: 1.25;
}

.field-card {
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform: translate(-50%, -50%) rotate(var(--r)) scale(var(--s));
}

.field-card__body {
  display: block;
  width: var(--w);
  aspect-ratio: 5 / 7;
  border-radius: 8px;
  box-shadow: var(--shadow-card);
  animation: card-float var(--d, 28s) ease-in-out var(--delay, 0s) infinite;
}

@keyframes card-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(var(--float, -14px));
  }
}

.card-layer--far .field-card__body {
  filter: blur(1.4px);
  opacity: 0.42;
}

.card-layer--mid .field-card__body {
  filter: blur(0.5px);
  opacity: 0.7;
}

.card-layer--near .field-card__body {
  opacity: 0.96;
}

.field-card__body--back {
  position: relative;
  border: 1px solid rgba(94, 223, 212, 0.28);
  background: var(--card-back);
}

.field-card__body--back::before {
  position: absolute;
  inset: 6%;
  content: "";
  border: 1px solid rgba(94, 223, 212, 0.18);
  border-radius: 5px;
}

.field-card__body--back::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 34%;
  aspect-ratio: 1;
  content: "";
  background: linear-gradient(180deg, #e3b45c, #a9761f);
  clip-path: polygon(50% 0%, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0% 50%, 38% 38%);
  transform: translate(-50%, -50%);
}

.field-card__body--face {
  position: relative;
  display: grid;
  place-items: center;
  border: 1px solid rgba(22, 35, 43, 0.22);
  background: var(--card-face);
  color: var(--card-ink);
}

.field-card__body--face b {
  font-family: var(--font-display);
  font-size: 54px;
  font-weight: 600;
  line-height: 1;
}

.field-card__body--face small {
  position: absolute;
  right: 0;
  bottom: 8%;
  left: 0;
  color: rgba(22, 35, 43, 0.42);
  font-size: 8px;
  text-align: center;
}

.stage__copy {
  position: relative;
  z-index: 6;
  text-align: center;
  pointer-events: none;
}

/* Keep the display copy readable when a card passes directly behind it. */
.stage__copy::before {
  position: absolute;
  inset: -34% -26%;
  z-index: -1;
  content: "";
  background: radial-gradient(ellipse at center, var(--stage-halo) 0%, var(--stage-halo) 34%, transparent 72%);
  filter: blur(6px);
}

.stage__copy h1 {
  font-family: var(--font-display);
  font-size: 104px;
  font-weight: 600;
  line-height: 1;
  text-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
}

html[data-theme="light"] .stage__copy h1 {
  text-shadow: none;
}

.stage__copy p {
  margin-top: 16px;
  color: var(--fg-soft);
  font-size: 15px;
}

.stage__hint {
  position: absolute;
  bottom: 26px;
  left: 50%;
  z-index: 6;
  display: grid;
  justify-items: center;
  gap: 8px;
  color: var(--fg-dim);
  font-size: 12px;
  text-decoration: none;
  transform: translateX(-50%);
}

.stage__hint i {
  width: 1px;
  height: 34px;
  background: linear-gradient(180deg, var(--fg-dim), transparent);
  animation: hint-drop 2.2s ease-in-out infinite;
}

@keyframes hint-drop {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  50% {
    transform: translateY(6px);
    opacity: 1;
  }
}

/* ------------------------------------------------------------------- works */

.works {
  position: relative;
  z-index: 6;
  border-top: 1px solid var(--line);
  background: var(--bg);
}

.work {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto auto;
  gap: 28px;
  align-items: center;
  padding: 26px 40px;
  text-decoration: none;
  transition: background 200ms ease;
}

.work:hover {
  background: var(--bg-soft);
}

.work__index {
  color: var(--fg-dim);
  font-family: var(--font-display);
  font-size: 12px;
}

.work__name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
}

.work__meta {
  color: var(--fg-soft);
  font-size: 13px;
}

.work__go {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-size: 13px;
}

.work__go i {
  font-style: normal;
  transition: transform 200ms ease;
}

.work:hover .work__go i {
  transform: translateX(4px);
}

/* ------------------------------------------------------------------ footer */

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px 24px;
  padding: 22px 40px;
  border-top: 1px solid var(--line);
  color: var(--fg-dim);
  font-size: 12px;
}

/* -------------------------------------------------------------- responsive */

@media (max-width: 900px) {
  .stage__copy h1 {
    font-size: 78px;
  }
}

@media (max-width: 640px) {
  .top {
    padding: 0 16px;
  }

  .top__link {
    display: none;
  }

  .stage {
    padding-inline: 16px;
  }

  .stage__copy h1 {
    font-size: 56px;
  }

  .stage__copy p {
    font-size: 14px;
  }

  .work {
    grid-template-columns: 40px minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: 10px 14px;
    padding: 22px 16px;
  }

  .work__meta {
    grid-column: 2;
  }

  .work__go {
    grid-column: 2;
  }

  .foot {
    padding: 20px 16px;
  }
}

@media (max-width: 400px) {
  .stage__copy h1 {
    font-size: 46px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .field-card__body,
  .stage__hint i {
    animation: none;
  }

  .card-layer {
    transition: none;
  }
}
