/* ====================
   极简摄影作品集
   ==================== */

/* ====================
   Self-hosted Pacifico font
   ==================== */
@font-face {
  font-family: 'Pacifico';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/Pacifico-v23.ttf') format('truetype');
}

/* ====================
   Variables
   ==================== */
:root {
  --color-bg: #1c1c1c;
  --color-text: #ffffff;
  --color-text-light: #cccccc;
  --color-text-muted: #888888;
  --font-display: "Pacifico", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, "Times New Roman", serif;
  --font-body: "Pacifico", cursive;
  --transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ====================
   Reset
   ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ====================
   光标策略
   纯文字区域使用默认箭头，不显示 I 型文本光标。
   注意：能否划选文字由 user-select 决定，与 cursor 完全无关 ——
   这里只改光标外观，按住拖动依然可以正常选中文字。
   ==================== */
body {
  cursor: default;
}

/* 链接与可点击元素仍显示手型 */
a,
button,
[role="button"],
summary,
.gallery-link {
  cursor: pointer;
}

/* 输入类控件保留文本光标 */
input,
textarea,
select {
  cursor: auto;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.1s ease-out;
}

/* ====================
   Home Page - Hero Photo
   ==================== */
.home {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

/* 照片容器：图片未就绪时显示灰色占位块。
   尺寸由 JS 依据 photos-meta.json 的预设比例提前锁定，
   因此文字位置自首帧起固定，不随图片加载完成而位移。 */
.photo-wrapper {
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  background-color: #2e2e2e;
  /* width/height 过渡：预置尺寸切换为照片实际尺寸时平滑展开而非瞬间跳变
     （垂直方向二者已对齐，故文字位置不受影响） */
  transition: box-shadow 1s ease, width 0.3s ease, height 0.3s ease;
  /* 首帧尺寸由 <head> 内联脚本按全站照片比例中位数预置（与主脚本同一公式），
     主脚本拿到该照片真实比例后立即覆盖为精确尺寸。
     此处 fallback 仅在内联脚本未执行时生效 */
  width: var(--hero-w, min(62vw, 558px));
  height: var(--hero-h, min(55vh, 62vw));
}

.hero-photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.7s ease;
}

.hero-photo.is-loaded {
  opacity: 1;
}

@keyframes fadeIn {
  to { opacity: 1; }
}

/* ====================
   About Section
   ==================== */
.about {
  text-align: center;
  margin-top: 3rem;
  opacity: 0;
  animation: fadeIn 1s ease forwards;
  animation-delay: 0.8s;
}

.about-name {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 500;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

.about-text {
  max-width: 480px;
  color: var(--color-text-light);
  font-size: 1rem;
  font-weight: 300;
  margin-bottom: 1.5rem;
}

.about-contact {
  justify-content: center;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.contact-font {
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, "Times New Roman", serif;
}

.about-contact a {
  color: var(--color-text-muted);
  text-decoration: none;
  transition: var(--transition);
}

.about-contact a:hover {
  color: var(--color-text);
}

/* ====================
   Gallery Link
   ==================== */
.gallery-link {
  margin-top: 4rem;
  opacity: 0;
  animation: fadeIn 1s ease forwards;
  animation-delay: 1.2s;
}

.gallery-link a,
.gallery-link span {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--color-text-light);
  text-decoration: none;
  font-size: 0.8rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid transparent;
  transition: var(--transition);
}

.gallery-link a:hover {
  color: var(--color-text);
  border-bottom-color: var(--color-text);
}

.gallery-link svg {
  width: 16px;
  height: 16px;
  transition: var(--transition);
  transform: translateY(-3px);
}

.gallery-link a:hover svg {
  transform: translateY(3px);
}

/* ====================
   Gallery Section (Home Page)
   ==================== */
.gallery-section {
  padding: 6rem 2rem;
  max-width: 1600px;
  margin: 0 auto;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 3rem;
}

.gallery-item {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1/1;
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: transparent;
}

.gallery-item img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* ====================
   Responsive
   ==================== */
@media (max-width: 768px) {
  /* 首图尺寸统一由 JS 计算，此处不再重复声明，避免与 inline 尺寸冲突 */
  .about-name {
    font-size: 1.5rem;
  }
  
  .about-text {
    font-size: 0.9rem;
  }
  
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
  }
}

@media (max-width: 480px) {
  .about-contact {
    flex-direction: column;
    gap: 0.5rem;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
  }
}

/* ====================
   照片固定化
   禁止把照片拖出页面（拖到标签栏会在新标签页打开、拖到桌面会保存），
   并关闭长按菜单中的「存储图像」。
   说明：这类处理只能拦住常规手势操作，无法阻止截图或开发者工具
   直接读取图片 —— 图片 URL 本身是公开可直连的。若需真正限制访问，
   应改为 OSS 私有读 + 签名 URL，或配置 Referer 防盗链。
   ==================== */
img {
  -webkit-user-drag: none;   /* Chrome / Edge / Safari */
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
  user-drag: none;
  /* 防止「先选中再拖动」这条路径 */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  /* iOS 长按不弹出「存储图像」菜单 */
  -webkit-touch-callout: none;
}
