/* ThirtyFile company website */

:root {
  --bg: #f7f9fd;
  --bg-glow: #dfe9ff;
  --surface: #ffffff;
  --text: #10204a;
  --text-soft: #5a6888;
  --line: #dfe5f1;
  --hover: #eef3ff;
  --brand: #2563eb;
  --floater: #2563eb;
  --logo-line: #2563eb;
  --shadow: 0 18px 40px -16px rgba(16, 32, 74, 0.28);
  --font: "Geist", "Noto Sans TC", "Noto Sans JP", "PingFang TC", "Hiragino Sans", "Microsoft JhengHei", "Yu Gothic", system-ui, sans-serif;
  color-scheme: light;
}

/* Dark follows the system unless the switch picked a theme (<html data-theme>) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #070c1c;
    --bg-glow: #142a66;
    --surface: #0f1730;
    --text: #eef2ff;
    --text-soft: #9aa8cc;
    --line: #1d2a52;
    --hover: #17244a;
    --brand: #5b93ff;
    --floater: #7aa8ff;
    --logo-line: #5b93ff;
    --shadow: 0 18px 40px -16px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #070c1c;
  --bg-glow: #142a66;
  --surface: #0f1730;
  --text: #eef2ff;
  --text-soft: #9aa8cc;
  --line: #1d2a52;
  --hover: #17244a;
  --brand: #5b93ff;
  --floater: #7aa8ff;
  --logo-line: #5b93ff;
  --shadow: 0 18px 40px -16px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100svh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  /* Short screens scroll vertically; nothing spills sideways */
  overflow-x: clip;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 8px;
}

/* Top bar: the language menu and the theme switch */
.top {
  position: relative;
  z-index: 5;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  padding: 16px;
}

.lang {
  position: relative;
}

.lang summary {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 75%, transparent);
  backdrop-filter: blur(8px);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: border-color 0.2s;
}

.lang summary::-webkit-details-marker {
  display: none;
}

.lang summary:hover,
.lang[open] summary {
  border-color: var(--brand);
}

.lang .globe {
  width: 16px;
  height: 16px;
  color: var(--text-soft);
}

.lang .chev {
  width: 14px;
  height: 14px;
  color: var(--text-soft);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.lang[open] .chev {
  transform: rotate(180deg);
}

.lang ul {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 168px;
  margin: 0;
  padding: 6px;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transform-origin: 100% 0;
  animation: menu-in 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.lang li {
  animation: item-in 0.3s ease both;
}

.lang li:nth-child(2) {
  animation-delay: 0.04s;
}

.lang li:nth-child(3) {
  animation-delay: 0.08s;
}

.lang a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 9px;
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
  transition: background 0.15s;
}

.lang a:hover {
  background: var(--hover);
}

.lang a[aria-current="page"] {
  color: var(--brand);
  font-weight: 600;
}

.lang .tick {
  width: 16px;
  height: 16px;
}

/* Closing plays the opening in reverse (assets/site.js adds the class, then closes) */
.lang.closing ul {
  animation: menu-out 0.18s ease forwards;
}

@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.92);
  }
}

@keyframes menu-out {
  to {
    opacity: 0;
    transform: translateY(-6px) scale(0.92);
  }
}

@keyframes item-in {
  from {
    opacity: 0;
    transform: translateX(8px);
  }
}

/* Round buttons: the theme switch and GitHub */
.round {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 75%, transparent);
  backdrop-filter: blur(8px);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.round:hover {
  border-color: var(--brand);
  color: var(--brand);
  transform: rotate(-10deg) scale(1.08);
}

.round svg {
  width: 18px;
  height: 18px;
}

.theme-toggle:hover {
  transform: rotate(30deg) scale(1.08);
}

.theme-toggle .moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .moon {
    display: block;
  }
  :root:not([data-theme="light"]) .theme-toggle .sun {
    display: none;
  }
}

:root[data-theme="dark"] .theme-toggle .moon {
  display: block;
}

:root[data-theme="dark"] .theme-toggle .sun {
  display: none;
}

/* Stage: the logo in the middle, office things drifting around it */
.stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.floaters {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.floater {
  position: absolute;
  color: var(--floater);
  opacity: 0.2;
  will-change: transform;
}

.floater svg {
  display: block;
  width: 100%;
  height: 100%;
}

.glow {
  position: fixed;
  left: 50%;
  top: 50%;
  width: min(760px, 120vw);
  aspect-ratio: 1;
  translate: -50% -56%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--bg-glow), transparent 62%);
  pointer-events: none;
  z-index: 0;
}

.mark {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(20px, 4vmin, 36px);
}

.logo-button {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  border-radius: 40%;
  -webkit-tap-highlight-color: transparent;
}

.logo {
  display: block;
  width: clamp(96px, 32vmin, 260px);
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 18px 30px rgba(37, 99, 235, 0.25));
}

/* An outline keeps the white face visible on a light page */
.lg-line {
  stroke: var(--logo-line);
  stroke-width: 0.6;
}

.word {
  margin: 0;
  font-size: clamp(36px, min(10vw, 13vh), 104px);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1;
}

.word .ch {
  display: inline-block;
}

.word .file {
  color: var(--brand);
}

/* Under the word: the product website and GitHub */
.links {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: clamp(4px, 1vmin, 12px);
}

.links .gh {
  width: 46px;
  height: 46px;
  /* It follows the pointer with GSAP (assets/site.js), so no CSS transform here */
  transition: border-color 0.2s, color 0.2s;
}

.links .gh:hover {
  transform: none;
}

.links .gh svg {
  width: 20px;
  height: 20px;
}

/* The link to the product website: a pill that fills with the brand colour on hover */
.more {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 18px 0 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 75%, transparent);
  backdrop-filter: blur(8px);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  overflow: hidden;
  isolation: isolate;
  transition: color 0.3s, border-color 0.3s;
}

.more::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--brand);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.more:hover,
.more:focus-visible {
  color: #fff;
  border-color: var(--brand);
}

.more:hover::before,
.more:focus-visible::before {
  transform: scaleX(1);
}

.more svg {
  width: 18px;
  height: 18px;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.more:hover svg,
.more:focus-visible svg {
  transform: translateX(4px);
}

/* Little office icons thrown out when the logo is clicked */
.burst {
  position: fixed;
  z-index: 4;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  color: var(--brand);
  pointer-events: none;
}

.burst svg {
  width: 100%;
  height: 100%;
}

.foot {
  position: relative;
  z-index: 3;
  padding: 16px;
  text-align: center;
  color: var(--text-soft);
  font-size: 12px;
  letter-spacing: 0.04em;
}

/* Theme switch: the new theme grows as a circle from the button (assets/site.js) */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
