@charset "utf-8";

/*
 * 版面調整（流動寬度 + 行動裝置）
 *
 * 原本的版面是固定 1000px 寬（#main_content 1000px / 選單 194px / 內容 803px），
 * 各頁 CSS 又寫死了容器的 width 與 height，導致視窗再寬也用不到，作品照片只有 180px。
 *
 * 這裡不修改既有樣式，改以流動寬度覆蓋：容器上限放寬到 1400px，
 * 內容區與作品縮圖改用百分比，視窗越寬照片越大。
 *
 * 各頁的 CSS 是在 body 內載入、順序在本檔之後，故需要 !important 才能覆蓋。
 */

/* 選單開關預設隱藏，僅手機版顯示（規則須排在 media query 之前才能被覆蓋） */
#mobile_menu_toggle {
  display: none;
}


/* ==========================================================================
   所有寬度：外框改為流動寬度，側邊選單保留
   ========================================================================== */

@media screen {

  /* 全站統一寬度。原本是 1000px，放寬讓作品照片變大；
     不再放到 1400px，那個寬度下文字頁面的行長會不好閱讀，
     15 吋筆電也一個畫面看不完。 */
  #main_content {
    width: auto !important;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 12px;
    box-sizing: border-box;
  }

  /* 圖片一律不超出容器（覆蓋 HTML 的 width="763" 等屬性） */
  img {
    max-width: 100%;
    height: auto;
  }

  /* 頁首的 logo / 頁名 / 語言選擇原本各佔 500px 寬並左右浮動，
     容器一旦窄於 1000px 就放不下，需改為自適應並自我清除浮動。
     原本固定 100px 高，內容其實只有約 60px，改為自動收合。 */
  #top_content {
    height: auto !important;
    margin-top: 8px !important;
    overflow: hidden;
  }

  /* 頁名（PROJECTS 等）原本 65px 行高，跟著頁首一起收 */
  #navicat_content {
    height: auto !important;
    line-height: 1.2 !important;
    font-size: 24px !important;
    padding-top: 4px;
  }

  #language_content {
    margin-top: 6px !important;
  }

  #logo_content,
  #navicat_content,
  #language_content {
    width: auto !important;
    max-width: 50%;
  }

  /* 各頁把 #body_content 寫死了高度（1690px、1800px、1900px），內容改為自動撐開。
     這裡的 clear 不可省：overflow:hidden 使其成為 BFC，而 BFC 會避開前面
     未清除的浮動元素（#language_content），沒有 clear 會讓整塊被擠成剩餘寬度。 */
  #body_content {
    height: auto !important;
    min-height: 0 !important;
    clear: both;
    overflow: hidden;
  }

  /* 內容區原為 float:left + width:803px + overflow:scroll，
     改為建立 BFC 自動填滿選單右側的剩餘空間 */
  #imformation_content {
    width: auto !important;
    height: auto !important;
    min-height: 0 !important;
    float: none !important;
    overflow: hidden !important;
  }

  /* 各頁內容容器一律解除固定寬高 */
  #view_content,
  #title_content,
  #navitation_content,
  #profile_content,
  #company_content,
  #company_table,
  #location_content,
  #location,
  .service_content,
  .bulletin_content,
  .bulletin_content_s,
  #contact_text {
    width: auto !important;
    height: auto !important;
    min-height: 0 !important;
    margin-left: 20px !important;
    margin-right: 20px !important;
  }

  /* 注意：#view_content 不可改 overflow —— 首頁 FlexSlider 與作品相簿
     都靠 overflow:hidden 隱藏未顯示的圖片，改成 visible 會整排攤開撐爆版面 */
  #view_content {
    background-color: transparent !important;
  }

  /* 作品詳細頁把它設成 line-height:0，高度收合後文字會被下方的大圖蓋住 */
  #navitation_content {
    line-height: 1.5 !important;
    padding-bottom: 6px;
  }

  /* 這幾個容器內含左右並排的浮動欄位，原本靠寫死的高度撐住。
     高度改成 auto 後必須自我清除浮動，否則會塌陷成 0，
     後面的區塊（例如「據點」）會疊到上一段的旁邊。 */
  #company_content,
  #company_table,
  #location_content,
  #location,
  #profile_content,
  .service_content,
  .bulletin_content,
  .bulletin_content_s {
    overflow: hidden;
  }

  /* ---- 作品縮圖：改用百分比，一行四張，視窗越寬照片越大 ----
     原本固定 180x180。高度用 padding-bottom 撐出正方形，
     因為內層的 .img / .msg 是絕對定位，不會撐開父層。 */
  .works_img,
  .works_img.margin_rt {
    width: 23.8% !important;
    height: 0 !important;
    padding-bottom: 23.8% !important;
    margin: 0 1.6% 1.6% 0 !important;
  }

  .works_img.margin_rt {
    margin-right: 0 !important;
  }

  .works_img .img,
  .works_img .msg {
    width: 100% !important;
    height: 100% !important;
  }

  /* project.php 有段 JS 會依 180px 換算並寫進 inline style，
     這裡用 !important 蓋掉，改由 object-fit 裁切置中。 */
  .works_img .img img {
    width: 100% !important;
    height: 100% !important;
    margin-left: 0 !important;
    margin-top: 0 !important;
    object-fit: cover;
  }

  .works_img .msg {
    box-sizing: border-box !important;
    padding: 15px !important;
  }
}


