/* 小田機械 — 企業官網設計稿
   tokens: 工業中性灰 + 品牌橙（取自畫冊），切角斜線為画册品牌母題 */

:root {
  --paper: #f4f5f6;
  --surface: #ffffff;
  --ink: #16181b;
  --graphite: #404650;
  --steel: #7d8590;
  --line: #dfe3e8;
  --brand: #ee6c1b;
  --brand-deep: #b84e0d;
  --brand-tint: #fdeee2;
  --sans: "Noto Sans TC", "PingFang TC", "PingFang SC", "Microsoft JhengHei",
    "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  --r: 3px;
  --nav-h: 68px;
  --max: 1240px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  color: var(--graphite);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
button { font: inherit; cursor: pointer; }

h1, h2, h3, h4 {
  margin: 0;
  color: var(--ink);
  font-weight: 800;
  line-height: 1.28;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(2.1rem, 5.2vw, 3.6rem); }
h2 { font-size: clamp(1.6rem, 3.4vw, 2.4rem); }
h3 { font-size: 1.18rem; }
p { margin: 0; }

.container {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: 24px;
}

section { padding-block: clamp(64px, 9vw, 112px); }

.kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 14px;
}
.kicker::before {
  content: "";
  width: 26px;
  height: 3px;
  background: var(--brand);
}

.lead {
  font-size: clamp(1rem, 1.5vw, 1.12rem);
  color: var(--graphite);
  max-width: 62ch;
}

.sec-head { margin-bottom: clamp(28px, 4vw, 48px); }
.sec-head--row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.sec-head--row .lead { max-width: 62ch; }

/* ---------- 斜線母題 ---------- */
.slashes { display: inline-flex; gap: 5px; }
.slashes i {
  width: 9px;
  height: 20px;
  background: var(--brand);
  transform: skewX(-22deg);
}
.slashes i:nth-child(2) { background: var(--brand-deep); }

/* ---------- 按鈕 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 26px;
  border: 1px solid transparent;
  border-radius: var(--r);
  font-weight: 700;
  font-size: 0.96rem;
  transition: transform 0.18s var(--ease), background 0.18s, color 0.18s,
    border-color 0.18s;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-deep); }
.btn--ghost { border-color: var(--line); color: var(--ink); background: var(--surface); }
.btn--ghost:hover { border-color: var(--ink); }
.btn--onInk { border-color: rgba(255, 255, 255, 0.34); color: #fff; }
.btn--onInk:hover { background: rgba(255, 255, 255, 0.12); }
.btn__arrow { width: 18px; height: 10px; background: currentColor;
  clip-path: polygon(0 40%, 72% 40%, 72% 0, 100% 50%, 72% 100%, 72% 60%, 0 60%); }

/* ---------- 導覽 ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
}
.brand { display: flex; align-items: baseline; gap: 9px; }
.brand__cn { font-size: 1.32rem; font-weight: 800; color: var(--ink); letter-spacing: 0.02em; }
.brand__en {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  color: var(--steel);
  text-transform: uppercase;
}
.nav__links { display: flex; align-items: center; gap: 30px; }
.nav__links a {
  position: relative;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--graphite);
  padding-block: 6px;
}
.nav__links a:hover { color: var(--ink); }
.nav__links a.is-active { color: var(--ink); }
.nav__links a.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 3px;
  background: var(--brand);
}
.nav__cta { display: flex; align-items: center; gap: 14px; }
.nav__burger {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  padding: 11px 12px;
}
.nav__burger span { display: block; height: 2px; background: var(--ink); margin-block: 3px; }

@media (max-width: 980px) {
  .nav__burger { display: block; }
  .nav__cta .btn { display: none; }
  .nav__links {
    position: fixed;
    inset: var(--nav-h) 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding: 8px 24px 20px;
    display: none;
  }
  .nav__links a { padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 1.05rem; }
  .nav__links a.is-active::after { display: none; }
  .nav.is-open .nav__links { display: flex; }
  .nav.is-open .nav__cta .btn { display: inline-flex; width: 100%; justify-content: center; }
}

/* ---------- 首頁 Hero ---------- */
.hero {
  position: relative;
  background: var(--surface);
  padding-block: clamp(44px, 6vw, 84px);
  overflow: hidden;
}
.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 64px);
  align-items: center;
}
.hero__title { margin-bottom: 20px; }
.hero__title em { font-style: normal; color: var(--brand); }
.hero__sub { font-size: clamp(1rem, 1.6vw, 1.15rem); max-width: 42ch; margin-bottom: 30px; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 14px; }
.hero__media { position: relative; }
.hero__frame {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--ink);
  clip-path: polygon(14% 0, 100% 0, 100% 100%, 0 100%, 0 22%);
  overflow: hidden;
}
.hero__frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.08);
  transform: scale(1.02);
  transition: transform 1.2s var(--ease);
}
.hero__frame:hover img { transform: scale(1.07); }
.hero__frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, rgba(238, 108, 27, 0.28), transparent 55%);
  mix-blend-mode: multiply;
}
.hero__mark {
  position: absolute;
  left: -22px;
  bottom: 26px;
  background: var(--brand);
  color: #fff;
  padding: 12px 20px 12px 30px;
  font-weight: 700;
  font-size: 0.95rem;
  clip-path: polygon(8px 0, 100% 0, 100% 100%, 0 100%);
}
.hero__mark span { font-family: var(--mono); font-size: 1.5rem; display: block; line-height: 1.1; }
@media (max-width: 900px) {
  .hero__grid { grid-template-columns: 1fr; }
  .hero__mark { left: 0; }
}

