/* ==========================================================
   UPWARD テーマ：スマホ・タブレット
   タブレット：1299px以下／スマホ：768px以下（1300px以上がPC）
   左右の余白：タブレット 40px／スマホ 24px
   ========================================================== */

/* ハンバーガーメニュー（PCでは出さない） */
.menu-btn,.sp-nav{display:none}
/* スマホだけの改行（<br class="sp-only">） */
.sp-only{display:none}

/* ==========================================================
   タブレット（1299px以下）
   ========================================================== */
@media (max-width: 1299px){
  :root{--bleed:-40px} /* 画面端まで伸ばす量＝左右の余白 */
  .wrap{width:auto;margin:0 40px}
  .h2{font-size:32px}

  /* ----- ヘッダー：ハンバーガーメニュー ----- */
  header .in{position:relative;z-index:2;margin:0 40px} /* メニューを開いても、ロゴとボタンは上に出す */
  .gnav{display:none}
  .menu-btn{display:block;position:relative;z-index:2;width:48px;height:48px;margin-right:-12px;background:none;border:0;cursor:pointer;color:#fff}
  .menu-btn span{position:absolute;left:12px;width:24px;height:1px;background:currentColor;transition:transform .3s,opacity .3s}
  .menu-btn span:nth-child(1){top:16px}
  .menu-btn span:nth-child(2){top:24px}
  .menu-btn span:nth-child(3){top:32px}
  .is-menu-open .menu-btn span:nth-child(1){transform:translateY(8px) rotate(45deg)}
  .is-menu-open .menu-btn span:nth-child(2){opacity:0}
  .is-menu-open .menu-btn span:nth-child(3){transform:translateY(-8px) rotate(-45deg)}
  .sp-nav{display:flex;flex-direction:column;justify-content:center;align-items:center;position:fixed;inset:0;z-index:1;padding:88px 24px 40px;background:#262626;overflow-y:auto;opacity:0;visibility:hidden;transition:opacity .3s,visibility .3s}
  .is-menu-open .sp-nav{opacity:1;visibility:visible}
  .is-menu-open{overflow:hidden} /* メニューを開いている間は後ろをスクロールさせない */
  .sp-nav ul{list-style:none;text-align:center}
  .sp-nav li a{display:block;padding:12px 0;font-size:16px;letter-spacing:.1em;line-height:1.6}
  .sp-cta{display:inline-block;margin-top:32px;border:1px solid #fff;padding:16px 56px;font-size:14px;letter-spacing:.1em}

  /* ----- 共通 ----- */
  .sec{padding:112px 0}
  .sec-head{margin-bottom:48px}
  .page-hero{padding-top:80px}
  .page-hero .wrap{padding-bottom:48px}
  .page-hero h1{font-size:32px}

  /* ----- TOP ----- */
  .atsu1{font-size:96px}
  .catch1{font-size:24px}
  .philo .grid{grid-template-columns:1fr;gap:0}
  .philo .atsu-art{height:auto;width:auto;margin:0}
  .philo .calligraphy{padding:40px 0 0}
  .philo .calligraphy img{max-width:640px}
  .txt1{padding-top:40px;text-align:center} /* 見出し・文・ボタンを中央に */
  .str{padding:112px 0}
  .str .head{grid-template-columns:1fr;gap:32px}
  .str .items{gap:32px;margin-top:64px}
  .str .item:nth-child(2){margin-top:48px}
  .str .item:nth-child(3){margin-top:96px}
  .str .item .ph{height:200px}
  .str .num{font-size:48px;margin-top:-28px}
  .str .item h3{font-size:20px}
  .str .item h3 br{display:none}
  .mat{padding-top:112px}
  .mat .head-c{margin-bottom:48px}
  .mat .band{width:auto;margin:0 40px;grid-template-columns:repeat(6,1fr);grid-template-rows:none}
  .mat .band .card:nth-child(1),.mat .band .card:nth-child(2){grid-column:span 3;grid-row:auto;height:360px}
  .mat .band .card:nth-child(n+3){grid-column:span 2;grid-row:auto;height:280px}
  .mat .band .card:nth-child(n+3) .body{padding:24px}
  .mat .band h3{font-size:20px}
  .mat .band .card .sdgs-support{right:16px;top:16px;gap:8px}
  .mat .band .card .sdgs-support p{display:none} /* 小さいカードではマークだけ */
  .mat .band .card .sdgs-support img{width:48px;height:48px}
  .others2{grid-template-columns:1fr;gap:24px;padding-bottom:112px}
  .others2 .more{align-self:start;justify-self:start}
  .craft{padding:112px 0}
  .craft .head{grid-template-columns:1fr;gap:32px}
  .finish{grid-template-columns:repeat(3,1fr);margin-top:56px}
  .finish .cell{height:240px}
  .finish .cell .ph{border-bottom:1px solid #fff}
  .works{padding:112px 0}
  .works .grid{grid-template-columns:1fr;gap:40px}
  .works .vh{writing-mode:horizontal-tb;font-size:32px;white-space:normal} /* 見出しは横書きに */
  .mosaic2{grid-template-rows:repeat(3,128px);gap:8px}
  .latest{padding-left:0}
  .latest .cards{gap:24px}
  .culture{padding:112px 0}
  .culture .grid{grid-template-columns:1fr 1fr;gap:40px} /* 横並び 50：50 */
  .culture .big .ph{margin-left:0} /* 50：50 にそろえるため、画面端までは伸ばさない */
  .culture .small{padding-top:0}
  .culture .small .ph{height:auto;aspect-ratio:920/470} /* 左の写真と同じ縦横比に */
  .culture h3{font-size:20px}
  .news{padding:80px 0}
  .news .grid{grid-template-columns:1fr;gap:32px}
  .cta1{padding:112px 0}
  footer{padding-top:64px}
  footer .grid{grid-template-columns:repeat(3,1fr);gap:40px 24px}
  footer .grid > div:first-child{grid-column:1/-1}

  /* ----- 会社概要 ----- */
  .c-philo .grid{grid-template-columns:1fr;gap:40px}
  .c-philo .atsu{width:auto;margin:0;justify-content:center}
  .c-philo .atsu img{width:320px}
  .c-philo .label,.c-philo .h2,.c-philo .lead{text-align:center} /* 三つの信念の一覧は左ぞろえのまま */
  .c-msg .grid{grid-template-columns:1fr;gap:32px;max-width:760px;margin:0 auto} /* 中身を中央に（文章は左ぞろえ） */
  .profile .row{grid-template-columns:200px 1fr}
  .access{grid-template-columns:1fr;gap:32px}

  /* ----- WordPressの各ページ ----- */
  .post-detail .wrap,.contact .wrap,.privacy .wrap{width:auto}
  .s-strength .str-list li{grid-template-columns:360px 1fr;gap:40px}
  .works-archive .latest .cards{grid-template-columns:repeat(2,1fr);row-gap:48px}
  .w-body{grid-template-columns:1fr;gap:40px;margin-top:56px}
  .social-item{grid-template-columns:320px 1fr;gap:40px}
  .mat-grid{gap:48px 32px}
  .mat-item img{height:220px}
  .other-item{grid-template-columns:1fr;gap:32px}
  .fin-grid{grid-template-columns:repeat(2,1fr);gap:48px 32px}
}

/* ==========================================================
   スマホ（768px以下）
   ========================================================== */
@media (max-width: 768px){
  :root{--bleed:-24px}
  .sp-only{display:inline}
  html{scroll-padding-top:64px}
  .wrap{margin:0 24px}
  .h2{font-size:24px}
  .lead{font-size:14px}
  .mt28{margin-top:24px} .mt40{margin-top:32px}
  .more{min-width:0;width:100%;max-width:320px}
  .btn{padding:16px 40px}

  /* ----- ヘッダー ----- */
  header .in{height:64px;margin:0 24px}
  header .logo img{height:32px}
  body.sub{padding-top:64px}
  .sp-nav{padding-top:64px}

  /* ----- 共通 ----- */
  .sec{padding:80px 0}
  .sec-head{margin-bottom:40px}
  .page-hero{padding-top:56px}
  .page-hero .wrap{flex-direction:column;align-items:flex-start;gap:16px;padding-bottom:40px}
  .page-hero h1{font-size:28px}
  .crumb{max-width:none;text-align:left;padding-bottom:0}

  /* ----- TOP ----- */
  .mv{height:100svh;min-height:560px}
  .atsu1{font-size:72px}
  .catch1{font-size:20px;margin-top:24px}
  .biz1{font-size:12px;letter-spacing:.05em;margin-top:16px;padding:0 24px}
  .sub1{font-size:11px}
  .philo{padding-bottom:80px}
  .philo .calligraphy{padding-top:24px}
  .philo .h2 br,.c-philo .h2 br{display:none} /* 見出しの改行をなしに */
  .txt1{padding-top:24px}
  .str{padding:80px 0}
  .str .items{grid-template-columns:1fr;gap:48px;margin-top:48px}
  .str .item:nth-child(2),.str .item:nth-child(3){margin-top:0}
  .str .item .ph{height:240px}
  .mat{padding-top:80px}
  .mat .head-c{margin-bottom:40px}
  .mat .band{margin:0 24px;grid-template-columns:1fr;gap:8px}
  .mat .band .card:nth-child(1),.mat .band .card:nth-child(2){grid-column:auto;height:280px}
  .mat .band .card:nth-child(n+3){grid-column:auto;height:240px}
  .mat .band .body,.mat .band .card:nth-child(n+3) .body{padding:24px}
  .others2{padding:40px 24px 80px}
  .craft{padding:80px 0}
  .finish{grid-template-columns:repeat(2,1fr);margin-top:40px}
  .finish .cell{height:200px}
  .finish .cell p{left:16px;top:16px;font-size:16px}
  .works{padding:80px 0}
  .works .vh{font-size:24px}
  .mosaic2{grid-template-columns:repeat(2,1fr);grid-template-rows:none;margin-right:0}
  .mosaic2 .ph{grid-column:auto;grid-row:auto;aspect-ratio:1/1}
  .latest{margin-top:48px}
  .latest .cards{grid-template-columns:1fr;gap:40px}
  .culture{padding:80px 0}
  .culture .h2{margin-bottom:40px}
  .culture .grid{grid-template-columns:1fr;gap:48px} /* スマホは縦並び */
  .culture .big .ph{margin-left:var(--bleed)} /* 左の写真は画面端まで */
  .culture .small .ph{height:240px;aspect-ratio:auto}
  .news{padding:64px 0}
  .news ul.list li a{grid-template-columns:auto auto 1fr;gap:8px 16px;padding:20px 0;font-size:14px}
  .news ul.list li a .ttl{grid-column:1/-1}
  .news ul.list li a > span:last-child{display:none} /* 矢印 */
  .news .cat{padding:0 8px}
  .cta1{padding:80px 0}
  footer{padding:56px 0 24px}
  footer .grid{grid-template-columns:1fr;gap:32px;text-align:center} /* ロゴ・連絡先・メニューを中央に */
  footer .grid > div:first-child{grid-column:auto}
  footer .bottom{flex-direction:column;align-items:center;gap:8px;margin-top:48px} /* コピーライト・ページトップへも中央に */

  /* ----- 会社概要 ----- */
  .c-philo .atsu img{width:240px}
  .belief li{grid-template-columns:48px 1fr;padding:20px 0}
  .belief .n,.belief h3{font-size:20px}
  .belief li > div p{font-size:14px}
  .c-msg .sign{flex-wrap:wrap;gap:8px 16px;margin-top:40px}
  .c-msg .sign img.sig{width:144px}
  .profile .row{grid-template-columns:1fr;padding:20px 0}
  .profile dd{font-size:14px}
  .access h3{font-size:20px}

  /* ----- 一覧・詳細 ----- */
  .filter{gap:8px;margin-bottom:40px}
  .works-archive .latest .cards{grid-template-columns:1fr;row-gap:40px}
  .w-photos .subs{grid-template-columns:repeat(2,1fr);gap:8px;margin-top:8px}
  .w-spec .row{grid-template-columns:88px 1fr}
  .back{margin-top:56px}
  .entry{font-size:14px}
  .entry h2{font-size:20px}
  .entry h3{font-size:16px}
  .entry th{width:96px}

  /* ----- お問い合わせ ----- */
  .contact-intro{margin-bottom:48px}
  .contact-intro .tel .serif{display:block;margin:4px 0 0}
  .form .row{grid-template-columns:1fr;gap:8px;padding:20px 0}
  .form dt{padding-top:0}
  .pp-block{margin-top:40px}
  .pp-scroll{height:280px;padding:24px 20px}
  .submit input[type="submit"]{width:100%;max-width:320px;padding:16px 24px}
  .contact-thanks .h2{font-size:24px}

  /* ----- プライバシーポリシー ----- */
  .pp-text{font-size:14px}
  .pp-ttl{font-size:20px}
  .pp-text h3{margin-top:40px}

  /* ----- 私たちの強み ----- */
  .s-strength::before{background-size:160% auto}
  .s-strength .str-list li{grid-template-columns:1fr;gap:24px;padding:32px 0}
  .s-strength .str-list .n,.s-strength .str-list h3{font-size:20px}
  .s-strength .points dt{font-size:15px}
  .s-strength .points dd{font-size:14px}

  /* ----- 企業文化・社会貢献 ----- */
  .calli-row{flex-direction:column} /* 縦に1枚ずつ */
  .social-item{grid-template-columns:1fr;gap:24px;padding:40px 0}
  .social-item .img.is-w320 img{width:100%;max-width:320px}
  .social-item h3{font-size:20px;margin:12px 0 16px}
  .social-item p{font-size:14px}

  /* ----- 製品・加工技術 ----- */
  .sub-h{font-size:20px;margin-bottom:32px}
  .sub-h ~ .sub-h,.mat-grid + .sub-h{margin-top:64px}
  .mat-grid{grid-template-columns:1fr;gap:40px}
  .mat-item,.mat-item:nth-child(-n+2){grid-column:auto}
  .mat-item h4,.other-item h4{font-size:20px}
  .other-item{padding-bottom:40px;margin-bottom:40px}
  .other-item .imgs{gap:8px}
  .other-item .catch{font-size:16px}
  .other-item p{font-size:14px}
  .prd-items{grid-template-columns:repeat(2,1fr);gap:16px 8px}
  .others-thumbs{gap:8px;margin-top:32px}
  .others-thumbs li{flex:1;width:auto}
  .fin-grid{grid-template-columns:1fr;gap:40px}
  .fin-item h4{font-size:18px}
}

/* ログイン中の管理バー（782px以下は高さ46px） */
@media (max-width: 782px){
  .admin-bar header{top:46px}
}
