/**
 * QuietHouse v1 - Base Styles
 * 纸笔质感 - Paper & Pen Aesthetic
 * 严格灰度色彩管制
 */

/* ========== CSS Reset ========== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body, h1, h2, h3, h4, h5, h6, p, ul, ol, li, figure, figcaption, blockquote, dl, dd {
  margin: 0;
  padding: 0;
}

ul, ol {
  list-style: none;
}

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

input, button, textarea, select {
  font: inherit;
}

/* ========== Color Palette (Grayscale Only) ========== */
:root {
  --paper-white: #FAFAFA;        /* 米白色纸张 */
  --ink-black: #2C2C2C;          /* 墨水深灰 */
  --pencil-gray: #888888;        /* 铅笔灰 */
  --line-gray: #EAEAEA;          /* 极淡线条 */
  --pure-black: #000000;         /* 纯黑（仅用于强调） */
  
  /* Dynamic atmosphere colors */
  --bg-color: #FAFAFA;           /* 默认背景 */
  --text-main: #2C2C2C;          /* 默认文字 */
}

/* ========== Atmosphere System (Time-based) ========== */
/* Dawn - 清晨 (5-9点) */
[data-atmosphere="dawn"] {
  --bg-color: #F4F6F8;           /* 清冷晨雾灰 */
}

/* Day - 白昼 (9-16点) */
[data-atmosphere="day"] {
  --bg-color: #FAFAFA;           /* 明亮暖米白 */
}

/* Dusk - 黄昏 (16-19点) */
[data-atmosphere="dusk"] {
  --bg-color: #FDFcf8;           /* 微暖夕阳调 */
}

/* Night - 深夜 (19-5点) */
[data-atmosphere="night"] {
  --bg-color: #1a1a1a;           /* 深色模式 */
  --text-main: #e0e0e0;          /* 浅色文字 */
}

/* Sleep mode overrides atmosphere */
body.sleep-mode {
  --bg-color: #1a1a1a;
  --text-main: #e0e0e0;
}

/* ========== Typography ========== */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Roboto', 'Helvetica Neue', 'Helvetica', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.8;
  color: var(--text-main);
  background-color: var(--bg-color);
  letter-spacing: 0.02em;
  transition: background-color 2s ease, color 1s ease;
  position: relative;
}

/* Paper Grain Texture - 纸面质感 */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.4'/%3E%3C/svg%3E");
  opacity: 0.05;
  pointer-events: none;
  z-index: 9999;
  mix-blend-mode: multiply;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0.03em;
}

h1 { 
  font-size: 1.8rem; 
  margin-bottom: 0.5em;
}

h2 { 
  font-size: 1.4rem; 
  margin-bottom: 0.5em;
}

h3 { 
  font-size: 1.2rem; 
  margin-bottom: 0.4em;
}

h4 { 
  font-size: 1.1rem; 
  margin-bottom: 0.4em;
}

p {
  margin-bottom: 1em;
}

/* ========== Layout ========== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px;
}

.container-narrow {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 24px;
}

/* ========== Utilities ========== */
.text-secondary {
  color: var(--pencil-gray);
}

.mt-1 { margin-top: 12px; }
.mt-2 { margin-top: 24px; }
.mt-3 { margin-top: 36px; }
.mt-4 { margin-top: 48px; }

.mb-1 { margin-bottom: 12px; }
.mb-2 { margin-bottom: 24px; }
.mb-3 { margin-bottom: 36px; }
.mb-4 { margin-bottom: 48px; }

.p-1 { padding: 12px; }
.p-2 { padding: 24px; }
.p-3 { padding: 36px; }
.p-4 { padding: 48px; }

/* ========== Links ========== */
a {
  color: var(--ink-black);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--pure-black);
}

/* ========== Selection ========== */
::selection {
  background-color: var(--line-gray);
  color: var(--ink-black);
}
