/* ===== Editorial warm — design tokens ===== */
:root {
  --color-bg: #f5f0e8;
  --color-bg-alt: #ebe4d6;
  --color-surface: #fffcf7;
  --color-text: #1a1614;
  --color-text-muted: #6b635c;
  --color-primary: #c45c26;
  --color-primary-hover: #a34a1c;
  --color-accent: #3d6b5e;
  --color-accent-light: #e8f0ed;
  --color-border: #d9d0c4;
  --color-border-strong: #1a1614;
  --color-success: #3d6b5e;
  --color-warning: #b45309;
  --shadow-sm: 3px 3px 0 var(--color-border-strong);
  --shadow-md: 5px 5px 0 var(--color-border-strong);
  --shadow-soft: 0 12px 40px rgba(26, 22, 20, 0.08);
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 0;
  --radius-full: 4px;
  --font-display: "DM Serif Display", "Noto Serif TC", Georgia, serif;
  --font-sans: "Instrument Sans", "PingFang TC", "Noto Sans TC", sans-serif;
  --max-width: 1080px;
  --header-height: 64px;
  --transition: 0.18s ease;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--color-text);
  background: var(--color-bg);
  background-image: radial-gradient(circle at 1px 1px, rgba(26, 22, 20, 0.06) 1px, transparent 0);
  background-size: 24px 24px;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--color-primary-hover);
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: var(--color-surface);
  border-bottom: 2px solid var(--color-border-strong);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.25rem;
  color: var(--color-text);
  letter-spacing: -0.02em;
}

.logo:hover {
  color: var(--color-text);
}

.logo-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--color-primary);
  border: 2px solid var(--color-border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1rem;
  box-shadow: 2px 2px 0 var(--color-border-strong);
}

.nav-desktop {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-desktop a {
  color: var(--color-text-muted);
  font-weight: 500;
  font-size: 0.875rem;
  padding: 0.5rem 0.875rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
}

.nav-desktop a:hover,
.nav-desktop a.is-active {
  color: var(--color-text);
  background: var(--color-bg-alt);
}

.nav-toggle {
  display: none;
  background: var(--color-surface);
  border: 2px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  padding: 0.375rem 0.5rem;
  cursor: pointer;
  color: var(--color-text);
  font-size: 1.25rem;
  box-shadow: 2px 2px 0 var(--color-border-strong);
}

.nav-mobile {
  display: none;
  position: fixed;
  inset: var(--header-height) 0 0 0;
  background: var(--color-surface);
  padding: 1rem 1.5rem;
  flex-direction: column;
  gap: 0.25rem;
  border-top: 2px solid var(--color-border-strong);
  z-index: 99;
}

.nav-mobile.is-open {
  display: flex;
}

.nav-mobile a {
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  font-weight: 500;
  font-size: 1.0625rem;
}

.nav-mobile a:last-child {
  border-bottom: none;
}

/* ===== Footer ===== */
.site-footer {
  margin-top: auto;
  padding: 3.5rem 0 2rem;
  background: var(--color-text);
  color: #a8a29e;
  border-top: 4px solid var(--color-primary);
}

.site-footer a {
  color: #e7e5e4;
}

.site-footer a:hover {
  color: #fff;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2.5rem;
  margin-bottom: 2.5rem;
}

.footer-brand .logo {
  color: #fafaf9;
  margin-bottom: 1rem;
}

.footer-brand .logo-icon {
  background: var(--color-primary);
}

.footer-brand p {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.75;
  max-width: 300px;
}

.footer-col h4 {
  margin: 0 0 1rem;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-primary);
}

.footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-col li {
  margin-bottom: 0.625rem;
}

.footer-col a {
  font-size: 0.9375rem;
}

.footer-bottom {
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8125rem;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.375rem;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 2px solid var(--color-border-strong);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

.btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow-md);
}

.btn:active {
  transform: translate(0, 0);
  box-shadow: none;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  color: #fff;
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
}

.btn-secondary:hover {
  background: var(--color-bg-alt);
  color: var(--color-text);
}

.btn-accent {
  background: var(--color-accent);
  color: #fff;
}

.btn-accent:hover {
  background: #325a4f;
  color: #fff;
}

.btn-lg {
  padding: 0.9375rem 1.75rem;
  font-size: 1rem;
}

.btn[disabled],
.btn.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
  box-shadow: var(--shadow-sm);
}

/* ===== App card — horizontal editorial ===== */
.app-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1.5rem;
  background: var(--color-surface);
  border: 2px solid var(--color-border-strong);
  padding: 1.5rem 1.75rem;
  transition: transform var(--transition), box-shadow var(--transition);
  text-decoration: none;
  color: inherit;
}

.app-card:hover {
  transform: translate(-3px, -3px);
  box-shadow: var(--shadow-md);
  color: inherit;
}

.app-card-num {
  font-family: var(--font-display);
  font-size: 2.5rem;
  line-height: 1;
  color: var(--color-border);
  user-select: none;
}

.app-card-icon-wrap {
  flex-shrink: 0;
}

.app-card-icon {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  border: 2px solid var(--color-border-strong);
  box-shadow: 3px 3px 0 var(--color-border-strong);
}

.app-card-body {
  min-width: 0;
}

.app-card-body h3 {
  margin: 0 0 0.375rem;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 400;
}

.app-card-body p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.9375rem;
  line-height: 1.55;
}

.app-card-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
  flex-shrink: 0;
}

.app-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1.5px solid var(--color-accent);
  color: var(--color-accent);
  background: var(--color-accent-light);
}

.app-badge.is-soon {
  border-color: var(--color-warning);
  color: var(--color-warning);
  background: #fffbeb;
}

.app-card-arrow {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--color-border-strong);
  background: var(--color-bg);
  font-size: 1.25rem;
  transition: background var(--transition);
}

.app-card:hover .app-card-arrow {
  background: var(--color-primary);
  color: #fff;
}

/* Legacy preview hidden in new layout */
.app-card-preview {
  display: none;
}

.app-card-meta,
.app-card-link {
  display: none;
}

/* ===== Legal ===== */
.legal-page {
  padding: 3rem 0 4rem;
}

.legal-page h1 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 400;
}

.legal-updated {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--color-border);
}

.legal-content h2 {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 400;
  margin: 2rem 0 0.75rem;
}

.legal-content h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 1.5rem 0 0.5rem;
}

.legal-content p,
.legal-content li {
  color: var(--color-text-muted);
}

.legal-content ul,
.legal-content ol {
  padding-left: 1.25rem;
}

.legal-content li {
  margin-bottom: 0.5rem;
}

/* ===== Layout ===== */
.page-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.section-label {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--color-primary);
  margin-bottom: 0.75rem;
}

.section-title {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-size: clamp(1.875rem, 4vw, 2.75rem);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.section-desc {
  margin: 0 0 2.5rem;
  color: var(--color-text-muted);
  font-size: 1.0625rem;
  max-width: 520px;
}

/* ===== Page themes ===== */
body.page-remote {
  --page-tint: #f0ebe3;
  --page-accent: #8b5a3c;
}

body.page-file {
  --page-tint: #e8f0ed;
  --page-accent: #3d6b5e;
}

body.page-legal {
  background: var(--color-surface);
  background-image: none;
}

@media (max-width: 768px) {
  .nav-desktop {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .app-card {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 1.25rem;
  }

  .app-card-num {
    font-size: 1.5rem;
  }

  .app-card-side {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }
}
