/*
Theme Name: kii's portfolio
Theme URI: https://webkeys.site/
Author: kii
Description: Shopify構築者ポートフォリオサイト用オリジナルテーマ。
Version: 1.0
Requires PHP: 7.4
Text Domain: kii-portfolio
*/

:root {
  --font-serif: "Hiragino Mincho ProN", "YuMincho", "Yu Mincho", "Noto Serif JP", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --content-w: 1180px;
  --accent-ink: #17140f;
}

/* --bg matches the plain wall color in the hero photo (assets/img/hero-laptop.jpg) as it
   actually renders on screen (sampled from a browser screenshot, not the raw file — the
   JPEG's embedded color profile made a naive file read read ~15% too dark and gray). */
:root,
:root[data-theme="light"] {
  --bg: #f2efe4;
  --bg-soft: #e8e3d3;
  --surface: #f8f6ee;
  --text: #17140f;
  --text-mute: #6e695c;
  --accent: #f2d675;
  --accent-hover: #eac95a;
  --accent-strong: #785800;
  --accent-soft: #f0e9d0;
  --border: #ddd6c2;
}
/* dark mode: a warm charcoal (not pure black) so long-form reading stays comfortable */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1a15; --bg-soft: #24211b; --surface: #211e18;
    --text: #eee7d8; --text-mute: #9a937f;
    --accent: #f0d778; --accent-hover: #f6e29c; --accent-strong: #f0d778; --accent-soft: #332c17; --border: #33301f;
  }
}
:root[data-theme="dark"] {
  --bg: #1c1a15; --bg-soft: #24211b; --surface: #211e18;
  --text: #eee7d8; --text-mute: #9a937f;
  --accent: #f0d778; --accent-hover: #f6e29c; --accent-strong: #f0d778; --accent-soft: #332c17; --border: #33301f;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg); color: var(--text); font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  transition: background .25s ease, color .25s ease;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

a { color: inherit; }
:focus-visible { outline: 1px solid var(--accent-strong); outline-offset: 3px; }

img { max-width: 100%; }

/* ---- shared utility classes (deliberately outside the BEM block/element hierarchy —
   reused as-is across many unrelated blocks, e.g. .wrap on nav/hero/every section,
   .eyebrow on hero/section-head/about, .btn on hero/work-detail, .plate on about/work) ---- */
.wrap { max-width: var(--content-w); margin: 0 auto; padding: 0 40px; }
@media (max-width: 640px) { .wrap { padding: 0 22px; } }

.eyebrow {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--text-mute); margin: 0 0 18px;
}

h1, h2, h3 { text-wrap: balance; margin: 0; font-weight: 400; }

.reveal { animation: rise .8s cubic-bezier(.16,1,.3,1) both; }
.reveal--d1 { animation-delay: .08s; } .reveal--d2 { animation-delay: .16s; } .reveal--d3 { animation-delay: .24s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

.plate {
  position: relative; overflow: hidden; border: 1px solid var(--border);
  background:
    radial-gradient(130% 150% at 15% -10%, var(--accent-soft), transparent 55%),
    radial-gradient(120% 140% at 105% 115%, var(--bg-soft), transparent 60%),
    var(--surface);
}
.plate img { position: static; width: 100%; height: auto; display: block; }

.arrow { display: inline-block; transition: transform .2s ease; }
.arrow--left { }

.btn {
  display: inline-flex; align-items: center; gap: 10px; text-decoration: none;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .08em; font-weight: 700;
  padding: 15px 26px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  cursor: pointer;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn:hover .arrow, .work__btn:hover .arrow, .link-arrow:hover .arrow, .works__slider-btn:hover .arrow {
  transform: translateX(4px);
}
.link-arrow:hover .arrow--left, .works__slider-btn:hover .arrow--left { transform: translateX(-4px); }

.link-arrow {
  text-decoration: none; font-family: var(--font-mono); font-size: 12px; letter-spacing: .06em; color: var(--text-mute);
  border-bottom: 1px solid var(--border); padding-bottom: 4px;
}
.link-arrow:hover { color: var(--text); border-color: var(--accent-strong); }

.field-label {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-mute); margin: 0 0 8px;
}

/* small note under a "サイトを見る" button showing a demo store's password —
   identical in the work card and the work-detail page, so it's kept as a shared
   component rather than duplicated inside both .work and .work-detail */
.password-note { margin: 0; font-family: var(--font-mono); font-size: 11px; letter-spacing: .04em; color: var(--text-mute); }
.password-note__value { font-size: 13px; color: var(--text); }

/* ---- nav block ---- */
.nav { position: sticky; top: 0; z-index: 20; padding-block: 20px; background: var(--bg); border-bottom: 1px solid var(--border); }
.nav .wrap { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 14px 24px; }
.nav__logo { display: inline-flex; align-items: center; font-family: var(--font-mono); font-weight: 700; font-size: 15px; letter-spacing: .02em; text-decoration: none; color: inherit; }
.nav__logo::before { content: ""; display: inline-block; width: 8px; height: 8px; background: var(--accent); margin-right: 9px; }
.nav__links { display: flex; flex-wrap: wrap; gap: 12px 24px; list-style: none; margin: 0; padding: 0; }
.nav__link {
  text-decoration: none; font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-mute); border-bottom: 1px solid transparent; padding-bottom: 3px;
}
.nav__link:hover { color: var(--text); border-color: var(--accent-strong); }

