/* House Studio — Google 风格设计系统
 *
 * Material Design 3 的形状、海拔与动效，配 Google 自家产品的色板（#1a73e8 那一套，Gmail /
 * Drive / Cloud Console 用的），而不是 M3 默认的紫色基线 —— 后者虽然也是 Material，但没人会
 * 把它认成「谷歌」。
 *
 * 三个页面以前各存一份变量，而且已经开始漂移：同一个「次要文字」颜色在首页是 #8b97a8、在另外
 * 两页是 #93a0b2。所以令牌只在这里定义一次。
 *
 * 字体不走 Google Fonts。这是个中文站，fonts.googleapis.com 在国内取不到，会换来一段白屏；
 * 而只自托管 Roboto 的拉丁子集，又会让中西文落在两套字形上，比统一用系统字更难看。谷歌的观感
 * 主要来自颜色、间距、圆角、海拔和动效，这几样这里都是照着做的。
 */

:root {
  /* 色板 —— Google 产品色 */
  --blue-900: #174ea6;
  --blue-700: #1765cc;   /* 悬停 */
  --blue-600: #1a73e8;   /* 主色 */
  --blue-100: #d2e3fc;
  --blue-50:  #e8f0fe;   /* 主色容器 */
  --grey-900: #202124;   /* 正文 */
  --grey-700: #5f6368;   /* 次要文字、图标 */
  --grey-500: #9aa0a6;
  --grey-300: #dadce0;   /* 描边 */
  --grey-200: #e8eaed;
  --grey-100: #f1f3f4;   /* 高层容器 */
  --grey-50:  #f8f9fa;   /* 容器 */
  --white:    #fff;
  --red-600:   #d93025;
  --green-600: #1e8e3e;
  --yellow-700:#f29900;

  /* 语义别名 —— 页面只用这一层，换皮时不用改组件 */
  --surface:        var(--white);
  --surface-sub:    var(--grey-50);
  --surface-high:   var(--grey-100);
  --on-surface:     var(--grey-900);
  --on-surface-dim: var(--grey-700);
  --outline:        var(--grey-300);
  --outline-soft:   var(--grey-200);
  --primary:        var(--blue-600);
  --on-primary:     var(--white);
  --primary-cont:   var(--blue-50);
  --on-primary-cont:var(--blue-900);
  --error:          var(--red-600);
  --ok:             var(--green-600);

  /* 海拔 —— Google 实际在用的那组阴影，比 M3 规范里的更贴产品 */
  --e1: 0 1px 2px 0 rgb(60 64 67 / .30), 0 1px 3px 1px rgb(60 64 67 / .15);
  --e2: 0 1px 2px 0 rgb(60 64 67 / .30), 0 2px 6px 2px rgb(60 64 67 / .15);
  --e3: 0 1px 3px 0 rgb(60 64 67 / .30), 0 4px 8px 3px rgb(60 64 67 / .15);

  /* 形状 */
  --r-xs: 4px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 28px;
  --r-full: 999px;

  /* 动效 —— M3 的 standard easing，减速比线性明显「有重量」 */
  --ease: cubic-bezier(.2, 0, 0, 1);
  --ease-out: cubic-bezier(0, 0, 0, 1);
  --t-fast: 100ms;
  --t: 200ms;
  --t-slow: 300ms;

  --safe: env(safe-area-inset-bottom, 0px);

  --font: "Google Sans", "Google Sans Text", Roboto, -apple-system, "Segoe UI",
          "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--on-surface);
  background: var(--surface-sub);
  -webkit-font-smoothing: antialiased;
}

/* 字阶 —— Material 3。字号、行高、字重、字距是一组，拆开用就不是这个体系了 */
.t-display { font: 400 36px/44px var(--font); letter-spacing: 0; }
.t-headline { font: 400 24px/32px var(--font); letter-spacing: 0; }
.t-title { font: 500 16px/24px var(--font); letter-spacing: .1px; }
.t-body { font: 400 14px/20px var(--font); letter-spacing: .2px; }
.t-body-lg { font: 400 16px/24px var(--font); letter-spacing: .15px; }
.t-label { font: 500 14px/20px var(--font); letter-spacing: .1px; }
.t-label-sm { font: 500 12px/16px var(--font); letter-spacing: .5px; }
.dim { color: var(--on-surface-dim); }
.err { color: var(--error); }

/* ---------------------------------------------------------------- 按钮 */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 24px; border: none; border-radius: var(--r-full);
  font: 500 14px/20px var(--font); letter-spacing: .1px;
  cursor: pointer; position: relative; overflow: hidden;
  background: transparent; color: var(--primary);
  transition: background-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.btn:disabled { cursor: default; opacity: .38; }