/* ---------- 數據帶 ---------- */
.stats { background: var(--ink); color: #fff; padding-block: 34px; }
.stats__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.stat__n {
  font-family: var(--mono);
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
}
.stat__n b { color: var(--brand); font-weight: 700; }
.stat__l { font-size: 0.86rem; color: #a6adb8; margin-top: 6px; }
@media (max-width: 720px) {
  .stats__grid { grid-template-columns: repeat(2, 1fr); gap: 26px; }
}

/* ---------- 產品 bento ---------- */
.bento {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-rows: 210px;
  gap: 14px;
}
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 22px;
  isolation: isolate;
  transition: border-color 0.25s, transform 0.25s var(--ease);
}
.tile:hover { border-color: var(--brand); transform: translateY(-3px); }
.tile__img {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s var(--ease);
}
.tile:hover .tile__img { transform: scale(1.05); }
.tile__scrim {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(to top, rgba(12, 14, 16, 0.88) 0%, rgba(12, 14, 16, 0.42) 45%, rgba(12, 14, 16, 0.05) 100%);
}
.tile--photo { color: #fff; }
.tile--photo h3 { color: #fff; }
.tile--photo p { color: rgba(255, 255, 255, 0.78); }
.tile--light { justify-content: flex-end; }
.tile--light .tile__img { object-fit: contain; padding: 18px 18px 0; inset: 0 0 auto 0; height: 58%; }
.tile__code {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--brand);
  align-self: flex-start;
  background: var(--brand-tint);
  border: 1px solid #f7d6bd;
  padding: 3px 9px;
  border-radius: 2px;
}
.tile--photo .tile__code { background: rgba(238, 108, 27, 0.92); color: #fff; border-color: transparent; }
.tile p { font-size: 0.9rem; margin-top: 6px; max-width: 40ch; }
.tile__models { font-family: var(--mono); font-size: 0.78rem; color: var(--steel); margin-top: 10px; }
.tile--photo .tile__models { color: rgba(255, 255, 255, 0.62); }

.t-a { grid-column: span 5; grid-row: span 2; }
.t-b { grid-column: span 4; grid-row: span 1; }
.t-c { grid-column: span 3; grid-row: span 1; }
.t-d { grid-column: span 3; grid-row: span 1; }
.t-e { grid-column: span 4; grid-row: span 1; }
.t-f { grid-column: span 12; grid-row: span 1; }
@media (max-width: 980px) {
  .bento { grid-template-columns: repeat(6, 1fr); grid-auto-rows: 200px; }
  .t-a { grid-column: span 6; grid-row: span 2; }
  .t-b, .t-c, .t-d, .t-e { grid-column: span 3; }
  .t-f { grid-column: span 6; }
}
@media (max-width: 620px) {
  .bento { grid-template-columns: 1fr; grid-auto-rows: 220px; }
  .t-a, .t-b, .t-c, .t-d, .t-e, .t-f { grid-column: span 1; grid-row: span 1; }
  .t-a { grid-row: span 2; }
}

/* ---------- 深色流程帶 ---------- */
.process { background: var(--ink); color: #fff; }
.process h2 { color: #fff; }
.process .lead { color: #a6adb8; }
.process__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  margin-top: 44px;
}
.step { position: relative; }
.step__img {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #22262b;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 22px 100%, 0 calc(100% - 22px));
}
.step__img img { width: 100%; height: 100%; object-fit: cover; }
.step h3 { color: #fff; margin-top: 20px; display: flex; align-items: center; gap: 10px; }
.step h3 i { width: 8px; height: 18px; background: var(--brand); transform: skewX(-22deg); }
.step p { color: #9aa2ad; font-size: 0.94rem; margin-top: 8px; }
@media (max-width: 860px) { .process__grid { grid-template-columns: 1fr; gap: 36px; } }

/* ---------- 工況橫向滾動 ---------- */
.apps__track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(280px, 340px);
  gap: 18px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 12px;
  scrollbar-width: thin;
}
.app { scroll-snap-align: start; }
.app__img {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--line);
}
.app__img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--ease); }
.app:hover .app__img img { transform: scale(1.05); }
.app figcaption { padding-top: 14px; }
.app h3 { font-size: 1.02rem; }
.app p { font-size: 0.88rem; color: var(--steel); margin-top: 4px; }

/* ---------- 關於 ---------- */
.about { background: var(--surface); }
.about__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(28px, 5vw, 64px);
  align-items: center;
}
.about__list { list-style: none; margin: 26px 0 0; padding: 0; display: grid; gap: 12px; }
.about__list li {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 12px;
  font-size: 0.96rem;
  color: var(--graphite);
}
.about__list li::before {
  content: "";
  width: 8px;
  height: 16px;
  margin-top: 8px;
  background: var(--brand);
  transform: skewX(-22deg);
}
.about__media { position: relative; }
.about__media img { width: 100%; border-radius: var(--r); }
@media (max-width: 900px) { .about__grid { grid-template-columns: 1fr; } }

/* ---------- CTA ---------- */
.cta { background: var(--brand); color: #fff; padding-block: clamp(48px, 6vw, 72px); }
.cta__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) auto;
  gap: 28px;
  align-items: center;
}
.cta h2 { color: #fff; }
.cta p { color: rgba(255, 255, 255, 0.9); margin-top: 10px; max-width: 52ch; }
.cta .btn--ghost { background: #fff; border-color: #fff; color: var(--brand-deep); }
.cta .btn--ghost:hover { background: var(--ink); border-color: var(--ink); color: #fff; }
@media (max-width: 800px) { .cta__grid { grid-template-columns: 1fr; } }

/* ---------- 頁腳 ---------- */
.footer { background: var(--ink); color: #98a0ab; padding-block: 56px 30px; font-size: 0.92rem; }
.footer__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr));
  gap: 32px;
  padding-bottom: 36px;
  border-bottom: 1px solid #2a2f36;
}
.footer h4 { color: #fff; font-size: 0.96rem; margin-bottom: 14px; }
.footer a:hover { color: #fff; }
.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.footer .brand__cn { color: #fff; }
.footer__bottom {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 22px;
  font-size: 0.82rem;
  color: #6d7581;
}
@media (max-width: 860px) { .footer__grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .footer__grid { grid-template-columns: 1fr; } }

/* ---------- 內頁 banner ---------- */
.pagehead { background: var(--surface); border-bottom: 1px solid var(--line); padding-block: clamp(40px, 6vw, 68px); }
.pagehead__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 420px);
  gap: 28px;
  align-items: end;
}
.pagehead h1 { font-size: clamp(1.9rem, 4.2vw, 2.9rem); }
@media (max-width: 860px) { .pagehead__grid { grid-template-columns: 1fr; } }

/* ---------- 產品詳情 ---------- */
.pgroup { border-top: 1px solid var(--line); padding-block: clamp(48px, 6vw, 76px); }
.pgroup:first-of-type { border-top: 0; }
.pgroup__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 48px);
  align-items: start;
}
.pgroup__media { display: grid; gap: 12px; }
.pgroup__media--row { grid-template-columns: repeat(2, 1fr); }
.pgroup__media img {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--surface);
}
.pgroup__media .cut { object-fit: contain; background: var(--surface); }
.jumpnav {
  position: sticky;
  top: var(--nav-h);
  z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 10px 0;
}
.jumpnav a {
  flex: 0 0 auto;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--graphite);
  background: var(--surface);
}
.jumpnav a:hover { border-color: var(--brand); color: var(--brand-deep); }
/* 錨點跳轉時避開置頂導覽與吸附選單 */
.pgroup[id] { scroll-margin-top: calc(var(--nav-h) + 58px); }
@media (max-width: 900px) { .pgroup__head { grid-template-columns: 1fr; } }