/* ==========================================================================
   平板（768 ~ 1023px）：作品改一行三張
   ========================================================================== */

@media screen and (min-width: 768px) and (max-width: 1023px) {

  /* 選單固定佔 194px，這個寬度下一行放四張只剩 120px，比改版前還小。
     這裡讓每個縮圖都帶右邊距（含 .margin_rt），三個剛好佔滿一行。 */
  .works_img,
  .works_img.margin_rt {
    width: 31% !important;
    height: 0 !important;
    padding-bottom: 31% !important;
    margin: 0 2.33% 2.33% 0 !important;
  }
}


/* ==========================================================================
   桌機（≥ 1024px）
   ========================================================================== */

@media screen and (min-width: 1024px) {

  /* 視窗夠寬時不需要左右留白，維持與改版前相同的內容寬度 */
  #main_content {
    padding: 0;
  }
}


/* ==========================================================================
   手機（≤ 767px）：選單收合，所有並排欄位改為上下堆疊
   ========================================================================== */

@media screen and (max-width: 767px) {

  #main_content {
    padding: 0 10px;
  }

  /* ---- 頁首 ----
     logo、頁名、語言選擇原本各自佔一行。改為 logo 與語言並排，
     頁名則由 JS 搬進 MENU 列（見 views/index.php），省下兩行高度。 */

  #top_content {
    height: auto !important;
    margin-top: 8px !important;
    overflow: hidden;
  }

  #logo_content {
    width: auto !important;
    float: left !important;
  }

  #logo_content img {
    max-width: 150px;
    padding-top: 2px !important;
  }

  /* 頁名已移到 MENU 列，這裡只留給 JS 讀取文字用 */
  #navicat_content {
    display: none !important;
  }

  #language_content {
    width: auto !important;
    float: right !important;
    margin-top: 6px !important;
    text-align: right !important;
  }

  /* 這個 clear 原本用來把語言選擇推到 logo 下方，
     手機版要讓兩者並排，得讓它失效 */
  #top_content .clear {
    display: none;
  }

  #btn_lan_zh,
  #btn_lan_en {
    font-size: 14px !important;
    margin-left: 12px !important;
  }

  #btn_lan_en {
    margin-left: 0 !important;
  }

  /* ---- 選單（漢堡開關） ---- */

  #mobile_menu_toggle {
    display: block;
    padding: 12px 14px;
    font-size: 15px;
    line-height: 18px;
    color: #686868;
    background-color: #f4f4f4;
    border-bottom: 1px solid #C1C1C1;
    cursor: pointer;
    user-select: none;
  }

  #mobile_menu_toggle .bar {
    display: inline-block;
    width: 18px;
    height: 2px;
    margin-right: -18px;
    background-color: #a6db21;
    vertical-align: middle;
  }

  #mobile_menu_toggle .bar:nth-child(1) { margin-bottom: 10px; }
  #mobile_menu_toggle .bar:nth-child(3) { margin-top: 10px; margin-right: 10px; }

  /* 由 JS 從 #navicat_content 搬過來的頁名 */
  #mobile_menu_toggle .menu_page_title {
    float: right;
    color: #a6db21;
    font-size: 15px;
  }

  /* 預設收合，點開關後加上 .open */
  #menu_content {
    display: none;
    width: 100% !important;
    height: auto !important;
    float: none !important;
    border-bottom: 1px solid #C1C1C1;
  }

  #menu_content.open {
    display: block;
  }

  #nav,
  #nav > .pages {
    width: 100% !important;
    height: auto !important;
  }

  /* 觸控目標放大到 44px 以上 */
  .pages {
    line-height: 46px !important;
    font-size: 16px !important;
  }

  #imformation_content {
    border-left: none !important;
  }

  /* ---- 內容區塊 ---- */

  #view_content,
  #title_content,
  #navitation_content,
  #profile_content,
  #company_content,
  #company_table,
  #location_content,
  #location,
  .service_content,
  .bulletin_content,
  .bulletin_content_s,
  #contact_text {
    margin-left: 14px !important;
    margin-right: 14px !important;
  }

  #title_content {
    height: auto !important;
    line-height: 1.4 !important;
    font-size: 18px !important;
    padding: 10px 0;
  }


  #company_table {
    margin: 0 14px 30px 14px !important;
  }

  /* ---- 關於我們 ---- */

  #profile_title,
  #company_title,
  #location_title {
    margin: 25px 0 20px 0 !important;
    font-size: 18px !important;
  }

  /* 左右兩欄（108px / 560px）改為上下堆疊 */
  #lt_content,
  #rt_content,
  #location_img,
  #location_table {
    width: auto !important;
    height: auto !important;
    float: none !important;
    margin-left: 0 !important;
    text-align: left !important;
  }

  #lt_content {
    margin-bottom: 6px !important;
    font-weight: bold;
  }

  #rt_content {
    margin-bottom: 25px !important;
  }

  .item_height,
  #investor_height {
    height: auto !important;
  }

  /* 標籤已由 JS 搬到對應內容的前面（見 pages/company.php）。
     標籤保留綠色標線，內容（.rt_border）則不加線，靠縮排區隔。 */
  .company_name,
  .company_set,
  .company_capital,
  .company_business,
  .company_person,
  .company_investor {
    height: auto !important;
    margin-bottom: 4px !important;
    border-right: none !important;
    border-left: 6px solid #a6db21 !important;
    padding-right: 0 !important;
    padding-left: 12px !important;
    font-weight: bold;
  }

  #rt_content .rt_border,
  .rt_border {
    margin-bottom: 20px !important;
    border-left: none !important;
    padding-left: 18px !important;
    font-weight: normal;
    line-height: 1.6;
  }

  #location_table {
    margin-bottom: 25px !important;
  }

  #location_japan,
  #location_NETWORK {
    margin-bottom: 25px !important;
  }

  .date_tp_margin,
  .tp_margin {
    margin-top: 25px !important;
  }

  /* 表格在窄螢幕上可橫向捲動，不撐破版面 */
  #imformation_content table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  td {
    padding: 5px !important;
    font-size: 14px;
  }

  /* ---- 服務流程 ---- */

  .service_img,
  .service_text,
  .service_title {
    width: auto !important;
    height: auto !important;
    float: none !important;
    margin-left: 0 !important;
  }

  .service_img {
    margin-bottom: 12px !important;
    border: none !important;
  }

  .service_text {
    font-size: 14px !important;
    line-height: 1.7 !important;
  }

  /* 只縮不放：圖片原尺寸小於容器時維持原樣，避免被拉大而糊掉、佔滿整個畫面 */
  .service_img img {
    width: auto !important;
    max-width: 100%;
  }

  .service_title {
    margin-bottom: 10px !important;
    font-size: 17px !important;
  }

  /* ---- 最新消息 ---- */

  .bulletin_content,
  .bulletin_content_s {
    display: block !important;
    padding-bottom: 45px !important;
  }

  .service_img_s {
    float: none !important;
    margin-bottom: 10px !important;
  }

  /* 原本以絕對定位排在圖片右側，窄螢幕改為正常流排在下方 */
  .service_title_s {
    position: static !important;
    width: auto !important;
    top: auto !important;
    left: auto !important;
    margin-bottom: 8px;
  }

  .service_acontent_s {
    width: auto !important;
  }

  .date,
  .date_content_s {
    position: static !important;
    width: auto !important;
    height: auto !important;
    margin-top: 8px !important;
    text-align: left !important;
    line-height: 1.5 !important;
  }

  #bulletin_height {
    height: auto !important;
  }

  /* ---- 作品列表：一行兩張，維持正方形 ---- */

  .works_img,
  .works_img.margin_rt {
    width: 48% !important;
    height: 0 !important;
    padding-bottom: 48% !important;
    margin: 0 1% 2% 1% !important;
  }

  .works_img .img,
  .works_img .msg {
    width: 100% !important;
    height: 100% !important;
    padding: 0 !important;
  }

  .works_img .img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .works_img .msg {
    box-sizing: border-box;
    padding: 10px !important;
    font-size: 13px !important;
    line-height: 1.4;
  }

  /* ---- 作品相簿（specialshop）----
     大圖輪播的尺寸規則放在 pages/specialshop.php 的 media query 裡，
     與計算位移的 JS 擺在一起比較好對照；此處不要再設 .btn_album 的寬度，
     否則會蓋掉 JS 依可視區算出的值。 */

  /* 左右翻頁鈕縮小，避免在小螢幕蓋住圖片 */
  #btn_album_l,
  #btn_album_r {
    width: 30px !important;
    height: 30px !important;
    margin-top: -15px !important;
    background-size: 60px 30px !important;
  }

  /* ---- 聯絡我們 ---- */

  #table_title,
  #contact_table {
    width: auto !important;
    height: auto !important;
    float: none !important;
    margin-left: 0 !important;
    border-right: none !important;
  }

  #table_title {
    margin-bottom: 15px !important;
    border-left: 6px solid #a6db21 !important;
  }

  /* 標籤已由 JS 搬到各欄位前面（見 pages/contact.php），改為欄位標題樣式 */
  .item {
    height: auto !important;
    line-height: 1.6 !important;
    margin-bottom: 4px;
    padding: 0 0 0 10px !important;
    border-left: 4px solid #a6db21;
    text-align: left !important;
    font-size: 15px !important;
  }

  .input,
  input,
  textarea,
  select {
    box-sizing: border-box;
    width: 100% !important;
    max-width: 100% !important;
  }

  input,
  select {
    height: 40px !important;
  }

  input[type="checkbox"],
  input[type="radio"],
  input[type="submit"],
  input[type="button"] {
    width: auto !important;
    height: auto !important;
  }

  textarea {
    height: 120px !important;
  }

  select {
    margin-left: 0 !important;
    margin-bottom: 10px;
  }

  #input_inline,
  #words,
  #tips {
    display: block !important;
  }

  /* ---- 頁尾 ---- */

  #footer_content {
    height: auto !important;
    padding: 15px 0;
    line-height: 1.6 !important;
  }

  #contact,
  #company {
    float: none !important;
    display: block;
    margin: 0 0 8px 0 !important;
  }
}

