/*
Theme Name: FDTW
Theme URI: https://fdtworld.com
Author: Daichi
Author URI: https://fdtworld.com
Description: A minimal, refined theme for FDTW — From Daichi To World. Culture, Travel, Life from Japan.
Version: 1.2.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: fdtw
*/

/* ========================================
   CSS Reset & Base
   ======================================== */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Colors - Warm Beige Palette */
    --color-bg: #F2F0EC;
    --color-bg-alt: #EAE7E1;
    --color-text: #1A1A1A;
    --color-text-light: #555555;
    --color-text-lighter: #888888;
    --color-border: #D9D6D0;
    --color-accent: #1A1A1A;
    --color-white: #FFFFFF;

    /* Typography */
    --font-heading: 'Rubik', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-jp: 'Noto Serif JP', serif;

    /* Spacing */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 2rem;
    --space-lg: 4rem;
    --space-xl: 6rem;
    --space-xxl: 8rem;

    /* Layout */
    --max-width: 1200px;
    --max-width-narrow: 800px;
    --header-height: 80px;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    color: var(--color-text);
    background-color: var(--color-bg);
    line-height: 1.7;
    font-weight: 400;
}

a {
    color: inherit;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

a:hover {
    opacity: 0.7;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.3;
}

/* ========================================
   Utility
   ======================================== */

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-md);
}

.container--narrow {
    max-width: var(--max-width-narrow);
    margin: 0 auto;
    padding: 0 var(--space-md);
}

.jp-accent {
    font-family: var(--font-jp);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ========================================
   Header
   ======================================== */

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: var(--header-height);
    display: flex;
    align-items: center;
    color: var(--color-text);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.site-header--home {
    background-color: transparent;
}

.site-header--scrolled {
    background-color: rgba(242, 240, 236, 0.97);
    backdrop-filter: blur(10px);
    box-shadow: 0 1px 0 var(--color-border);
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-md);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-logo {
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.site-logo a {
    display: block;
}

.primary-nav {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.primary-nav a {
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 400;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    position: relative;
}

.primary-nav a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background-color: currentColor;
    transition: width 0.3s ease;
}

.primary-nav a:hover {
    opacity: 1;
}

.primary-nav a:hover::after {
    width: 100%;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-xs);
    color: inherit;
}

.menu-toggle span {
    display: block;
    width: 24px;
    height: 1px;
    background-color: currentColor;
    margin: 6px 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ========================================
   Hero Section (Homepage)
   ======================================== */

.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background-color: var(--color-bg);
    color: var(--color-text);
    position: relative;
    overflow: hidden;
}

.hero__content {
    position: relative;
    z-index: 2;
}

.hero__title {
    font-family: var(--font-heading);
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.01em;
    color: var(--color-text);
}

/* ========================================
   Section Common
   ======================================== */

.section {
    padding: var(--space-lg) 0;
}

.section--alt {
    background-color: var(--color-bg-alt);
}

.section__header {
    margin-bottom: var(--space-md);
}

.section__label {
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--color-text-lighter);
    margin-bottom: var(--space-sm);
}

.section__title {
    font-size: clamp(1.75rem, 3vw, 2.5rem);
}

/* ========================================
   Latest Posts Grid
   ======================================== */

.posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
}

.post-card {
    display: block;
    transition: transform 0.3s ease;
}

.post-card:hover {
    opacity: 1;
    transform: translateY(-4px);
}

.post-card__image {
    aspect-ratio: 3 / 2;
    overflow: hidden;
    margin-bottom: var(--space-sm);
    background-color: var(--color-bg-alt);
}

.post-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.post-card:hover .post-card__image img {
    transform: scale(1.03);
}

.post-card__category {
    font-family: var(--font-body);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-text-lighter);
    margin-bottom: var(--space-xs);
}

.post-card__title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: var(--space-xs);
}

.post-card__date {
    font-size: 0.8125rem;
    color: var(--color-text-lighter);
}

/* ========================================
   Featured Post (Large)
   ======================================== */

.featured-post {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
    align-items: center;
}

.featured-post__image {
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background-color: var(--color-bg-alt);
}

.featured-post__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.featured-post__category {
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-text-lighter);
    margin-bottom: var(--space-sm);
}

