/* ==========================================================================
   TOP page — Figma v3 (Page 1 "TOP" 1440 / Page 2 "TOP" 375),
   comps in docs/_design/top/. Mobile first; desktop layout from 1024px unless noted.
   ========================================================================== */

/* --- Hero ---------------------------------------------------------------
   < 1024px (Figma SP 「MV」 / 「TOP - 2/11」): the intro fills the first screen below the
   header and is centered in it; the diagram sits 67px under the button (pulled up by
   --hero-free, set in main.js) and fades in on the first scroll. */
.p-top-hero {
	padding-block: 0 48px;
	text-align: center;
}

.p-top-hero__intro {
	display: flex;
	flex-direction: column;
	justify-content: center;
	min-height: calc(100vh - var(--header-h) - var(--admin-bar-h));
	min-height: calc(100svh - var(--header-h) - var(--admin-bar-h));
}

.p-top-hero__title {
	font-size: var(--fs-display);
	line-height: 1.4;
}

@media (max-width: 767.98px) {
	.p-top-hero__title {
		font-size: clamp(28px, 9.6vw, 36px); /* 36 @375 */
	}
}

.p-top-hero__lead {
	margin-top: var(--space-6);
	font-size: 16px;
	font-weight: 500;
}

.p-top-hero__actions {
	margin-top: var(--space-12);
}

@media (max-width: 1023.98px) {
	.p-top-hero__actions .c-btn {
		min-width: 212px;
	}
}

/* Diagram reveal on first scroll (mobile only; never hidden without JS or with reduced motion) */
@media (max-width: 1023.98px) and (prefers-reduced-motion: no-preference) {
	.js .p-top-hero__diagram {
		opacity: 0;
		transform: translateY(24px);
		transition: opacity 0.6s ease, transform 0.6s ease;
	}

	.js .p-top-hero__diagram.is-visible {
		opacity: 1;
		transform: none;
	}
}

/* Diagram — mobile (335 × 286): Zenworth on top, diagonal arrows, 経営層 / 現場 below,
   each node on a soft white ellipse over the infinity lines. */
.p-top-hero__diagram {
	position: relative;
	display: grid;
	grid-template-columns: 140px 1fr 140px;
	grid-template-rows: 115px 33px 120px;
	row-gap: 9px;
	width: min(335px, 100% - 40px);
	margin: calc(67px - var(--hero-free, 0px)) auto 0;
}

/* <picture> wrappers must not become grid items (the image inside is absolutely positioned) */
.p-top-why__card > picture {
	display: contents;
}

.p-top-hero__infinity {
	position: absolute;
	top: 78px;
	left: 50%;
	width: calc(100% + 1px);
	max-width: none;
	height: auto;
	transform: translateX(-50%);
}

/* Inline SVG: SP artwork below 1024px, PC artwork from 1024px */
.p-top-hero__infinity--pc {
	display: none;
}

@media (min-width: 1024px) {
	.p-top-hero__infinity--sp {
		display: none;
	}

	.p-top-hero__infinity--pc {
		display: block;
	}
}

.p-top-hero__node {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	white-space: nowrap;
}

/* Blurred white ellipse behind the node text (Figma exports, blur included) */
.p-top-hero__node::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: -1;
	width: 180px;
	height: 160px;
	background: url("../../img/top/hero-ellipse-side-sp.svg") center / 100% 100% no-repeat;
	transform: translate(-50%, -50%);
}

.p-top-hero__node--center {
	grid-column: 1 / -1;
	grid-row: 1;
	justify-self: center;
	width: 210px;
}

.p-top-hero__node--center::before {
	width: 250px;
	height: 155px;
	background-image: url("../../img/top/hero-ellipse-center-sp.svg");
}

.p-top-hero__node--mgmt {
	grid-column: 1;
	grid-row: 3;
}

.p-top-hero__node--field {
	grid-column: 3;
	grid-row: 3;
}

.p-top-hero__node-title {
	font-size: 22px;
	font-weight: 700;
}

.p-top-hero__node-text {
	margin-top: 6px;
	font-size: 14px;
	font-weight: 500;
}

.p-top-hero__brand img {
	display: block;
	width: 120px;
	height: auto;
}

.p-top-hero__node--center .p-top-hero__node-text {
	margin-top: 13px;
	font-weight: 700;
	color: var(--c-primary);
}

/* ⇄ arrow pair. The box is the Figma arrow frame; ::before is the exported SVG,
   which overhangs the frame by 1px (sides) and 7.36px (top). */
