Files
web/assets/css/main.css
T
2025-10-06 18:28:49 +07:00

444 lines
14 KiB
CSS

@import "tailwindcss";
@custom-variant dark (&:where(.dark-theme, .dark-theme *));
@theme {
--ui-primary: var(--color-deep-dark);
--ui-container: var(--container-4xl);
--ui-container-narrow: var(--container-3xl);
--ui-radius: var(--radius-sm);
--ui-bg: white;
--ui-bg-muted: var(--color-cloud-semilight);
--ui-bg-elevated: var(--color-cloud-medium);
--ui-bg-inverted: var(--color-deep-dark);
--ui-bg-muted-inverted: var(--color-deep-semidark);
--ui-bg-elevated-inverted: var(--color-deep-medium);
--ui-border: var(--color-cloud-medium);
--ui-border-accented: var(--color-cloud-semidark);
--ui-border-intense: var(--color-cloud-dark);
--ui-text: var(--color-deep-dark);
--ui-text-muted: var(--color-smoke-medium);
--ui-text-blind: var(--color-smoke-dark);
--ui-text-inverted: var(--color-cloud-light);
--ui-text-muted-inverted: var(--color-cloud-medium);
--ui-text-blind-inverted: var(--color-cloud-dark);
--ui-header-logo-inverted: 1;
--color-primary-dark: rgb(0, 101, 254);
--color-primary: rgb(0, 101, 254);
--color-primary-ghost: rgba(0, 101, 254, 0);
--color-primary-light: rgb(53, 154, 255);
--color-primary-lighter: rgb(109, 182, 255);
--color-primary-content: rgb(237, 248, 255);
--color-text: rgb(50,50,50);
--color-deep-dark: rgb(19, 19, 19);
--color-deep-semidark: rgb(28, 28, 28);
--color-deep-medium: rgb(32, 32, 32);
--color-deep-semilight: rgb(37, 37, 37);
--color-deep-light: rgb(42, 42, 42);
--color-smoke-dark: rgb(73, 73, 73);
--color-smoke-semidark: rgb(78, 78, 78);
--color-smoke-medium: rgb(84, 84, 84);
--color-smoke-semilight: rgb(89, 89, 89);
--color-smoke-light: rgb(95, 95, 95);
--color-cloud-dark: rgb(223, 223, 223);
--color-cloud-semidark: rgb(230, 230, 230);
--color-cloud-medium: rgb(237, 237, 237);
--color-cloud-semilight: rgb(243, 243, 243);
--color-cloud-light: rgb(250, 250, 250);
--color-mc-outline: 30, 30, 31;
--color-mc-inline: 255, 255, 255, 0.2;
--color-mc-primary: 79, 160, 51;
--color-mc-primary-hover: 60, 133, 39;
--color-mc-primary-up: 29, 77, 19;
--color-mc-primary-down: 40, 100, 28;
--color-mc-surface: 244, 246, 249;
--color-mc-surface-container: 230, 232, 235;
--color-mc-surface-hover: 208, 209, 212;
--color-mc-surface-up: 88, 88, 90;
--color-mc-surface-down: 177, 178, 181;
--color-mc-input: 49, 50, 51;
--color-mc-input-shadow: 36, 36, 37;
--color-mc-container: 72, 73, 74;
--color-mc-container-up: 49, 50, 51;
--color-mc-container-hover: 88, 88, 90;
--color-mc-container-down: 49, 50, 51;
--color-mc-container-top: 90, 91, 92;
--color-mc-container-bottom: 50, 51, 52;
--font-sans: Inter, Sarabun, sans-serif;
--font-sans--font-feature-settings: "liga", "calt", "ss01", "cv05", "cv06", "cv11";
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
--font-serif: "NotoSerif", "NotoSerifThai", Georgia, Garamond, "Times New Roman", Times, serif;
--font-math: CMUSerif, "Cambria Math", "LatinModern Math", "STIXGeneral", math;
--ease-fluid: 0.2, 0, 0, 1;
--ease-fluid-in: .6, .2, .7, .4;
}
@supports (font-variation-settings: normal) {
:root {
--font-sans: InterVariable, Sarabun, sans-serif;
font-optical-sizing: auto;
}
}
.dark-mode {
--ui-primary: var(--color-cloud-light);
--ui-bg: var(--color-deep-dark);
--ui-bg-muted: var(--color-deep-semidark);
--ui-bg-elevated: var(--color-deep-medium);
--ui-bg-inverted: var(--color-cloud-light);
--ui-bg-muted-inverted: var(--color-cloud-semilight);
--ui-bg-elevated-inverted: var(--color-cloud-medium);
--ui-border: var(--color-deep-medium);
--ui-border-accented: var(--color-deep-light);
--ui-text: var(--color-cloud-dark);
--ui-text-muted: var(--color-cloud-medium);
--ui-text-blind: var(--color-cloud-dark);
--ui-text-inverted: var(--color-deep-light);
--ui-text-muted-inverted: var(--color-deep-medium);
--ui-text-blind-inverted: var(--color-deep-dark);
--ui-header-logo-inverted: 0;
--color-text: rgb(180,180,180);
}
@keyframes ring {
0% {
outline: 0px solid var(--ui-ring-color);
outline-offset: var(--ui-ring-offset);
}
25% {
outline: 12px solid var(--ui-ring-color);
outline-offset: var(--ui-ring-offset);
}
100% {
outline: var(--ui-ring-size) solid var(--ui-ring-color);
outline-offset: var(--ui-ring-offset);
}
}
*:focus-visible {
--ui-ring-size: 2px;
--ui-ring-color: var(--color-primary);
--ui-ring-offset: 0;
animation: ring 0.5s cubic-bezier(var(--ease-fluid));
outline: var(--ui-ring-size) solid var(--ui-ring-color);
outline-offset: var(--ui-ring-offset);
}
body,main {
font-family: var(--font-sans);
padding: 0;
margin: 0;
color: var(--ui-text);
background-color: var(--ui-bg);
line-height: 1.35;
}
img {
@apply rounded-lg;
}
.web-header {
display: flex;
flex-direction: row;
position: sticky;
top: 0;
height: calc(var(--spacing)*14);
z-index: 1000;
@apply duration-200 transition-all;
}
.web-header.web-header-bg {
@apply bg-(--ui-bg)/75 backdrop-blur border-b border-(--ui-text)/5;
}
.web-header-emit-shadow-when-top.shadow-active {
@apply shadow-lg;
}
.web-header-autohide.web-header-hidden {
@apply scale-95 blur opacity-0 invisible;
}
.web-nav, .web-footer-content, .article {
width: 100%;
}
.web-heading {
margin: 0 auto;
padding: 0 calc(var(--spacing)*4);
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
width: 100%;
height: 100%;
max-width: var(--ui-container);
.web-heading-left-section {
width: fit-content;
display: flex;
flex-direction: row;
justify-content: start;
height: 100%;
align-items: center;
}
.web-heading-right-section {
display: flex;
width: fit-content;
flex-direction: row;
justify-content: end;
height: 100%;
align-items: center;
}
}
p {
@apply my-[1em];
}
.font-hero {
@apply text-5xl font-bold my-[.2em];
line-height: 1.3;
}
.font-hero-desc {
@apply text-xl font-medium;
}
.web-title {
@apply text-3xl font-bold my-[.7em] transition-[color] ease-fluid duration-100;
a {
cursor: pointer;
}
.link-inline-icon {
@apply transition-[opacity_margin] ease-fluid duration-100 select-none;
margin-left: 0.5rem;
opacity: 0.5;
}
&:hover .link-inline-icon {
opacity: 1;
margin-left: 1rem;
}
&:active a {
@apply text-primary;
}
&:focus-visible a {
@apply underline;
}
&.link {
color: var(--ui-text);
}
}
.web-nav-title {
--web-nav-title-shadow: 0px 0px 16px var(--ui-bg);
@apply text-lg font-bold;
text-shadow: var(--web-nav-title-shadow),
var(--web-nav-title-shadow),
var(--web-nav-title-shadow),
var(--web-nav-title-shadow),
var(--web-nav-title-shadow);
}
.web-hero.web-hero-bg, .web-hero-post.web-hero-bg {
@apply bg-(--color-deep-semidark) text-(--color-cloud-medium);
h1,h2,h3,h4,h5,h6 {
@apply text-(--color-cloud-light)
}
}
.web-hero-post {
/* padding: clamp(calc(var(--spacing) * 32), 9vw, calc(var(--spacing) * 48)) calc(var(--spacing)*4); */
@apply flex flex-col items-center text-center;
}
.web-section {
@apply my-16 px-4;
max-width: var(--ui-container);
margin: calc(var(--spacing)*16) auto;
}
.web-section.web-section-narrow {
@apply my-16 px-4;
max-width: var(--ui-container-narrow);
margin: calc(var(--spacing)*16) auto;
}
.project-card-container, .font-card-container, .post-card-container {
@apply flex flex-col gap-1 ml-0 list-none;
}
.project-card-container > li:not(:last-child):not(:first-child):not(:only-child) > .project-card,
.post-card-container > a.post-card:not(:last-child):not(:first-child):not(:only-child),
.font-card-container > li:not(:last-child):not(:first-child):not(:only-child) > .font-card {
@apply rounded-md;
}
.project-card-container > li:last-child:not(:only-child) > .project-card,
.post-card-container > a.post-card:last-child:not(:only-child),
.font-card-container > li:last-child:not(:only-child) > .font-card {
@apply rounded-t-md;
}
.project-card-container > li:first-child:not(:only-child) > .project-card,
.post-card-container > a.post-card:first-child:not(:only-child),
.font-card-container > li:first-child:not(:only-child) > .font-card {
@apply rounded-b-md;
}
.project-card-container > li, .post-card-container > li, .font-card-container > li { @apply ml-0; }
.project-card, .font-card, .post-card {
height: 100%;
@apply flex flex-col p-2 items-center rounded-2xl sm:flex-row sm:gap-4 bg-(--ui-bg-muted) hover:bg-(--ui-bg-elevated) transition-colors duration-100 ease-fluid ml-0;
h3 { @apply text-2xl font-bold line-clamp-1; }
h3,p { z-index: 1; }
img { @apply mb-2 sm:mb-0 aspect-video object-cover w-full sm:max-w-56 rounded-lg; }
p {
@apply line-clamp-2;
margin: 0;
width: 100%;
}
.iconify {
background-color: var(--ui-text);
width: calc(var(--spacing)*16);
height: calc(var(--spacing)*16);
}
.project-card-content, .font-card-content, .post-card-content {
@apply block w-full px-2 sm:px-0;
}
&.disabled {
@apply opacity-50 pointer-events-none cursor-not-allowed;
}
}
.font-card {
padding: 0.5rem 1rem;
}
.font-card {
@apply flex-row;
}
.hamburger-toggle {
@apply flex md:hidden h-14 w-9 cursor-pointer items-center justify-center hover:bg-(--ui-text)/5 active:bg-(--ui-text)/10 transition-colors duration-100 ease-fluid;
}
.hamburger-menu {
transform-origin: top right;
@apply flex flex-col sticky h-fit left-0 top-14 w-full max-w-(--ui-container) mx-auto z-[1000] transition-all duration-200 ease-fluid;
.nav-wrapper {
list-style-type: none;
display: flex;
flex-direction: column;
margin: 0;
padding: 0 calc(var(--spacing)*4);
width: 100%;
gap: 6px;
align-items: end;
.nav-link, .nav-button {
display: flex;
font-size: 15px;
width: 100%;
max-width: 18rem;
@apply ml-0 justify-end;
a, .hamburger-btn-square {
display: flex;
align-items: center;
width: 100%;
@apply px-4 h-14 shadow-lg rounded-[28px] bg-(--ui-bg)/75 backdrop-blur border border-(--ui-text)/5 cursor-pointer hover:text-primary active:scale-[.975] transition-colors transition-transform duration-100 ease-fluid;
}
a.router-link-exact-active {
@apply text-primary;
}
.hamburger-btn-square {
@apply aspect-square justify-center;
width: unset;
}
}
.nav-button {
font-size: 15px;
width: 100%;
max-width: 18rem;
@apply ml-0 justify-end flex;
}
.nav-button.nav-button-only-desktop {
@apply hidden md:flex;
}
}
}
.hamburger-menu.hamburger-menu-hidden {
@apply scale-95 blur opacity-0 invisible;
}
.nav-links {
@apply hidden md:flex;
height: 100%;
.nav-wrapper {
list-style-type: none;
display: flex;
flex-direction: row;
height: 100%;
gap: 6px;
.nav-link {
font-size: 15px;
align-content: center;
height: 100%;
@apply m-0;
a {
display: flex;
align-items: center;
@apply px-3 h-10 rounded-[20px] bg-(--ui-bg)/75 backdrop-blur border border-(--ui-text)/5 cursor-pointer hover:text-primary active:opacity-80 transition-colors duration-100 ease-fluid;
}
a.router-link-exact-active {
@apply text-primary;
}
}
}
}
code, pre, tt, kbd, samp {
font-size: 1em;
}
.link, .prose a {
& {
@apply underline text-(--ui-text);
}
&:hover {
@apply no-underline bg-(--ui-text) text-(--ui-bg);
}
&:active {
@apply opacity-80;
}
&.link-no-underline {
@apply no-underline;
}
}
.prose h2 > a {
@apply no-underline
}
ul,li { @apply ml-[1em] }
ul { @apply list-disc; }
button.btn, a.btn {
@apply cursor-pointer;
}
.btn {
@apply h-10 bg-primary text-primary-content px-4 rounded-[20px];
}
.btn.btn-sm {
@apply h-9;
}
.btn.btn-neutral {
@apply bg-(--ui-bg-muted) text-(--ui-text);
&:hover {
@apply bg-(--ui-bg-elevated);
}
&:active {
@apply bg-(--ui-border-accented);
}
}
.prose {
@apply font-serif text-lg;
ol { @apply list-decimal ml-[1em]; }
p, li { line-height: 1.5; }
h2 a, h3 a, h4 a, h5 a, h6 a { @apply text-(--ui-text); }
hr { margin-block: 1em; @apply border-(--ui-border-intense); }
li { margin-block: 1em; }
h1,h2,h3,h4,h5,h6 {
@apply font-serif font-bold;
scroll-margin-top: 80px;
}
h2 {
@apply text-2xl my-6;
}
h3 {
@apply text-xl my-6;
}
h4 {
@apply text-lg my-6;
}
img {
@apply my-3;
}
}
.post-cover {
gap: 1.5rem;
display: flex;
@apply flex-col md:flex-row-reverse
}
.post-cover > .img-cover {
@apply w-full aspect-[4/3] max-w-full md:max-w-[55%] object-cover;
}