.featured-post__title {
    font-size: clamp(1.5rem, 2.5vw, 2rem);
    margin-bottom: var(--space-sm);
}

.featured-post__excerpt {
    color: var(--color-text-light);
    font-size: 0.9375rem;
    line-height: 1.8;
    margin-bottom: var(--space-md);
}

.featured-post__link {
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-bottom: 1px solid currentColor;
    padding-bottom: 2px;
}

/* ========================================
   Blog Archive
   ======================================== */

.archive-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg) var(--space-md);
}

.archive-card {
    display: block;
}

.archive-card:hover {
    opacity: 1;
}

.archive-card__image {
    aspect-ratio: 16 / 10;
    overflow: hidden;
    margin-bottom: var(--space-sm);
    background-color: var(--color-bg-alt);
}

.archive-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.archive-card:hover .archive-card__image img {
    transform: scale(1.03);
}

.archive-card__meta {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-xs);
}

.archive-card__category {
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-text-lighter);
}

.archive-card__date {
    font-size: 0.8125rem;
    color: var(--color-text-lighter);
}

.archive-card__title {
    font-family: var(--font-heading);
    font-size: 1.375rem;
    line-height: 1.4;
    margin-bottom: var(--space-xs);
}

.archive-card__excerpt {
    font-size: 0.9375rem;
    color: var(--color-text-light);
    line-height: 1.7;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    margin-top: var(--space-xl);
}

.pagination a,
.pagination span {
    font-size: 0.875rem;
    padding: var(--space-xs) var(--space-sm);
}

.pagination .current {
    font-weight: 700;
}

/* ========================================
   Single Post
   ======================================== */

.single-post__header {
    text-align: center;
    padding: calc(var(--header-height) + var(--space-xl)) 0 var(--space-lg);
}

.single-post__category {
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-text-lighter);
    margin-bottom: var(--space-sm);
}

.single-post__title {
    font-size: clamp(2rem, 4vw, 3rem);
    max-width: 800px;
    margin: 0 auto var(--space-sm);
}

.single-post__date {
    font-size: 0.875rem;
    color: var(--color-text-lighter);
}

.single-post__featured-image {
    max-width: 1000px;
    margin: 0 auto var(--space-lg);
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.single-post__featured-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.single-post__content {
    max-width: var(--max-width-narrow);
    margin: 0 auto;
    padding: 0 var(--space-md);
}

.single-post__content p {
    margin-bottom: 1.5em;
    font-size: 1.0625rem;
    line-height: 1.9;
}

.single-post__content h2 {
    font-size: 1.75rem;
    margin: var(--space-lg) 0 var(--space-sm);
}

.single-post__content h3 {
    font-size: 1.375rem;
    margin: var(--space-md) 0 var(--space-sm);
}

.single-post__content blockquote {
    border-left: 2px solid var(--color-border);
    padding-left: var(--space-md);
    margin: var(--space-md) 0;
    font-style: italic;
    color: var(--color-text-light);
}

.single-post__content img {
    margin: var(--space-md) 0;
}

.single-post__content ul,
.single-post__content ol {
    margin-bottom: 1.5em;
    padding-left: 1.5em;
}

.single-post__content li {
    margin-bottom: 0.5em;
}

/* Share: Copy Link */
.share-copy {
    max-width: var(--max-width-narrow);
    margin: 40px auto 0;
    padding: 0 var(--space-md);
    display: flex;
    justify-content: flex-end;
}

.share-copy__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 0;
    border: none;
    background: transparent;
    font-family: var(--font-body);
    font-size: 0.75rem;
    color: var(--color-text-lighter);
    cursor: pointer;
    transition: color 0.2s ease;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.share-copy__btn:hover {
    color: var(--color-text);
}

.share-copy__btn svg {
    flex-shrink: 0;
}

/* Post Navigation */
.post-nav {
    max-width: var(--max-width-narrow);
    margin: var(--space-lg) auto 0;
    padding: 0 var(--space-md);
    display: flex;
    justify-content: space-between;
}

.post-nav__item {
    max-width: 45%;
}

.post-nav__label {
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-text-lighter);
    margin-bottom: var(--space-xs);
}

.post-nav__title {
    font-family: var(--font-heading);
    font-size: 1.125rem;
}