.p-top-hero__arrow {
	position: relative;
	z-index: 2; /* above the node ellipses */
	grid-column: 1 / -1;
	grid-row: 2;
	place-self: center;
	width: 32px;
	height: 10px;
}

.p-top-hero__arrow::before {
	content: "";
	position: absolute;
	top: -7.364px;
	left: -1px;
	width: 34px;
	height: 30.728px;
	background: url("../../img/top/hero-arrows-sp.svg") 0 0 / 100% 100% no-repeat;
}

/* Mobile: turned into the diagonals ↙↗ (left) and ↖↘ (right) */
.p-top-hero__arrow--left {
	transform: translateX(-73.67px) rotate(120deg) scaleY(-1);
}

.p-top-hero__arrow--right {
	transform: translateX(73.67px) rotate(60deg);
}

@media (min-width: 768px) {
	.p-top-hero__lead {
		font-size: 18px;
	}
}

@media (min-width: 1024px) {
	.p-top-hero {
		padding-block: 64px 28px;
	}

	.p-top-hero__intro {
		display: block;
		min-height: 0;
	}

	.p-top-hero__lead {
		font-size: 20px;
	}

	.p-top-hero__actions {
		margin-top: var(--space-8);
	}

	/* Desktop: nodes placed on the infinity graphic, left → right (positions from Figma) */
	.p-top-hero__diagram {
		display: block;
		width: calc(100% - var(--container-padding) * 2);
		max-width: 1142px;
		aspect-ratio: 1142 / 445;
		margin-top: -4px;
	}

	.p-top-hero__infinity {
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;
		transform: none;
	}

	/* 300px white circle blurred 25px: hides the line crossing behind Zenworth */
	.p-top-hero__diagram::before {
		content: "";
		position: absolute;
		top: 49.2%;
		left: 50.09%;
		z-index: 1;
		width: 26.27%;
		aspect-ratio: 1;
		background-color: var(--c-bg);
		border-radius: 50%;
		filter: blur(25px);
		transform: translate(-50%, -50%);
	}

	.p-top-hero__node,
	.p-top-hero__arrow {
		position: absolute;
		z-index: 2;
		top: 49.2%;
		transform: translate(-50%, -50%);
	}

	.p-top-hero__node::before {
		content: none;
	}

	.p-top-hero__node--mgmt {
		left: 20.05%;
	}

	.p-top-hero__arrow--left {
		left: 34.06%;
	}

	.p-top-hero__node--center {
		left: 50.09%;
		width: auto;
	}

	.p-top-hero__arrow--right {
		left: 66.46%;
	}

	.p-top-hero__node--field {
		left: 80.12%;
	}

	.p-top-hero__arrow {
		width: 74px;
		height: 16px;
	}

	.p-top-hero__arrow::before {
		width: 76px;
		background-image: url("../../img/top/hero-arrows.svg");
	}

	.p-top-hero__node-title {
		font-size: 26px;
	}

	.p-top-hero__node-text {
		margin-top: 10px;
		font-size: 18px;
	}

	.p-top-hero__node--center .p-top-hero__node-text {
		margin-top: 13px;
	}

	.p-top-hero__brand img {
		width: 150px;
	}
}

/* --- CHALLENGES (shared section, assets/css/sections.css): TOP spacing ----
   Comes right after the hero, so less top padding than a regular section. */
.p-challenges {
	padding-top: 48px;
}

.p-challenges .c-section-head {
	margin-bottom: var(--space-6);
}

@media (min-width: 1024px) {
	.p-challenges {
		padding-top: var(--section-space);
	}

	.p-challenges .c-section-head {
		margin-bottom: var(--space-12);
	}
}

/* --- SERVICES (F-31 cards) ---------------------------------------------- */
.p-top-services {
	padding-bottom: var(--space-16);
}

.p-top-services__list {
	display: grid;
	gap: var(--space-4);
}

.p-top-services__card {
	display: grid;
	grid-template-rows: 1fr auto;
	min-height: 228px;
	padding: 24px 30px 28px 32px;
	background-color: var(--c-primary);
	color: var(--c-on-dark);
	text-decoration: none;
	border-radius: var(--radius-md);
}

/* Alternate blue / navy, so added business pages keep the rhythm */
.p-top-services__item:nth-child(even) .p-top-services__card {
	background-color: var(--c-primary-dark);
}

/* Hover (Figma variants): card darkened 20% (blue) / 40% (navy), arrow filled */
.p-top-services__card:hover {
	background-image: linear-gradient(var(--c-shade-hover), var(--c-shade-hover));
}

