/* Melco Precisions — minimal site
   Built to the client's hand-drawn structure: intro block, moving pics strip,
   and a top-right menu opening to Industry / Material / Infra / Intro. */

:root {
  --ink: #14161a;
  --paper: #ffffff;
  --muted: #6a7280;
  --line: #e6e8ec;
  --wash: #f6f7f8;
  --accent: #b4331f;
  --shell: min(1180px, 100% - 48px);
  --step: clamp(72px, 9vw, 132px);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  /* kill the grey flash on tap on iOS/Android */
  -webkit-tap-highlight-color: rgba(180, 51, 31, .12);
  /* honour the notch on landscape iPhones */
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

img { max-width: 100%; display: block; }
a { color: inherit; }

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.02em; line-height: 1.12; }
h1 { font-size: clamp(38px, 6vw, 68px); }
h2 { font-size: clamp(28px, 3.6vw, 42px); }
h3 { font-size: clamp(19px, 1.5vw, 22px); letter-spacing: -0.01em; }
p { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }

.shell { width: var(--shell); margin-inline: auto; }
.section { padding-block: var(--step); }
.section--wash { background: var(--wash); }
.section--line { border-top: 1px solid var(--line); }

.eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 18px;
}
.lede { font-size: clamp(18px, 1.6vw, 21px); color: var(--muted); max-width: 62ch; }
.prose { max-width: 68ch; color: var(--muted); }
.prose strong { color: var(--ink); font-weight: 600; }

/* ── header: logo left, menu button right (per sketch) ─────────────────── */
.head {
  position: sticky; top: 0; z-index: 60;
  background: rgba(255, 255, 255, .88);
  /* Safari needs the prefix — without it iOS gets a see-through header, no blur */
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
/* if blur is unsupported, fall back to an opaque bar rather than see-through */
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .head { background: #fff; }
}
.head__in { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-block: 14px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; flex-shrink: 0; }
.brand img { width: 46px; height: 46px; object-fit: contain; }
.brand__text { display: flex; flex-direction: column; line-height: 1.25; }
.brand__name { font-weight: 700; letter-spacing: -0.02em; font-size: 18px; }
.brand__sub { font-size: 11px; color: var(--muted); letter-spacing: .02em; font-weight: 400; }

/* ── desktop nav ────────────────────────────────────────────────────────── */
.nav { margin-left: auto; }
.nav__list { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 28px; }
.nav__list a {
  text-decoration: none; font-size: 14.5px; font-weight: 500; letter-spacing: -0.01em;
  padding: 6px 0; position: relative; white-space: nowrap; transition: color .18s;
}
.nav__list a::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .2s;
}
.nav__list a:hover { color: var(--accent); }
.nav__list a:hover::after, .nav__list a[aria-current="page"]::after { transform: scaleX(1); }
.nav__list a[aria-current="page"] { color: var(--accent); }

/* ── three-line hamburger — mobile only ─────────────────────────────────── */
.hamburger {
  display: none; flex-direction: column; gap: 5px; padding: 8px;
  background: none; border: 0; cursor: pointer;
}
.hamburger span { display: block; width: 24px; height: 2px; background: var(--ink); border-radius: 2px; }

@media (max-width: 1000px) {
  .nav { display: none; }
  .hamburger { display: flex; }
}
@media (max-width: 560px) {
  .brand__sub { display: none; }
  .brand img { width: 40px; height: 40px; }
  .brand__name { font-size: 16px; }
}

/* menu panel — the four destinations the client drew */
.menu {
  position: fixed; inset: 0; z-index: 70;
  background: var(--paper);
  display: grid; place-items: center;
  /* short screens (landscape phones) must be able to reach the last item */
  overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 72px 24px 32px;
  /* visibility flips instantly on open so focus() lands, and is held until the
     fade-out finishes on close */
  opacity: 0; visibility: hidden;
  transition: opacity .28s ease, visibility 0s linear .28s;
}
.menu[data-open="true"] { opacity: 1; visibility: visible; transition: opacity .28s ease, visibility 0s; }
@media (prefers-reduced-motion: reduce) { .menu { transition: none; } .menu[data-open="true"] { transition: none; } }
.menu__close {
  position: absolute; top: 16px; right: max(24px, calc((100vw - var(--shell)) / 2));
  background: none; border: 1px solid var(--line); border-radius: 999px;
  width: 42px; height: 42px; cursor: pointer; color: inherit; font-size: 20px; line-height: 1;
}
.menu__close:hover { border-color: var(--ink); }
.menu__list { list-style: none; margin: 0; padding: 0; text-align: center; }
.menu__list a {
  display: block; text-decoration: none; padding: 10px 0;
  font-size: clamp(34px, 6vw, 58px); font-weight: 600; letter-spacing: -0.03em;
  transition: color .18s;
}
.menu__list a:hover, .menu__list a[aria-current="page"] { color: var(--accent); }
.menu__meta { margin-top: 44px; text-align: center; font-size: 14px; color: var(--muted); }
.menu__meta a { text-decoration: none; }
.menu__meta a:hover { color: var(--ink); }