/* ========================================
   Page (About, etc.)
   ======================================== */

.page__header {
    text-align: center;
    padding: calc(var(--header-height) + var(--space-xl)) 0 var(--space-lg);
}

.page__title {
    font-size: clamp(2rem, 4vw, 3rem);
    font-family: var(--font-body);
    font-weight: 500;
}

.page__content {
    max-width: var(--max-width-narrow);
    margin: 0 auto;
    padding: 0 var(--space-md);
}

.page__content p {
    margin-bottom: 1.5em;
    font-size: 1.0625rem;
    line-height: 1.9;
}

.page__content h2 {
    font-size: 1.75rem;
    margin: var(--space-lg) 0 var(--space-sm);
}

.page__content img {
    margin: var(--space-md) 0;
}

/* ========================================
   Footer
   ======================================== */

.site-footer {
    border-top: 1px solid var(--color-border);
    padding: var(--space-lg) 0;
    margin-top: var(--space-xl);
}

.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.footer-copyright {
    font-size: 0.8125rem;
    color: var(--color-text-lighter);
}

.footer-social {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.footer-social a {
    color: var(--color-text-light);
    font-size: 0.8125rem;
    font-weight: 400;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* ========================================
   Contact Form
   ======================================== */

.contact-form-wrapper {
    max-width: 600px;
    margin: 0 auto;
}

.contact-form__field {
    margin-bottom: var(--space-md);
}

.contact-form__field label {
    display: block;
    font-family: var(--font-body);
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-text-light);
    margin-bottom: var(--space-xs);
}

.contact-form__field .required {
    color: var(--color-text-lighter);
}

.contact-form__field input,
.contact-form__field textarea {
    width: 100%;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--color-text);
    background-color: transparent;
    border: 1px solid var(--color-border);
    padding: 0.875rem 1rem;
    transition: border-color 0.2s ease;
    -webkit-appearance: none;
    border-radius: 0;
}

.contact-form__field input:focus,
.contact-form__field textarea:focus {
    outline: none;
    border-color: var(--color-text);
}

.contact-form__field input::placeholder,
.contact-form__field textarea::placeholder {
    color: var(--color-text-lighter);
}

.contact-form__field textarea {
    resize: vertical;
    line-height: 1.7;
}

.contact-form__submit {
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-white);
    background-color: var(--color-text);
    border: none;
    padding: 1rem 2.5rem;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.contact-form__submit:hover {
    opacity: 0.8;
}

.contact-message {
    text-align: center;
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
    font-size: 0.9375rem;
}

.contact-message--success {
    border: 1px solid var(--color-border);
    color: var(--color-text);
}

.contact-message--error {
    border: 1px solid #c44;
    color: #c44;
}

/* ========================================
   Reading Progress Bar
   ======================================== */

.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 2px;
    background-color: var(--color-accent);
    z-index: 9999;
    transition: width 0.1s linear;
}

/* ========================================
   Tip Section
   ======================================== */
.tip-section {
    background: var(--color-bg-alt, #EAE7E1);
    border-radius: 12px;
    padding: 1.75rem 1.5rem 1.5rem;
    max-width: var(--max-width-narrow, 680px);
    margin: 2rem auto;
    text-align: center;
}

.tip-desc-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 18px;
}

.tip-cup-icon {
    color: #bbb;
    flex-shrink: 0;
    position: relative;
    top: 1px;
}

