|
// ---- |
|
// Sass (v3.3.3) |
|
// Compass (v1.0.0.alpha.18) |
|
// ---- |
|
|
|
/* Variables |
|
------------------------------------------*/ |
|
|
|
// Font sizes & line-heights |
|
$font-verdana: ( |
|
stack: "Verdana, serif", |
|
|
|
base: ( |
|
font-size: .9, |
|
line-height: 1.5, |
|
max-width: 35 |
|
), |
|
|
|
text: ( |
|
font-size: 1, |
|
line-height: 1.5, |
|
max-width: 35 |
|
) |
|
); |
|
|
|
$font-bernina: ( |
|
stack: "\"jaf-bernina-sans\", Verdana, serif", |
|
|
|
base: ( |
|
font-size: 1, |
|
line-height: 1.4, |
|
max-width: 33 |
|
), |
|
|
|
text: ( |
|
font-size: 1.125, |
|
line-height: 1.4, |
|
max-width: 33 |
|
) |
|
); |
|
|
|
$font-default: $font-verdana; |
|
|
|
|
|
// Breakpoints |
|
$width-narrow: 40em; |
|
$width-medium: 60em; |
|
$width-wide: 80em; |
|
|
|
|
|
/* Mixins |
|
------------------------------------------*/ |
|
|
|
// FONTSET FUNCTIONS |
|
// This function is intended to be called by other functions and can be used to get information from the Sass list above. The $feature can be any key from the Sass list such as line-height or font-size. |
|
@function _fontset-feature($feature, $family:$font-default, $set: 'base'){ |
|
$result: map-get(map-get($family, $set), $feature); |
|
@return ($result * 1em); |
|
} |
|
|
|
// Sets the family from the stack key in a Sass list |
|
@function fontset-family($family) { |
|
$result: map-get($family, stack); |
|
@return unquote($result); |
|
} |
|
|
|
// FONT-SIZE + LINE-HEIGHT FUNCTIONS |
|
// These functions return the font-size or line-height depending on the font-family list. To avoid duplication these functions call the fontset-feature function above. |
|
|
|
@function calc-font-size($set, $family:$font-default) { |
|
@return _fontset-feature(font-size, $family, $set); |
|
} |
|
|
|
@function calc-line-height($set, $family:$font-default) { |
|
@return _fontset-feature(line-height, $family, $set); |
|
} |
|
|
|
@function calc-max-width($set, $family:$font-default) { |
|
@return _fontset-feature(max-width, $family, $set); |
|
} |
|
|
|
// FONT-SCALE MIXIN |
|
// Applies the functions above into a mixin so that we can set font-size and line-height at the same time. |
|
// If there is a font-family set there |
|
// Example: @include font-scale(small, $font-verdana); |
|
@mixin font-scale ($font-size, $family:$font-default, $line-height:$font-size, $max-width:$font-size) { |
|
font-size: calc-font-size($font-size, $family); |
|
line-height: calc-line-height($line-height, $family); |
|
max-width: calc-max-width($max-width, $family); |
|
@if $family != $font-default { |
|
font-family: fontset-family($family); |
|
} |
|
} |
|
|
|
// Breakpoints |
|
@mixin responsive($width) { |
|
@if $width == narrow-screens { |
|
@media only screen and (min-width: $width-narrow) { |
|
@content; |
|
} |
|
} |
|
@else if $width == medium-screens { |
|
@media only screen and (min-width: $width-medium) { |
|
@content; |
|
} |
|
} |
|
@else if $width == wide-screens { |
|
@media only screen and (min-width: $width-wide) { |
|
@content; |
|
} |
|
} |
|
} |
|
|
|
p { |
|
@include font-scale(base); |
|
.wf-active & { |
|
@include font-scale(base, $font-bernina); |
|
} |
|
@include responsive(narrow-screens) { |
|
@include font-scale(text); |
|
.wf-active & { |
|
@include font-scale(text, $font-bernina); |
|
} |
|
} |
|
} |
|
|
|
body { |
|
margin: 2em; |
|
font-family: fontset-family($font-verdana); |
|
color: #444; |
|
@include responsive(narrow-screens) { |
|
margin: 2em 4em; |
|
} |
|
} |