@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500&display=swap');

:root {
    --base-unit: 1rem;
    
    --space-xs: calc(var(--base-unit) * 0.5);
    --space-sm: var(--base-unit);
    --space-md: calc(var(--base-unit) * 2);
    --space-lg: calc(var(--base-unit) * 3);
    --space-xl: calc(var(--base-unit) * 5);
    
    --menu-width: 200px;
    --content-max-width: 1200px;
    --text-max-width: 960px;
    --grid-gap: calc(var(--base-unit) * 2.5);
    
    --color-text: #1A1A1A;
    --color-background: #E8E8E8;
    
    --text-indent: 2em;
    
    font-family: Inter, 'Noto Sans JP', sans-serif;
    font-feature-settings: 'liga' 1, 'calt' 1;
  }
  
  *, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }
  
  html, body {
    height: 100%;
  }
  
  body {
    font-family: Inter, 'Noto Sans JP', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", "Hiragino Kaku Gothic ProN", sans-serif;
    font-weight: 500;
    font-size: 16px;
    line-height: 1.5;
    text-transform: lowercase;
    background: var(--color-background);
    color: var(--color-text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-display: swap;
    text-rendering: optimizeLegibility;
  }
  
  /* Link styling */
  a {
    color: inherit;
    text-decoration: none;
    border-bottom: 0.1em solid currentColor;
  }
  
  .main-nav .logo {
    display: block;
    margin-bottom: var(--space-sm);
    border-bottom: none !important;
    text-decoration: none !important;
  }
  
  .main-nav .logo:hover,
  .main-nav .logo:focus,
  .main-nav .logo:active {
    border-bottom: none !important;
    text-decoration: none !important;
    outline: none;
    box-shadow: none;
  }
  
  .main-nav a:not(.logo),
  .entry a h2,
  .entries a,
  .see-also-list a,
  .language-toggle a {
    border-bottom: 0.1em solid transparent;
    transition: border-color 0.2s ease;
  }
  
  a:hover:not(.logo),
  .main-nav a:hover:not(.logo),
  .entries a:hover:not(.logo),
  .see-also-list a:hover:not(.logo),
  .language-toggle a:hover:not(.logo) {
    border-bottom-color: currentColor;
  }
  
  /* Media elements */
  img, video {
    display: block;
    max-width: 100%;
    height: auto;
  }
  
  /* Simple video styling */
  video {
    margin-bottom: var(--space-md);
    background-color: var(--color-background);
  }
  
  ul {
    list-style: none;
  }
  
  /* Layout structure */
  .container {
    display: grid;
    grid-template-columns: var(--menu-width) minmax(0, 1fr);
    grid-template-rows: 1fr auto;
    gap: var(--grid-gap);
    padding: var(--space-sm) var(--space-sm) 0;
    min-height: 100vh;
  }
  
  main {
    max-width: var(--content-max-width);
    display: flow-root;
  }
  
  /* Navigation */
  .main-nav {
    position: sticky;
    top: var(--space-sm);
    height: fit-content;
    display: flow-root;
  }
  
  .menu li {
    display: block;
    margin-bottom: 0;
  }
  
  /* Enhanced typography */
  .entry-title, 
  h1, h2, h3,
  .main-nav a,
  .menu li a {
    font-weight: 500;
    letter-spacing: -0.01em;
  }
  
  /* Entry structure */
  .entries {
    display: flow-root;
    margin-bottom: var(--space-xl);
  }
  
  .entries:last-child {
    margin-bottom: 0;
  }
  
  .entry {
    display: flow-root;
    margin-bottom: var(--space-xl);
  }
  
  .entry:last-child {
    margin-bottom: 0;
  }
  
.entry-title {
  font-size: 1rem;
  font-weight: 500;
  margin-top: var(--space-sm);
  text-indent: var(--text-indent);
}
  
  .entry-content {
    display: flow-root;
  }
  
  .entry-content .entry-title {
    margin-top: var(--space-xl);
    margin-bottom: var(--space-sm);
  }
  
  .entry-content > * {
    margin-bottom: var(--space-xl);
  }
  
  .entry-content > *:last-child {
    margin-bottom: 0;
  }
  
  .entry-content > p,
  .entry-content > span,
  .entry-content > div:not(.full-width) {
    max-width: var(--text-max-width);
  }
  
  /* Paragraph styling */
  p {
    text-wrap: pretty;
    text-indent: 0;
  }
  
  p + p:not(.no-indent) {
    text-indent: var(--text-indent);
  }
  
  .tab, 
  p.tab {
    text-indent: var(--text-indent);
  }
  
  .no-indent {
    text-indent: 0 !important;
  }
  
  .entry-description p {
    margin-bottom: 0;
  }
  
  /* Japanese text */
  :lang(ja) {
    font-weight: 500;
  }
  
  /* Media handling */
  .entry img,
  .entry video,
  .entry-content img,
  .entry-content video {
    margin-bottom: var(--space-sm);
  }
  
  .entry-content :is(img, video) + :is(img, video) {
    margin-top: var(--space-md);
  }
  
  /* See also section */
  .see-also {
    margin-top: var(--space-xl);
    display: flow-root;
  }
  
  .see-also h2 {
    text-indent: var(--text-indent);
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: var(--space-sm);
  }
  
  .see-also-list li {
    margin-bottom: var(--space-sm);
  }
  
  .see-also-list li:last-child {
    margin-bottom: 0;
  }
  
  /* Language toggle */
  .language-toggle {
    text-indent: var(--text-indent);
    margin-bottom: var(--space-sm);
  }
  
  /* Helper classes */
  .indented {
    margin-left: var(--text-indent);
    margin-top: var(--space-sm);
    margin-bottom: var(--space-sm);
  }
  
  /* Footer */
  footer {
    grid-column: 2 / 3;
    padding-bottom: var(--space-sm);
    margin-top: auto;
  }
  
  /* Content animations */
  @keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
  }
  
  .entry, .entry-content > * {
    animation: fadeIn 0.5s ease-in;
  }
  
  /* Responsive behavior - iPad/Tablet */
  @media (max-width: 1024px) {
    .container {
      display: flex;
      flex-direction: column;
      padding: var(--space-sm);
    }
    
    .main-nav {
      position: static;
      margin-bottom: var(--space-md);
      width: 100%;
    }
    
    .logo {
      margin-bottom: var(--space-sm);
    }
    
    .menu {
      display: flex;
      flex-direction: column;
    }
    
    footer {
      grid-column: auto;
      margin-top: var(--space-xl);
    }
  }
  
  /* Mobile specific adjustments */
  @media (max-width: 768px) {
    :root {
      --base-unit: 0.85rem;
    }
    
    .main-nav {
      margin-bottom: var(--space-md);
    }
    
    .entries {
      margin-bottom: var(--space-lg);
    }
    
    .entry {
      margin-bottom: var(--space-lg);
    }
  }

  /* About page specific styles for footer positioning */
@media (max-width: 1024px) {
    .about-page .container {
      min-height: 100vh;
      display: flex;
      flex-direction: column;
    }
    
    .about-page main {
      flex-grow: 1;
      display: flex;
      flex-direction: column;
    }
    
    .about-page .entry-content {
      flex-grow: 1;
    }
    
    .about-page footer {
      margin-top: auto;
      padding-bottom: var(--space-sm);
    }
  }