html { font-size: 15px; }
@media (min-width: 768px) { html { font-size: 16px; } }

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #fff;
    color: #212529;
}

/* CJK font stacks only where needed (constitution: technical constraints) */
body.lang-zh-Hant { font-family: system-ui, "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", sans-serif; }
body.lang-zh-Hans { font-family: system-ui, "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif; }
body.lang-ja { font-family: system-ui, "Yu Gothic UI", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif; }


.intro { max-width: 46rem; }

.product-card__image {
    display: block;
    aspect-ratio: 1 / 1;
    background: #f8f9fa;
    overflow: hidden;
}
.product-card__image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 1rem;
}
.product-card .card-title a { color: inherit; }
.product-card:hover { box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .08); }

.product-description img { max-width: 100%; height: auto; }

.culture-switcher .nav-link { padding-left: .5rem; padding-right: .5rem; }

.admin-nav .nav-link { border-radius: .375rem; }

/* Product gallery (details page) */
.gallery-main {
    aspect-ratio: 1 / 1;
    background: #f8f9fa;
    overflow: hidden;
}
.gallery-main img { width: 100%; height: 100%; object-fit: contain; padding: 1rem; }
.gallery-thumbs { display: flex; flex-wrap: wrap; gap: .5rem; }
.contact-features li { margin-bottom: .75rem; }
.gallery-thumb {
    width: 4.5rem;
    height: 4.5rem;
    padding: .25rem;
    border: 2px solid #dee2e6;
    border-radius: .375rem;
    background: #fff;
}
.gallery-thumb img { width: 100%; height: 100%; object-fit: contain; }
.gallery-thumb.active, .gallery-thumb:hover { border-color: #0d6efd; }

/* Admin photo manager */
.photo-thumb { aspect-ratio: 1 / 1; background: #f8f9fa; }
.photo-thumb img { width: 100%; height: 100%; object-fit: contain; padding: .5rem; }

/* Text / HTML editor (admin product form) */
.html-editor__visual { overflow-y: auto; max-height: 32rem; }
.html-editor__visual:focus { outline: none; }
.html-editor__visual ul, .html-editor__visual ol { padding-left: 1.5rem; }
.html-editor__visual p { margin-bottom: .5rem; }
.html-editor__tools .btn { min-width: 2.25rem; }

/* Homepage banner: image on the left, company name after it on the right.
   Height, fit and position come from the brand's banner settings (admin → Homepage banner). */
.home-banner {
    background: #f4f6f8;
    border-bottom: 1px solid #e5e7eb;
}
.home-banner__row {
    display: flex;
    align-items: center;
    gap: 1rem 2rem;
    padding-top: 1rem;
    padding-bottom: 1rem;
}
.home-banner img {
    display: block;
    flex: 0 1 auto;
    height: var(--banner-h, 420px);
    width: auto;
    max-width: 65%;
    min-width: 0;
    object-fit: contain;
    /* White/cream areas of the logo image take the strip colour (#f4f6f8), so the image has no visible box.
       brightness(1.02) first lifts near-white (e.g. fujikawa.jpg's 253,252,250) to pure white. */
    filter: brightness(1.02);
    mix-blend-mode: multiply;
}
.home-company { flex: 1 1 auto; min-width: 0; text-align: left; }
.home-company__name {
    margin: 0;
    font-size: clamp(1.25rem, 1rem + 1.2vw, 2rem);
    font-weight: 600;
    letter-spacing: .04em;
    overflow-wrap: anywhere;
}
.home-company__name-en {
    margin: .25rem 0 0;
    font-size: .95rem;
    color: #6c757d;
    letter-spacing: .06em;
}
/* Centred layout (per brand: admin → Homepage banner → Alignment). */
.home-banner__row--center { justify-content: center; }
.home-banner__row--center .home-company { flex: 0 1 auto; } /* hug the text so image + name are centred as a group */
@media (max-width: 767.98px) {
    .home-banner__row { flex-direction: column; align-items: flex-start; }
    .home-banner__row--center { align-items: center; }
    .home-banner__row--center .home-company { text-align: center; }
    .home-banner img { height: calc(var(--banner-h, 420px) * 0.55); max-width: 100%; }
}

/* Homepage application areas (bottom of the home page) */
.home-app__img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: .5rem;
}
.home-app__text {
    margin-top: .9rem;
    color: #495057;
    line-height: 1.7;
    white-space: pre-line; /* keep line breaks typed in the admin area */
}
.home-app-editor__img { aspect-ratio: 1 / 1; object-fit: cover; width: 100%; }

/* Homepage introduction (above the application images) */
.home-intro__text {
    color: #495057;
    line-height: 1.8;
    max-width: 62rem;
    white-space: pre-line; /* single line breaks typed in the admin area */
}

/* Content pages (certification): wide tables scroll inside the page on phones. */
.site-page-body h2 { font-size: 1.25rem; margin-top: 2rem; }
.site-page-body table { display: block; width: max-content; max-width: 100%; overflow-x: auto; }
.site-page-body th, .site-page-body td { min-width: 4.5rem; }

/* AI Consultant page (spec FR-061). Styles for the editable HTML in Content/ai-consultant.html,
   adapted from images/index.html and scoped to .ai-page so they cannot leak into the rest of the site. */
.ai-page {
  --ai-bg: #F3EEE5; --ai-bg-alt: #ECE5D8; --ai-ink: #101010; --ai-muted: #6E6A61; --ai-accent: #307927;
  --ai-line: rgba(16,16,16,.16); --ai-serif: "Fraunces", "Noto Serif TC", serif;
  --ai-ease: cubic-bezier(0.86,0,0.07,1);
  background: var(--ai-bg); color: var(--ai-ink); line-height: 1.75; border-radius: .5rem; overflow: hidden;
}
.ai-page a { color: inherit; text-decoration: none; }
.ai-page ul { padding: 0; margin: 0; }
.ai-page .ai-grn { color: var(--ai-accent); font-weight: 500; }
.ai-page .ai-en { font-size: 11px; letter-spacing: .28em; text-transform: uppercase; color: var(--ai-muted); font-weight: 500; }

.ai-page .ai-hero { min-height: 70vh; display: flex; flex-direction: column; justify-content: flex-end; padding: 8vh 5% 7vh; position: relative; }
.ai-page .ai-ghost {
  position: absolute; top: 50%; right: 2.5%; transform: translateY(-58%); writing-mode: vertical-rl;
  font-family: var(--ai-serif); font-weight: 300; font-size: clamp(44px,4.6vw,74px); line-height: 1; letter-spacing: .14em;
  color: transparent; -webkit-text-stroke: 1px rgba(16,16,16,.16); text-transform: uppercase; pointer-events: none; user-select: none;
}
.ai-page .ai-kicker { display: inline-flex; align-items: center; gap: 12px; font-size: 12px; letter-spacing: .24em; text-transform: uppercase; color: var(--ai-muted); font-weight: 500; margin-bottom: 4vh; }
.ai-page .ai-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ai-accent); animation: ai-pulse 1.8s infinite; flex-shrink: 0; }
@keyframes ai-pulse { 0% { box-shadow: 0 0 0 0 rgba(48,121,39,.45); } 70% { box-shadow: 0 0 0 12px rgba(48,121,39,0); } 100% { box-shadow: 0 0 0 0 rgba(48,121,39,0); } }
.ai-page .ai-title { font-family: var(--ai-serif); font-weight: 400; font-size: clamp(32px,5.6vw,80px); line-height: 1.14; letter-spacing: -.01em; position: relative; z-index: 1; margin: 0; }
.ai-page .ai-row { display: block; animation: ai-rise 1.15s cubic-bezier(.16,1,.3,1) both; }
.ai-page .ai-row + .ai-row { animation-delay: .12s; }
@keyframes ai-rise { from { opacity: 0; transform: translateY(40%); } to { opacity: 1; transform: none; } }
.ai-page .ai-thin { font-weight: 300; color: var(--ai-muted); }
.ai-page .ai-hero-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 5%; margin-top: 6vh; flex-wrap: wrap; }
.ai-page .ai-hero-foot p { max-width: 34em; color: var(--ai-muted); font-size: 15.5px; font-weight: 300; margin: 0; }
.ai-page strong, .ai-page b { color: var(--ai-ink); font-weight: 500; }
.ai-page .ai-cta { font-family: var(--ai-serif); font-size: 20px; font-weight: 500; white-space: nowrap; padding-bottom: 4px; border-bottom: 1px solid currentColor; }
.ai-page .ai-arrow { display: inline-block; transition: transform .5s var(--ai-ease); }
.ai-page .ai-cta:hover .ai-arrow { transform: translateX(8px); }