/* 状态层：Material 用一层同色半透明覆盖表达悬停/按下，而不是换一个色值。好处是同一个规则能
   套在任何底色的按钮上，深浅都成立。 */
.btn::after {
  content: ""; position: absolute; inset: 0; background: currentColor;
  opacity: 0; transition: opacity var(--t) var(--ease); pointer-events: none;
}
.btn:hover:not(:disabled)::after { opacity: .08; }
.btn:focus-visible::after { opacity: .12; }
.btn:active:not(:disabled)::after { opacity: .12; }
.btn:focus-visible { outline: 3px solid var(--blue-100); outline-offset: 1px; }

.btn-filled { background: var(--primary); color: var(--on-primary); }
.btn-filled:hover:not(:disabled) { box-shadow: var(--e1); }
.btn-filled:disabled { background: var(--grey-100); color: var(--grey-500); opacity: 1; }

.btn-tonal { background: var(--primary-cont); color: var(--on-primary-cont); }

.btn-outlined { border: 1px solid var(--outline); color: var(--primary); background: var(--surface); }
.btn-outlined:hover:not(:disabled) { border-color: var(--blue-100); background: var(--blue-50); }

.btn-text { padding: 0 12px; }

.btn-sm { height: 32px; padding: 0 16px; font-size: 13px; }
.btn-icon {
  width: 40px; height: 40px; padding: 0; border-radius: 50%; color: var(--on-surface-dim);
}

/* ---------------------------------------------------------------- 卡片与面板 */

.card {
  background: var(--surface); border-radius: var(--r-xl);
  box-shadow: var(--e1); padding: 24px;
}
.panel {
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--e2);
}

/* ---------------------------------------------------------------- 芯片 */

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 14px; border-radius: var(--r-sm);
  border: 1px solid var(--outline); background: var(--surface);
  font: 500 13px/20px var(--font); letter-spacing: .1px; color: var(--on-surface);
  cursor: pointer; position: relative; overflow: hidden; white-space: nowrap;
  transition: background-color var(--t) var(--ease), border-color var(--t) var(--ease),
              color var(--t) var(--ease);
}
.chip::after {
  content: ""; position: absolute; inset: 0; background: currentColor;
  opacity: 0; transition: opacity var(--t) var(--ease); pointer-events: none;
}
.chip:hover::after { opacity: .06; }
.chip:active::after { opacity: .1; }
.chip[aria-pressed="true"], .chip.on {
  background: var(--primary-cont); border-color: transparent; color: var(--on-primary-cont);
}
.chip-elevated { border-color: transparent; box-shadow: var(--e1); }

/* ---------------------------------------------------------------- 表单 */

.select {
  height: 40px; padding: 0 32px 0 12px; border-radius: var(--r-xs);
  border: 1px solid var(--outline); background: var(--surface); color: var(--on-surface);
  font: 400 14px/20px var(--font); cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'><path d='M5 8l5 5 5-5' fill='none' stroke='%235f6368' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat; background-position: right 8px center;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.select:hover { border-color: var(--grey-700); }
.select:focus { outline: none; border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }

/* ---------------------------------------------------------------- 底部面板 */

.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--surface); border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--e3); padding: 8px 24px calc(24px + var(--safe));
  transform: translateY(102%); transition: transform var(--t-slow) var(--ease);
  max-height: 76vh; overflow: auto;
}
.sheet.open { transform: none; }
/* 抓手。它不只是装饰：底部面板从下缘滑入，一条居中的短横是告诉人「这块能往下拨」的通用记号。 */
.sheet::before {
  content: ""; display: block; width: 32px; height: 4px; border-radius: 2px;
  background: var(--grey-300); margin: 0 auto 16px;
}

/* ---------------------------------------------------------------- 杂项 */

.scrim {
  position: fixed; inset: 0; background: rgb(32 33 36 / .32); z-index: 29;
  opacity: 0; pointer-events: none; transition: opacity var(--t) var(--ease);
}
.scrim.on { opacity: 1; pointer-events: auto; }

.divider { height: 1px; background: var(--outline-soft); border: 0; margin: 16px 0; }

/* 无障碍：只对键盘用户显示焦点圈，鼠标点击不显示 —— 但键盘必须显示，否则用 Tab 的人会迷路。 */
:focus:not(:focus-visible) { outline: none; }

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 1ms !important; animation-duration: 1ms !important; }
}
