Warren Chen 4679cc70ef Add subscription floating action button with toggle functionality
- Implemented a floating action button (FAB) for newsletter subscription in the template.
- Added JavaScript to handle the toggle state of the FAB and close it on outside clicks or Escape key press.
- Created CSS styles for the FAB, including animations and responsive design.
- Added a Django template tag to return a random default cover image for the FAB.
- Integrated a form for email input and submission within the FAB.
2026-03-06 18:54:33 +09:00

522 lines
8.3 KiB
CSS

body {
color: #0e1b42;
font-size: 16px;
}
a {
text-decoration: none;
color: inherit;
}
.site-container {
max-width: 890px;
margin: 0 auto;
padding: 0 16px;
}
.full-bleed {
width: 100vw;
margin-left: calc(50% - 50vw);
}
.site-header {
position: relative;
z-index: 10;
}
.template-darkbackground .site-header {
background-color: #0e1b42;
color: #ffffff;
}
.header-inner {
display: flex;
align-items: center;
gap: 24px;
padding: 30px 0;
}
.logo {
display: inline-flex;
align-items: center;
}
.logo--light {
display: none;
}
.logo--dark {
display: inline-flex;
}
.template-darkbackground .logo--light {
display: inline-flex;
}
.template-darkbackground .logo--dark {
display: none;
}
.main-nav {
flex: 1 1 auto;
margin-left: 16px;
top: 56px;
}
.main-menu {
display: flex;
align-items: center;
gap: 18px;
list-style: none;
margin: 0;
padding: 0;
width: 100%;
}
.menu-item {
position: relative;
flex: 1 1 0;
text-align: left;
}
.menu-item-header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
}
.submenu-toggle {
display: none;
align-items: center;
justify-content: center;
width: 28px;
height: 28px;
border: 0;
background: none;
padding: 0;
cursor: pointer;
color: inherit;
}
.submenu-toggle::after {
content: "";
width: 8px;
height: 8px;
border-right: 2px solid currentColor;
border-bottom: 2px solid currentColor;
transform: rotate(45deg);
display: block;
transition: transform 160ms ease;
}
.menu-item.is-open .submenu-toggle::after {
transform: rotate(225deg);
}
.menu-divider {
display: none;
height: 1px;
background: currentColor;
opacity: 0.6;
margin: 8px 0 0;
}
.menu-toggle {
display: none;
align-items: center;
justify-content: center;
flex-direction: column;
gap: 4px;
width: 32px;
height: 32px;
background: none;
border: 0;
padding: 0;
cursor: pointer;
}
.menu-toggle-bar {
width: 20px;
height: 2px;
background: currentColor;
display: block;
}
.menu-toggle.is-open .menu-toggle-bar:nth-child(1) {
transform: translateY(6px) rotate(45deg);
}
.menu-toggle.is-open .menu-toggle-bar:nth-child(2) {
opacity: 0;
}
.menu-toggle.is-open .menu-toggle-bar:nth-child(3) {
transform: translateY(-6px) rotate(-45deg);
}
.main-menu-link {
display: inline-block;
padding: 12px 4px;
font-variation-settings: normal;
font-family: "Inter:Regular", "Noto Sans JP:Regular", sans-serif;
word-break: break-word;
font-weight: 400;
font-style: normal;
font-size: 14px;
letter-spacing: 0px;
line-height: normal;
--letter-spacing: 0px;
}
.submenu {
position: absolute;
top: 100%;
left: 50%;
transform: translateX(-50%);
margin-top: -2px;
margin-left: 20px;
list-style: none;
padding-inline-start: 0;
border-bottom: #0e1b42;
border-style: solid;
border-width: 0 0 1px 0;
opacity: 0;
visibility: hidden;
pointer-events: none;
transition: opacity 160ms ease, transform 160ms ease;
}
.template-darkbackground .submenu {
border-bottom: #ffffff;
border-style: solid;
border-width: 0 0 1px 0;
}
.menu-item:hover .submenu,
.menu-item:focus-within .submenu {
opacity: 1;
visibility: visible;
pointer-events: auto;
transform: translateX(-50%) translateY(2px);
}
.submenu-item {
min-width: 94px;
height: 36px;
border: #0e1b42;
border-style: solid;
border-width: 1px 1px 0 1px;
background-color: #ffffff;
}
.template-darkbackground .submenu-item {
border: #ffffff;
border-style: solid;
border-width: 1px 1px 0 1px;
background-color: #0e1b42;
}
.submenu-item a {
display: block;
font-variation-settings: normal;
font-family: "Inter:Regular", "Noto Sans JP:Regular", sans-serif;
word-break: break-word;
font-weight: 400;
font-style: normal;
font-size: 14px;
letter-spacing: 0px;
line-height: normal;
--letter-spacing: 0px;
padding: 8px 16px;
}
.submenu-item a:hover,
.submenu-item a:focus {
background: rgba(0, 0, 0, 0.05);
}
.header-search .search-input {
display: flex;
align-items: center;
}
.header-search {
margin-left: auto;
}
.header-search .search-icon {
display: inline-flex;
align-items: center;
justify-content: center;
width: 28px;
height: 28px;
background: none;
border: 0;
padding: 0;
cursor: pointer;
color: #1b2140;
}
.header-search .search-icon svg {
width: 28px;
height: 28px;
}
.header-search .search-input {
background-color: rgba(0, 0, 0, 0.2);
}
.template-darkbackground .header-search .search-input {
background-color: rgba(255, 255, 255, 0.4);
}
.header-search input[type="search"] {
border: 0;
background: transparent;
outline: none;
width: 153px;
}
.template-darkbackground .header-search input[type="search"] {
color: #ffffff;
}
.template-darkbackground .header-search input[type="search"]::placeholder {
color: #ffffff88;
}
.block-title {
display: inline-block;
width: 197px;
height: 87px;
vertical-align: middle;
font-size: 20px;
font-weight: 700;
}
.block-title span {
padding-left: 21px;
line-height: 87px;
}
.template-darkbackground .site-hero-band {
background-color: #0e1b42;
color: #ffffff;
}
.template-darkbackground .site-hero-band .block-title {
background-color: #ffffff;
color: #0e1b42;
}
@media (max-width: 1023px) {
.site-container {
max-width: 640px;
}
.header-search input[type="search"] {
width: 90px;
}
}
@media (max-width: 768px) {
}
@media (min-width: 575px) and (max-width: 767px) {
.site-container {
max-width: 426px;
}
.site-header .site-container {
transform: translateX(-30px);
}
.main-menu {
justify-content: flex-end;
}
.header-search input[type="search"] {
width: 163px;
}
.main-nav {
right: -28px;
}
}
@media (max-width: 767px) {
.site-header .site-container {
position: relative;
}
.header-inner {
width: 100%;
}
.main-nav {
position: absolute;
width: 220px;
display: none;
padding: 16px 0;
background: #0e1b42;
box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
z-index: 5;
}
.main-nav.is-open {
display: block;
}
.main-menu {
flex-direction: column;
align-items: flex-start;
gap: 12px;
width: 220px;
padding: 0 16px;
}
.menu-item {
flex: 0 0 auto;
width: 100%;
text-align: left;
}
.menu-item-header {
width: 192px;
}
.menu-toggle {
display: flex;
margin-left: 12px;
}
.template-darkbackground .menu-toggle {
color: #ffffff;
}
.main-nav {
background: #ffffff;
}
.template-darkbackground .main-nav {
background: #0e1b42;
}
.template-darkbackground .main-menu-link {
font-size: 14px;
}
.submenu-toggle {
display: inline-flex;
}
.menu-divider {
margin-left: 0;
margin-right: 0;
width: 92px;
}
.menu-item.is-open .menu-divider {
display: block;
}
.submenu {
position: static;
margin: 8px 0 0;
opacity: 1;
visibility: visible;
pointer-events: auto;
display: none;
border: 0;
}
.template-darkbackground .submenu {
border: 0;
}
.menu-item.is-open .submenu {
display: block;
transform: none;
}
.submenu-item {
background: none;
border: 0;
height: auto;
}
.template-darkbackground .submenu-item {
border: 0;
height: auto;
}
.submenu-item a {
padding: 6px 0 6px 18px;
font-size: 14px;
}
}
@media (max-width: 574px) {
.site-container {
max-width: 300px;
}
.header-inner {
flex-wrap: wrap;
}
.header-search {
width: 100%;
order: 3;
margin-left: 0;
margin-top: 12px;
}
.header-search input[type="search"] {
width: 195px;
}
.main-nav {
right: 16px;
}
.block-title {
width: 139px;
height: 55px;
font-size: 16px;
}
.block-title span {
padding-left: 14px;
line-height: 55px;
}
}
@layer figreset {
:root {
font-family: var( --default-font-family,ui-sans-serif,system-ui,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol','Noto Color Emoji' )
}
html {
-webkit-text-size-adjust: 100%;
-webkit-tap-highlight-color: transparent;
-webkit-font-smoothing: antialiased;
width: 100%
}
body {
margin: 0;
width: 100%
}
body: has([data-page-overflowx='hidden']) {
overflow-x:hidden
}
body: has([data-page-overflowx='auto']) {
overflow-x:auto
}
}