.p-top-services__item:nth-child(even) .p-top-services__card:hover {
	background-image: linear-gradient(var(--c-shade-hover-strong), var(--c-shade-hover-strong));
}

.p-top-services__card:focus-visible {
	outline-offset: 4px;
}

.p-top-services__title {
	display: block;
	font-size: 36px;
	font-weight: 400;
}

.p-top-services__text {
	display: block;
	margin-top: var(--space-1);
	font-size: var(--fs-text);
}

.p-top-services__arrow {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	justify-self: end;
	align-self: end;
	width: 48px;
	height: 48px;
	border: 1px solid var(--c-on-dark);
	border-radius: 50%;
	transition: background-color var(--transition-base), border-color var(--transition-base);
}

.p-top-services__arrow svg {
	width: 24px;
	height: 24px;
	stroke-width: 1;
}

.p-top-services__card:hover .p-top-services__arrow {
	background-color: var(--c-on-dark-hover);
	border-color: transparent;
}

@media (min-width: 768px) {
	.p-top-services__list {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 1024px) {
	.p-top-services {
		padding-bottom: var(--space-30);
	}

	.p-top-services .c-section-head {
		margin-bottom: var(--space-12);
	}

	.p-top-services__card {
		grid-template-columns: 1fr auto;
		grid-template-rows: none;
		align-items: center;
		column-gap: var(--space-6);
		min-height: 206px;
		padding: 40px 60px 54px;
	}

	.p-top-services__title {
		font-size: 40px;
	}

	.p-top-services__arrow {
		align-self: center;
		width: 64px;
		height: 64px;
	}

	.p-top-services__arrow svg {
		width: 32px;
		height: 32px;
		stroke-width: 0.75; /* = 1px at 32px */
	}
}

/* --- WHY ZENWORTH ------------------------------------------------------- */
.p-top-why__card {
	position: relative;
	overflow: hidden;
	padding: 48px 30px; /* Figma SP 2/11 */
	background-color: var(--c-bg);
	border-radius: var(--radius-md);
}

.p-top-why__head,
.p-top-why__points {
	position: relative;
	z-index: 1;
}

.p-top-why__title {
	margin-top: 6px;
	font-size: 28px;
}

/* Layers graphic (rendered by Figma with its blur effects, 2x): top-right of the card on
   mobile, bottom-left on desktop; clipped by the card */
.p-top-why__deco {
	position: absolute;
	top: 83px;
	left: 245px;
	width: 177px;
	height: auto;
	pointer-events: none;
}

.p-top-why__points {
	display: grid;
	gap: var(--space-8);
	margin-top: var(--space-12);
}

.p-top-why__point-title {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 15px; /* one line at 291px (Figma SP) */
}

.p-top-why__badge {
	display: inline-flex;
	flex-shrink: 0;
	align-items: center;
	justify-content: center;
	width: 35px;
	padding: 1px 2px;
	font-size: 11px;
	font-weight: 700;
	line-height: 1.6;
	color: var(--c-on-dark);
	background-color: var(--c-primary);
	border-radius: 3px;
}

.p-top-why__point-text {
	margin-top: var(--space-2);
	font-size: var(--fs-text);
	letter-spacing: -0.03em; /* Figma SP: -0.42px */
}

@media (min-width: 1024px) {
	.p-top-why__card {
		display: grid;
		grid-template-columns: 1fr 400px;
		align-content: center;
		column-gap: var(--space-10);
		min-height: 560px;
		/* 100 (Figma 1440); 60 on 1024-wide screens so 「課題の特定から実装まで」 stays on one line */
		padding: clamp(60px, calc((100vw - 1024px) / 4 + 60px), 100px);
	}

	/* Explicit cells: the decoration between them must never shift the points */
	.p-top-why__head {
		grid-area: 1 / 1;
	}

	.p-top-why__points {
		grid-area: 1 / 2;
	}

	.p-top-why__title {
		font-size: 32px;
	}

	.p-top-why__point-title {
		font-size: 16px;
	}

	.p-top-why__badge {
		width: 50px;
		font-size: 13px;
	}

	.p-top-why__point-text {
		letter-spacing: 0;
	}

	/* PNG on purpose: the top layer's background blur can't be exported to SVG */
	.p-top-why__deco {
		top: 269px;
		left: 69px;
		width: 431px;
	}

	.p-top-why__points {
		margin-top: var(--space-10);
	}
}