/* ── home: intro block ─────────────────────────────────────────────────── */
.intro { padding-block: clamp(64px, 10vw, 128px) clamp(48px, 6vw, 76px); }
.intro h1 { max-width: 17ch; margin-bottom: 26px; }
.intro__grid { display: grid; gap: clamp(28px, 4vw, 56px); grid-template-columns: 1fr; }
@media (min-width: 900px) { .intro__grid { grid-template-columns: 1.05fr .95fr; align-items: end; } }

/* ── home: the moving PICS strip ───────────────────────────────────────── */
.pics { padding-bottom: var(--step); }
.pics__head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.pics__hint { font-size: 13px; color: var(--muted); }
.marquee { position: relative; overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.marquee__track { display: flex; gap: 18px; width: max-content; animation: slide 64s linear infinite; }
.marquee:hover .marquee__track, .marquee:focus-within .marquee__track { animation-play-state: paused; }
@keyframes slide { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .marquee { overflow-x: auto; -webkit-mask-image: none; mask-image: none; }
  .marquee__track { animation: none; }
}

.tile { width: 250px; flex: 0 0 auto; text-decoration: none; display: block; }
.tile__img { position: relative; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 4px; background: var(--wash); }
.tile__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.tile:hover .tile__img img, .tile:focus-visible .tile__img img { transform: scale(1.05); }
.tile__name { margin-top: 12px; font-size: 15px; font-weight: 500; letter-spacing: -0.01em; }
.tile__to { font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.tile:hover .tile__to { color: var(--accent); }

/* ── generic blocks ────────────────────────────────────────────────────── */
.stack { display: grid; gap: clamp(56px, 7vw, 92px); }

.row { display: grid; gap: clamp(24px, 4vw, 52px); align-items: center; }
@media (min-width: 900px) {
  .row { grid-template-columns: 1fr 1fr; }
  .row--flip > .row__media { order: -1; }
}
.row__media { position: relative; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 4px; background: var(--wash); }
.row__media img { width: 100%; height: 100%; object-fit: cover; }

.grid { display: grid; gap: 22px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); }

.card { text-decoration: none; display: block; }
.card__img { position: relative; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 4px; background: var(--wash); margin-bottom: 12px; }
.card__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.card:hover .card__img img { transform: scale(1.05); }
.card__title { font-size: 16px; font-weight: 500; letter-spacing: -0.01em; }
.card__note { font-size: 13.5px; color: var(--muted); }

.mark { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 999px; margin-bottom: 16px; }
.mark svg { width: 21px; height: 21px; color: var(--accent); }

.facts { list-style: none; margin: 26px 0 0; padding: 0; display: grid; gap: 1px; background: var(--line); border-block: 1px solid var(--line); }
.facts li { background: var(--paper); padding: 16px 2px; display: flex; gap: 18px; align-items: baseline; }
.facts b { font-weight: 600; min-width: 118px; }
.facts span { color: var(--muted); font-size: 15.5px; }
/* tap-to-call / tap-to-mail are the most-used links on a phone — give them room */
.facts a { display: inline-block; padding: 5px 0; text-decoration: none; border-bottom: 1px solid var(--line); }
.facts a:hover { border-bottom-color: var(--accent); color: var(--accent); }
.menu__meta a { display: inline-block; padding: 8px 4px; }

.figures { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); }
.figures div { background: var(--paper); padding: 26px 22px; }
.figures dt { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.figures dd { margin: 0; font-size: clamp(24px, 2.4vw, 32px); font-weight: 600; letter-spacing: -0.02em; }

.link {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 26px;
  text-decoration: none; font-weight: 500; font-size: 15px;
  border-bottom: 1px solid var(--line); padding-bottom: 3px;
  transition: border-color .2s, gap .2s, color .2s;
}
.link:hover { border-color: var(--accent); color: var(--accent); gap: 12px; }

/* ── page head ─────────────────────────────────────────────────────────── */
.phead { padding-block: clamp(56px, 8vw, 104px) clamp(32px, 4vw, 52px); }
.phead h1 { max-width: 15ch; margin-bottom: 20px; }

/* ── footer ────────────────────────────────────────────────────────────── */
.foot { border-top: 1px solid var(--line); padding-block: 56px 40px; font-size: 14.5px; }
.foot__grid { display: grid; gap: 32px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .foot__grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .foot__grid { grid-template-columns: 1.6fr 1fr 1fr 1fr; } }
.foot h4 { margin: 0 0 14px; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
/* thumb-sized tap targets on touch screens */
.foot ul a { display: inline-block; padding: 7px 0; }
.foot a { text-decoration: none; color: var(--muted); transition: color .18s; }
.foot a:hover { color: var(--ink); }
.foot address { font-style: normal; color: var(--muted); }
.foot__bar { margin-top: 44px; padding-top: 22px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; color: var(--muted); font-size: 13px; }

/* ── products page: the two head-term cards ─────────────────────────────── */
.prod-hero-grid { display: grid; gap: 22px; grid-template-columns: 1fr; }
@media (min-width: 800px) { .prod-hero-grid { grid-template-columns: 1fr 1fr; } }
.prod-hero {
  display: flex; flex-direction: column; text-decoration: none;
  border: 1px solid var(--line); border-radius: 6px; overflow: hidden;
  transition: border-color .2s, transform .2s;
}
.prod-hero:hover { border-color: var(--accent); transform: translateY(-3px); }
.prod-hero__img { display: block; aspect-ratio: 16 / 10; overflow: hidden; background: var(--wash); }
.prod-hero__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.prod-hero:hover .prod-hero__img img { transform: scale(1.05); }
.prod-hero__body { display: flex; flex-direction: column; padding: 26px 26px 30px; flex: 1; }
.prod-hero__name { font-size: clamp(23px, 2.2vw, 28px); font-weight: 700; letter-spacing: -0.02em; margin-bottom: 10px; }
.prod-hero__sub { color: var(--muted); font-size: 15.5px; line-height: 1.65; margin-bottom: 12px; }
.prod-hero__meta { font-size: 13px; color: var(--muted); padding-top: 12px; border-top: 1px solid var(--line); }
.prod-hero .link { margin-top: auto; align-self: flex-start; }
@media (prefers-reduced-motion: reduce) { .prod-hero, .prod-hero__img img { transition: none; } .prod-hero:hover { transform: none; } .prod-hero:hover .prod-hero__img img { transform: none; } }

/* ── form ──────────────────────────────────────────────────────────────── */
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 7px; }
.field label { font-size: 13px; font-weight: 500; letter-spacing: .01em; }
.field input, .field select, .field textarea {
  font: inherit; font-size: 15px; line-height: 1.5; color: var(--ink);
  background-color: var(--paper); border: 1px solid var(--line); border-radius: 4px;
  padding: 12px 13px; width: 100%; transition: border-color .2s;
  /* iOS otherwise renders its own rounded/inset control and ignores the above */
  -webkit-appearance: none; appearance: none;
}
/* input and select sit side by side — keep them the same height */
.field input, .field select { height: 48px; }
/* the select loses its arrow once appearance is off — draw one back */
.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%236a7280' stroke-width='1.6' d='M1 1.5 6 6.5l5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
  padding-right: 38px;
}
.field textarea { min-height: 132px; resize: vertical; }
/* iOS Safari zooms the page when a focused input is under 16px */
@media (max-width: 820px) { .field input, .field select, .field textarea { font-size: 16px; } }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--ink); }
.field input[aria-invalid="true"], .field textarea[aria-invalid="true"] { border-color: var(--accent); }
.field__err { font-size: 12.5px; color: var(--accent); min-height: 0; }
.form__pair { display: grid; gap: 16px; }
@media (min-width: 620px) { .form__pair { grid-template-columns: 1fr 1fr; } }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.form__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.btn {
  font: inherit; font-size: 15px; font-weight: 500; cursor: pointer;
  border-radius: 999px; padding: 12px 22px; border: 1px solid var(--ink);
  background: var(--ink); color: var(--paper);
  transition: background .2s, color .2s;
}
.btn:hover { background: transparent; color: var(--ink); }
.btn--ghost { background: transparent; color: var(--ink); }
.btn--ghost:hover { background: var(--ink); color: var(--paper); }
.form__note { font-size: 13px; color: var(--muted); }
.form__ok {
  display: none; padding: 13px 15px; border-radius: 4px;
  background: #f0f7f1; border: 1px solid #cfe6d4; color: #1f5130; font-size: 14.5px;
}
.form__ok[data-show="true"] { display: block; }