.ai-page .ai-sec { padding: 10vh 5%; }
.ai-page .ai-head { display: flex; align-items: baseline; gap: 20px; margin-bottom: 6vh; border-bottom: 1px solid var(--ai-line); padding-bottom: 22px; }
.ai-page .ai-idx { font-family: var(--ai-serif); font-size: 13px; color: var(--ai-accent); letter-spacing: .08em; }
.ai-page .ai-head h2 { font-family: var(--ai-serif); font-weight: 400; font-size: clamp(28px,4vw,54px); letter-spacing: -.01em; line-height: 1.1; margin: 0; }
.ai-page .ai-head .ai-en { margin-left: auto; }

.ai-page .ai-about { background: var(--ai-bg-alt); }
.ai-page .ai-about-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 6%; align-items: start; }
.ai-page .ai-statement, .ai-page .ai-lead { font-family: var(--ai-serif); font-weight: 400; font-size: clamp(22px,2.6vw,34px); line-height: 1.45; }
.ai-page .ai-hl { background: linear-gradient(transparent 62%, rgba(48,121,39,.28) 62%); }
.ai-page .ai-about-body p { color: var(--ai-muted); font-weight: 300; margin-bottom: 1.4em; font-size: 15.5px; }
.ai-page .ai-creds { margin-top: 4vh; border-top: 1px solid var(--ai-line); }
.ai-page .ai-creds li { list-style: none; display: flex; align-items: baseline; gap: 18px; padding: 16px 0; border-bottom: 1px solid var(--ai-line); font-size: 14px; }
.ai-page .ai-tag { font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--ai-accent); min-width: 86px; font-weight: 500; }