.tip-desc {
    font-size: 13px;
    color: var(--color-text-lighter, #999);
    margin: 0;
    line-height: 1.5;
}

/* Currency + Amount combo field */
.tip-combo {
    display: flex;
    align-items: stretch;
    border: 0.5px solid var(--color-border, #D9D6D0);
    border-radius: 10px;
    background: #fff;
    overflow: visible;
    max-width: 300px;
    margin: 0 auto 14px;
    height: 42px;
    position: relative;
}

/* Currency trigger (left side) */
.tip-cur-trigger {
    display: flex;
    align-items: center;
    border-right: 0.5px solid #e8e5e0;
    padding: 0 8px 0 10px;
    gap: 6px;
    flex-shrink: 0;
    cursor: pointer;
    user-select: none;
    transition: background 0.1s;
}

.tip-cur-trigger:hover {
    background: rgba(0, 0, 0, 0.02);
}

.tip-cur-flag {
    font-size: 16px;
    line-height: 1;
}

.tip-cur-label {
    font-size: 13px;
    color: #777;
}

.tip-cur-arrow {
    color: #aaa;
    margin-left: 2px;
}

/* Custom dropdown */
.tip-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: #fff;
    border: 0.5px solid var(--color-border, #D9D6D0);
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    z-index: 10;
    display: none;
    min-width: 160px;
    padding: 4px 0;
    max-height: 240px;
    overflow-y: auto;
}

.tip-dropdown.open {
    display: block;
}

.tip-dropdown-opt {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    cursor: pointer;
    font-size: 13px;
    color: #555;
    transition: background 0.1s;
}

.tip-dropdown-opt:hover {
    background: #f5f3ef;
}

.tip-dropdown-opt.active {
    background: #edeae5;
    font-weight: 500;
}

.tip-dropdown-flag {
    font-size: 16px;
    line-height: 1;
}

/* Amount input (right side) */
.tip-amount-field {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 0 8px;
}

.tip-amount-sym {
    font-size: 15px;
    color: #aaa;
    font-weight: 500;
    line-height: 1;
}

.tip-amount-field input {
    border: none;
    outline: none;
    font-size: 16px;
    width: 100%;
    background: transparent;
    font-family: 'DM Sans', sans-serif;
    color: var(--color-text, #1A1A1A);
    font-weight: 500;
    padding: 0 0 0 1px;
}

.tip-amount-field input::placeholder {
    color: #ccc;
    font-weight: 400;
}

.tip-amount-field input::-webkit-outer-spin-button,
.tip-amount-field input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.tip-amount-field input[type=number] {
    -moz-appearance: textfield;
}

/* Message */
.tip-message-wrap {
    max-width: 300px;
    margin: 0 auto 14px;
}

.tip-message {
    width: 100%;
    border: 0.5px solid var(--color-border, #D9D6D0);
    border-radius: 10px;
    background: #fff;
    padding: 9px 12px;
    font-size: 13px;
    font-family: 'DM Sans', sans-serif;
    resize: none;
    display: block;
    color: var(--color-text, #1A1A1A);
}

.tip-message::placeholder {
    color: #c5c2bc;
}

/* Submit button */
.tip-submit {
    display: inline-block;
    background: #555;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 9px 36px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    margin-bottom: 8px;
    letter-spacing: 0.01em;
    transition: background 0.15s;
}

.tip-submit:hover {
    background: #444;
}

.tip-submit:disabled {
    background: #999;
    cursor: not-allowed;
}

.tip-note {
    font-size: 11px;
    color: #c5c2bc;
    margin: 0;
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 768px) {
    :root {
        --space-lg: 3rem;
        --space-xl: 4rem;
        --space-xxl: 5rem;
    }

    .menu-toggle {
        display: block;
    }

    .primary-nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 100%;
        height: 100vh;
        background-color: var(--color-bg);
        flex-direction: column;
        justify-content: center;
        gap: var(--space-md);
        transition: right 0.3s ease;
        z-index: 999;
    }

    .primary-nav.active {
        right: 0;
    }

    .primary-nav a {
        font-size: 1.25rem;
        color: var(--color-text);
    }

    .posts-grid {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }

    .featured-post {
        grid-template-columns: 1fr;
    }

    .archive-grid {
        grid-template-columns: 1fr;
    }

    .footer-inner {
        flex-direction: column;
        gap: var(--space-md);
        text-align: center;
    }

    .hero__title {
        font-size: clamp(2rem, 8vw, 3rem);
    }

    .tip-section {
        padding: 20px 16px;
    }

    .tip-row {
        flex-wrap: wrap;
        gap: 6px;
    }
}

@media (max-width: 480px) {
    :root {
        --space-md: 1.5rem;
    }
}

/* ========================================
   WordPress Specific
   ======================================== */

.wp-block-image {
    margin: var(--space-md) 0;
}

.alignwide {
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

.alignfull {
    width: 100vw;
    margin-left: calc(-50vw + 50%);
}

body.admin-bar .site-header {
    top: 32px;
}

@media (max-width: 782px) {
    body.admin-bar .site-header {
        top: 46px;
    }
}