/* http://meyerweb.com/eric/tools/css/reset/ 
   v2.0 | 20110126
   License: none (public domain)
*/

html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  font: inherit;
  vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section {
  display: block;
}
body {
  line-height: 1;
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden; /* 防止水平滾動 */
  box-sizing: border-box;
}

html {
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden; /* 防止水平滾動 */
  box-sizing: border-box;
}

* {
  box-sizing: border-box; /* 確保所有元素使用 border-box */
}

/* 全域游標設定 */
a, 
h1, h2, h3, h4, h5, h6,
p, span, div, 
button,
.item,
.item_card,
nav ul li {
  cursor: pointer;
}
ol,
ul {
  list-style: none;
}
blockquote,
q {
  quotes: none;
}
blockquote:before,
blockquote:after,
q:before,
q:after {
  content: "";
  content: none;
}
table {
  border-collapse: collapse;
  border-spacing: 0;
}


/* Header / navigation */
header {
  background-color: white;
  color: black;
  padding: 20px;
  display: flex; /* enable flexbox layout for header */
  align-items: center; /* vertically center items */
}

/* push the nav to the right within the header */
header nav {
  margin-left: auto;
}
header h1 {
  display: inline-block;
  font-size: 16px;
  cursor: pointer;
}
header ul {
  display: flex;
  justify-content: flex-end;
}

h1 a {
  color: black;
  text-decoration: none;
}
ul a {
  color: black;
  text-decoration: none;
  display: inline-block;
  margin-left: 30px;
  font-size: 16px;
  cursor: pointer;
}
.container {
  max-width: 1400px; /* 增加最大寬度 */
  margin: 0 auto; /* 居中對齊 */

  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 120px 80px; /* 大幅增加間距：垂直120px，水平80px */
  padding: 80px 60px; /* 增加容器內邊距 */
  align-items: start;
}

@media (max-width: 768px) {
  .container {
    grid-template-columns: 1fr !important;
    gap: 80px 0; /* 增加手機版垂直間距 */
    padding: 30px 20px; /* 調整 padding */
    margin: 0; /* 移除可能的 margin */
    display: grid !important; /* 強制 grid 顯示 */
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  
  /* 確保所有項目都顯示 */
  .item:nth-child(1),  /* item0003 嬌依絲 */
  .item:nth-child(2),  /* item0001 yankigori */
  .item:nth-child(3),  /* item0002 RAY WANG photography */
  .item:nth-child(4),  /* item0004 葉月堂-手作雪花冰 */
  .item:nth-child(5) { /* item0005 1111南部打工快搜 */
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    grid-column: 1 !important; /* 強制單欄 */
  }
  
  .item-wide {
    grid-column: span 1 !important; /* 手機版時強制回到單格 */
  }
  
  .item {
    width: 100%;
    max-width: none;
    display: block !important; /* 確保項目顯示 */
    margin: 0; /* 移除可能的外邊距 */
    position: relative;
  }
  .item_card {
    width: 100%;
    display: block !important; /* 確保卡片顯示 */
  }
  .item img {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    display: block !important;
  }
  .item h3 {
    display: block !important; /* 確保標題顯示 */
    margin-top: 25px; /* 增加圖片和標題間距 */
  }
  
  /* 導航響應式設計 */
  header {
    flex-direction: column;
    text-align: center;
    padding: 15px;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
  }
  header nav {
    margin-left: 0;
    margin-top: 15px;
  }
  header ul {
    justify-content: center;
  }
  ul a {
    margin-left: 15px;
    margin-right: 15px;
    font-size: 14px;
  }
}

/* 更小螢幕的額外優化 */
@media (max-width: 480px) {
  .container {
    gap: 70px 0; /* 增加小螢幕間距 */
    padding: 20px 15px; /* 增加上下padding */
    margin: 0; /* 移除可能的 margin */
    grid-template-columns: 1fr !important; /* 強制單欄顯示 */
    display: grid !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  
  /* 超小螢幕確保所有5個項目都顯示 */
  .item:nth-child(1),  /* item0003 */
  .item:nth-child(2),  /* item0001 */
  .item:nth-child(3),  /* item0002 */
  .item:nth-child(4),  /* item0004 */
  .item:nth-child(5) { /* item0005 */
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    grid-column: 1 !important;
  }
  
  .item {
    display: block !important; /* 強制顯示所有項目 */
    width: 100% !important;
    margin: 0 !important;
  }
  .item h3 {
    font-size: 16px;
    margin-top: 20px; /* 增加圖片和標題間距 */
    display: block !important;
  }
  .item-wide {
    grid-column: span 1 !important; /* 確保雙欄項目在小螢幕變單欄 */
  }
  .item_card {
    display: block !important;
    width: 100% !important;
  }
  .item img {
    display: block !important;
    width: 100% !important;
    height: auto !important;
  }
  
  header {
    padding: 10px;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
  }
  header h1 {
    font-size: 14px;
  }
  ul a {
    margin-left: 10px;
    margin-right: 10px;
    font-size: 13px;
  }
  
  /* 確保整個頁面不會水平滾動 */
  body {
    overflow-x: hidden !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }
}

.item {
  position: relative;
  text-align: center;
  overflow: hidden; /* 🚩 關鍵：限制放大後的圖片不超出邊界 */
  display: block; /* 確保基礎顯示 */
  width: 100%;
  visibility: visible; /* 確保可見 */
  opacity: 1; /* 確保不透明 */
}

.item-wide {
  grid-column: span 2; /* 佔兩格寬度 */
}

.item_card {
  overflow: hidden;
  display: block;
  width: 100%;
}

/* 確保所有圖片都能正確載入和顯示 */
.item img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* 確保標題顯示 */
.item h3 {
  display: block;
  text-align: center;
  margin-top: 30px; /* 桌機版圖片和標題間距 */
  font-size: 18px; /* 稍微調整字體大小 */
}

.item img {
  display: block; /* 🚩 避免圖片底部留白 */
  width: 100%; /* 填滿容器寬度 */
  height: 100%; /* 可視需要設固定高度或 auto */
  object-fit: fill; /* 🚩 保持比例填滿框 */
  transition: transform 0.8s ease;
  cursor: pointer;
  position: relative; /* 讓它在自己的框內定位 */
}

.item:hover img {
  transform: scale(1.1);
}

/* horizontal gradient text placed between header and container */
.gradient-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px 20px;
}

.gradient-text--horizontal {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1px;
  background: linear-gradient(90deg, #ff6a00, #ffcc00, #00c6ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin: 0;
}

/* Responsive rules for canvas and gradient text */
#p5-canvas-container {
  width: 90%;
  max-width: 1000px;
  margin: 0 auto;
}

@media (max-width: 768px) {
  .gradient-wrapper { padding: 8px 10px; }
  .gradient-text--horizontal { font-size: 18px; }
}

@media (max-width: 480px) {
  .gradient-wrapper { padding: 6px 8px; }
  .gradient-text--horizontal { font-size: 14px; }
  #p5-canvas-container { max-width: 480px; }
}