/* hamburger toggle — hidden on desktop, only shown once the menu goes off-canvas */
.nav__toggle {
  display: none; position: relative; z-index: 20;
  width: 32px; height: 32px; padding: 0; border: none; background: none; cursor: pointer;
}
.nav__toggle-bar {
  display: block; position: absolute; left: 3px; right: 3px; height: 2px; background: var(--text);
  transition: transform .7s cubic-bezier(.16,1,.3,1), opacity .5s ease .1s, top .7s cubic-bezier(.16,1,.3,1);
}
.nav__toggle-bar:nth-child(1) { top: 10px; }
.nav__toggle-bar:nth-child(2) { top: 16px; }
.nav__toggle-bar:nth-child(3) { top: 22px; }
.nav__toggle.is-active .nav__toggle-bar:nth-child(1) { top: 16px; transform: rotate(945deg); }
.nav__toggle.is-active .nav__toggle-bar:nth-child(2) { opacity: 0; transform: rotate(720deg); }
.nav__toggle.is-active .nav__toggle-bar:nth-child(3) { top: 16px; transform: rotate(-945deg); }

.nav__overlay {
  position: fixed; inset: 0; z-index: 14; background: rgba(23,20,15,.32);
  opacity: 0; pointer-events: none; transition: opacity .3s ease;
}
.nav__overlay.is-active { opacity: 1; pointer-events: auto; }

@media (max-width: 768px) {
  .nav__toggle { display: block; }
  .nav__links {
    position: fixed; top: 0; right: 0; z-index: 15; height: 100vh; width: min(78vw, 320px);
    flex-direction: column; flex-wrap: nowrap; align-items: flex-start; gap: 26px;
    margin: 0; padding: 100px 36px 40px; background: var(--bg);
    box-shadow: -12px 0 32px rgba(23,20,15,.12);
    transform: translateX(100%); transition: transform .4s cubic-bezier(.16,1,.3,1);
    overflow-y: auto;
  }
  .nav__links.is-active { transform: translateX(0); }
  .nav__link { font-size: 12.5px; }
}

section { padding: 128px 0; position: relative; }
section + section { border-top: 1px solid var(--border); }
@media (max-width: 780px) { section { padding: 88px 0; } }
@media (max-width: 480px) { section { padding: 64px 0; } }

/* ---- section-head block (repeated at the top of every content section) ---- */
.section-head { margin-bottom: 64px; }
@media (max-width: 480px) { .section-head { margin-bottom: 44px; } }
.section-head__title { font-family: var(--font-serif); font-size: clamp(30px, 3.6vw, 42px); letter-spacing: .01em; }
.section-head__lead { color: var(--text-mute); font-size: 14.5px; line-height: 2; margin: 20px 0 0; }

/* ---- hero block ---- */
.hero__banner {
  position: relative; width: 100vw; margin-left: calc(50% - 50vw);
  aspect-ratio: 2.15 / 1; min-height: 460px; overflow: hidden;
  /* pin the palette to the light set: this sits on a fixed-color photo, not the page's own theme */
  --text: #17140f; --text-mute: #6e695c; --border: #d6d0c0;
  --accent: #f2d675; --accent-hover: #eac95a; --accent-strong: #785800; --accent-ink: #17140f;
}
/* keep the box at least as wide (relative to height) as the source photo (~1.5:1),
   so object-fit:cover only ever trims top/bottom — never the sides. A narrower
   ratio here would crop into the laptop screen on the right and misalign the
   composited screenshot from its bezel. */