.ai-page .ai-svc-list { border-top: 1px solid var(--ai-line); }
.ai-page .ai-svc { display: grid; grid-template-columns: 70px 1fr 1.1fr 50px; gap: 3%; align-items: center; padding: 34px 0; border-bottom: 1px solid var(--ai-line); position: relative; transition: padding-left .6s var(--ai-ease), background .6s var(--ai-ease); }
.ai-page .ai-svc:hover { padding-left: 18px; background: rgba(48,121,39,.06); }
.ai-page .ai-no { font-family: var(--ai-serif); font-size: 15px; color: var(--ai-muted); transition: color .4s; }
.ai-page .ai-svc:hover .ai-no { color: var(--ai-accent); }
.ai-page .ai-svc h3 { font-family: var(--ai-serif); font-weight: 500; font-size: clamp(20px,2.2vw,28px); line-height: 1.25; margin: 0; }
.ai-page .ai-svc h3 .ai-en, .ai-page .ai-step h4 .ai-en { display: block; font-size: 10.5px; letter-spacing: .22em; margin-top: 6px; }
.ai-page .ai-svc p { font-size: 14px; color: var(--ai-muted); font-weight: 300; margin: 0; }
.ai-page .ai-arr { justify-self: end; width: 44px; height: 44px; border: 1px solid var(--ai-line); border-radius: 50%; display: grid; place-items: center; transition: background .5s var(--ai-ease), color .5s, transform .5s var(--ai-ease); }
.ai-page .ai-svc:hover .ai-arr { background: var(--ai-accent); border-color: var(--ai-accent); color: var(--ai-bg); transform: rotate(-45deg); }

