diff --git a/src/app/(main)/layout.tsx b/src/app/(main)/layout.tsx index 6896a34..46162a8 100644 --- a/src/app/(main)/layout.tsx +++ b/src/app/(main)/layout.tsx @@ -36,7 +36,7 @@ export default async function MainLayout({ programs={programs} /> -
{children}
+
{children}
-
+
دانشگاه صنعتی امیرکبیر
diff --git a/src/app/globals.css b/src/app/globals.css index a9d4dd0..1a83fad 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -121,78 +121,49 @@ * { @apply border-border outline-ring/50; } + html { + @apply font-sans scroll-smooth; + scroll-padding-top: 6rem; + -webkit-text-size-adjust: 100%; + text-size-adjust: 100%; + } body { @apply bg-background text-foreground antialiased; font-size: 16px; line-height: 1.65; text-align: start; } - html { - @apply font-sans scroll-smooth; - scroll-padding-top: 6rem; + html, + body { + width: 100%; + max-width: 100%; + overflow-x: clip; + } + /* Flex/grid children must be allowed to shrink below intrinsic content width */ + #__next, + main, + [data-slot="page-shell"] { + min-width: 0; + max-width: 100%; } a { color: inherit; text-decoration: none; } - img { + img, + video, + canvas, + iframe { max-width: 100%; } -} - -/* Metamorphism dots + lines — soft presence, not noise */ -@keyframes metamorph-line-pulse { - 0%, - 100% { - opacity: 0.35; - } - 50% { - opacity: 0.85; + video, + iframe { + height: auto; } } -@keyframes metamorph-dot-breathe { - 0%, - 100% { - opacity: 0.55; - transform: scale(1); - } - 50% { - opacity: 1; - transform: scale(1.35); - } -} - -@keyframes metamorph-field-drift { - 0%, - 100% { - transform: translate3d(0, 0, 0); - } - 50% { - transform: translate3d(1.2%, -0.8%, 0); - } -} - -@keyframes metamorph-dash-flow { - from { stroke-dashoffset: 24; } - to { stroke-dashoffset: 0; } -} - -@keyframes section-reveal { - from { opacity: 0; transform: translateY(2rem); } - to { opacity: 1; transform: translateY(0); } -} - -.metamorph-field__mesh { - animation: metamorph-field-drift 18s ease-in-out infinite; -} - -.metamorph-field__line { - stroke-dasharray: 4 8; - animation: - metamorph-line-pulse 7s ease-in-out infinite, - metamorph-dash-flow 8s linear infinite; -} +/* Metamorph field: static on purpose (animations removed for mobile perf). + Legacy keyframes kept only so reduced-motion rules stay harmless. */ .page-hero::after, .home-hero::after { @@ -249,15 +220,23 @@ radial-gradient(circle at 90% 80%, color-mix(in oklab, var(--accent) 10%, transparent), transparent 25%); } -@supports (animation-timeline: view()) { - .motion-section { - animation: section-reveal both cubic-bezier(0.22, 1, 0.36, 1); - animation-timeline: view(); - animation-range: entry 5% cover 28%; +/* Scroll-driven reveals: desktop only — expensive while scrolling on phones */ +@media (min-width: 768px) and (prefers-reduced-motion: no-preference) { + @supports (animation-timeline: view()) { + @keyframes section-reveal { + from { opacity: 0; transform: translateY(1.25rem); } + to { opacity: 1; transform: translateY(0); } + } + + .motion-section { + animation: section-reveal both cubic-bezier(0.22, 1, 0.36, 1); + animation-timeline: view(); + animation-range: entry 8% cover 22%; + } } } -@media (hover: hover) { +@media (hover: hover) and (prefers-reduced-motion: no-preference) { [data-slot="card"] img { transition: transform 500ms cubic-bezier(0.22, 1, 0.36, 1); } @@ -266,10 +245,11 @@ } } -.metamorph-field__dot { - transform-box: fill-box; - transform-origin: center; - animation: metamorph-dot-breathe 6s ease-in-out infinite; +@media (max-width: 767px) { + .motion-section[data-tone="muted"], + .motion-section[data-tone="dark"] { + background-image: none; + } } @media (prefers-reduced-motion: reduce) { @@ -283,14 +263,6 @@ animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; } - .metamorph-field__mesh, - .metamorph-field__line, - .metamorph-field__dot { - animation: none !important; - } - .metamorph-field animate { - display: none; - } .motion-section { animation: none !important; } diff --git a/src/app/layout.tsx b/src/app/layout.tsx index d6829ad..a01341c 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,10 +1,16 @@ -import type { Metadata } from "next"; +import type { Metadata, Viewport } from "next"; import localFont from "next/font/local"; import { NextIntlClientProvider } from "next-intl"; import { getLocale, getMessages, getTranslations } from "next-intl/server"; import { JsonLd, organizationJsonLd } from "@/lib/seo/json-ld"; import "./globals.css"; +export const viewport: Viewport = { + width: "device-width", + initialScale: 1, + viewportFit: "cover", +}; + const iranSans = localFont({ src: [ { @@ -93,7 +99,7 @@ export default async function RootLayout({ return ( - + - {children} +
+ {children} +
diff --git a/src/app/professional/layout.tsx b/src/app/professional/layout.tsx index 712697b..d5ed6be 100644 --- a/src/app/professional/layout.tsx +++ b/src/app/professional/layout.tsx @@ -30,7 +30,7 @@ export default async function ProfessionalLayout({ courses={courses} programs={programs} /> -
{children}
+
{children}
value.replace(/[۰-۹]/g, (digit) => String(PERSIAN_DIGITS.indexOf(digit))); +const toLatin = (value: string) => + value.replace(/[۰-۹]/g, (digit) => String(PERSIAN_DIGITS.indexOf(digit))); -export function AnimatedMetric({ value, className }: { value: string; className?: string }) { +function shouldAnimate() { + if (typeof window === "undefined") return false; + if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) return false; + // Skip count-up on phones — saves main-thread work while scrolling + if (window.matchMedia("(max-width: 767px)").matches) return false; + return true; +} + +export function AnimatedMetric({ + value, + className, +}: { + value: string; + className?: string; +}) { const ref = useRef(null); const [display, setDisplay] = useState(value); useEffect(() => { const element = ref.current; - if (!element || window.matchMedia("(prefers-reduced-motion: reduce)").matches) return; + if (!element || !shouldAnimate()) return; + const latin = toLatin(value).replaceAll("٬", ""); const match = latin.match(/^(\D*)(\d+)(\D*)$/); if (!match) return; const [, prefix, rawNumber, suffix] = match; const target = Number(rawNumber); - const observer = new IntersectionObserver(([entry]) => { - if (!entry.isIntersecting) return; - observer.disconnect(); - const startedAt = performance.now(); - const duration = 1000; - const tick = (now: number) => { - const progress = Math.min((now - startedAt) / duration, 1); - const eased = 1 - Math.pow(1 - progress, 3); - const current = Math.round(target * eased).toLocaleString("fa-IR"); - setDisplay(`${prefix}${current}${suffix}`); - if (progress < 1) requestAnimationFrame(tick); - }; - requestAnimationFrame(tick); - }, { threshold: 0.55 }); + const observer = new IntersectionObserver( + ([entry]) => { + if (!entry.isIntersecting) return; + observer.disconnect(); + const startedAt = performance.now(); + const duration = 900; + const tick = (now: number) => { + const progress = Math.min((now - startedAt) / duration, 1); + const eased = 1 - Math.pow(1 - progress, 3); + const current = Math.round(target * eased).toLocaleString("fa-IR"); + setDisplay(`${prefix}${current}${suffix}`); + if (progress < 1) requestAnimationFrame(tick); + }; + requestAnimationFrame(tick); + }, + { threshold: 0.55 }, + ); observer.observe(element); return () => observer.disconnect(); }, [value]); - return {display}; + return ( + + {display} + + ); } diff --git a/src/components/atoms/BrandLogo.tsx b/src/components/atoms/BrandLogo.tsx index 17e134d..055ed41 100644 --- a/src/components/atoms/BrandLogo.tsx +++ b/src/components/atoms/BrandLogo.tsx @@ -13,7 +13,7 @@ type BrandLogoProps = { compact?: boolean; }; -/** AUT seal — white mark on transparent; sits on brand disc. */ +/** AUT seal — raw mark only (transparent), no disc/ring/background. */ export function BrandLogo({ href = "/", title, @@ -33,8 +33,7 @@ export function BrandLogo({ > @@ -44,7 +43,11 @@ export function BrandLogo({ fill priority sizes="48px" - className="object-contain p-[18%]" + className={cn( + "object-contain", + // Asset is white-on-transparent; invert to dark ink on light surfaces + !onDark && "brightness-0", + )} /> @@ -60,7 +63,7 @@ export function BrandLogo({ {subtitle ? (