@media (max-width: 700px) { .hero__banner { aspect-ratio: 1.55 / 1; min-height: 0; } }
.hero__image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 65%; display: block; }
.hero__scrim {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(245,241,230,.94) 0%, rgba(245,241,230,.8) 34%, rgba(245,241,230,.2) 60%, rgba(245,241,230,0) 74%);
}
.hero__content {
  position: relative; z-index: 2; height: 100%; display: flex; flex-direction: column; justify-content: center;
  transform: translateY(-32px);
}
.hero__title {
  font-family: var(--font-serif); font-size: clamp(32px, 4.6vw, 56px); line-height: 1.42; letter-spacing: .01em; color: var(--text);
  text-wrap: balance;
}
.hero__title em {
  font-style: normal; color: var(--accent-ink); white-space: nowrap;
  background-image: linear-gradient(transparent 58%, var(--accent) 58%);
  padding: 0 .08em; box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
.hero__lead { font-size: 15px; line-height: 2; color: var(--text-mute); margin: 22px 0 34px; max-width: 50ch; }
.hero__cta-row { display: flex; align-items: center; flex-wrap: wrap; gap: 18px 32px; }
@media (max-width: 767px) { .hero__cta-row .btn { padding: 10px 15px; } }
@media (max-width: 768px) {
  .hero__content { padding: 24px 30px; transform: none; }
  .hero__content .eyebrow { margin-bottom: 10px; }
  .hero__title { font-size: clamp(24px, 6vw, 32px); line-height: 1.35; }
  /* the full description doesn't fit next to the photo at this width without
     forcing the box taller than the safe (~1.5:1) crop ratio — drop it here,
     the same copy is still readable in the Service section below */
  .hero__lead { display: none; }
  .hero__cta-row { margin-top: 18px; }
  /* a narrow box needs the readable panel to cover most of the width, not just the left third */
  .hero__scrim {
    background: linear-gradient(90deg, rgba(245,241,230,.96) 0%, rgba(245,241,230,.9) 62%, rgba(245,241,230,.35) 85%, rgba(245,241,230,0) 100%);
  }
}

/* ---- works block (a category group: title + grid or slider of .work cards) ---- */
.works + .works { margin-top: 72px; }
.works__title {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-mute); margin: 0 0 32px; padding-bottom: 14px; border-bottom: 1px solid var(--border);
}
.works__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 56px 40px; }
/* grid items default to min-width:auto, which respects the nowrap title's full
   unshrunk text width and expands the track to fit it — min-width:0 lets the
   track follow the 1fr track size instead, so the title's own wrap/shrink handling
   is what deals with overflow, not the grid item itself */
.works__grid > .work { min-width: 0; }
@media (max-width: 768px) { .works__grid { grid-template-columns: 1fr; } }