/* ── blog ──────────────────────────────────────────────────────────────── */
.posts { display: grid; gap: 1px; background: var(--line); border-block: 1px solid var(--line); }
.post-link { background: var(--paper); padding: 30px 2px; text-decoration: none; display: grid; gap: 8px; transition: background .2s; }
.post-link:hover { background: var(--wash); }
.post-link__meta { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.post-link__title { font-size: clamp(21px, 2.2vw, 27px); font-weight: 600; letter-spacing: -0.02em; line-height: 1.22; }
.post-link__sub { color: var(--muted); font-size: 15.5px; max-width: 70ch; }

.article { max-width: 70ch; }
.article h2 { font-size: clamp(23px, 2.4vw, 29px); margin: 46px 0 14px; }
.article h3 { margin: 32px 0 10px; }
.article p, .article li { color: var(--muted); }
.article ul { padding-left: 20px; margin: 0 0 1.1em; display: grid; gap: 7px; }
.article strong { color: var(--ink); font-weight: 600; }
.article__meta { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 16px; }
.article__note {
  margin: 34px 0; padding: 18px 20px; border-left: 2px solid var(--accent);
  background: var(--wash); border-radius: 0 4px 4px 0; font-size: 15.5px; color: var(--muted);
}
.article__note strong { color: var(--ink); }

/* ── alloy composition tables ───────────────────────────────────────────── */
/* 10 columns will never fit a phone — the wrapper scrolls, the page never does */
.table-wrap {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line); border-radius: 6px; background: var(--paper);
}
.spec-table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 860px; }
.spec-table__cap {
  caption-side: top; text-align: left; padding: 16px 18px 14px;
  font-weight: 600; font-size: 14px; color: var(--ink); border-bottom: 1px solid var(--line);
}
.spec-table thead th {
  background: var(--wash); color: var(--muted); text-align: right;
  padding: 11px 14px; font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; white-space: nowrap; border-bottom: 1px solid var(--line);
}
.spec-table thead th:first-child { text-align: left; }
.spec-table tbody th {
  text-align: left; padding: 11px 14px; font-weight: 600; color: var(--ink);
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.spec-table tbody td {
  padding: 11px 14px; text-align: right; color: var(--muted);
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.spec-table tbody tr + tr th, .spec-table tbody tr + tr td { border-top: 1px solid var(--line); }
.spec-table tbody tr:hover th, .spec-table tbody tr:hover td { background: var(--wash); }
@media (max-width: 700px) { .spec-table { font-size: 12.5px; } .spec-table thead th, .spec-table tbody th, .spec-table tbody td { padding: 9px 11px; } }

/* ── floating WhatsApp ──────────────────────────────────────────────────── */
.wa-btn {
  position: fixed; z-index: 900;
  /* clear the home indicator on notched iPhones */
  bottom: calc(26px + env(safe-area-inset-bottom, 0px));
  right: calc(26px + env(safe-area-inset-right, 0px));
  width: 58px; height: 58px; border-radius: 50%;
  background: #25d366; color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 26px rgba(37, 211, 102, .38);
  transition: transform .2s, box-shadow .2s;
}
.wa-btn svg { width: 29px; height: 29px; }
.wa-btn:hover { transform: scale(1.07); box-shadow: 0 12px 32px rgba(37, 211, 102, .5); }
@media (max-width: 560px) {
  .wa-btn {
    width: 52px; height: 52px;
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    right: calc(18px + env(safe-area-inset-right, 0px));
  }
  .wa-btn svg { width: 26px; height: 26px; }
}
@media (prefers-reduced-motion: reduce) { .wa-btn { transition: none; } .wa-btn:hover { transform: none; } }

:where(a, button):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