/* ---------- 規格表 ---------- */
.spec { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 0.84rem; }
.spec caption {
  text-align: left;
  font-family: var(--sans);
  font-weight: 700;
  color: var(--ink);
  padding-bottom: 10px;
  font-size: 1rem;
}
.spec th, .spec td { padding: 10px 12px; text-align: left; white-space: nowrap; }
.spec thead th {
  background: var(--brand);
  color: #fff;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 0.86rem;
}
.spec thead th:first-child { border-radius: var(--r) 0 0 0; }
.spec thead th:last-child { border-radius: 0 var(--r) 0 0; }
.spec tbody tr:nth-child(even) { background: var(--surface); }
.spec tbody tr:nth-child(odd) { background: #f9fafb; }
.spec tbody th { font-family: var(--sans); font-weight: 600; color: var(--ink); background: #eef0f3 !important; }
.spec td { color: var(--graphite); }
.tablewrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
}
.spechint { font-size: 0.82rem; color: var(--steel); margin-top: 10px; }

/* ---------- 表單 ---------- */
.form {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.field { display: grid; gap: 7px; }
.field--full { grid-column: 1 / -1; }
.field label { font-size: 0.88rem; font-weight: 700; color: var(--ink); }
.field input, .field select, .field textarea {
  font: inherit;
  font-size: 0.96rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 13px 14px;
  width: 100%;
}
.field textarea { min-height: 130px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(238, 108, 27, 0.18);
}
.field small { color: var(--steel); font-size: 0.78rem; }
.field .err { color: #b3261e; font-size: 0.8rem; display: none; }
.field.is-invalid input, .field.is-invalid textarea, .field.is-invalid select { border-color: #b3261e; }
.field.is-invalid .err { display: block; }
@media (max-width: 700px) { .form { grid-template-columns: 1fr; } }

.contactgrid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: clamp(28px, 5vw, 56px);
  align-items: start;
}
@media (max-width: 900px) { .contactgrid { grid-template-columns: 1fr; } }
.infocard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; }
.infocard + .infocard { margin-top: 14px; }
.infocard dt { font-size: 0.82rem; color: var(--steel); font-weight: 600; }
.infocard dd { margin: 4px 0 16px; color: var(--ink); font-weight: 700; font-family: var(--mono); }
.infocard dd:last-child { margin-bottom: 0; }
.infocard dd.todo { color: var(--steel); font-weight: 500; font-style: normal; border-bottom: 1px dashed var(--line); }

/* ---------- 案例 ---------- */
.cases { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.case { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.case__img { aspect-ratio: 16 / 10; overflow: hidden; background: var(--line); }
.case__img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--ease); }
.case:hover .case__img img { transform: scale(1.04); }
.case__body { padding: 20px; }
.case__meta { font-family: var(--mono); font-size: 0.76rem; color: var(--steel); margin-top: 8px; }
@media (max-width: 980px) { .cases { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .cases { grid-template-columns: 1fr; } }

.note {
  border-left: 3px solid var(--brand);
  background: var(--brand-tint);
  padding: 16px 20px;
  font-size: 0.92rem;
  color: #7a4520;
  border-radius: 0 var(--r) var(--r) 0;
}

/* ---------- 動效 ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }
.reveal[data-delay="1"] { transition-delay: 0.08s; }
.reveal[data-delay="2"] { transition-delay: 0.16s; }
.reveal[data-delay="3"] { transition-delay: 0.24s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .tile, .app__img img, .case__img img, .hero__frame img { transition: none; }
  .btn:active { transform: none; }
}

/* 简繁开关 */
.langsw { display: inline-flex; align-self: center; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--surface); }
.langsw a { font-family: var(--mono); font-size: .72rem; letter-spacing: .06em; line-height: 1; padding: 7px 9px; color: var(--steel); text-decoration: none; }
.langsw a + a { border-left: 1px solid var(--line); }
.langsw a:hover { color: var(--ink); }
.langsw a.on { background: var(--ink); color: #fff; }
@media (max-width: 560px) {
  .brand__cn { white-space: nowrap; }
  .brand__en { display: none; }
  .langsw a { padding: 7px 8px; }
}