/* 4件以上のグループは横並び3つ+スライダー表示に切り替わる（inc/helpers.php参照） */
/* side padding reserves a gutter for the arrows so they sit beside the photos, never on top of them */
.works__slider { position: relative; padding: 0 15px; }
@media (min-width: 621px) { .works__slider { padding: 0 35px; } }
@media (min-width: 768px) { .works__slider { padding: 0 30px; } }
@media (min-width: 901px) { .works__slider { padding: 0 35px; } }
.works__slider-track {
  display: flex; gap: 40px; margin: 0 -1px; padding: 1px 1px 8px;
  overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.works__slider-track::-webkit-scrollbar { display: none; }
.works__slider-track > .work {
  flex: 0 0 calc((100% - 80px) / 3); min-width: 200px; scroll-snap-align: start;
}
/* a peeking (partially cut off) card shows only its photo; text appears once
   it scrolls fully into view (see the IntersectionObserver in works-slider.js) */
.works__slider-track > .work:not(.is-fully-visible) .work__body { visibility: hidden; }
@media (max-width: 900px) { .works__slider-track > .work { flex-basis: calc((100% - 40px) / 2); } }
@media (max-width: 768px) {
  .works__slider-track { gap: 30px; }
  .works__slider-track > .work { flex-basis: 90%; }
}
@media (max-width: 570px) { .works__slider-track { gap: 18px; } }

/* prev/next sit in the slider's side gutters, vertically centered on the photo
   (its height is set by JS since each work photo has its own natural aspect ratio) */
.works__slider-btn {
  position: absolute; top: 90px; transform: translateY(-50%); z-index: 3;
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  font-family: var(--font-mono); font-size: 14px; cursor: pointer;
}
.works__slider-btn[data-slider-prev] { left: 0; }
.works__slider-btn[data-slider-next] { right: 0; }
.works__slider-btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
@media (max-width: 620px) {
  .works__slider-btn { width: 30px; height: 30px; font-size: 12px; }
}
.works__slider-btn:disabled { opacity: .35; cursor: default; }
.works__slider-btn:disabled:hover { background: var(--accent); border-color: var(--accent); }

/* ---- work block (a single card — used inside .works__grid or .works__slider-track) ---- */
.work__media { overflow: hidden; margin-bottom: 24px; display: block; }
.work__media .plate { aspect-ratio: 11 / 6; transition: transform .6s cubic-bezier(.16,1,.3,1); }
.work__media .plate img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.work__media:hover .plate { transform: scale(1.035); }
.work__title {
  font-family: var(--font-serif); font-size: 18px; margin-bottom: 14px;
  line-height: 1.4;
}
.work__tasks {
  margin: 0 0 20px; padding: 0; list-style: none;
  display: flex; flex-direction: column; gap: 6px;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .02em; color: var(--text-mute);
}
.work__tasks li { padding-left: 1.1em; position: relative; }
.work__tasks li::before { content: "―"; position: absolute; left: 0; color: var(--accent-strong); }
.works__grid .work__title { font-size: clamp(20px, 2.2vw, 24px); }
.work__title-main { white-space: nowrap; }
.work__body p { font-size: 14px; line-height: 2; color: var(--text-mute); margin: 0 0 22px; }
.work__cta { display: flex; flex-direction: column; align-items: center; gap: 12px; }

/* work card / detail page CTAs — real buttons, not just underlined text, so the
   available action (and whether it leaves the site) reads at a glance */
.work__btn {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .06em; font-weight: 400;
  padding: 11px 18px; border: 1px solid var(--border); color: var(--text-mute);
}
.work__btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }

/* ---- field-row block (a "label + value" pair — used for 使用技術/制作期間 on the
   work-detail page) ---- */
.field-row { margin-bottom: 28px; padding-top: 22px; }
.field-row__value { margin: 0; font-size: 13.5px; line-height: 1.8; color: var(--text); }

/* ---- work-detail block (single-work.php) ---- */
.work-detail__overview { font-size: 15px; line-height: 2; color: var(--text-mute); margin: 0 0 40px; }
.work-detail__tasks, .work-detail__highlights { margin-bottom: 28px; padding-top: 22px; }
.work-detail__list { margin: 0; padding-left: 1.2em; font-size: 13.5px; line-height: 1.9; color: var(--text); }
.work-detail__list li { margin-bottom: 6px; }

/* a thin rule draws itself in (left to right) as each field scrolls into view,
   drawing the eye to 使用技術/対応項目/制作期間/主なカスタマイズポイント on the
   detail page — see the IntersectionObserver in assets/js/line-reveal.js */
.line-reveal { position: relative; }
.line-reveal::before {
  content: ""; position: absolute; top: 0; left: 0; height: 1px; width: 100%;
  background: var(--border); transform: scaleX(0); transform-origin: left;
  transition: transform .8s cubic-bezier(.16,1,.3,1);
}
.line-reveal.is-visible::before { transform: scaleX(1); }
.work-detail__cta { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 40px 0; }
.work-detail__note {
  display: inline-flex; align-items: center; font-family: var(--font-mono); font-size: 11px;
  letter-spacing: .04em; color: var(--text-mute); padding: 11px 18px; border: 1px dashed var(--border);
}
.work-detail__back { text-align: center; padding-top: 32px; border-top: 1px solid var(--border); }

/* ---- skills block ---- */
.skills-list { padding: 30px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.skills-list__items { margin: 0; font-size: 15.5px; line-height: 2.1; color: var(--text); }
.skills-list__item {
  font-style: normal; color: var(--accent-ink);
  background-image: linear-gradient(transparent 62%, var(--accent) 62%);
  padding: 0 .05em; box-decoration-break: clone; -webkit-box-decoration-break: clone;
}

/* ---- service block ---- */
.service__row {
  display: flex; justify-content: space-between; align-items: center; gap: 24px;
  padding: 28px 0; border-top: 1px solid var(--border);
}
.service__row:last-child { border-bottom: 1px solid var(--border); }
.service__row--main { padding: 40px 0; }
.service__row--main .service__row-name { font-family: var(--font-serif); color: var(--accent-strong); }
.service__row-name { font-size: 20px; }
.service__row-meta { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-mute); letter-spacing: .04em; text-align: right; flex: none; line-height: 1.9; }
.service__row--main .service__row-meta { max-width: 430px; }
@media (max-width: 900px) {
  .service__row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .service__row-meta, .service__row--main .service__row-meta { text-align: left; max-width: none; }
}