.ai-page .ai-process { background: var(--ai-ink); color: var(--ai-bg); }
.ai-page .ai-process .ai-head { border-bottom-color: rgba(243,238,229,.2); }
.ai-page .ai-process .ai-en { color: rgba(243,238,229,.55); }
.ai-page .ai-steps { display: grid; grid-template-columns: repeat(4,1fr); border-top: 1px solid rgba(243,238,229,.2); }
.ai-page .ai-step { padding: 34px 22px 50px; border-right: 1px solid rgba(243,238,229,.2); display: flex; flex-direction: column; gap: 14px; }
.ai-page .ai-step:last-child { border-right: none; }
.ai-page .ai-n { font-family: var(--ai-serif); font-size: 44px; font-weight: 300; color: var(--ai-accent); line-height: 1; }
.ai-page .ai-step h4 { font-family: var(--ai-serif); font-size: 20px; font-weight: 500; margin: 0; }
.ai-page .ai-step p { font-size: 13px; color: rgba(243,238,229,.62); font-weight: 300; line-height: 1.8; margin: 0; }

.ai-page .ai-who-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6%; }
.ai-page .ai-who-list { border-top: 1px solid var(--ai-line); }
.ai-page .ai-who-list li { list-style: none; padding: 22px 0; border-bottom: 1px solid var(--ai-line); display: flex; gap: 22px; align-items: baseline; }
.ai-page .ai-tick { font-family: var(--ai-serif); color: var(--ai-accent); font-size: 15px; flex-shrink: 0; }
.ai-page .ai-who-list b { font-size: 16px; }
.ai-page .ai-who-list li div > span { display: block; color: var(--ai-muted); font-size: 13.5px; font-weight: 300; margin-top: 4px; }

.ai-page .ai-contact { background: var(--ai-bg-alt); padding-bottom: 12vh; }
.ai-page .ai-big { font-family: var(--ai-serif); font-weight: 400; font-size: clamp(34px,5.6vw,84px); line-height: 1.1; letter-spacing: -.01em; max-width: 12em; }
.ai-page .ai-contact-row { display: flex; gap: 6%; flex-wrap: wrap; margin-top: 6vh; align-items: center; }
.ai-page .ai-mail { font-family: var(--ai-serif); font-size: clamp(20px,2.6vw,34px); font-weight: 500; border-bottom: 1px solid currentColor; }
.ai-page .ai-note { color: var(--ai-muted); font-size: 14px; font-weight: 300; max-width: 30em; margin: 0; }

@media (max-width: 960px) {
  .ai-page .ai-steps { grid-template-columns: 1fr 1fr; }
  .ai-page .ai-step:nth-child(2) { border-right: none; }
  .ai-page .ai-step { border-bottom: 1px solid rgba(243,238,229,.2); }
}
@media (max-width: 860px) {
  .ai-page .ai-about-grid, .ai-page .ai-who-grid { grid-template-columns: 1fr; gap: 5vh; }
  .ai-page .ai-svc { grid-template-columns: 50px 1fr; }
  .ai-page .ai-svc p { grid-column: 2; }
  .ai-page .ai-arr { display: none; }
}
@media (max-width: 760px) { .ai-page .ai-ghost { display: none; } }
@media (max-width: 560px) {
  .ai-page .ai-head .ai-en { display: none; }
  .ai-page .ai-steps { grid-template-columns: 1fr; }
  .ai-page .ai-step { border-right: none; }
}
@media (prefers-reduced-motion: reduce) {
  .ai-page .ai-row, .ai-page .ai-dot { animation: none; }
}