/* ---- flow block ---- */
.flow__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 40px; }
@media (max-width: 900px) { .flow__grid { grid-template-columns: 1fr 1fr; gap: 40px 32px; } }
@media (max-width: 520px) { .flow__grid { grid-template-columns: 1fr; gap: 36px; } }
.flow__step { padding-top: 20px; border-top: 1px solid var(--border); }
.flow__step-number { font-family: var(--font-mono); font-size: 26px; color: var(--accent-strong); letter-spacing: .02em; margin: 0 0 18px; }
.flow__step-title { font-family: var(--font-serif); font-size: 19px; margin: 0 0 12px; }
.flow__step-desc { font-size: 13.5px; line-height: 1.9; color: var(--text-mute); margin: 0; }

/* ---- about block ---- */
.about .wrap { display: grid; grid-template-columns: .72fr 1.28fr; gap: 64px; }
@media (max-width: 780px) { .about .wrap { grid-template-columns: 1fr; } }
.about__body p { font-size: 15px; line-height: 2.05; color: var(--text-mute); margin: 0 0 20px; }
.about__body strong { color: var(--text); font-weight: 400; }
.about__quote { font-family: var(--font-serif); font-style: italic; font-size: 21px; color: var(--text); display: block; margin-bottom: 26px; line-height: 1.7; }

/* ---- contact-field block (the custom Contact Form 7 field markup — see the
   form's own "フォーム" tab in wp-admin, not a PHP template in this theme) ---- */
.contact-field { margin-bottom: 30px; }
.contact-field label {
  display: block; font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em;
  color: var(--text-mute); margin-bottom: 10px;
}
.contact-field__required {
  display: inline-block; margin-left: 6px; padding: 1px 7px;
  font-size: 10px; letter-spacing: .04em; color: var(--accent-ink);
  background: var(--accent); border-radius: 2px; vertical-align: middle;
}
.contact-field input[type="text"], .contact-field input[type="email"], .contact-field input[type="tel"], .contact-field textarea {
  width: 100%; font: inherit; font-size: 15px; padding: 10px 2px; color: var(--text);
  background: transparent; border: none; border-bottom: 1px solid var(--border); border-radius: 0;
}
.contact-field input::placeholder, .contact-field textarea::placeholder { color: var(--text-mute); opacity: .55; }
.contact-field input:focus, .contact-field textarea:focus { outline: none; border-color: var(--accent-strong); }
.contact-field textarea { resize: vertical; min-height: 100px; }

/* Contact Form 7's own classes (wpcf7-*) are generated by the plugin, not this
   theme, so they're styled by class/tag selector rather than a BEM block */
.wpcf7-form p { margin: 0 0 30px; }
.wpcf7-form label { display: block; font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; color: var(--text-mute); margin-bottom: 10px; }
.wpcf7-form input[type="text"], .wpcf7-form input[type="email"], .wpcf7-form textarea {
  width: 100%; font: inherit; font-size: 15px; padding: 10px 2px; color: var(--text);
  background: transparent; border: none; border-bottom: 1px solid var(--border); border-radius: 0;
}
.wpcf7-form input:focus, .wpcf7-form textarea:focus { outline: none; border-color: var(--accent-strong); }
.wpcf7-form textarea { resize: vertical; min-height: 100px; }
.wpcf7-spinner { display: none; }
.wpcf7-not-valid-tip { color: #b03a2e; font-size: 12px; margin-top: 6px; }
.wpcf7-response-output { font-family: var(--font-mono); font-size: 12px; border-radius: 0 !important; margin: 24px 0 0 !important; }

/* ---- site-footer block ---- */
.site-footer { padding: 40px 0 72px; }
.site-footer .wrap { display: flex; justify-content: center; font-family: var(--font-mono); font-size: 11px; color: var(--text-mute); letter-spacing: .04em; }
